Class: DTask::RemoteBox
- Inherits:
-
Object
- Object
- DTask::RemoteBox
- Defined in:
- lib/dtask.rb
Overview
Remote box.
Instance Attribute Summary collapse
-
#err ⇒ Object
readonly
Returns the value of attribute err.
-
#out ⇒ Object
readonly
Returns the value of attribute out.
Instance Method Summary collapse
-
#cd_appdir ⇒ Object
Change the current to application directory.
-
#initialize ⇒ RemoteBox
constructor
A new instance of RemoteBox.
-
#l(cmd) ⇒ Object
Run the command or call the task.
-
#l!(cmd) ⇒ Object
Ignore errors.
-
#sh(cmd) ⇒ Object
Run the command.
Constructor Details
Instance Attribute Details
#err ⇒ Object (readonly)
Returns the value of attribute err.
31 32 33 |
# File 'lib/dtask.rb', line 31 def err @err end |
#out ⇒ Object (readonly)
Returns the value of attribute out.
31 32 33 |
# File 'lib/dtask.rb', line 31 def out @out end |
Instance Method Details
#cd_appdir ⇒ Object
Change the current to application directory.
62 63 64 |
# File 'lib/dtask.rb', line 62 def cd_appdir l "cd #{Config.appdir} && pwd" end |
#l(cmd) ⇒ Object
Run the command or call the task.
41 42 43 |
# File 'lib/dtask.rb', line 41 def l(cmd) cmd.kind_of?(Symbol) ? DTask.run(cmd) : sh(cmd) end |
#l!(cmd) ⇒ Object
Ignore errors.
46 47 48 |
# File 'lib/dtask.rb', line 46 def l!(cmd) begin l(cmd) rescue Error end end |
#sh(cmd) ⇒ Object
Run the command.
51 52 53 54 55 56 57 58 59 |
# File 'lib/dtask.rb', line 51 def sh(cmd) puts "% #{cmd}" res = @shell.send_command(cmd) pout res.stdout if res.stdout and res.stdout.size > 0 perr res.stderr if res.stderr and res.stderr.size > 0 @out << res.stdout @err << res.stderr res.status == 0 ? res.stdout : (raise Error) end |