Skip to content
This repository was archived by the owner on Dec 14, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions modules/http_stack/manifests/apache.pp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@
ensure => "directory",
}

# Create home directories for the users that will be using Drush.
file { '/home/vagrant/.drush':
ensure => 'directory',
owner => 'vagrant',
group => 'vagrant',
}

# Find the sites.
$site_names_string = generate('/usr/bin/find', '-L', '/vagrant_sites/' , '-type', 'd', '-printf', '%f\0', '-maxdepth', '1', '-mindepth', '1')
$site_names = split($site_names_string, '\0')
Expand Down
33 changes: 28 additions & 5 deletions modules/http_stack/manifests/apache/site.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
define http_stack::apache::site () {
define http_stack::apache::site (
$ensure = 'present',
$drush_alias = true,
) {

# Special handling for a 'webroot' subdirectory.
# We pretend like it's the root.
Expand All @@ -14,22 +17,34 @@
$f2 = "/vagrant_sites/$name/.parrot-php7"
$_exists2 = inline_template("<%= File.exists?('$f2') %>")
case $_exists2 {
"true": { $fpm_port = "9997" } # PHP 7.1
"true": { # PHP 7.1
$fpm_port = "9997"
$php = "/usr/bin/php7.1"
}
"false": {

# Test for PHP 7.1
$f3 = "/vagrant_sites/$name/.parrot-php7.1"
$_exists3 = inline_template("<%= File.exists?('$f3') %>")
case $_exists3 {
"true": { $fpm_port = "9997" } # PHP 7.1
"true": { # PHP 7.1
$fpm_port = "9997"
$php = "/usr/bin/php7.1"
}
"false": {

# Test for PHP 7.0
$f4 = "/vagrant_sites/$name/.parrot-php7.0"
$_exists4 = inline_template("<%= File.exists?('$f4') %>")
case $_exists4 {
"true": { $fpm_port = "9998" } # PHP 7.0
"false": { $fpm_port = "9999" } # PHP 5.6
"true": { # PHP 7.0
$fpm_port = "9998"
$php = "/usr/bin/php7.0"
}
"false": { # PHP 5.6
$fpm_port = "9999"
$php = "/usr/bin/php5.6"
}
}
}
}
Expand Down Expand Up @@ -73,4 +88,12 @@
group => 'root',
}

if $drush_alias {
parrot_drush::components::php::drush_alias { $name:
root => "/vagrant_sites/$name$webroot_subdir",
ensure => $ensure,
php_executable => $php,
protocol => 'https://',
}
}
}
17 changes: 17 additions & 0 deletions modules/parrot_drush/manifests/components/php/drush_alias.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
define parrot_drush::components::php::drush_alias (
$root,
$ensure = 'present',
$uri = $name,
$php_executable = undef,
$protocol = '',
)
{

file {"/home/vagrant/.drush/$name.aliases.drushrc.php":
ensure => $ensure,
owner => 'vagrant',
group => 'vagrant',
content => template('parrot_drush/php/drush_alias.erb'),
require => File['/home/vagrant/.drush'],
}
}
10 changes: 10 additions & 0 deletions modules/parrot_drush/templates/php/drush_alias.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

$aliases['<%= @name %>'] = array(
'uri' => '<%= @protocol %><%= @uri %>',
'root' => '<%= @root %>',
<%- if @php_executable -%>
'php' => '<%= @php_executable %>',
<%- end -%>
'local' => TRUE, // Required to avoid double-calling, see https://github.com/drush-ops/drush/issues/1870
);