Module: SimpleDeploy::CLI
- Defined in:
- lib/simple_deploy/cli.rb,
lib/simple_deploy/cli/list.rb,
lib/simple_deploy/cli/clone.rb,
lib/simple_deploy/cli/create.rb,
lib/simple_deploy/cli/deploy.rb,
lib/simple_deploy/cli/events.rb,
lib/simple_deploy/cli/shared.rb,
lib/simple_deploy/cli/status.rb,
lib/simple_deploy/cli/update.rb,
lib/simple_deploy/cli/destroy.rb,
lib/simple_deploy/cli/execute.rb,
lib/simple_deploy/cli/outputs.rb,
lib/simple_deploy/cli/protect.rb,
lib/simple_deploy/cli/template.rb,
lib/simple_deploy/cli/instances.rb,
lib/simple_deploy/cli/resources.rb,
lib/simple_deploy/cli/attributes.rb,
lib/simple_deploy/cli/parameters.rb,
lib/simple_deploy/cli/environments.rb
Defined Under Namespace
Modules: Shared
Classes: Attributes, Clone, Create, Deploy, Destroy, Environments, Events, Execute, Instances, List, Outputs, Parameters, Protect, Resources, Status, Template, Update
Class Method Summary
collapse
Class Method Details
.commands ⇒ Object
90
91
92
93
94
|
# File 'lib/simple_deploy/cli.rb', line 90
def self.commands
return @commands if @commands
klasses = SimpleDeploy::CLI.constants.reject { |c| c == :Shared }
@commands = klasses.map { |klass| SimpleDeploy::CLI.const_get(klass).new }
end
|
.length_of_longest_command ⇒ Object
96
97
98
|
# File 'lib/simple_deploy/cli.rb', line 96
def self.length_of_longest_command
commands.map { |c| c.command_name.length }.max
end
|
.start ⇒ Object
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/simple_deploy/cli.rb', line 26
def self.start
cmd = ARGV.shift
case cmd
when 'attributes'
CLI::Attributes.new.show
when 'clone'
CLI::Clone.new.clone
when 'create'
CLI::Create.new.create
when 'destroy', 'delete'
CLI::Destroy.new.destroy
when 'deploy'
CLI::Deploy.new.deploy
when 'environments', 'envs'
CLI::Environments.new.environments
when 'events'
CLI::Events.new.show
when 'execute'
CLI::Execute.new.execute
when 'instances'
CLI::Instances.new.list
when 'list'
CLI::List.new.stacks
when 'outputs'
CLI::Outputs.new.show
when 'parameters'
CLI::Parameters.new.show
when 'protect'
CLI::Protect.new.protect
when 'resources'
CLI::Resources.new.show
when 'status'
CLI::Status.new.show
when 'template'
CLI::Template.new.show
when 'update'
CLI::Update.new.update
when '-h'
usage
when '-v'
puts SimpleDeploy::VERSION
else
puts "Unknown command: '#{cmd}'."
puts ''
usage
exit 1
end
end
|
.usage ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/simple_deploy/cli.rb', line 76
def self.usage
puts 'Usage: simple_deploy command'
puts ''
puts 'Append -h for help on specific subcommand.'
puts ''
puts 'Commands:'
commands.each do |cmd|
$stdout.printf " %-#{length_of_longest_command}s %s\n",
cmd.command_name,
cmd.command_summary
end
end
|