Sha256: 8365584cdc2efb6116820b80e4df5e3ad05391b183a8f2f266e8f16faccd20ca

Contents?: true

Size: 987 Bytes

Versions: 4

Compression:

Stored size: 987 Bytes

Contents

module VagrantPlugins
  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/chef"
require_relative "bucket/gem"
require_relative "bucket/pacman"
require_relative "bucket/yum"
require_relative "bucket/rvm"

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vagrant-cachier-0.3.3 lib/vagrant-cachier/bucket.rb
vagrant-cachier-0.3.2 lib/vagrant-cachier/bucket.rb
vagrant-cachier-0.3.1 lib/vagrant-cachier/bucket.rb
vagrant-cachier-0.3.0 lib/vagrant-cachier/bucket.rb