vagrant-cachier-ng/lib/vagrant-cachier/bucket/generic.rb
Gustavo L. de M. Chaves 8ac8d7f6f6 Fix multi generic bucket set up
The previously documented way to specify multiple generic buckets
doesn't work because vagrant-cachier can't enable a bucket type more
than once.

Here we generalize the configs hash that the generic bucket gets making
it possible to specify multiple buckets with a single hash. The
documentation is changed accordingly.

Note that we keep it backwards compatible for single generic bucket
specification.

Issue: https://github.com/fgrehm/vagrant-cachier/issues/99
2014-04-16 09:04:49 -03:00

27 lines
714 B
Ruby

module VagrantPlugins
module Cachier
class Bucket
class Generic < Bucket
def install
# First we normalize the @configs hash as a hash of hashes
if @configs.has_key?(:cache_dir)
@configs = { @name => @configs }
end
# Now we iterate through all generic buckets's configurations and
# set them up.
@configs.each do |key, conf|
if conf.has_key?(:cache_dir)
symlink(conf[:cache_dir], "/tmp/vagrant-cache/#{key}")
else
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: "Generic[#{key}]")
end
end
end
end
end
end
end