Class: CICI::Util
- Inherits:
-
Object
- Object
- CICI::Util
- Defined in:
- lib/cici/util.rb
Instance Method Summary collapse
- #get_env(name) ⇒ Object
-
#initialize(ui) ⇒ Util
constructor
A new instance of Util.
- #run_command(command) ⇒ Object
Constructor Details
#initialize(ui) ⇒ Util
Returns a new instance of Util.
5 6 7 |
# File 'lib/cici/util.rb', line 5 def initialize(ui) @ui = ui end |
Instance Method Details
#get_env(name) ⇒ Object
15 16 17 18 |
# File 'lib/cici/util.rb', line 15 def get_env(name) @ui.fail("Forgot to specify environment variable, #{name}") unless ENV[name] ENV[name] end |
#run_command(command) ⇒ Object
9 10 11 12 13 |
# File 'lib/cici/util.rb', line 9 def run_command(command) @ui.warning("Running command: #{command}") success = system(command) @ui.fail("\nCommand failed. Fix issue and try again.") unless success end |