From 2f75ffe692f9468f52e568ca237ce30c4a9a3810 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Sat, 1 Feb 2014 18:12:38 -0200 Subject: [PATCH] Clean up InstallBuckets action a bit --- lib/vagrant-cachier/action/install_buckets.rb | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/vagrant-cachier/action/install_buckets.rb b/lib/vagrant-cachier/action/install_buckets.rb index f96d947..0114fb8 100644 --- a/lib/vagrant-cachier/action/install_buckets.rb +++ b/lib/vagrant-cachier/action/install_buckets.rb @@ -11,28 +11,27 @@ module VagrantPlugins def call(env) @app.call(env) - @env = env - configure_cache_buckets + configure_cache_buckets(env) end def configure_cache_buckets - return unless @env[:machine].config.cache.enabled? + return unless env[:machine].config.cache.enabled? - if @env[:machine].config.cache.auto_detect - Bucket.auto_detect(@env) + if env[:machine].config.cache.auto_detect + Bucket.auto_detect(env) end - return unless @env[:machine].config.cache.buckets.any? + return unless env[:machine].config.cache.buckets.any? - @env[:ui].info 'Configuring cache buckets...' - cache_config = @env[:machine].config.cache + env[:ui].info 'Configuring cache buckets...' + cache_config = env[:machine].config.cache cache_config.buckets.each do |bucket_name, configs| # cachier_debug "Installing #{bucket_name} with configs #{configs.inspect}" - Bucket.install(bucket_name, @env, configs) + Bucket.install(bucket_name, env, configs) end - data_file = @env[:machine].data_dir.join('cache_dirs') - data_file.open('w') { |f| f.print @env[:cache_dirs].uniq.join("\n") } + data_file = env[:machine].data_dir.join('cache_dirs') + data_file.open('w') { |f| f.print env[:cache_dirs].uniq.join("\n") } end end end