class Scooter::Commands::Scale

Public Instance Methods

run() click to toggle source
# File lib/scooter/commands/scale.rb, line 6
def run
  Scooter.ui.verbose("Executing the `#{name}` command.")

  begin
    app = ::Marathon::App.get(options['id'])

    if app.instances != options['instances']
      Scooter.ui.info("Scaling '#{options['id']}' from #{app.instances} to #{options['instances']}...")
      app.scale!(options['instances'], global_options['force'])
    else
      Scooter.ui.info("'#{options['id']}' instances already set to #{options['instances']}.")
    end
    
  rescue ::Marathon::Error::NotFoundError => e
    Scooter.ui.warn(e)
  end
  
  Scooter.ui.verbose("Execution of `#{name}` command has completed.")
end