Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow 'all' ass a webserver option.

  • Loading branch information...
commit 97c2b8ee2d419e7bfbe7e283a0d0afd2caf61072 1 parent 504976f
@gphat authored
Showing with 11 additions and 7 deletions.
  1. +11 −7 lib/Dist/Zilla/Plugin/Dpkg/PerlbrewStarman.pm
View
18 lib/Dist/Zilla/Plugin/Dpkg/PerlbrewStarman.pm
@@ -5,7 +5,7 @@ use Moose::Util::TypeConstraints;
extends 'Dist::Zilla::Plugin::Dpkg';
-enum 'WebServer', [qw(apache nginx)];
+enum 'WebServer', [qw(apache nginx all)];
#ABSTRACT: Generate dpkg files for your perlbrew-backed, starman-based perl app
@@ -437,13 +437,16 @@ around '_generate_file' => sub {
$_[2]->{starman_port} = $self->starman_port;
$_[2]->{startup_time} = $self->startup_time;
- if($self->web_server eq 'apache') {
- $_[2]->{webserver_config_link} = '# Symlink to the apache config for the environment we`re in
+ $_[2]->{webserver_config_link} = '';
+ $_[2]->{webserver_restart} = '';
+
+ if(($self->web_server eq 'apache') || ($self->web_server eq 'all')) {
+ $_[2]->{webserver_config_link} .= '# Symlink to the apache config for the environment we`re in
if [ ! -e /etc/apache2/sites-available/$PACKAGE ]; then
ln /srv/$PACKAGE/config/apache/$PACKAGE.conf /etc/apache2/sites-available/$PACKAGE
fi
';
- $_[2]->{webserver_restart} = 'a2enmod proxy proxy_http rewrite
+ $_[2]->{webserver_restart} .= 'a2enmod proxy proxy_http rewrite
a2ensite $PACKAGE
mkdir -p /var/log/apache2/$PACKAGE
if which invoke-rc.d >/dev/null 2>&1; then
@@ -452,13 +455,14 @@ around '_generate_file' => sub {
/etc/init.d/apache2 restart
fi
';
- } else {
- $_[2]->{webserver_config_link} = '# Symlink to the nginx config for the environment we`re in
+ }
+ if(($self->web_server eq 'nginx') || ($self->web_server eq 'all')) {
+ $_[2]->{webserver_config_link} .= '# Symlink to the nginx config for the environment we`re in
if [ ! -h /etc/nginx/sites-available/$PACKAGE ]; then
ln -s /srv/$PACKAGE/config/nginx/$PACKAGE.conf /etc/nginx/sites-available/$PACKAGE
fi
';
- $_[2]->{webserver_restart} = 'if which invoke-rc.d >/dev/null 2>&1; then
+ $_[2]->{webserver_restart} .= 'if which invoke-rc.d >/dev/null 2>&1; then
invoke-rc.d nginx restart
else
/etc/init.d/nginx restart

2 comments on commit 97c2b8e

@tripside
Collaborator

nice commit message

@gphat
Owner
Please sign in to comment.
Something went wrong with that request. Please try again.