Class: Vagrant::Cachier::Bucket::Apt
- Inherits:
-
Vagrant::Cachier::Bucket
- Object
- Vagrant::Cachier::Bucket
- Vagrant::Cachier::Bucket::Apt
- Defined in:
- lib/vagrant-cachier/bucket/apt.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Vagrant::Cachier::Bucket
auto_detect, bucket_name, inherited, #initialize, install
Constructor Details
This class inherits a constructor from Vagrant::Cachier::Bucket
Class Method Details
.capability ⇒ Object
5 6 7 |
# File 'lib/vagrant-cachier/bucket/apt.rb', line 5 def self.capability :apt_cache_dir end |
Instance Method Details
#install ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/vagrant-cachier/bucket/apt.rb', line 9 def install machine = @env[:machine] guest = machine.guest if guest.capability?(:apt_cache_dir) guest_path = guest.capability(:apt_cache_dir) @env[:cache_dirs] << guest_path machine.communicate.tap do |comm| comm.execute("mkdir -p /tmp/vagrant-cache/#{@name}") unless comm.test("test -L #{guest_path}") comm.sudo("rm -rf #{guest_path}") comm.sudo("mkdir -p `dirname #{guest_path}`") comm.sudo("ln -s /tmp/vagrant-cache/#{@name} #{guest_path}") end end else # TODO: Raise a better error raise "You've configured an APT cache for a guest machine that does not support it!" end end |