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.
7 8 9 |
# File 'lib/commands.rb', line 7 def build @build end |
Instance Method Details
#execute_command(command) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/commands.rb', line 16 def execute_command command puts Color.yellow + command + Color.clear puts " " if command.include?('<%') && command.include?('%>') ruby = command.gsub("<%","").gsub("%>","") eval(ruby) else puts `#{command}` if $? != 0 raise Color.bright_yellow + "`" + Color.green + command + Color.bright_yellow + "`" + Color.clear + " has exit code " + $?.to_s end end end |