2013-10-21 09:17:59 +00:00
|
|
|
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}"
|
2013-10-21 09:17:59 +00:00
|
|
|
@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')
|
2013-10-21 09:17:59 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|