Class: VagrantPlugins::Cachier::Bucket::Gem

Inherits:
VagrantPlugins::Cachier::Bucket show all
Defined in:
lib/vagrant-cachier/bucket/gem.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from VagrantPlugins::Cachier::Bucket

auto_detect, bucket_name, #comm, #empty_dir?, #guest, inherited, #initialize, install, #machine, #symlink, #symlink?, #user_symlink

Constructor Details

This class inherits a constructor from VagrantPlugins::Cachier::Bucket

Class Method Details

.capabilityObject



5
6
7
# File 'lib/vagrant-cachier/bucket/gem.rb', line 5

def self.capability
  :gemdir
end

Instance Method Details

#installObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/vagrant-cachier/bucket/gem.rb', line 9

def install
  if guest.capability?(:gemdir)
    if gemdir_path = guest.capability(:gemdir)
      prefix         = gemdir_path.split('/').last
      bucket_path    = "/tmp/vagrant-cache/#{@name}/#{prefix}"
      gem_cache_path = "#{gemdir_path}/cache"

      symlink(gem_cache_path, bucket_path)
    end
  else
    @env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'RubyGems')
  end
end