author | ymh <ymh.work@gmail.com> |
Thu, 10 Nov 2016 14:07:02 +0100 | |
changeset 410 | 240ca282331d |
parent 353 | bf1bc6b08c46 |
permissions | -rw-r--r-- |
353
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
# == Class: drush |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
# Installs Drush system-wide with Composer and prepares a working environment. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
# === Parameters |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
7 |
# [*versions*] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
8 |
# Array of versions of drush to install. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
# Valid values are '6', '7', '8', and 'master'. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
# [*default_version*] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
# String with the drush version considered the main version. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
# [*install_type*] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
# Install distribution package or source code. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
# Valid values: 'dist', 'source'. Defaults to 'dist'. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |
# [*autoupdate*] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
# Try and install new versions automatically. Defaults to false. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
# [*ensure_extra_packages*] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
# Boolean indicating wether extra system packages must be installed. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
# It defaults to false to not interfere with other modules. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
24 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
25 |
# [*extra_packages*] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
26 |
# Array of extra packages to install if ensure_extra_packages is true. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
27 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
28 |
# [*bash_integration*] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
29 |
# Boolean indicating whether to enable drush bash facilities. It configures |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
30 |
# bash to source drush's example.bashrc for any session. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
31 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
32 |
# [*bash_autocompletion*] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
33 |
# Boolean indicating whether to enable bash autocompletion for drush commands. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
34 |
# Doesn't take effect if bash_integration is true. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
35 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
36 |
# [*extensions*] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
37 |
# List of drush extensions to download. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
38 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
39 |
# [*aliases*] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
40 |
# Hash of aliases to make available system wide. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
41 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
42 |
# [*composer_path*] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
43 |
# Absolute path to composer executable. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
44 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
45 |
# [*php_path*] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
46 |
# Path to an alternative php executable to run drush with. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
47 |
# If provided, it will set DRUSH_PHP environment variable system-wide. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
48 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
49 |
# [*php_ini_path*] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
50 |
# Path to an alternative php ini file. If provided, it will set PHP_INI |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
51 |
# environment variable system-wide. See `docs-ini-files` for details. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
52 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
53 |
# [*drush_ini_path*] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
54 |
# Path to a ini file with php overrides. If provided, it will set DRUSH_INI |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
55 |
# environment variable system-wide. See `docs-ini-files` for details. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
56 |
# |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
57 |
class drush( |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
58 |
$versions = ['7',], |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
59 |
$default_version = '7', |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
60 |
$install_type = 'dist', |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
61 |
$autoupdate = false, |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
62 |
$ensure_extra_packages = false, |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
63 |
$extra_packages = $drush::params::extra_packages, |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
64 |
$bash_integration = false, |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
65 |
$bash_autocompletion = true, |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
66 |
$extensions = [], |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
67 |
$aliases = {}, |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
68 |
$composer_path = '/usr/local/bin/composer', |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
69 |
$php_path = undef, |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
70 |
$php_ini_path = undef, |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
71 |
$drush_ini_path = undef, |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
72 |
) inherits drush::params { |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
73 |
|
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
74 |
# Pick default major version. |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
75 |
validate_string($default_version) |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
76 |
$parts = split($default_version, '[.]') |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
77 |
$default_version_major = $parts[0] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
78 |
|
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
79 |
validate_absolute_path($composer_path) |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
80 |
|
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
81 |
$install_base_path = '/opt/drush' |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
82 |
$drush_exe_default = '/usr/local/bin/drush' |
410 | 83 |
if($php_path) { |
84 |
$drush_php = $php_path |
|
85 |
} else { |
|
86 |
$drush_php = "/usr/bin/php" |
|
87 |
} |
|
353
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
88 |
|
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
89 |
class{'drush::setup': } -> |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
90 |
class{'drush::config': } ~> |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
91 |
class{'drush::cacheclear': } -> |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
92 |
Class['drush'] |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
93 |
|
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
94 |
} |
bf1bc6b08c46
correct provisioning to install drush and correct config files + module definition for menu access problem
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
95 |