webrat/spec/integration/merb/tasks/merb.thor/utils.rb

41 lines
678 B
Ruby
Raw Permalink Normal View History

class String
def /(other)
(Pathname.new(self) + other).to_s
end
end
module ColorfulMessages
2009-04-08 00:30:12 +00:00
# red
def error(*messages)
puts messages.map { |msg| "\033[1;31m#{msg}\033[0m" }
end
2009-04-08 00:30:12 +00:00
# yellow
def warning(*messages)
puts messages.map { |msg| "\033[1;33m#{msg}\033[0m" }
end
2009-04-08 00:30:12 +00:00
# green
def success(*messages)
puts messages.map { |msg| "\033[1;32m#{msg}\033[0m" }
end
2009-04-08 00:30:12 +00:00
alias_method :message, :success
2009-04-08 00:30:12 +00:00
# magenta
def note(*messages)
puts messages.map { |msg| "\033[1;35m#{msg}\033[0m" }
end
2009-04-08 00:30:12 +00:00
# blue
def info(*messages)
puts messages.map { |msg| "\033[1;34m#{msg}\033[0m" }
end
2009-04-08 00:30:12 +00:00
end
module ThorUI
extend ColorfulMessages
end