Class: VagrantPlugins::Cachier::Bucket::AptCacher

Inherits:
VagrantPlugins::Cachier::Bucket show all
Defined in:
lib/vagrant-cachier/bucket/apt_cacher.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



7
8
9
# File 'lib/vagrant-cachier/bucket/apt_cacher.rb', line 7

def self.capability
  :apt_cacher_dir
end

Instance Method Details

#installObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/vagrant-cachier/bucket/apt_cacher.rb', line 11

def install
  if guest.capability?(:apt_cacher_dir)
    if guest_path = guest.capability(:apt_cacher_dir)
      synced_folder_type = (machine.config.cache.synced_folder_opts || {})[:type]
      if synced_folder_type && synced_folder_type.to_sym == :nfs
        symlink(guest_path)
      else
        @env[:ui].warn I18n.t('vagrant_cachier.nfs_required', bucket: 'apt-cacher')
      end
    end
  else
    @env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'apt-cacher')
  end
end