lib/hanzo.rb in hanzo-0.2.3 vs lib/hanzo.rb in hanzo-0.3
- old
+ new
@@ -8,15 +8,18 @@
require 'hanzo/version'
module Hanzo
def self.run(command)
print(command, :green)
- Bundler.with_clean_env { `#{command}` }
+ output = nil
+ ::Bundler.with_clean_env { output = `#{command}` }
+ output
end
- def self.print(text, *colors)
+ 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)
HighLine.say HighLine.color(" #{text}", *colors)
end
def self.title(text)
HighLine.say HighLine.color("-----> #{text}", :blue)
@@ -26,7 +29,13 @@
HighLine.agree " #{question} "
end
def self.ask(question, &blk)
HighLine.ask "-----> #{question} ", &blk
+ end
+end
+
+class String
+ def unindent
+ gsub /^#{scan(/^\s*/).min_by{|l|l.length}}/, ''
end
end