Class: Webbynode::Commands::Remote

Inherits:
Webbynode::Command show all
Defined in:
lib/webbynode/commands/remote.rb

Constant Summary

Constants inherited from Webbynode::Command

Webbynode::Command::Aliases, Webbynode::Command::CommandError, Webbynode::Command::InvalidCommand, Webbynode::Command::InvalidOption, Webbynode::Command::Settings

Instance Method Summary collapse

Methods inherited from Webbynode::Command

add_alias, #api, class_for, command, command_class_name, description, for, #gemfile, #git, help, inherited, #initialize, #io, #no?, #notify, option, #option, #options, options_help, #param, #param_values, parameter, #params, #params_hash, params_help, #pushand, #remote_executor, requires_initialization!, requires_options!, requires_pushed_application!, #run, #server, setting, #settings, summary, summary_help, usage, #validate_initialization, #validate_options, #yes?

Constructor Details

This class inherits a constructor from Webbynode::Command

Instance Method Details

#executeObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/webbynode/commands/remote.rb', line 12

def execute
  unless server.application_pushed?
    io.log "Before being able to run remote commands from your webby, you must first push your application to it."
    exit
  end
  
  # Parses Pushand File and returns remote application name
  remote_app_name = pushand.parse_remote_app_name
  
  # Notify the user
  io.log "Executing remote command...".color(:cyan)
  
  # Executes the command on the remote server inside the application root folder
  result = spinner {
    remote_executor.exec("cd #{remote_app_name}; #{param_values.join(" ")}", false)
  }

  puts result
end