{"comment":{"created_at":"2011-10-17T23:43:21Z","body":"That would work.  And the name of the module you suggest is better.\r\n\r\nAlthough I was indeed suggesting that the wire protocol be extended with a \"load_code_file\" message.  As I was saying the the wall-of-text above, it could be important if someone wants to make use of the --require, --profile, --exclude options to Cucumber.  Perhaps different sets of features need certain common step definitions, while there are different test fixtures contained in feature specific files.  The --require option could be useful here.\r\n\r\nIf I was a C# developer, I think I would like the wire server started only after a \"make\" is done in the directory containing the step definition code.  But I'm not, so I'll leave that sort of decision to those who are. :)","updated_at":"2011-10-17T23:43:21Z","url":"https://api.github.com/repos/cucumber/cucumber/issues/comments/2436286","id":2436286,"user":{"avatar_url":"https://secure.gravatar.com/avatar/8954422b8d412abccc2f0b4ccfae4ca6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"8954422b8d412abccc2f0b4ccfae4ca6","url":"https://api.github.com/users/graza","id":147433,"login":"graza"}},"action":"created","issue":{"number":154,"created_at":"2011-10-14T00:26:56Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"Wire protocol implementations that I've seen tend to use wrapper scripts that get the wire server running whilst making a guess at the directories from which to load files in their native language, and then launch Cucumber passing any parameters through.  This not only obscures Cucumber, but could cause issues with wrong interpretation of parameters, and hence wrong sets of step definitions being loaded.\r\n\r\nI'd like to extend WireSupport in two ways: \r\n\r\n1/ To have Cucumber start the wire server itself, and \r\n2/ Allow Cucumber to tell the wire server which step definition files to load.\r\n\r\nFirst: It's fairly easy to get a process to start a child process.  It just needs to know what to load.  However the current implementation on the Cucumber side uses TCP sockets to make the connection and this isn't great for connecting to child processes; so I propose that Cucumber use Socket.pair to create a Unix domain socket connection prior to spawning the child process.  This prevents issues like trying to decide which TCP port should be used, waiting for the child process to listen.  (I'm not 100% sure this will work under Windows.)\r\n\r\nSecond:  Cucumber supports being extended to support other languages through modules named with the file extension used by the language.  For example, .rb files use the Cucumber::RbSupport module.  If a new language was to be implemented as a wire protocol server, a corresponding Cucumber language support module could be based on WireSupport.  If the wire protocol was extended to support a load_code_file message, then Cucumber could tell the wire server exactly which files to load for a given test.\r\n\r\nI have an implementation of these ideas which borrows heavily from the current WireSupport code:  https://gist.github.com/1285897\r\n\r\nBut this is probably a fairly fragile way to implement language support using the wire protocol because it would break when the Cucumber code changes.  Instead I propose a wire protocol module that could be included in a language support module to get access to the wire protocol.\r\n\r\nFor example, imagining that there's a Cucumber::WireProtocol module for doing this, for a language whose files have the .bacon file extension:\r\n\r\n    module Cucumber\r\n      module BaconSupport\r\n        class BaconLanguage\r\n          include Cucumber::WireProtocol\r\n          def initialize(step_mother)\r\n            # start server with connection remembered in @socket\r\n          end\r\n          attr_reader :socket\r\n        end\r\n      end\r\n    end\r\n\r\nWhen Cucumber is running, the first .bacon file it finds will cause the code above to be loaded and the class to be instantiated.  Then all .bacon files will be passed to the object's load_code_file method which will send the message down to the child process for loading.\r\n\r\nComments welcome.\r\n\r\nCheers,\r\nGra.","comments":9,"title":"WireSupport proposed changes","updated_at":"2011-10-17T23:43:21Z","url":"https://api.github.com/repos/cucumber/cucumber/issues/154","id":1906614,"assignee":null,"milestone":null,"closed_at":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/8954422b8d412abccc2f0b4ccfae4ca6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"8954422b8d412abccc2f0b4ccfae4ca6","url":"https://api.github.com/users/graza","id":147433,"login":"graza"},"html_url":"https://github.com/cucumber/cucumber/issues/154","labels":[],"state":"open"},"legacy":{"issue_id":1906614,"comment_id":2436286}}