lib/hanzo.rb in hanzo-0.4.1 vs lib/hanzo.rb in hanzo-0.4.2
- old
+ new
@@ -10,18 +10,26 @@
module Hanzo
def self.run(command, fetch_output = false)
print(command, :green)
output = true
- ::Bundler.with_clean_env do
+ _run do
if fetch_output
output = `#{command}`
else
system(command)
end
end
output
+ end
+
+ def self._run(&blk)
+ if defined?(Bundler)
+ ::Bundler.with_clean_env(&blk)
+ else
+ blk.call
+ end
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)