From 85aa8a112e97e2c25d7af090fd9fab83e86a842b Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 4 Oct 2012 13:50:46 +0100 Subject: Travis script. --- .travis.yml | 33 ++++++++++++++++++++++++ perllib/FixMyStreet/App/Controller/Admin.pm | 2 +- perllib/FixMyStreet/App/Controller/Photo.pm | 3 +-- perllib/FixMyStreet/App/Controller/Report/New.pm | 1 - perllib/FixMyStreet/App/View/Web.pm | 1 + perllib/FixMyStreet/Geocode/OSM.pm | 2 +- 6 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..dc371120d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,33 @@ +notifications: + email: false + +language: perl +perl: + - "5.14" + +before_install: + - sudo apt-get update -qq + - sudo apt-get install -qq jhead +# A couple of other modules that normally come from packages, but no system stuff here + - cpanm -q Carton Locale::gettext Math::BigInt::GMP SOAP::Lite + - sudo locale-gen cy_GB.UTF-8 en_GB.UTF-8 nb_NO.UTF-8 +install: + - carton install --deployment +before_script: + - psql -c 'create database fms;' -U postgres + - psql fms postgres < db/schema.sql + - psql fms postgres < db/alert_types.sql + - psql fms postgres < db/generate_secret.sql + - > + sed -r -e "s,(FMS_DB_USER:) 'fms',\\1 'postgres'," + -e "s,cobrand_one,fixmystreet," + -e "s,cobrand_two: 'hostname_substring2',fixmystreet: 'localhost'," + -e "s,(BASE_URL:) 'http://www.example.org',\\1 'http://localhost'," + -e "s,(MAPIT_URL:) '',\\1 'http://mapit.mysociety.org/'," + -e "s,(CONTACT_EMAIL:) 'team,\\1 'person," + conf/general.yml-example > conf/general.yml + - ./bin/cron-wrapper ./bin/make_po FixMyStreet-EmptyHomes + - ./bin/cron-wrapper ./bin/make_emptyhomes_welsh_po + - commonlib/bin/gettext-makemo FixMyStreet +script: "bin/cron-wrapper perl /usr/bin/prove -rl t" + diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index f72478cff..b53b6ab06 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -7,6 +7,7 @@ BEGIN { extends 'Catalyst::Controller'; } use POSIX qw(strftime strcoll); use Digest::MD5 qw(md5_hex); use mySociety::EmailUtil qw(is_valid_email); +use if !$ENV{TRAVIS}, 'Image::Magick'; use FixMyStreet::SendReport; @@ -1289,7 +1290,6 @@ sub trim { sub _rotate_image { my ($photo, $direction) = @_; - use Image::Magick; my $image = Image::Magick->new; $image->BlobToImage($photo); my $err = $image->Rotate($direction); diff --git a/perllib/FixMyStreet/App/Controller/Photo.pm b/perllib/FixMyStreet/App/Controller/Photo.pm index fc4c3fde7..fa4baf045 100644 --- a/perllib/FixMyStreet/App/Controller/Photo.pm +++ b/perllib/FixMyStreet/App/Controller/Photo.pm @@ -9,6 +9,7 @@ use Digest::SHA1 qw(sha1_hex); use File::Path; use File::Slurp; use Path::Class; +use if !$ENV{TRAVIS}, 'Image::Magick'; =head1 NAME @@ -116,7 +117,6 @@ sub no_photo : Private { # Shrinks a picture to the specified size, but keeping in proportion. sub _shrink { my ($photo, $size) = @_; - use Image::Magick; my $image = Image::Magick->new; $image->BlobToImage($photo); my $err = $image->Scale(geometry => "$size>"); @@ -130,7 +130,6 @@ sub _shrink { # Shrinks a picture to 90x60, cropping so that it is exactly that. sub _crop { my ($photo) = @_; - use Image::Magick; my $image = Image::Magick->new; $image->BlobToImage($photo); my $err = $image->Resize( geometry => "90x60^" ); diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index a4462e035..43ce0e876 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -6,7 +6,6 @@ BEGIN { extends 'Catalyst::Controller'; } use FixMyStreet::Geocode; use Encode; -use Image::Magick; use List::MoreUtils qw(uniq); use POSIX 'strcoll'; use HTML::Entities; diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm index eac194dff..42878be37 100644 --- a/perllib/FixMyStreet/App/View/Web.pm +++ b/perllib/FixMyStreet/App/View/Web.pm @@ -171,6 +171,7 @@ sub version { my $path = FixMyStreet->path_to('web', $file); $version_hash{$file} = ( stat( $path ) )[9]; } + $version_hash{$file} ||= ''; return "$file?$version_hash{$file}"; } diff --git a/perllib/FixMyStreet/Geocode/OSM.pm b/perllib/FixMyStreet/Geocode/OSM.pm index 78db7fe44..d96338c16 100644 --- a/perllib/FixMyStreet/Geocode/OSM.pm +++ b/perllib/FixMyStreet/Geocode/OSM.pm @@ -58,7 +58,7 @@ sub string { } if (!$js) { - return { error => _('Sorry, we could not parse that location. Please try again.') }; + return { error => _('Sorry, we could not find that location.') }; } $js = JSON->new->utf8->allow_nonref->decode($js); -- cgit v1.2.3