Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
djoos committed Jan 30, 2013
0 parents commit c761d99
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 0 deletions.
74 changes: 74 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
Description
===========

This cookbook provides an easy way to install pdepend, PHP_Depend.

More information?
http://pdepend.org/

Requirements
============

## Cookbooks:

* php
* composer

## Platforms:

* Ubuntu
* Debian
* RHEL
* CentOS
* Fedora
* Scientific
* Amazon

Attributes
==========

* `node['pdepend']['install_method']` - Installation method, "pear" or "composer", 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)

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)

References
==========

* [pdepend home page] (http://pdepend.org/)

License and Authors
===================

Author: David Joos <[email protected]>
Author: Escape Studios Development <[email protected]>
Copyright: 2013, Escape Studios

Unless otherwise noted, all files are released under the MIT license,
possible exceptions will contain licensing information in them.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
12 changes: 12 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Cookbook Name:: pdepend
# Attributes:: default
#
# Copyright 2013, Escape Studios
#

default[:pdepend][:install_method] = "pear"
default[:pdepend][:version] = "latest"

#composer install only
default[:pdepend][:prefix] = "/usr/bin"
17 changes: 17 additions & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
maintainer "Escape Studios"
maintainer_email "[email protected]"
license "MIT"
description "Installs/Configures pdepend"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.0.1"

supports "ubuntu"
supports "debian"
supports "centos"
supports "redhat"
supports "fedora"
supports "scientific"
supports "amazon"

depends "php"
depends "composer"
44 changes: 44 additions & 0 deletions recipes/composer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#
# Cookbook Name:: pdepend
# Recipe:: composer
#
# Copyright 2013, Escape Studios
#

include_recipe "composer"

pdepend_dir = "#{Chef::Config[:file_cache_path]}/pdepend"

directory "#{pdepend_dir}" do
owner "root"
group "root"
mode "0755"
action :create
end

#figure out what version to install
if node[:pdepend][:version] != "latest"
version = node[:pdepend][:version]
else
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]
)
end

#composer update
execute "pdepend-composer" do
user "root"
cwd pdepend_dir
command "composer update"
action :run
end
13 changes: 13 additions & 0 deletions recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Cookbook Name:: pdepend
# Recipe:: default
#
# Copyright 2013, Escape Studios
#

case node[:pdepend][:install_method]
when "pear"
include_recipe "pdepend::pear"
when "composer"
include_recipe "pdepend::composer"
end
32 changes: 32 additions & 0 deletions recipes/pear.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# Cookbook Name:: pdepend
# Recipe:: pear
#
# Copyright 2013, Escape Studios
#

include_recipe "php"

#PHP Extension and Application Repository PEAR channel
php_pear_channel "pear.php.net" do
action :update
end

#upgrade PEAR
php_pear "PEAR" do
action :upgrade
end

#pdepend PEAR channel
pearhub_chan = php_pear_channel "pear.pdepend.org" do
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
end
10 changes: 10 additions & 0 deletions templates/default/composer.json.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "pdepend",
"description": "pdepend",
"require": {
"pdepend/pdepend": "<%= @version %>"
},
"config": {
"bin-dir": "<%= @bindir %>"
}
}

0 comments on commit c761d99

Please sign in to comment.