Puppet Class: php::composer

Inherits:
::php::params
Defined in:
manifests/composer.pp

Overview

Install composer package manager

Parameters

source

Holds URL to the Composer source file

path

Holds path to the Composer executable

auto_update

Defines if composer should be auto updated

max_age

Defines the time in days after which an auto-update gets executed

root_group

UNIX group of the root user

Parameters:

  • source (Any) (defaults to: $::php::params::composer_source)
  • path (Any) (defaults to: $::php::params::composer_path)
  • auto_update (Any) (defaults to: true)
  • max_age (Any) (defaults to: $::php::params::composer_max_age)
  • root_group (Any) (defaults to: $::php::params::root_group)


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'manifests/composer.pp', line 20

class php::composer (
  $source      = $::php::params::composer_source,
  $path        = $::php::params::composer_path,
  $auto_update = true,
  $max_age     = $::php::params::composer_max_age,
  $root_group  = $::php::params::root_group,
) inherits ::php::params {

  if $caller_module_name != $module_name {
    warning('php::composer is private')
  }

  validate_string($source)
  validate_absolute_path($path)
  validate_bool($auto_update)
  validate_re("x${max_age}", '^x\d+$')

  ensure_packages(['wget'])

  exec { 'download composer':
    command => "wget ${source} -O ${path}",
    creates => $path,
    path    => ['/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/',
                '/usr/local/bin', '/usr/local/sbin'],
    require => [Class['::php::cli'],Package['wget']],
  } ->
  file { $path:
    mode  => '0555',
    owner => root,
    group => $root_group,
  }

  if $auto_update {
    class { '::php::composer::auto_update':
      max_age => $max_age,
      source  => $source,
      path    => $path,
    }
  }
}