Class: CICI::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/cici/util.rb

Instance Method Summary collapse

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