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
46
47
48
49
50
51
52
|
# File 'lib/gutsy/cli.rb', line 16
def self.generate(args)
unless args.length == 2
puts <<-TEXT
Error: Not enough arguments for command 'generate'
Usage: gutsy generate [config_path] [output_path]
DESCRIPTION
Generates a gem scaffold and resource API clients on top of a heroics-generated client.
ARGUMENTS
[config_path] - Path to gutsy configuration file
[output_path] - Path to output generated API client gem(s).
(Will be created if it doesn't exist)
TEXT
exit 1
end
config_path = File.expand_path(args[0])
output_path = File.expand_path(args[1])
config = Gutsy::Configuration.load_from_file!(config_path)
config.apps.each do |app_config|
generator = Gutsy::Cli::Generator.new(app_config, output_path)
begin
generator.generate!
rescue => e
puts "FAIL"
puts e.message
puts e.backtrace.join("\n")
exit 1
end
end
exit 0
end
|