2013-06-08 02:37:02 +00:00
|
|
|
module VagrantPlugins
|
2013-05-22 22:38:26 +00:00
|
|
|
module Cachier
|
|
|
|
class Bucket
|
|
|
|
def self.inherited(base)
|
|
|
|
@buckets ||= []
|
|
|
|
@buckets << base
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.auto_detect(env)
|
|
|
|
@buckets.each do |bucket|
|
|
|
|
if env[:machine].guest.capability?(bucket.capability)
|
|
|
|
env[:machine].config.cache.enable bucket.bucket_name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.bucket_name
|
|
|
|
# TODO: Handle MultiWord bucket classes
|
|
|
|
self.name.split('::').last.downcase
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.install(name, env, configs)
|
|
|
|
bucket = const_get(name.to_s.capitalize)
|
|
|
|
bucket.new(name, env, configs).install
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(name, env, configs)
|
|
|
|
@name = name
|
|
|
|
@env = env
|
|
|
|
@configs = configs
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
require_relative "bucket/apt"
|
|
|
|
require_relative "bucket/gem"
|
|
|
|
require_relative "bucket/pacman"
|
|
|
|
require_relative "bucket/yum"
|