Class: Commands
- Inherits:
-
Hash
- Object
- Hash
- Commands
- Defined in:
- lib/commands.rb
Instance Attribute Summary collapse
-
#build ⇒ Object
Returns the value of attribute build.
Instance Method Summary collapse
- #execute_command(command) ⇒ Object
-
#initialize ⇒ Commands
constructor
A new instance of Commands.
- #show ⇒ Object
Constructor Details
Instance Attribute Details
#build ⇒ Object
Returns the value of attribute build.
9 10 11 |
# File 'lib/commands.rb', line 9 def build @build end |
Instance Method Details
#execute_command(command) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/commands.rb', line 20 def execute_command command puts " " + Color.green + command + Color.clear if command.include?('<%') && command.include?('%>') ruby = command.gsub("<%","").gsub("%>","") eval(ruby) else out = `#{command}` if $? != 0 puts out raise Color.bright_yellow + "`" + Color.green + command + Color.bright_yellow + "`" + Color.clear + " has exit code " + $?.to_s end end end |