simpleweb/puppet-composer

Name: puppet-composer

Owner: Simpleweb

Description: A very flexible puppet recipe to install and use the composer PHP dependency manager.

Created: 2014-02-07 11:11:43.0

Updated: 2014-02-07 11:13:23.0

Pushed: 2014-02-07 11:13:11.0

Homepage: null

Size: 140

Language: Puppet

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Composer Puppet Module

Build Status

Description

The puppet-composer module installs the latest version of Composer from http://getcomposer.org. Composer is a dependency manager for PHP.

Installation
Puppet Forge

We recommend installing using the Puppet Forge as it automatically satisfies dependencies.

puppet module install --target-dir=/your/path/to/modules tPl0ch-composer
Installation via git submodule

You can also install as a git submodule and handle the dependencies manually. See the Dependencies section below.

git submodule add git://github.com/tPl0ch/puppet-composer.git modules/composer
Dependencies

This module requires the following Puppet modules:

Usage

To install the composer binary globally in /usr/local/bin you only need to declare the composer class. We try to set some sane defaults. There are also a number of parameters you can tweak should the defaults not be sufficient.

Simple Include

To install the binary with the defaults you just need to include the following in your manifests:

include composer
Full Include

Alternatively, you can set a number of options by declaring the class with parameters:

s { 'composer':
target_dir      => '/usr/local/bin',
composer_file   => 'composer', # could also be 'composer.phar'
download_method => 'curl',     # or 'wget'
logoutput       => false,
tmp_path        => '/tmp',
php_package     => 'php5-cli',
curl_package    => 'curl',
wget_package    => 'wget',
composer_home   => '/root',
suhosin_enable  => true,

Creating Projects

The composer::project definition provides a way to create projects in a target directory.

oser::project { 'silex':
project_name   => 'fabpot/silex-skeleton',  # REQUIRED
target_dir     => '/vagrant/silex', # REQUIRED
version        => '2.1.x-dev', # Some valid version string
prefer_source  => true,
stability      => 'dev', # Minimum stability setting
keep_vcs       => false, # Keep the VCS information
dev            => true, # Install dev dependencies
repository_url => 'http://repo.example.com', # Custom repository URL
user           => undef, # Set the user to run as

Updating Packages

The composer::exec definition provides a more generic wrapper arround composer update and install commands. The following example will update the silex/silex and symfony/browser-kit packages in the /vagrant/silex directory. You can omit packages to update the entire project.

oser::exec { 'silex-update':
cmd                  => 'update',  # REQUIRED
cwd                  => '/vagrant/silex', # REQUIRED
packages             => ['silex/silex', 'symfony/browser-kit'], # leave empty or omit to update whole project
prefer_source        => false, # Only one of prefer_source or prefer_dist can be true
prefer_dist          => false, # Only one of prefer_source or prefer_dist can be true
dry_run              => false, # Just simulate actions
custom_installers    => false, # No custom installers
scripts              => false, # No script execution
interaction          => false, # No interactive questions
optimize             => false, # Optimize autoloader
dev                  => false, # Install dev dependencies
user                 => undef, # Set the user to run as
refreshonly          => false, # Only run on refresh

Installing Packages

We support the install command in addition to update. The install command will ignore the packages parameter and the following example is the equivilent to running composer install in the /vagrant/silex directory.

oser::exec { 'silex-install':
cmd                  => 'install',  # REQUIRED
cwd                  => '/vagrant/silex', # REQUIRED
prefer_source        => false,
prefer_dist          => false,
dry_run              => false, # Just simulate actions
custom_installers    => false, # No custom installers
scripts              => false, # No script execution
interaction          => false, # No interactive questions
optimize             => false, # Optimize autoloader
dev                  => false, # Install dev dependencies

Development

We have rspec-puppet and Travis CI setup for the project. To run the spec tests locally you need bundler installed:

install bundler

Then you can install the required gems:

le install

Finally, the tests can be run:

 spec
Contributing

We welcome everyone to help develop this module. To contribute:

Todo

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.