From fc9b052ffb93cb336b82149ecc805098a62f80fc Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 28 Jul 2020 11:05:59 -0300 Subject: Support both legacy drush and drush launcher --- manifests/drush.pp | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/manifests/drush.pp b/manifests/drush.pp index f7ef791..96678fc 100644 --- a/manifests/drush.pp +++ b/manifests/drush.pp @@ -1,8 +1,7 @@ class drupal::drush( - $launcher = false, - $version = lookup('drupal::drush::version', undef, undef, '8.3.5') + $legacy_version = lookup('drupal::drush::legacy_version', undef, undef, '8.3.5') ) { - # Drush config folder + # Drush legacy config folder file { '/etc/drush': ensure => directory, owner => root, @@ -10,7 +9,7 @@ class drupal::drush( mode => '0644', } - # Drush default configuration + # Drush legacy default configuration file { '/etc/drush/drushrc.php': ensure => present, owner => root, @@ -21,7 +20,7 @@ class drupal::drush( } package { 'drush': - ensure => absent, + ensure => absent, } #vcsrepo { "/usr/local/share/drush": @@ -48,17 +47,31 @@ class drupal::drush( # require => Exec['getcomposer'], #} - $download_url = $launcher ? { - true => "https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar", - false => "https://github.com/drush-ops/drush/releases/download/${version}/drush.phar", + # Drush wrapper + file { '/usr/local/bin/drush': + ensure => present, + owner => root, + group => root, + mode => '0755', + source => 'puppet:///modules/drupal/drush', + } + + # Drush Legacy + exec { 'getdrush_legacy': + command => "/usr/bin/wget https://github.com/drush-ops/drush/releases/download/${version}/drush.phar -O /usr/local/bin/drush-legacy && chmod +x /usr/local/bin/drush-legacy", + user => 'root', + cwd => '/tmp', + timeout => 0, + creates => '/usr/local/bin/drush-legacy', } - exec { 'getdrush': + # Drush Launcher + exec { 'getdrush_launcher': #command => "/usr/bin/wget https://github.com/drush-ops/drush-launcher/releases/download/${version}/drush.phar -O /usr/local/bin/drush && chmod +x /usr/local/bin/drush", - command => "/usr/bin/wget ${download_url} -O /usr/local/bin/drush && chmod +x /usr/local/bin/drush", + command => "/usr/bin/wget https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar -O /usr/local/bin/drush-launcher && chmod +x /usr/local/bin/drush-launcher", user => 'root', cwd => '/tmp', timeout => 0, - creates => '/usr/local/bin/drush', + creates => '/usr/local/bin/drush-launcher', } } -- cgit v1.2.3