Class: Pushapp::Pipe

Inherits:
Object
  • Object
show all
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

.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