From 8e6d48d5ee351594fc92f1e680ba4a2219ed57ca Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 15 Jan 2015 15:33:21 +0000 Subject: Remove need for cron-wrapper with existing scripts Call the necessary boilerplate in each script so you can call them directly. Remove boilerplate from files that don't need it. --- .travis.yml | 4 ++-- Vagrantfile | 2 +- bin/cron-wrapper | 6 ++++-- bin/fetch-comments | 7 +++++++ bin/fetch-comments-24hs | 10 +++++++++- bin/geocode | 9 +++++++-- bin/install-as-user | 8 ++++---- bin/make_css_watch | 9 +++++++++ bin/open311-populate-service-list | 8 ++++++++ bin/open311-update-reports | 8 ++++++++ bin/problem-creation-graph | 11 ++++++++--- bin/problems-filed-graph | 11 ++++++++--- bin/run-tests | 6 ++++-- bin/send-alerts | 7 +++++++ bin/send-comments | 7 +++++++ bin/send-questionnaires | 7 +++++++ bin/send-reports | 7 +++++++ bin/update-all-reports | 7 +++++++ bin/update-schema | 16 ++++++++++------ bin/zurich/overdue-alert | 7 +++++++ conf/crontab-example | 24 ++++++++++++------------ conf/sysvinit.example | 2 +- perllib/CronFns.pm | 7 ------- perllib/FixMyStreet/App/Controller/Reports.pm | 2 +- perllib/FixMyStreet/SendReport/London.pm | 1 + script/fixmystreet_app_create.pl | 7 +++++++ script/fixmystreet_app_server.pl | 4 ++++ script/fixmystreet_app_test.pl | 7 +++++++ setenv.pl | 13 ++++++------- t/app/controller/reports.t | 2 +- t/open311.t | 4 ---- t/open311/getservicerequestupdates.t | 4 ---- t/open311/populate-service-list.t | 4 ---- t/utils.t | 4 ---- 34 files changed, 171 insertions(+), 71 deletions(-) diff --git a/.travis.yml b/.travis.yml index 207f4a3c7..2c80b3534 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,8 +25,8 @@ before_install: install: - .travis/install before_script: - - ./bin/cron-wrapper ./bin/make_po FixMyStreet-EmptyHomes - - ./bin/cron-wrapper ./bin/emptyhomes/make_welsh_po + - ./bin/make_po FixMyStreet-EmptyHomes + - ./bin/emptyhomes/make_welsh_po - commonlib/bin/gettext-makemo FixMyStreet script: "bin/run-tests t" after_script: diff --git a/Vagrantfile b/Vagrantfile index 7cebebbf9..cc6832f9a 100755 --- a/Vagrantfile +++ b/Vagrantfile @@ -38,7 +38,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| echo "****************" echo "You can now ssh into your vagrant box: vagrant ssh" echo "The website code is found in: ~/fixmystreet" - echo "You can run the dev server with: bin/cron-wrapper script/fixmystreet_app_server.pl [-d] [-r] [--fork]" + echo "You can run the dev server with: script/fixmystreet_app_server.pl [-d] [-r] [--fork]" EOS # Create a private network, which allows host-only access to the machine diff --git a/bin/cron-wrapper b/bin/cron-wrapper index 127fd8d8a..c75f0289b 100755 --- a/bin/cron-wrapper +++ b/bin/cron-wrapper @@ -1,8 +1,10 @@ #!/usr/bin/env perl BEGIN { # set all the paths to the perl code - use FindBin; - require "$FindBin::Bin/../setenv.pl"; + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; } exec { $ARGV[0] } @ARGV or die $!; diff --git a/bin/fetch-comments b/bin/fetch-comments index a276433e4..4eb9def14 100755 --- a/bin/fetch-comments +++ b/bin/fetch-comments @@ -8,6 +8,13 @@ use strict; use warnings; require 5.8.0; +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; +} + use FixMyStreet::App; use CronFns; my ($verbose, $nomail) = CronFns::options(); diff --git a/bin/fetch-comments-24hs b/bin/fetch-comments-24hs index 602383d40..27853bcc1 100755 --- a/bin/fetch-comments-24hs +++ b/bin/fetch-comments-24hs @@ -7,9 +7,17 @@ use strict; use warnings; +require 5.8.0; + +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; +} + use DateTime; use DateTime::Format::W3CDTF; -require 5.8.0; use FixMyStreet::App; use CronFns; diff --git a/bin/geocode b/bin/geocode index 2b85ff572..2559f7a3c 100755 --- a/bin/geocode +++ b/bin/geocode @@ -6,8 +6,6 @@ geocode - commandline tool to test geocoders =head1 SYNOPSIS - $ eval `perl setenv.pl`, or call with bin/cron-wrapper - $ bin/geocode --geocoder=Bing --cobrand=bromley "Glebe Rd" # ... if your conf/general.yml supplies GEOCODER: @@ -24,6 +22,13 @@ use strict; use warnings; require 5.8.0; +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; +} + use Data::Dumper; use Pod::Usage; use feature 'say'; diff --git a/bin/install-as-user b/bin/install-as-user index 33a74c140..0e1c151fb 100755 --- a/bin/install-as-user +++ b/bin/install-as-user @@ -127,15 +127,15 @@ then psql -U "$UNIX_USER" "$DB_NAME" < "$REPOSITORY"/db/alert_types.sql psql -U "$UNIX_USER" "$DB_NAME" < "$REPOSITORY"/db/generate_secret.sql else - bin/cron-wrapper update-schema --commit + bin/update-schema --commit fi echo $DONE_MSG # Generate po and mo files (these invocations taken from Kagee's script): echo "Creating locale .mo files" -bin/cron-wrapper bin/make_po FixMyStreet-EmptyHomes -bin/cron-wrapper bin/emptyhomes/make_welsh_po +bin/make_po FixMyStreet-EmptyHomes +bin/emptyhomes/make_welsh_po commonlib/bin/gettext-makemo FixMyStreet echo $DONE_MSG -bin/cron-wrapper update-all-reports +bin/update-all-reports diff --git a/bin/make_css_watch b/bin/make_css_watch index 63a27a35e..2ae287429 100755 --- a/bin/make_css_watch +++ b/bin/make_css_watch @@ -1,7 +1,16 @@ #!/usr/bin/env perl + use strict; use warnings; use feature 'say'; + +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; +} + use Cwd qw(abs_path); use File::ChangeNotify; use File::Find::Rule; diff --git a/bin/open311-populate-service-list b/bin/open311-populate-service-list index be1ace3b9..11f9005a5 100755 --- a/bin/open311-populate-service-list +++ b/bin/open311-populate-service-list @@ -2,6 +2,14 @@ use strict; use warnings; + +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; +} + use FixMyStreet::App; use Open311::PopulateServiceList; use Getopt::Long::Descriptive; diff --git a/bin/open311-update-reports b/bin/open311-update-reports index a964ba8c9..6a1c894d7 100755 --- a/bin/open311-update-reports +++ b/bin/open311-update-reports @@ -8,6 +8,14 @@ use strict; use warnings; + +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; +} + use Open311::GetUpdates; use FixMyStreet::App; diff --git a/bin/problem-creation-graph b/bin/problem-creation-graph index e1b6f2cc4..c3d10f934 100755 --- a/bin/problem-creation-graph +++ b/bin/problem-creation-graph @@ -10,13 +10,18 @@ use strict; use warnings; require 5.8.0; -use FindBin; +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + chdir "$d/.."; + require "$d/../setenv.pl"; +} + use File::Temp qw(tempfile); use FixMyStreet::App; -chdir("$FindBin::Bin/../"); - my %config = ( gplot_output => "set terminal png font 'Vera.ttf' 9 size 1200,400", extension => '.png', diff --git a/bin/problems-filed-graph b/bin/problems-filed-graph index d3e132f8e..abfe0cf1a 100755 --- a/bin/problems-filed-graph +++ b/bin/problems-filed-graph @@ -10,13 +10,18 @@ use strict; use warnings; require 5.8.0; -use FindBin; +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + chdir "$d/.."; + require "$d/../setenv.pl"; +} + use File::Temp qw(tempfile); use FixMyStreet::App; -chdir("$FindBin::Bin/../"); - my %config = ( gplot_output => "set terminal png font 'Vera.ttf' 9 size 1200,600", extension => '.png', diff --git a/bin/run-tests b/bin/run-tests index 42315e2f2..612a13628 100755 --- a/bin/run-tests +++ b/bin/run-tests @@ -2,8 +2,10 @@ use strict; use warnings; BEGIN { - use FindBin; - require "$FindBin::Bin/../setenv.pl"; + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; } use FixMyStreet::TestAppProve; diff --git a/bin/send-alerts b/bin/send-alerts index 00c5426bc..94f7d5509 100755 --- a/bin/send-alerts +++ b/bin/send-alerts @@ -10,6 +10,13 @@ use strict; use warnings; require 5.8.0; +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; +} + use CGI; # XXX use CronFns; diff --git a/bin/send-comments b/bin/send-comments index 2192f674c..2d6b525b5 100755 --- a/bin/send-comments +++ b/bin/send-comments @@ -13,6 +13,13 @@ use strict; use warnings; require 5.8.0; +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; +} + use Digest::MD5; use Encode; use CronFns; diff --git a/bin/send-questionnaires b/bin/send-questionnaires index 7ed3c87c2..93d58ed77 100755 --- a/bin/send-questionnaires +++ b/bin/send-questionnaires @@ -10,6 +10,13 @@ use strict; use warnings; require 5.8.0; +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; +} + use CGI; # XXX Awkward kludge use Encode; use CronFns; diff --git a/bin/send-reports b/bin/send-reports index 16296dc5b..3c6f26cdb 100755 --- a/bin/send-reports +++ b/bin/send-reports @@ -10,6 +10,13 @@ use strict; use warnings; require 5.8.0; +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; +} + use CGI; # XXX use CronFns; diff --git a/bin/update-all-reports b/bin/update-all-reports index f4d6113cb..f6cd34210 100755 --- a/bin/update-all-reports +++ b/bin/update-all-reports @@ -10,6 +10,13 @@ use strict; use warnings; require 5.8.0; +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; +} + use FixMyStreet::App; use File::Path (); use File::Slurp; diff --git a/bin/update-schema b/bin/update-schema index af0da3601..ce193f29c 100755 --- a/bin/update-schema +++ b/bin/update-schema @@ -31,9 +31,13 @@ backup of your database before running. use strict; use warnings; -# Horrible boilerplate to set up appropriate library paths. -use FindBin; -use lib "$FindBin::Bin/../commonlib/perllib"; +my $bin_dir; +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + $bin_dir = dirname(File::Spec->rel2abs($0)); + require "$bin_dir/../setenv.pl"; +} use mySociety::Config; use mySociety::DBHandle qw(dbh); @@ -41,7 +45,7 @@ use mySociety::MaPit; use Getopt::Long; use Pod::Usage; -mySociety::Config::set_file("$FindBin::Bin/../conf/general"); +mySociety::Config::set_file("$bin_dir/../conf/general"); my %args = ( Name => mySociety::Config::get('FMS_DB_NAME'), User => mySociety::Config::get('FMS_DB_USER'), @@ -115,7 +119,7 @@ if ($upgrade) { if ($version) { die "Not currently implemented"; } - for my $path (glob("$FindBin::Bin/../db/schema_*")) { + for my $path (glob("$bin_dir/../db/schema_*")) { my ($name) = $path =~ /schema_(.*)\.sql$/; next if $name le $current_version; next if $name =~ /$current_version-/; # For number only match @@ -146,7 +150,7 @@ if ($upgrade) { if ($downgrade) { my %downgrades; - for my $path (glob("$FindBin::Bin/../db/downgrade_*")) { + for my $path (glob("$bin_dir/../db/downgrade_*")) { my ($from, $to) = $path =~ /downgrade_(.*)---(.*)\.sql$/; next unless $from eq $current_version; $downgrades{$to} = $path; diff --git a/bin/zurich/overdue-alert b/bin/zurich/overdue-alert index fd9c26cb9..4a8fea830 100755 --- a/bin/zurich/overdue-alert +++ b/bin/zurich/overdue-alert @@ -10,6 +10,13 @@ use strict; use warnings; require 5.8.0; +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; +} + use DateTime; use CronFns; use FixMyStreet::App; diff --git a/conf/crontab-example b/conf/crontab-example index a29a0de53..68197d7b1 100644 --- a/conf/crontab-example +++ b/conf/crontab-example @@ -11,24 +11,24 @@ PATH=/usr/local/bin:/usr/bin:/bin # send-reports has three rows so that its 8am entry can be run with --verbose to send a morning summary of anything that's gone wrong -5,10,15,20,25,30,35,40,45,50,55 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$FMS/send-reports.lock" "$FMS/bin/cron-wrapper send-reports" || echo "stalled?" -0 0-7,9-23 * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-reports.lock" "$FMS/bin/cron-wrapper send-reports" || echo "stalled?" -0 8 * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-reports.lock" "$FMS/bin/cron-wrapper send-reports --verbose" || echo "stalled?" +5,10,15,20,25,30,35,40,45,50,55 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$FMS/send-reports.lock" "$FMS/bin/send-reports" || echo "stalled?" +0 0-7,9-23 * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-reports.lock" "$FMS/bin/send-reports" || echo "stalled?" +0 8 * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-reports.lock" "$FMS/bin/send-reports --verbose" || echo "stalled?" -2 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-alerts.lock" "$FMS/bin/cron-wrapper send-alerts" || echo "stalled?" -22,52 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-questionnaires.lock" "$FMS/bin/cron-wrapper send-questionnaires" || echo "stalled?" +2 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-alerts.lock" "$FMS/bin/send-alerts" || echo "stalled?" +22,52 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-questionnaires.lock" "$FMS/bin/send-questionnaires" || echo "stalled?" # If you utilise Open311 and the updates extension, you will need to run these scripts -#*/5 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-comments.lock" "$FMS/bin/cron-wrapper send-comments" || echo "stalled?" -#*/5 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/fetch-comments.lock" "$FMS/bin/cron-wrapper fetch-comments" || echo "stalled?" +#*/5 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-comments.lock" "$FMS/bin/send-comments" || echo "stalled?" +#*/5 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/fetch-comments.lock" "$FMS/bin/fetch-comments" || echo "stalled?" -47 0-7,9-23 * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/open311-populate-service-list.lock" "$FMS/bin/cron-wrapper open311-populate-service-list" || echo "stalled?" -47 8 * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/open311-populate-service-list.lock" "$FMS/bin/cron-wrapper open311-populate-service-list --warn" || echo "stalled?" +47 0-7,9-23 * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/open311-populate-service-list.lock" "$FMS/bin/open311-populate-service-list" || echo "stalled?" +47 8 * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/open311-populate-service-list.lock" "$FMS/bin/open311-populate-service-list --warn" || echo "stalled?" # Once an hour, update the all reports stats -13 * * * * "$FMS/bin/cron-wrapper" update-all-reports +13 * * * * "$FMS/bin/update-all-reports" # Once a day on all servers -39 2 * * * "$FMS/bin/cron-wrapper" problems-filed-graph -43 2 * * * "$FMS/bin/cron-wrapper" problem-creation-graph +39 2 * * * "$FMS/bin/problems-filed-graph" +43 2 * * * "$FMS/bin/problem-creation-graph" 00 8 * * * "$FMS/bin/check-for-zombies" $UNIX_USER diff --git a/conf/sysvinit.example b/conf/sysvinit.example index 44424281b..9ad97e6ab 100755 --- a/conf/sysvinit.example +++ b/conf/sysvinit.example @@ -24,7 +24,7 @@ test -f $DAEMON || exit 0 set -e start_daemon() { - su -l -c "cd $SITE_HOME/fixmystreet && bin/cron-wrapper web/fixmystreet_app_fastcgi.cgi -d -l :9000 -n 2" $USER + su -l -c "cd $SITE_HOME/fixmystreet && web/fixmystreet_app_fastcgi.cgi -d -l :9000 -n 2" $USER } stop_daemon() { diff --git a/perllib/CronFns.pm b/perllib/CronFns.pm index 28268c08e..545526c8e 100755 --- a/perllib/CronFns.pm +++ b/perllib/CronFns.pm @@ -3,19 +3,12 @@ # # Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org -# -# $Id: CronFns.pm,v 1.1 2009-07-10 15:17:29 matthew Exp $ package CronFns; use strict; require 5.8.0; -# Horrible boilerplate to set up appropriate library paths. -use FindBin; -use lib "$FindBin::Bin/../perllib"; -use lib "$FindBin::Bin/../commonlib/perllib"; - use mySociety::Locale; sub options { diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 10ef30c90..352c47da8 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -74,7 +74,7 @@ sub index : Path : Args(0) { if ($@) { $c->stash->{message} = _("There was a problem showing the All Reports page. Please try again later."); if ($c->config->{STAGING_SITE}) { - $c->stash->{message} .= '

