Puppet Class: php::composer::auto_update

Defined in:
manifests/composer/auto_update.pp

Overview

Install composer package manager

=== Parameters

[max_age] Defines number of days after which Composer should be updated

[source] Holds URL to the Composer source file

[path] Holds path to the Composer executable

[proxy_type] proxy server type (none|http|https|ftp)

[proxy_server] specify a proxy server, with port number if needed. ie: https://example.com:8080.

=== Examples

include php::composer::auto_update class { "php::composer::auto_update": "max_age" => 90 }

Parameters:

  • max_age (Any)
  • source (Any)
  • path (Any)
  • proxy_type (Any) (defaults to: undef)
  • proxy_server (Any) (defaults to: undef)


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
# File 'manifests/composer/auto_update.pp', line 28

class php::composer::auto_update (
  $max_age,
  $source,
  $path,
  $proxy_type   = undef,
  $proxy_server = undef,
) {

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

  if $proxy_type and $proxy_server {
    $env = [ 'HOME=/root', "${proxy_type}_proxy=${proxy_server}" ]
  } else {
    $env = [ 'HOME=/root' ]
  }

  exec { 'update composer':
    command     => "${path} --no-interaction --quiet self-update",
    environment => $env,
    onlyif      => "test `find '${path}' -mtime +${max_age}`",
    path        => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', '/usr/local/sbin' ],
    require     => [File[$path], Class['::php::cli']],
  }
}