Class: DRbQS::CommandExecute
- Inherits:
-
Object
- Object
- DRbQS::CommandExecute
- Defined in:
- lib/drbqs/task.rb
Instance Method Summary collapse
- #exec ⇒ Object
-
#initialize(cmd, opts = {}) ⇒ CommandExecute
constructor
:transfer String or Array :compress true or false.
Constructor Details
#initialize(cmd, opts = {}) ⇒ CommandExecute
:transfer String or Array :compress true or false
47 48 49 50 51 52 53 54 |
# File 'lib/drbqs/task.rb', line 47 def initialize(cmd, opts = {}) @cmd = cmd unless (Array === @cmd || String === @cmd) raise ArgumentError, "Invalid command: #{@cmd.inspect}" end @transfer = opts[:transfer] @compress = opts[:compress] end |
Instance Method Details
#exec ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/drbqs/task.rb', line 56 def exec case @cmd when Array @cmd.each { |c| system(c) } when String system(@cmd) end exit_status = $?.exitstatus if @transfer if Array === @transfer @transfer.each { |path| DRbQS::FileTransfer.enqueue(path, @compress) } else DRbQS::FileTransfer.enqueue(@transfer, @compress) end end exit_status end |