diff --git a/README.md b/README.md index 90c3181..9403fee 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Requirements Attributes ========== -* `node['pdepend']['install_method']` - Installation method, "pear" or "composer", defaults to "pear" +* `node['pdepend']['install_method']` - Installation method, "pear", "composer" or "phar" defaults to "pear" * `node['pdepend']['version']` - The pdepend version that will be installed, defaults to "latest" * `node['pdepend']['prefix']` - The composer.json bin-dir, defaults to "/usr/bin" (composer install method only) @@ -36,9 +36,9 @@ Usage 1) include `recipe[pdepend]` in a run list 2) - change the attributes - --- OR --- - override the attribute on a higher level (http://wiki.opscode.com/display/chef/Attributes#Attributes-AttributesPrecedence) + change the attributes + --- OR --- + override the attribute on a higher level (http://wiki.opscode.com/display/chef/Attributes#Attributes-AttributesPrecedence) References ========== diff --git a/attributes/composer.rb b/attributes/composer.rb new file mode 100644 index 0000000..c062f97 --- /dev/null +++ b/attributes/composer.rb @@ -0,0 +1,8 @@ +# +# Cookbook Name:: pdepend +# Attributes:: composer +# +# Copyright 2013, Escape Studios +# + +default[:pdepend][:prefix] = "/usr/bin" \ No newline at end of file diff --git a/attributes/default.rb b/attributes/default.rb index 99810bf..efe8bd4 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -6,7 +6,4 @@ # default[:pdepend][:install_method] = "pear" -default[:pdepend][:version] = "latest" - -#composer install only -default[:pdepend][:prefix] = "/usr/bin" \ No newline at end of file +default[:pdepend][:version] = "latest" \ No newline at end of file diff --git a/attributes/phar.rb b/attributes/phar.rb new file mode 100644 index 0000000..588695f --- /dev/null +++ b/attributes/phar.rb @@ -0,0 +1,9 @@ +# +# Cookbook Name:: pdepend +# Attributes:: phar +# +# Copyright 2013, Escape Studios +# + +default[:pdepend][:phar_url] = "http://static.pdepend.org/php/latest/pdepend.phar" +default[:pdepend][:install_dir] = "" \ No newline at end of file diff --git a/metadata.rb b/metadata.rb index 09a300e..f407a45 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license "MIT" description "Installs/Configures pdepend" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "0.0.2" +version "0.0.3" %w{ debian ubuntu redhat centos fedora scientific amazon }.each do |os| supports os @@ -15,4 +15,5 @@ recipe "pdepend", "Installs pdepend." recipe "pdepend::composer", "Installs pdepend using composer." -recipe "pdepend::pear", "Installs pdepend using pear." \ No newline at end of file +recipe "pdepend::pear", "Installs pdepend using pear." +recipe "pdepend::phar", "Installs pdepend using phar." \ No newline at end of file diff --git a/recipes/composer.rb b/recipes/composer.rb index 4a5e88a..7161b10 100644 --- a/recipes/composer.rb +++ b/recipes/composer.rb @@ -10,35 +10,35 @@ pdepend_dir = "#{Chef::Config[:file_cache_path]}/pdepend" directory "#{pdepend_dir}" do - owner "root" - group "root" - mode "0755" - action :create + owner "root" + group "root" + mode "0755" + action :create end #figure out what version to install if node[:pdepend][:version] != "latest" - version = node[:pdepend][:version] + version = node[:pdepend][:version] else - version = "*.*.*" + version = "*.*.*" end #composer.json template "#{pdepend_dir}/composer.json" do - source "composer.json.erb" - owner "root" - group "root" - mode 0600 - variables( - :version => version, - :bindir => node[:pdepend][:prefix] - ) + source "composer.json.erb" + owner "root" + group "root" + mode 0600 + variables( + :version => version, + :bindir => node[:pdepend][:prefix] + ) end #composer update execute "pdepend-composer" do - user "root" - cwd pdepend_dir - command "composer update" - action :run + user "root" + cwd pdepend_dir + command "composer update" + action :run end \ No newline at end of file diff --git a/recipes/default.rb b/recipes/default.rb index 0a23d06..724143d 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -6,8 +6,10 @@ # case node[:pdepend][:install_method] - when "pear" - include_recipe "pdepend::pear" - when "composer" - include_recipe "pdepend::composer" + when "pear" + include_recipe "pdepend::pear" + when "composer" + include_recipe "pdepend::composer" + when "phar" + include_recipe "pdepend::phar" end \ No newline at end of file diff --git a/recipes/pear.rb b/recipes/pear.rb index 8bcac10..e6da668 100644 --- a/recipes/pear.rb +++ b/recipes/pear.rb @@ -14,19 +14,19 @@ #upgrade PEAR php_pear "PEAR" do - action :upgrade + action :upgrade end #pdepend PEAR channel pearhub_chan = php_pear_channel "pear.pdepend.org" do - action :discover + action :discover end #upgrade pdepend php_pear "PHP_Depend-beta" do - channel pearhub_chan.channel_name - if node[:pdepend][:version] != "latest" - version "#{node[:pdepend][:version]}" - end - action :upgrade + channel pearhub_chan.channel_name + if node[:pdepend][:version] != "latest" + version "#{node[:pdepend][:version]}" + end + action :upgrade end \ No newline at end of file diff --git a/recipes/phar.rb b/recipes/phar.rb new file mode 100644 index 0000000..b89f054 --- /dev/null +++ b/recipes/phar.rb @@ -0,0 +1,24 @@ +# +# Cookbook Name:: pdepend +# Recipe:: phar +# +# Copyright 2013, Escape Studios +# + +if node[:pdepend][:install_dir] != "" + pdepend_dir = node[:pdepend][:install_dir] +else + pdepend_dir = "#{Chef::Config[:file_cache_path]}/pdepend" +end + +directory "#{pdepend_dir}" do + owner "root" + group "root" + mode "0755" + action :create +end + +remote_file "#{pdepend_dir}/pdepend.phar" do + source node[:pdepend][:phar_url] + mode "0755" +end \ No newline at end of file