Class: Moonshot::Commands::Create

Inherits:
Moonshot::Command show all
Includes:
ParameterArguments
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.



11
12
13
# File 'lib/moonshot/commands/create.rb', line 11

def deploy
  @deploy
end

#versionObject (readonly)

Returns the value of attribute version.



11
12
13
# File 'lib/moonshot/commands/create.rb', line 11

def version
  @version
end

Instance Method Details

#executeObject



26
27
28
29
30
31
32
33
34
# File 'lib/moonshot/commands/create.rb', line 26

def execute
  controller.create

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

#parserObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/moonshot/commands/create.rb', line 13

def parser
  @deploy = true

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

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