Class: WatirProxyStartServer::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/watir-proxy-start-server/cli.rb

Class Method Summary collapse

Class Method Details

.execute(stdout, arguments = [], &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/watir-proxy-start-server/cli.rb', line 5

def self.execute(stdout, arguments=[], &block)

  options = { }
  mandatory_options = %w(  )

  parser = OptionParser.new do |opts|
    opts.banner = "      Usage: \#{File.basename($0)} [options]\n\n      Options are:\n    BANNER\n    opts.separator \"\"\n    opts.on(\"-d\", \"--drb-uri URI\", String,\n            \"URI passed to DRb.start_service\",\n            \"Default: \" + WatirProxy::Server.default_drb_uri\n           ) { |arg| options[:drb_uri] = arg }\n    opts.on(\"-h\", \"--help\",\n            \"Show this help message.\") { stdout.puts opts; exit }\n    opts.parse!(arguments)\n\n    if mandatory_options && mandatory_options.find { |option| options[option.to_sym].nil? }\n      stdout.puts opts; exit\n    end\n  end\n\n  WatirProxy::Server.start_service(options) do\n    block.call stdout if block\n  end\n  WatirProxy::Server.thread.join if WatirProxy::Server.thread\nend\n".gsub(/^          /,'')