Class: Fum::Commands::List
- Inherits:
-
Fum::Command
- Object
- Fum::Command
- Fum::Commands::List
- Includes:
- DNS
- Defined in:
- lib/fum/commands/list.rb
Instance Method Summary collapse
Methods included from DNS
#dns, #dns_names_equal, #ensure_trailing_dot, #find_records, #update_zone, #update_zones
Methods inherited from Fum::Command
Methods included from Util
Constructor Details
This class inherits a constructor from Fum::Command
Instance Method Details
#execute(options) ⇒ Object
-
:type
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 |
# File 'lib/fum/commands/list.rb', line 39 def execute() beanstalk = Fog::AWS[:beanstalk] case [:type] when :stacks beanstalk.solution_stacks.each { |stack| puts stack["SolutionStackName"] } when :applications beanstalk.applications.each { |app| puts app.name } when :environments list_environments() when :stages @application.main_decl.stages.each_value { |stage| puts stage.id } when :templates beanstalk.templates.each { |template| puts template.name } when :versions beanstalk.versions.each { |version| puts version.label } else die "Unknown object to list #{object}." end end |
#list_environments(options) ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'lib/fum/commands/list.rb', line 71 def list_environments() beanstalk = Fog::AWS[:beanstalk] environments = beanstalk.environments environments.each { |env| puts env.name } end |
#parse_options ⇒ Object
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 |
# File 'lib/fum/commands/list.rb', line 6 def opts = Trollop:: do "usage: list [options] <environment-id>, where options are:" end if ARGV.empty? die "Please specify a beanstalk type to list!" end object = ARGV.shift opts[:type] = case object when "stacks" :stacks when "app", "apps", "applications" :applications when "env", "envs", "environments" :environments when "stages" :stages when "templates" :templates when "versions" :versions else die "Unknown object to list #{object}." end opts end |