Skip to content

Commit ae61881

Browse files
authored
Merge pull request #571 from CyberLine/master
add ability to define composer update channel
2 parents 06f2162 + 966bc20 commit ae61881

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

REFERENCE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,9 @@ Install composer package manager
497497
[*path*]
498498
Holds path to the Composer executable
499499

500+
[*channel*]
501+
Holds the Update channel (stable|preview|snapshot|1|2)
502+
500503
[*proxy_type*]
501504
proxy server type (none|http|https|ftp)
502505

manifests/composer.pp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
# [*path*]
99
# Holds path to the Composer executable
1010
#
11+
# [*channel*]
12+
# Holds the Update channel (stable|preview|snapshot|1|2)
13+
#
1114
# [*proxy_type*]
1215
# proxy server type (none|http|https|ftp)
1316
#
@@ -28,6 +31,7 @@
2831
Stdlib::Absolutepath $path = $php::params::composer_path,
2932
$proxy_type = undef,
3033
$proxy_server = undef,
34+
Php::ComposerChannel $channel = 'stable',
3135
Boolean $auto_update = true,
3236
Integer $max_age = $php::params::composer_max_age,
3337
Variant[Integer, String] $root_group = $php::params::root_group,
@@ -52,6 +56,7 @@
5256
max_age => $max_age,
5357
source => $source,
5458
path => $path,
59+
channel => $channel,
5560
proxy_type => $proxy_type,
5661
proxy_server => $proxy_server,
5762
}

manifests/composer/auto_update.pp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
# [*path*]
1212
# Holds path to the Composer executable
1313
#
14+
# [*channel*]
15+
# Holds the Update channel (stable|preview|snapshot|1|2)
16+
#
1417
# [*proxy_type*]
1518
# proxy server type (none|http|https|ftp)
1619
#
@@ -29,8 +32,9 @@
2932
$max_age,
3033
$source,
3134
$path,
32-
$proxy_type = undef,
33-
$proxy_server = undef,
35+
Php::ComposerChannel $channel = 'stable',
36+
$proxy_type = undef,
37+
$proxy_server = undef,
3438
) {
3539

3640
assert_private()
@@ -44,7 +48,7 @@
4448

4549
exec { 'update composer':
4650
# touch binary when an update is attempted to update its mtime for idempotency when no update is available
47-
command => "${path} --no-interaction --quiet self-update; touch ${path}",
51+
command => "${path} --no-interaction --quiet self-update --${channel}; touch ${path}",
4852
environment => $env,
4953
onlyif => "test `find '${path}' -mtime +${max_age}`",
5054
path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', '/usr/local/sbin' ],

types/composerchannel.pp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
type Php::ComposerChannel = Enum[
2+
'stable',
3+
'preview',
4+
'snapshot',
5+
'1',
6+
'2' # lint:ignore:trailing_comma
7+
]

0 commit comments

Comments
 (0)