Class: Pushapp::Pipe
- Inherits:
-
Object
- Object
- Pushapp::Pipe
- Defined in:
- lib/pushapp/pipe.rb
Class Method Summary collapse
Class Method Details
.capture(cmd) ⇒ Object
22 23 24 25 26 |
# File 'lib/pushapp/pipe.rb', line 22 def self.capture(cmd) output, s = Open3.capture2e(cmd) raise "Failed with status #{s.exitstatus}: #{cmd.inspect}" unless s.success? output end |
.pipe(cmd, stdin = $stdin, stdout = $stdout) ⇒ Object
30 31 32 33 |
# File 'lib/pushapp/pipe.rb', line 30 def self.pipe cmd, stdin=$stdin, stdout=$stdout s = Open3.pipeline(cmd, :in => stdin, :out => stdout).last raise "Failed with status #{s.exitstatus}: #{cmd.inspect}" unless s.success? end |
.run(command) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pushapp/pipe.rb', line 7 def self.run(command) case command when String pipe(command) when Pushapp::Tasks::Script pipe(command.cmd) when Pushapp::Tasks::Base command.run when Array pipe(command) else raise "Unknown command format: '#{command.inspect}'" end end |