2
3
4
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
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/grifork/cli.rb', line 2
def run(argv)
OptionParser.new do |opt|
opt.on('-f', '--file Griforkfile') { |f| @taskfile = f }
opt.on('-o', '--override-by FILE') { |f| @override_file = f }
opt.on('-r', '--on-remote') { @on_remote = true }
opt.on('-n', '--dry-run') { @dry_run = true }
opt.on('-v', '--version') { @version = true }
opt.parse!(argv)
end
if @version
puts Grifork::VERSION
exit
end
config = load_taskfiles
if @dry_run
config.dry_run = true
end
config.freeze
Grifork.configure!(config)
logger = Grifork.logger
graph = Grifork::Graph.new(config.hosts)
logger.info("START | mode: #{config.mode}")
if @on_remote
puts "Start on remote. Hosts: #{config.hosts}"
end
case config.mode
when :standalone
graph.launch_tasks
when :grifork
graph.grifork
else
raise "Unexpected mode! #{config.mode}"
end
logger.info("END | mode: #{config.mode}")
if @on_remote
puts "End on remote."
end
end
|