From 2670ef3e1c43ad2c0659245cf807afa3419dc765 Mon Sep 17 00:00:00 2001 From: Hugo Fonseca Date: Mon, 1 Dec 2014 14:43:05 +0000 Subject: [PATCH 1/2] fixes #37 --- attributes/default.rb | 1 + recipes/global_configs.rb | 8 ++++++-- recipes/self_update.rb | 6 +++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 5206fa3..c0f5a2c 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -21,4 +21,5 @@ end default['composer']['global_configs'] = {} +default['composer']['home_dir'] = nil default['composer']['php_recipe'] = 'php::default' diff --git a/recipes/global_configs.rb b/recipes/global_configs.rb index dea93b5..37f520a 100644 --- a/recipes/global_configs.rb +++ b/recipes/global_configs.rb @@ -16,6 +16,10 @@ action :create end + if node['composer']['home_dir'].nil? + node.set['composer']['home_dir'] = "/home/#{user}/.composer" + end + user_configs.nil? && next user_configs.each_pair do |option, value| @@ -23,7 +27,7 @@ value.each_pair do |value_k, value_v| execute "composer-config-for-#{user}" do command "composer config --global #{option}.#{value_k} #{value_v}" - environment 'COMPOSER_HOME' => node['composer']['install_dir'] + environment 'COMPOSER_HOME' => node['composer']['home_dir'] user user group user action :run @@ -32,7 +36,7 @@ else execute "composer-config-for-#{user}" do command "composer config --global #{option} #{value}" - environment 'COMPOSER_HOME' => node['composer']['install_dir'] + environment 'COMPOSER_HOME' => node['composer']['home_dir'] user user group user action :run diff --git a/recipes/self_update.rb b/recipes/self_update.rb index 72ae9e7..8cb4e15 100644 --- a/recipes/self_update.rb +++ b/recipes/self_update.rb @@ -7,10 +7,14 @@ include_recipe 'composer::install' +if node['composer']['home_dir'].nil? + node.set['composer']['home_dir'] = node['composer']['install_dir'] +end + execute 'composer-self_update' do cwd node['composer']['install_dir'] command 'composer self-update' - environment 'COMPOSER_HOME' => node['composer']['install_dir'] + environment 'COMPOSER_HOME' => node['composer']['home_dir'] action :run ignore_failure true end From af17c10056fb6b2a5ab2c6cdbf3783e23c12f58d Mon Sep 17 00:00:00 2001 From: Hugo Fonseca Date: Mon, 1 Dec 2014 15:38:09 +0000 Subject: [PATCH 2/2] remove whitespace --- recipes/global_configs.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/global_configs.rb b/recipes/global_configs.rb index 37f520a..be8cdfc 100644 --- a/recipes/global_configs.rb +++ b/recipes/global_configs.rb @@ -19,7 +19,7 @@ if node['composer']['home_dir'].nil? node.set['composer']['home_dir'] = "/home/#{user}/.composer" end - + user_configs.nil? && next user_configs.each_pair do |option, value|