Skip to content

Commit

Permalink
#559: drush, add module
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff1evesque committed Dec 9, 2017
1 parent 82e1612 commit 457638f
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
###
### Configure required composer.
###

class drush::configure_composer {
exec { 'move-composer-phar':
command => 'mv composer.phar /usr/bin/composer/composer',
path => '/usr/bin',
cwd => '/root',
before => File['/usr/local/bin/composer'],
}

## symlink composer to path
file { '/usr/local/bin/composer':
ensure => '/usr/bin/composer/composer',
require => Exec['move-composer-phar'],
notify => Exec['initialize-drush'],
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
###
### Download required composer.
###

class drush::download_composer {
exec { 'download-composer':
command => 'wget https://getcomposer.org/installer',
path => '/usr/bin',
cwd => '/root',
notify => Exec['move-composer-installer'],
creates => [
'/usr/local/bin/drush',
'/usr/bin/composer/vendor/drush/drush/drush',
'/usr/bin/composer/composer',
'/usr/bin/composer/composer.json',
],
provider => 'shell',
}

exec { 'move-composer-installer':
command => 'mv installer composer-installer.php',
path => '/usr/bin',
cwd => '/root',
onlyif => 'test -e /root/installer',
refreshonly => true,
}
}
18 changes: 18 additions & 0 deletions puppet/environment/development/modules/drush/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
###
### Configures drush instance.
###

class drush {
include php::install_rpm
include php::enable_rpm
include php::install_php
include httpd::restart

## enforce resource ordering: applies left resource first, if the left
## resource changes, the right resource will refresh.
##
Class['php::install_rpm'] ~>
Class['php::enable_rpm'] ~>
Class['php::install_php'] ~>
Class['httpd::restart']
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
###
### Install required composer.
###

class drush::install_composer {
exec { 'install-composer':
command => 'php composer-installer.php',
path => '/usr/bin',
cwd => '/root',
environment => [
'COMPOSER_HOME=/usr/bin/composer',
],
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
###
### Install drush.
###

class drush::install_composer {
include httpd

exec { 'initialize-drush':
command => "composer global require drush/drush:${version}",
path => ['/usr/bin', '/usr/bin/composer'],
environment => [
'COMPOSER_HOME=/usr/bin/composer',
],
provider => 'shell',
require => File['/usr/local/bin/composer'],
notify => Exec['update-composer'],
}

exec { 'update-composer':
command => 'composer global update',
cwd => '/usr/bin/composer/cache/files',
environment => ['COMPOSER_HOME=/usr/bin/composer'],
provider => 'shell',
refreshonly => true,
before => File['/usr/local/bin/drush'],
notify => Exec['restart-httpd'],
}

## symlink drush to path
file { '/usr/local/bin/drush':
ensure => '/usr/bin/composer/vendor/drush/drush/drush',
require => Exec['initialize-drush'],
notify => [
Exec['restart-httpd'],
Exec['drush-rc'],
],
}

## clear cache and registry
exec { 'drush-rc':
command => 'drush rc',
path => '/usr/local/bin',
refreshonly => true,
}
}

0 comments on commit 457638f

Please sign in to comment.