15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/rspec/daemon/cli.rb', line 15
def start(argv)
options = DEFAULT_OPTIONS.dup
if ENV['RSPEC_DAEMON_BIND_ADDRESS']
options[:bind_address] = ENV['RSPEC_DAEMON_BIND_ADDRESS']
end
if ENV['RSPEC_DAEMON_PORT']
options[:port] = ENV['RSPEC_DAEMON_PORT'].to_i
end
option_parser = OptionParser.new do |opts|
opts.on('-v', '--version', 'Prints version') do
puts RSpec::Daemon::VERSION
exit
end
opts.on('-b', '--bind ADDRESS', 'address to bind (default: 0.0.0.0)') do |address|
options[:bind_address] = address
end
opts.on('-p', '--port PORT', 'port to listen on (default: 3002)') do |port|
options[:port] = port
end
end
option_parser.parse!(argv)
RSpec::Daemon.new(options[:bind_address], options[:port]).start
0
end
|