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
35
36
37
38
39
40
|
# File 'lib/bowler/cli.rb', line 7
def self.start(args)
options = {
without: []
}
OptionParser.new {|opts|
opts.banner = "Usage: bowl [options] <process>..."
opts.on('-w', '--without <process>', 'Exclude a process from being launched') do |process|
options[:without] << process.to_sym
end
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
opts.on_tail('-v', '--version', 'Show the gem version') do
puts "Bowler #{Bowler::VERSION}"
exit
end
}.parse!(args)
processes = args.map(&:to_sym)
tree = Bowler::DependencyTree.load
to_launch = tree.dependencies_for(processes) - options[:without]
logger.info "Starting #{to_launch.join(', ')}.."
start_foreman_with( launch_string(to_launch) )
rescue PinfileNotFound
logger.error "Bowler could not find a Pinfile in the current directory."
rescue PinfileError => e
logger.error "Bowler could not load the Pinfile due to an error: #{e}"
end
|