Module: ImageOptimize::Command
- Included in:
- ImageBundleBase, Optimizer
- Defined in:
- lib/mixins/command.rb
Instance Method Summary collapse
- #debug(message) ⇒ Object
-
#execute(command, quiet = false) ⇒ Object
Returns Process::Status and output.
Instance Method Details
#debug(message) ⇒ Object
35 36 37 |
# File 'lib/mixins/command.rb', line 35 def debug() @log.debug if @log.respond_to?(:debug) end |
#execute(command, quiet = false) ⇒ Object
Returns Process::Status and output
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/mixins/command.rb', line 21 def execute(command, quiet=false) debug "COMMAND: #{command}" output = "" IO.popen("#{command} 2>&1") do |data| while line = data.gets puts line if !quiet output << line end end process_status = $? debug "OUTPUT: #{output}" return process_status, output end |