Class: Commands::DeployGroupDelete

Inherits:
Object
  • Object
show all
Defined in:
lib/commands/deploy_group_delete.rb

Instance Method Summary collapse

Instance Method Details

#optionsObject

holds the options that were passed you can set any initial defaults here



6
7
8
9
# File 'lib/commands/deploy_group_delete.rb', line 6

def options
  @options ||= {
  }
end

#register(opts, global_options) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/commands/deploy_group_delete.rb', line 18

def register(opts, global_options)
  opts.banner = "Usage: deploy_group_delete [options]"
  opts.description = "Delete a deploy group"

  opts.on('-g', "--group name", "Required - Name of this deploy group.") do |v|
    options[:group] = v
  end

end

#required_optionsObject

required options



12
13
14
15
16
# File 'lib/commands/deploy_group_delete.rb', line 12

def required_options
  @required_options ||= Set.new [
      :group,
  ]
end

#run(global_options, amazon) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/commands/deploy_group_delete.rb', line 29

def run(global_options, amazon)
  group_name = options[:group]

  # first see if already exists
  deploy_group = amazon.find_deploy_group(group_name)

  if deploy_group.nil? || deploy_group[:group] != group_name
    raise "Deploy group not found.  Doing nothing."
  end

  deploy_group.delete
end