From f8e419b8b606265ae90eb8d64170af18d8d32ea4 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Tue, 22 Oct 2013 13:51:45 -0200 Subject: [PATCH] "Disable" composer bucket if php is not installed --- lib/vagrant-cachier/cap/linux/composer_path.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/vagrant-cachier/cap/linux/composer_path.rb b/lib/vagrant-cachier/cap/linux/composer_path.rb index 605fde7..db89b7a 100644 --- a/lib/vagrant-cachier/cap/linux/composer_path.rb +++ b/lib/vagrant-cachier/cap/linux/composer_path.rb @@ -2,10 +2,16 @@ module VagrantPlugins module Cachier module Cap module Linux - module ComposerPath + module ComposerPath def self.composer_path(machine) - composer_path = '/home/vagrant/.composer' - return composer_path + composer_path = nil + machine.communicate.tap do |comm| + return unless comm.test('which php') + comm.execute 'echo $HOME' do |buffer, output| + composer_path = output.chomp if buffer == :stdout + end + end + return "#{composer_path}/.composer" end end end