lib/veewee/ui.rb in veewee-0.3.0.alpha4 vs lib/veewee/ui.rb in veewee-0.3.0.alpha5

- old
+ new

@@ -1,19 +1,21 @@ module Veewee # Vagrant UIs handle communication with the outside world (typically # through a shell). They must respond to the typically logger methods - # of `warn`, `error`, `info`, and `confirm`. + # of `warn`, `error`, `info`, and `success`. class UI attr_accessor :env def initialize(env) @env = env end - [:warn, :error, :info, :confirm].each do |method| - define_method(method) do |message| + [:warn, :error, :info, :success].each do |method| + define_method(method) do |message, *argv| + opts , *argv = argv + opts ||= {} # Log normal console messages env.logger.info("ui") { message } end end @@ -29,10 +31,10 @@ super(env) @shell = shell end - [[:warn, :yellow], [:error, :red], [:info, nil], [:confirm, :green]].each do |method, color| + [[:warn, :yellow], [:error, :red], [:info, nil], [:success, :green]].each do |method, color| class_eval <<-CODE def #{method}(message, opts=nil) super(message) opts ||= {} opts[:new_line] = true if !opts.has_key?(:new_line)