filefetcher
Version information
This version is compatible with:
- Puppet 3.x
Start using this module
Add this module to your Puppetfile:
mod 'gajdaw-filefetcher', '0.1.0'
Learn more about managing modules with a PuppetfileDocumentation
filefetcher
Puppet Module
Table of Contents
- Overview
- Module Description
- Setup
- Usage
- Reference
- Limitations
- Development
- Release notes
- To do
- Inspiration
Overview
This module aims to simplify the installation of applications that consist of a single file.
I prepared it and tested having PHP Phars in mind, like:
phpunit
composer
box
php-cs-fixer
Module Description
Currently, there are no binary distributions for
many php command line applications, like composer
, phpunit
, etc.
Thus, you cannot install them using package managers,
like APT, for example:
# These won't work
#
$ sudo apt-get install composer
$ sudo apt-get install phpunit
The filefetcher
module aims to make installation of
one-file-applications easier.
In general:
- the module downloads a file
- sets the owner
- sets the rights
It can be seen as a sequence of:
wget
chown
chmod
commands.
Setup
What filefetcher affects
Module:
- downloads a file using URL parameter (e.g.
https://getcomposer.org/composer.phar
) - saves it under given name (e.g.
composer
) in arbitrary directory (e.g./usr/local/bin
) - sets the owner (e.g.
root
) - sets the rights (e.g.
a+x
)
Setup Requirements
The module uses:
wget
to download filesmaestrodev-wget
puppet module https://github.com/maestrodev/puppet-wget- when missing,
wget
is automatically installed bymaestrodev-wget
module
Beginning with filefetcher
System wide install with Puppet
To install the module in your system run:
sudo puppet module install gajdaw-filefetcher
You may lock the version to avoid using the latest version:
sudo puppet module install gajdaw-filefetcher --version 0.1.0
System wide install with Git
You may also use git to install the module:
mkdir -p /etc/puppet/modules/box
cd /etc/puppet/modules/box
git clone --depth 1 https://github.com/pro-vagrant/puppet-filefetcher.git .
To lock the version, use:
git clone --depth 1 --branch v0.1.0 https://github.com/pro-vagrant/puppet-filefetcher.git .
Usage
The examples are stored under examples
directory.
Composer
Here is composer.pp
example:
# Filename: examples/composer.pp
filefetcher::fetch { 'composer':
source => 'https://getcomposer.org/composer.phar',
}
To run it use the following command:
sudo puppet apply examples/composer.pp
Phpunit
Here is phpunit.pp
example:
# Filename: examples/phpunit.pp
filefetcher::fetch { 'phpunit':
source => 'https://phar.phpunit.de/phpunit.phar',
}
To run it use the following command:
sudo puppet apply examples/phpunit.pp
Php-cs-fixer
Here is php-cs-fixer.pp
example:
# Filename: examples/php-cs-fixer.pp
filefetcher::fetch { 'php-cs-fixer':
source => 'http://cs.sensiolabs.org/get/php-cs-fixer.phar',
}
To run it use the following command:
sudo puppet apply examples/php-cs-fixer.pp
Box
Here is box.pp
example:
# Filename: examples/box.pp
filefetcher::fetch { 'box':
source => 'https://github.com/box-project/box2/releases/download/2.5.0/box-2.5.0.phar',
}
To run it use the following command:
sudo puppet apply examples/box.pp
Running binaries
If php is missing, install it with:
sudo apt-get install php5 -y
Now, you can use the binaries:
phpunit --version
composer --version
php-cs-fixer --version
box --version
Uninstall
Currently, to uninstall binaries, you have to use rm
command:
sudo rm /usr/local/bin/composer
sudo rm /usr/local/bin/phpunit
sudo rm /usr/local/bin/php-cs-fixer
sudo rm /usr/local/bin/box
Reference
The complete list of parameters is available in
manifests/fetch.pp
file.
Limitations
The box was tested on:
- Ubuntu 14.04 / Puppet 3.7
Development
When I work on this module I find the following commands indispensable:
cd some/dir/with/source/code/for/the/module
sudo puppet module list
puppet module build .
puppet-lint manifests --no-autoloader_layout-check
sudo puppet module install pkg/gajdaw-filefetcher-0.1.0.tar.gz
sudo puppet module uninstall gajdaw-filefetcher
sudo puppet apply examples/phpunit.pp
sudo puppet apply examples/composer.pp
sudo puppet apply examples/php-cs-fixer.pp
sudo puppet apply examples/box.pp
sudo puppet apply examples/symfony-standard-composer-json.pp
sudo puppet apply examples/php-common-phars.pp
Using them I don't have to upload the module to the Puppet Forge just to verify if it is working or not.
Release Notes
0.1.0
- initial release
- works fine with four attached examples
To do
- using array of hashes as in
examples/php-common-phars.pp
- tests
Inspiration
The inspiration came from
willdurrand-composer
authored
by William Durand.
Dependencies
- maestrodev/wget (>=1.2.0)