Class: Deis::Commands::Enable

Inherits:
Struct
  • Object
show all
Includes:
Helpers
Defined in:
lib/deis/commands/enable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#app_exists?, #capture_output, #capture_syscall, #debug?, #deis_command, #deis_local_command, #deis_login!, #deploy, #get_runner, #get_units!, #git_clone, #increment_retry!, #info, #reset_retry!, #run_util, #scale, seconds_to_human, #shell, #should_retry?, #status, #units

Instance Attribute Details

#appObject

Returns the value of attribute app

Returns:

  • (Object)

    the current value of app



3
4
5
# File 'lib/deis/commands/enable.rb', line 3

def app
  @app
end

Instance Method Details

#runObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/deis/commands/enable.rb', line 6

def run
  status "Enabling App: #{app}"
  get_units!
  if units.any? { |_, v| v > 0 }
    status "App Already enabled!"
    return
  end
  scale app, units.keys.each_with_object({}) { |k, h| h[k] = 1 }
  status "App enabled!"
end