Module: Ufo::Util
- Included in:
- Docker::Builder, Docker::Cleaner, Docker::Pusher, Ship
- Defined in:
- lib/ufo/util.rb
Instance Method Summary collapse
Instance Method Details
#execute(command, local_options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/ufo/util.rb', line 3 def execute(command, ={}) if @options[:noop] && ![:live] say "NOOP: #{command}" result = true # always success with no noop for specs else if [:use_system] result = system(command) else result = `#{command}` end end result end |
#pretty_time(total_seconds) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/ufo/util.rb', line 18 def pretty_time(total_seconds) minutes = (total_seconds / 60) % 60 seconds = total_seconds % 60 if total_seconds < 60 "#{seconds.to_i}s" else "#{minutes.to_i}m #{seconds.to_i}s" end end |