Sha256: fcd033afccc51dd5799f0ecb6357597c1db65753bf131da8964b16cbb45c25b9

Contents?: true

Size: 1.21 KB

Versions: 33

Compression:

Stored size: 1.21 KB

Contents

require "drb/drb"
# This code was taken from the RSpec project and slightly modified.

module Cucumber
  module Cli
    class DRbClientError < StandardError
    end
    # Runs features on a DRB server, originally created with Spork compatibility in mind.
    class DRbClient
      DEFAULT_PORT = 8990

      def self.run(args, error_stream, out_stream, port = nil)
        port ||= ENV["CUCUMBER_DRB"] || DEFAULT_PORT

        # See http://redmine.ruby-lang.org/issues/show/496 as to why we specify localhost:0
        begin
          DRb.start_service("druby://localhost:0")
        rescue SocketError
        # Ruby-1.8.7 on snow leopard doesn't like localhost:0 - but just :0
        # seems to work just fine
          DRb.start_service("druby://:0")
        end
        feature_server = DRbObject.new_with_uri("druby://127.0.0.1:#{port}")
        cloned_args = [] # I have no idea why this is needed, but if the regular args are sent then DRb magically transforms it into a DRb object - not an array
        args.each { |arg| cloned_args << arg }
        feature_server.run(cloned_args, error_stream, out_stream)
      rescue DRb::DRbConnError => e
        raise DRbClientError, "No DRb server is running."
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 7 rubygems

Version Path
aslakhellesoy-cucumber-0.3.101.2 lib/cucumber/cli/drb_client.rb
aslakhellesoy-cucumber-0.3.102.1 lib/cucumber/cli/drb_client.rb
aslakhellesoy-cucumber-0.3.102.2 lib/cucumber/cli/drb_client.rb
aslakhellesoy-cucumber-0.3.102 lib/cucumber/cli/drb_client.rb
aslakhellesoy-cucumber-0.3.103 lib/cucumber/cli/drb_client.rb
aslakhellesoy-cucumber-0.3.104 lib/cucumber/cli/drb_client.rb
kosmas58-cucumber-0.3.102 lib/cucumber/cli/drb_client.rb
kosmas58-cucumber-0.3.103 lib/cucumber/cli/drb_client.rb
davidtrogers-cucumber-0.6.2 lib/cucumber/cli/drb_client.rb
cucumber-0.6.2 lib/cucumber/cli/drb_client.rb
cucumber-0.6.1 lib/cucumber/cli/drb_client.rb
cucumber-0.6.0 lib/cucumber/cli/drb_client.rb
cucumber-0.5.3 lib/cucumber/cli/drb_client.rb
cucumber-0.5.2 lib/cucumber/cli/drb_client.rb
cucumber-0.5.1 lib/cucumber/cli/drb_client.rb
cucumber-0.5.0 lib/cucumber/cli/drb_client.rb
cucumber-0.4.5.rc2 lib/cucumber/cli/drb_client.rb
kbaum-cucumber-0.4.5.pre lib/cucumber/cli/drb_client.rb
cucumber-0.4.5.rc1 lib/cucumber/cli/drb_client.rb
middleman-0.10.17 vendor/gems/gems/cucumber-0.4.4/lib/cucumber/cli/drb_client.rb