Use our own Vagrant::UI for logging

This commit is contained in:
Justin Campbell 2014-01-24 11:31:55 -05:00
parent 12f7963d1f
commit 1cbdbdc6bf
14 changed files with 19 additions and 15 deletions

View file

@ -14,7 +14,7 @@ module VagrantPlugins
@machine = env[:machine] @machine = env[:machine]
if symlinks.any? if symlinks.any?
env[:ui].info I18n.t('vagrant_cachier.cleanup') Cachier.ui.info I18n.t('vagrant_cachier.cleanup')
if sshable? if sshable?
symlinks.each do |symlink| symlinks.each do |symlink|
remove_symlink symlink remove_symlink symlink
@ -43,7 +43,7 @@ module VagrantPlugins
end end
end end
rescue Timeout::Error rescue Timeout::Error
@env[:ui].warn(I18n.t('vagrant_cachier.unable_to_ssh')) Cachier.ui.warn(I18n.t('vagrant_cachier.unable_to_ssh'))
end end
return false return false

View file

@ -43,7 +43,7 @@ module VagrantPlugins
new_path = new_path.to_s.gsub(/^#{@env[:root_path]}\//, '') new_path = new_path.to_s.gsub(/^#{@env[:root_path]}\//, '')
# If we got here there is a single provider specific cacher dir, so # If we got here there is a single provider specific cacher dir, so
# let's be nice with users and just fix it ;) # let's be nice with users and just fix it ;)
@env[:ui].warn I18n.t('vagrant_cachier.will_fix_machine_cache_dir', Cachier.ui.warn I18n.t('vagrant_cachier.will_fix_machine_cache_dir',
current_path: current_path, current_path: current_path,
new_path: new_path) new_path: new_path)
FileUtils.mv current_path, new_path FileUtils.mv current_path, new_path

View file

@ -24,7 +24,7 @@ module VagrantPlugins
end end
end end
else else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'APT') Cachier.ui.info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'APT')
end end
end end
end end

View file

@ -26,11 +26,11 @@ module VagrantPlugins
end end
end end
else else
@env[:ui].info I18n.t('vagrant_cachier.nfs_required', bucket: 'apt-cacher') Cachier.ui.info I18n.t('vagrant_cachier.nfs_required', bucket: 'apt-cacher')
end end
end end
else else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'apt-cacher') Cachier.ui.info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'apt-cacher')
end end
end end
end end

View file

@ -24,7 +24,7 @@ module VagrantPlugins
end end
end end
else else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Chef') Cachier.ui.info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Chef')
end end
end end
end end

View file

@ -25,7 +25,7 @@ module VagrantPlugins
end end
end end
else else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Composer') Cachier.ui.info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Composer')
end end
end end
end end

View file

@ -29,7 +29,7 @@ module VagrantPlugins
end end
end end
else else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'RubyGems') Cachier.ui.info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'RubyGems')
end end
end end
end end

View file

@ -24,7 +24,7 @@ module VagrantPlugins
end end
end end
else else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'npm') Cachier.ui.info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'npm')
end end
end end
end end

View file

@ -24,7 +24,7 @@ module VagrantPlugins
end end
end end
else else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Pacman') Cachier.ui.info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Pacman')
end end
end end
end end

View file

@ -29,7 +29,7 @@ module VagrantPlugins
end end
end end
else else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'RVM') Cachier.ui.info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'RVM')
end end
end end
end end

View file

@ -27,7 +27,7 @@ module VagrantPlugins
end end
end end
else else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Yum') Cachier.ui.info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Yum')
end end
end end
end end

View file

@ -27,7 +27,7 @@ module VagrantPlugins
end end
end end
else else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Zypper') Cachier.ui.info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Zypper')
end end
end end
end end

View file

@ -8,6 +8,10 @@ I18n.load_path << File.expand_path("../../../locales/en.yml", __FILE__)
module VagrantPlugins module VagrantPlugins
module Cachier module Cachier
def self.ui
@ui ||= ::Vagrant::UI::Colored.new.scope('Cachier')
end
class Plugin < Vagrant.plugin('2') class Plugin < Vagrant.plugin('2')
name 'vagrant-cachier' name 'vagrant-cachier'

View file

@ -46,7 +46,7 @@ module VagrantPlugins
return unless @env[:machine].config.cache.buckets.any? return unless @env[:machine].config.cache.buckets.any?
@env[:ui].info 'Configuring cache buckets...' Cachier.ui.info 'Configuring cache buckets...'
cache_config = @env[:machine].config.cache cache_config = @env[:machine].config.cache
cache_config.buckets.each do |bucket_name, configs| cache_config.buckets.each do |bucket_name, configs|
cachier_debug "Installing #{bucket_name} with configs #{configs.inspect}" cachier_debug "Installing #{bucket_name} with configs #{configs.inspect}"