diff options
-rw-r--r-- | conf/packages | 1 | ||||
-rw-r--r-- | perl-external/.gitignore | 2 | ||||
-rw-r--r-- | perl-external/lib/perl5/local/lib.pm (renamed from perllib/local/lib.pm) | 0 | ||||
-rwxr-xr-x | setenv.pl | 54 | ||||
-rw-r--r-- | setup-dev-environment.bash | 11 |
5 files changed, 56 insertions, 12 deletions
diff --git a/conf/packages b/conf/packages index adeb4bd38..ce5c1e745 100644 --- a/conf/packages +++ b/conf/packages @@ -30,3 +30,4 @@ gettext libtest-exception-perl libipc-run3-perl libyaml-perl +liblist-moreutils-perl diff --git a/perl-external/.gitignore b/perl-external/.gitignore index 46ff56b3e..8db64e38e 100644 --- a/perl-external/.gitignore +++ b/perl-external/.gitignore @@ -1 +1 @@ -distributions +local-lib diff --git a/perllib/local/lib.pm b/perl-external/lib/perl5/local/lib.pm index 65e5365a6..65e5365a6 100644 --- a/perllib/local/lib.pm +++ b/perl-external/lib/perl5/local/lib.pm diff --git a/setenv.pl b/setenv.pl new file mode 100755 index 000000000..e6dd65f47 --- /dev/null +++ b/setenv.pl @@ -0,0 +1,54 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +use FindBin; +use List::MoreUtils 'uniq'; + +# Set the environment for the FixMyStreet project + +# Add the lii/perl5 in perl-external so that we can load local::lib from there +use lib "$FindBin::Bin/perl-external/lib/perl5"; + +# Add the perl-external dirs properly using local::lib +use local::lib "$FindBin::Bin/perl-external"; +use local::lib "$FindBin::Bin/perl-external/local-lib"; + +# add the local perllibs too +use lib "$FindBin::Bin/commonlib/perllib"; +use lib "$FindBin::Bin/perllib"; + +# also set the path to our scripts etc +$ENV{PATH} = join ':', uniq "$FindBin::Bin/bin", split( m/:/, $ENV{PATH} ); + +# now decide what to do - if no arguments print out shell arguments to set the +# environment. If there are arguments then run those so that they run correctly +if (@ARGV) { + system @ARGV; +} +else { + + my @keys = sort 'PATH', grep { m{^PERL} } keys %ENV; + + print << "STOP"; +# $0 - set up the environment for FixMyStreet. +# +# This script can be used one of two ways: +# +# With arguments executes the arguments with the environment correctly set - +# intended for things like the cron jobs: +# +# $0 env +# +# Or if no arguments prints out the bash shell commands needed to set up the +# environment - which is useful when developing. Use this to set your current +# shell: +# +# eval `$0` + +STOP + + print "export $_='$ENV{$_}'\n" for @keys; + print 'export PS1="(fms) $PS1"' . "\n"; +} diff --git a/setup-dev-environment.bash b/setup-dev-environment.bash deleted file mode 100644 index c5053e2e4..000000000 --- a/setup-dev-environment.bash +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# Set the Perl environment variables as needed -eval $(perl -Iperllib -Mlocal::lib=local-lib5) - -# add the non-standard perllib path to PERL5LIB -PERL5LIB=perllib:commonlib/perllib:$PERL5LIB - -# put a note in the promp so that we know environment is setup -PS1="(fms) $PS1" - |