Sha256: c5d704377f08f64f34b05aad632dda9407c8a455114e22b66237bc9a8d6a012e

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

module VagrantPlugins
  module Cachier
    class Bucket
      class Rvm < Bucket
        def self.capability
          :rvm_path
        end

        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
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vagrant-cachier-0.5.1 lib/vagrant-cachier/bucket/rvm.rb
vagrant-cachier-0.5.0 lib/vagrant-cachier/bucket/rvm.rb
vagrant-cachier-0.4.1 lib/vagrant-cachier/bucket/rvm.rb
vagrant-cachier-0.4.0 lib/vagrant-cachier/bucket/rvm.rb
vagrant-cachier-0.3.3 lib/vagrant-cachier/bucket/rvm.rb
vagrant-cachier-0.3.2 lib/vagrant-cachier/bucket/rvm.rb
vagrant-cachier-0.3.1 lib/vagrant-cachier/bucket/rvm.rb
vagrant-cachier-0.3.0 lib/vagrant-cachier/bucket/rvm.rb