class Soyuz::Command
Public Class Methods
build(cmd)
click to toggle source
# File lib/soyuz/command.rb, line 12 def self.build(cmd) return if cmd.nil? || cmd.empty? if cmd.is_a?(Array) CommandChoice.new(cmd) elsif cmd.is_a?(Hash) CommandEnv.new(cmd) else new(cmd) end end
new(cmd)
click to toggle source
# File lib/soyuz/command.rb, line 7 def initialize(cmd) raise ArgumentError, "Command must be a string" unless cmd.is_a?(String) @cmd = cmd end
Public Instance Methods
run()
click to toggle source
# File lib/soyuz/command.rb, line 24 def run say("<%= color('executing [#{@cmd}]...', :green) %>") exit(false) unless system(@cmd) end