Sha256: a543d4b006bce91b71111c5419b6219c0a83ad267020ffb97ee0d3799fbad1e0
Contents?: true
Size: 915 Bytes
Versions: 6
Compression:
Stored size: 915 Bytes
Contents
require 'shellwords' module Doc class Command def self.run(*command) new(*command).run end attr_reader :command, :status def initialize(*command) @command = command end def add(*arguments) @command.concat(arguments) end def run command_string = command.length == 1 ? command.first : command.map(&:to_s).shelljoin puts "cd #{Dir.pwd.shellescape}; #{command_string}" output = IO.popen("#{command_string} 2>&1", &:read) @status = $? status.success? || begin print output case when status.signaled? if status.termsig == 2 raise Interrupt.new else raise SignalException.new(status.termsig) end when status.exited? raise SystemExit.new(status.exitstatus) else raise status.inspect end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
doc-0.2.3 | lib/doc/command.rb |
doc-0.2.2 | lib/doc/command.rb |
doc-0.2.1 | lib/doc/command.rb |
doc-0.2.0 | lib/doc/command.rb |
doc-0.1.0 | lib/doc/command.rb |
doc-0.0.1 | lib/doc/command.rb |