]> gitweb.fluxo.info Git - puppet-drupal.git/commitdiff
Support both legacy drush and drush launcher
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 28 Jul 2020 14:05:59 +0000 (11:05 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 28 Jul 2020 14:05:59 +0000 (11:05 -0300)
manifests/drush.pp

index f7ef7911c8fbf805c465ba9067dee1538cfafbea..96678fc47e4d65e5a54253ed16c190e54896d577 100644 (file)
@@ -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',
   }
 }