Sha256: 777fac630bbd482a3926256e66a07e66d0ee1fa3dae83ae4d1c709ab04269346

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

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
        class_name = self.name.split('::').last
        class_name.scan(/[A-Z][a-z]*/).map{|x| x.downcase}.join("_")
      end

      def self.install(name, env, configs)
        bucket = const_get(name.to_s.split("_").map{|x| x.capitalize}.join(""))
        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"
require_relative "bucket/apt_cacher"
require_relative "bucket/composer"
require_relative "bucket/npm"
require_relative "bucket/zypper"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-cachier-0.5.1 lib/vagrant-cachier/bucket.rb
vagrant-cachier-0.5.0 lib/vagrant-cachier/bucket.rb