class VagrantPlugins::Cachier::Bucket

Public Class Methods

auto_detect(env) click to toggle source
# File lib/vagrant-cachier/bucket.rb, line 9
def self.auto_detect(env)
  @buckets.each do |bucket|
    if bucket.respond_to?(:capability) && env[:machine].guest.capability?(bucket.capability)
      env[:machine].config.cache.enable bucket.bucket_name
    end
  end
end
bucket_name() click to toggle source
# File lib/vagrant-cachier/bucket.rb, line 17
def self.bucket_name
  class_name = self.name.split('::').last
  class_name.scan(/[A-Z][a-z]*/).map{|x| x.downcase}.join("_")
end
inherited(base) click to toggle source
# File lib/vagrant-cachier/bucket.rb, line 4
def self.inherited(base)
  @buckets ||= []
  @buckets << base
end
install(name, env, configs) click to toggle source
# File lib/vagrant-cachier/bucket.rb, line 22
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
new(name, env, configs) click to toggle source
# File lib/vagrant-cachier/bucket.rb, line 27
def initialize(name, env, configs)
  @name    = name
  @env     = env
  @configs = configs
end

Public Instance Methods

comm() click to toggle source
# File lib/vagrant-cachier/bucket.rb, line 41
def comm
  machine.communicate
end
empty_dir?(path) click to toggle source
# File lib/vagrant-cachier/bucket.rb, line 79
def empty_dir?(path)
  not comm.test("test \"$(ls -A #{path} 2>/dev/null)\"")
end
guest() click to toggle source
# File lib/vagrant-cachier/bucket.rb, line 37
def guest
  machine.guest
end
machine() click to toggle source
# File lib/vagrant-cachier/bucket.rb, line 33
def machine
  @env[:machine]
end