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