Class: VagrantPlugins::Cachier::Bucket::Rvm
- Inherits:
-
VagrantPlugins::Cachier::Bucket
- Object
- VagrantPlugins::Cachier::Bucket
- VagrantPlugins::Cachier::Bucket::Rvm
- Defined in:
- lib/vagrant-cachier/bucket/rvm.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from VagrantPlugins::Cachier::Bucket
auto_detect, bucket_name, inherited, #initialize, install
Constructor Details
This class inherits a constructor from VagrantPlugins::Cachier::Bucket
Class Method Details
.capability ⇒ Object
5 6 7 |
# File 'lib/vagrant-cachier/bucket/rvm.rb', line 5 def self.capability :rvm_path 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 31 32 33 34 |
# File 'lib/vagrant-cachier/bucket/rvm.rb', line 9 def install machine = @env[:machine] guest = machine.guest if guest.capability?(:rvm_path) if rvm_path = guest.capability(:rvm_path) prefix = rvm_path.split('/').last bucket_path = "/tmp/vagrant-cache/#{@name}/#{prefix}" machine.communicate.tap do |comm| comm.execute("mkdir -p #{bucket_path}") rvm_cache_path = "#{rvm_path}/archives" @env[:cache_dirs] << rvm_cache_path unless comm.test("test -L #{rvm_cache_path}") comm.sudo("rm -rf #{rvm_cache_path}") comm.sudo("mkdir -p `dirname #{rvm_cache_path}`") comm.sudo("ln -s #{bucket_path} #{rvm_cache_path}") end end end else @env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'RVM') end end |