module Hanzo
Constants
- VERSION
Public Class Methods
_run(&blk)
click to toggle source
# File lib/hanzo.rb, line 28 def self._run(&blk) if defined?(Bundler) ::Bundler.with_clean_env(&blk) else blk.call end end
agree(question)
click to toggle source
# File lib/hanzo.rb, line 51 def self.agree(question) HighLine.agree " #{question} " end
ask(question, &blk)
click to toggle source
# File lib/hanzo.rb, line 55 def self.ask(question, &blk) HighLine.ask "-----> #{question} ", &blk end
config()
click to toggle source
# File lib/hanzo.rb, line 59 def self.config return YAML.load_file('.hanzo.yml') if File.exist?('.hanzo.yml') Hanzo.print 'Cannot locate .hanzo.yml' Hanzo.print 'For more information, please read https://github.com/mirego/hanzo' exit end
print(text = '', *colors)
click to toggle source
# File lib/hanzo.rb, line 36 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
run(command, fetch_output = false)
click to toggle source
# File lib/hanzo.rb, line 13 def self.run(command, fetch_output = false) print(command, :green) output = true _run do output = if fetch_output `#{command}` else system(command) end end output end
title(text)
click to toggle source
# File lib/hanzo.rb, line 47 def self.title(text) HighLine.say HighLine.color("-----> #{text}", :blue) end
unindent_print(text = '', *colors)
click to toggle source
# File lib/hanzo.rb, line 42 def self.unindent_print(text = '', *colors) colors = colors.map { |c| HighLine.const_get(c.to_s.upcase) } HighLine.say HighLine.color(text, *colors) end