Skip to content

Commit 0f5a0a2

Browse files
committed
FEAT: Module install wp-cli fine on Ubuntu Linux 18.04. You can run the wp command both from the symlink in /usr/local/bin and the real installation direcyory specificed with parameter install_path to the wp::cli class.
FEAT: Added class parameters manage_php_package, manage_curl_package and manage_git_package to be able to set that the module won't ensure these packages are installed. MISC: Simplified params.pp code.
1 parent 366718d commit 0f5a0a2

File tree

4 files changed

+27
-15
lines changed

4 files changed

+27
-15
lines changed

manifests/cli.pp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,27 @@
5353
}
5454
}
5555

56-
if ! defined( Package[ $::wp::php_package ] ) {
57-
package { $::wp::php_package:
58-
ensure => installed,
56+
if $manage_php_package {
57+
if ! defined( Package[ $::wp::php_package ] ) {
58+
package { $::wp::php_package:
59+
ensure => installed,
60+
}
5961
}
6062
}
6163

62-
if ! defined(Package['curl']) {
63-
package { 'curl':
64-
ensure => installed,
64+
if $manage_curl_package {
65+
if ! defined(Package['curl']) {
66+
package { 'curl':
67+
ensure => installed,
68+
}
6569
}
6670
}
6771

68-
if ! defined(Package['git']) {
69-
package { 'git':
70-
ensure => installed,
72+
if $manage_git_package {
73+
if ! defined(Package['git']) {
74+
package { 'git':
75+
ensure => installed,
76+
}
7177
}
7278
}
7379
}

manifests/init.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
$php_executable_path = $::wp::params::php_executable_path,
66
$bin_path = $::wp::params::bin_path,
77
$executable_filename = $::wp::params::executable_filename,
8+
$manage_php_package = $::wp::params::manage_php_package,
9+
$manage_curl_package = $::wp::params::manage_curl_package,
10+
$manage_git_package = $::wp::params::manage_git_package,
811
) inherits wp::params {
912
# ...
1013
}

manifests/params.pp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
# A class for parameters we might need to use.
22
class wp::params {
33
$user = $::operatingsystem ? {
4-
/^windows$/ => undef,
5-
default => 'www-data',
4+
'windows' => undef,
5+
default => 'www-data',
66
}
77
$bin_path = '/usr/local/bin'
88
$executable_filename = $::operatingsystem ? {
9-
/^windows$/ => 'wp.bat',
10-
default => 'wp',
9+
'windows' => 'wp.bat',
10+
default => 'wp',
1111
}
1212
$php_package = $::operatingsystem ? {
1313
/^(Debian|Ubuntu)$/ => 'php5-cli',
14-
/^windows$/ => 'php',
14+
'windows' => 'php',
1515
default => 'php-cli',
1616
}
1717
$php_executable_path = $::operatingsystem ? {
1818
'windows' => 'C:/tools/php80/php.exe',
1919
default => '/usr/bin/php',
2020
}
21+
$manage_php_package = true
22+
$manage_curl_package = true
23+
$manage_git_package = true
2124
}

templates/wp.sh.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
2-
<%= @php_executable_path %> "$(dirname $0)/wp-cli.phar" $@
2+
<%= @php_executable_path %> "$(dirname "$(readlink -f "$0")")/wp-cli.phar" $@
33

0 commit comments

Comments
 (0)