Class: Pike::Tasks::Command::Remote
- Inherits:
-
Object
- Object
- Pike::Tasks::Command::Remote
- Defined in:
- lib/pike/tasks/command/remote.rb
Instance Method Summary collapse
- #bundler(cmd, var_string, sudo = false) ⇒ Object
- #cd(new_cwd) ⇒ Object
-
#initialize(task) ⇒ Remote
constructor
A new instance of Remote.
- #run(cmd) ⇒ Object
Constructor Details
#initialize(task) ⇒ Remote
Returns a new instance of Remote.
5 6 7 |
# File 'lib/pike/tasks/command/remote.rb', line 5 def initialize(task) @task = task end |
Instance Method Details
#bundler(cmd, var_string, sudo = false) ⇒ Object
25 26 27 |
# File 'lib/pike/tasks/command/remote.rb', line 25 def bundler(cmd, var_string, sudo = false) run("#{@task.current_env.bundler_prefix} #{sudo ? 'sudo ' : ''} #{var_string} bundle #{cmd}") end |
#cd(new_cwd) ⇒ Object
21 22 23 |
# File 'lib/pike/tasks/command/remote.rb', line 21 def cd(new_cwd) return Pike::SSH::Connection.cd(new_cwd) end |
#run(cmd) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/pike/tasks/command/remote.rb', line 9 def run(cmd) prc = Pike::SSH::Connection.run(cmd) if prc.success? Logger.log prc.stdout Logger.log prc.stderr return prc.stdout + prc.stderr else Main.error("Error while executing #{cmd}: " + prc.stdout + prc.stderr) end end |