Perhaps the bin/update-all-reports script needs running. Use: bin/cron-wrapper bin/update-all-reports

' + $c->stash->{message} .= '

Perhaps the bin/update-all-reports script needs running. Use: bin/update-all-reports

' . sprintf(_('The error was: %s'), $@); } $c->stash->{template} = 'errors/generic.html'; diff --git a/perllib/FixMyStreet/SendReport/London.pm b/perllib/FixMyStreet/SendReport/London.pm index 2c48a091c..2a1ebc1c3 100644 --- a/perllib/FixMyStreet/SendReport/London.pm +++ b/perllib/FixMyStreet/SendReport/London.pm @@ -5,6 +5,7 @@ use Moose; BEGIN { extends 'FixMyStreet::SendReport'; } use Digest::MD5; +use FindBin; use LWP::UserAgent; use LWP::Simple; diff --git a/script/fixmystreet_app_create.pl b/script/fixmystreet_app_create.pl index c0ec0c898..f43c4ab82 100755 --- a/script/fixmystreet_app_create.pl +++ b/script/fixmystreet_app_create.pl @@ -3,6 +3,13 @@ use strict; use warnings; +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; +} + use Catalyst::ScriptRunner; Catalyst::ScriptRunner->run('FixMyStreet::App', 'Create'); diff --git a/script/fixmystreet_app_server.pl b/script/fixmystreet_app_server.pl index 3778cf27d..aeb57f0d2 100755 --- a/script/fixmystreet_app_server.pl +++ b/script/fixmystreet_app_server.pl @@ -2,6 +2,10 @@ BEGIN { $ENV{CATALYST_SCRIPT_GEN} = 40; + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; } use Catalyst::ScriptRunner; diff --git a/script/fixmystreet_app_test.pl b/script/fixmystreet_app_test.pl index 4eefd06a4..6f2770730 100755 --- a/script/fixmystreet_app_test.pl +++ b/script/fixmystreet_app_test.pl @@ -1,5 +1,12 @@ #!/usr/bin/env perl +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; +} + use Catalyst::ScriptRunner; Catalyst::ScriptRunner->run('FixMyStreet::App', 'Test'); diff --git a/setenv.pl b/setenv.pl index b0cf94a78..39dcc04b0 100755 --- a/setenv.pl +++ b/setenv.pl @@ -5,19 +5,18 @@ use warnings; my $root; -BEGIN { # add the local perllibs too - - # Can't use Path::Class here as we'd load the old debian one. - $root = __FILE__ =~ m{^(.*)/(web|bin)/\.\..*$} ? $1 : `pwd`; - chomp($root); +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + $root = dirname(File::Spec->rel2abs(__FILE__)); } # Set the environment for the FixMyStreet project -# Add the lib/perl5 in perl-external so that we can load local::lib from there +# Add the lib/perl5 in local so that we can load local::lib from there use lib "$root/local/lib/perl5"; -# Add the perl-external dirs properly using local::lib +# Now add the local dir properly using local::lib use local::lib "$root/local"; use lib "$root/commonlib/perllib"; diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t index 1b4fc3526..ecb43f447 100644 --- a/t/app/controller/reports.t +++ b/t/app/controller/reports.t @@ -85,7 +85,7 @@ $fife_problems[10]->update( { }); # Run the cron script that makes the data for /reports so we don't get an error. -system( "bin/cron-wrapper update-all-reports" ); +system( "bin/update-all-reports" ); # check that we can get the page $mech->get_ok('/reports'); diff --git a/t/open311.t b/t/open311.t index 0caacbffc..15bebe2fc 100644 --- a/t/open311.t +++ b/t/open311.t @@ -11,10 +11,6 @@ use HTTP::Response; use DateTime; use DateTime::Format::W3CDTF; -use FindBin; -use lib "$FindBin::Bin/../perllib"; -use lib "$FindBin::Bin/../commonlib/perllib"; - use_ok( 'Open311' ); my $o = Open311->new(); diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t index 00c25a83e..dac10d69b 100644 --- a/t/open311/getservicerequestupdates.t +++ b/t/open311/getservicerequestupdates.t @@ -5,10 +5,6 @@ use warnings; use Test::More; use CGI::Simple; -use FindBin; -use lib "$FindBin::Bin/../perllib"; -use lib "$FindBin::Bin/../commonlib/perllib"; - use_ok( 'Open311' ); use_ok( 'Open311::GetServiceRequestUpdates' ); diff --git a/t/open311/populate-service-list.t b/t/open311/populate-service-list.t index d9d65945b..b343b206d 100644 --- a/t/open311/populate-service-list.t +++ b/t/open311/populate-service-list.t @@ -6,10 +6,6 @@ use Test::More; use FixMyStreet::App; -use FindBin; -use lib "$FindBin::Bin/../perllib"; -use lib "$FindBin::Bin/../commonlib/perllib"; - use_ok( 'Open311::PopulateServiceList' ); use_ok( 'Open311' ); diff --git a/t/utils.t b/t/utils.t index 8ff9266fd..29759cddc 100644 --- a/t/utils.t +++ b/t/utils.t @@ -4,10 +4,6 @@ use strict; use warnings; use Test::More; -use FindBin; -use lib "$FindBin::Bin/../perllib"; -use lib "$FindBin::Bin/../commonlib/perllib"; - use Utils; my @truncate_tests = ( -- cgit v1.2.3