Class: Moonshot::Commands::Create

Inherits:
Moonshot::Command show all
Includes:
ParameterArguments, ParentStackOption, ShowAllEventsOption, TagArguments
Defined in:
lib/moonshot/commands/create.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Moonshot::Command

inherited

Instance Attribute Details

#deployObject (readonly)

Returns the value of attribute deploy.



19
20
21
# File 'lib/moonshot/commands/create.rb', line 19

def deploy
  @deploy
end

#versionObject (readonly)

Returns the value of attribute version.



19
20
21
# File 'lib/moonshot/commands/create.rb', line 19

def version
  @version
end

Instance Method Details

#executeObject



40
41
42
43
44
45
46
47
48
# File 'lib/moonshot/commands/create.rb', line 40

def execute
  controller.create

  if @deploy && @version.nil?
    controller.push
  elsif @deploy
    controller.deploy_version(@version)
  end
end

#parserObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/moonshot/commands/create.rb', line 21

def parser
  @deploy = true

  parser = super
  desc = 'Choose if code should be deployed immediately after the stack is created'
  parser.on('-d', '--[no-]deploy', TrueClass, desc) do |v|
    @deploy = v
  end

  desc = 'Version for initial deployment. If unset, a new development build is created from the local directory'
  parser.on('--version VERSION_NAME', desc) do |v|
    @version = v
  end

  parser.on('--template-file=FILE', 'Override the path to the CloudFormation template.') do |v|
    Moonshot.config.template_file = v
  end
end