lib/hanzo.rb in hanzo-0.4 vs lib/hanzo.rb in hanzo-0.4.1
- old
+ new
@@ -6,12 +6,22 @@
require 'hanzo/cli'
require 'hanzo/heroku'
require 'hanzo/version'
module Hanzo
- def self.run(command)
+ def self.run(command, fetch_output = false)
print(command, :green)
- ::Bundler.with_clean_env { system(command) }
+ output = true
+
+ ::Bundler.with_clean_env do
+ if fetch_output
+ output = `#{command}`
+ else
+ system(command)
+ end
+ end
+
+ output
end
def self.print(text = '', *colors)
colors = colors.map { |c| HighLine.const_get(c.to_s.upcase) }
text = text.join("\n ") if text.is_a?(Array)