vagrant-cachier-ng/lib/vagrant-cachier/bucket/composer.rb

35 lines
963 B
Ruby
Raw Normal View History

module VagrantPlugins
module Cachier
class Bucket
class Composer < Bucket
def self.capability
:composer_path
end
def install
machine = @env[:machine]
guest = machine.guest
if guest.capability?(:composer_path)
if composer_path = guest.capability(:composer_path)
2013-10-22 14:42:29 +00:00
bucket_path = "/tmp/vagrant-cache/#{@name}"
@env[:cache_dirs] << composer_path
machine.communicate.tap do |comm|
comm.execute("mkdir -p #{bucket_path}")
unless comm.test("test -L #{composer_path}")
comm.sudo("rm -rf #{composer_path}")
comm.sudo("ln -s #{bucket_path} #{composer_path}")
end
end
end
else
2014-01-24 16:31:55 +00:00
Cachier.ui.info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Composer')
end
end
end
end
end
end