The resource in the UI doesn't show up if it is nil

This commit is contained in:
Mitchell Hashimoto 2013-02-03 14:20:40 -08:00
parent 3df6088db0
commit 78e9853b71
2 changed files with 3 additions and 4 deletions

View File

@ -91,7 +91,7 @@ module Vagrant
@home_path = opts[:home_path] @home_path = opts[:home_path]
@lock_path = opts[:lock_path] @lock_path = opts[:lock_path]
@vagrantfile_name = opts[:vagrantfile_name] @vagrantfile_name = opts[:vagrantfile_name]
@ui = opts[:ui_class].new("vagrant") @ui = opts[:ui_class].new
@lock_acquired = false @lock_acquired = false

View File

@ -14,7 +14,7 @@ module Vagrant
class Interface class Interface
attr_accessor :resource attr_accessor :resource
def initialize(resource) def initialize(resource=nil)
@logger = Log4r::Logger.new("vagrant::ui::interface") @logger = Log4r::Logger.new("vagrant::ui::interface")
@resource = resource @resource = resource
end end
@ -99,7 +99,6 @@ module Vagrant
def clear_line def clear_line
reset = "\r" reset = "\r"
reset += "\e[0K" unless Util::Platform.windows? reset += "\e[0K" unless Util::Platform.windows?
reset
info(reset, :new_line => false) info(reset, :new_line => false)
end end
@ -126,7 +125,7 @@ module Vagrant
# This is called by `say` to format the message for output. # This is called by `say` to format the message for output.
def format_message(type, message, opts=nil) def format_message(type, message, opts=nil)
opts ||= {} opts ||= {}
message = "[#{@resource}] #{message}" if opts[:prefix] message = "[#{@resource}] #{message}" if @resource && opts[:prefix]
message message
end end
end end