From e0de5de91d0b5db884f0357877cd38e71492521a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 23 Jan 2013 12:41:57 +0000 Subject: [PATCH] Fix some warnings --- src/lib/Hydra.pm | 10 +++--- src/lib/Hydra/Controller/Root.pm | 46 +++++++++++++-------------- src/lib/Hydra/Helper/CatalystUtils.pm | 2 +- src/lib/Hydra/View/Plain.pm | 3 +- 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/lib/Hydra.pm b/src/lib/Hydra.pm index 3a350c52..f800adb8 100644 --- a/src/lib/Hydra.pm +++ b/src/lib/Hydra.pm @@ -2,11 +2,9 @@ package Hydra; use strict; use warnings; +use parent 'Catalyst'; use Hydra::Model::DB; - use Catalyst::Runtime '5.70'; - -use parent qw/Catalyst/; use Catalyst qw/ConfigLoader Static::Simple StackTrace @@ -15,9 +13,9 @@ use Catalyst qw/ConfigLoader Session Session::Store::FastMmap Session::State::Cookie - AccessLog - -Log=warn,fatal,error - /; + AccessLog/, + '-Log=warn,fatal,error'; + our $VERSION = '0.01'; __PACKAGE__->config( diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index a36c88bc..fd5a8d0d 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -118,18 +118,18 @@ sub robots_txt : Path('robots.txt') { my ($self, $c) = @_; sub uri_for { - my ($controller, $action, @args) = @_; + my ($c, $controller, $action, @args) = @_; return $c->uri_for($c->controller($controller)->action_for($action), @args)->path; } sub channelUris { - my ($controller, $bindings) = @_; + my ($c, $controller, $bindings) = @_; return - ( uri_for($controller, 'closure', $bindings, "*") - , uri_for($controller, 'manifest', $bindings) - , uri_for($controller, 'pkg', $bindings, "*") - , uri_for($controller, 'nixexprs', $bindings) - , uri_for($controller, 'channel_contents', $bindings) + ( uri_for($c, $controller, 'closure', $bindings, "*") + , uri_for($c, $controller, 'manifest', $bindings) + , uri_for($c, $controller, 'pkg', $bindings, "*") + , uri_for($c, $controller, 'nixexprs', $bindings) + , uri_for($c, $controller, 'channel_contents', $bindings) ); } @@ -137,22 +137,22 @@ sub robots_txt : Path('robots.txt') { # robots.txt. Note: wildcards are not universally supported in # robots.txt, but apparently Google supports them. my @rules = - ( uri_for('Build', 'deps', ["*"]) - , uri_for('Build', 'view_nixlog', ["*"], "*") - , uri_for('Build', 'view_log', ["*"], "*") - , uri_for('Build', 'view_log', ["*"]) - , uri_for('Build', 'download', ["*"], "*") - , uri_for('Root', 'nar', [], "*") - , uri_for('Root', 'status', []) - , uri_for('Root', 'all', []) - , uri_for('API', 'scmdiff', []) - , uri_for('API', 'logdiff', [],"*", "*") - , uri_for('Project', 'all', ["*"]) - , channelUris('Root', ["*"]) - , channelUris('Project', ["*", "*"]) - , channelUris('Jobset', ["*", "*", "*"]) - , channelUris('Job', ["*", "*", "*", "*"]) - , channelUris('Build', ["*"]) + ( uri_for($c, 'Build', 'deps', ["*"]) + , uri_for($c, 'Build', 'view_nixlog', ["*"], "*") + , uri_for($c, 'Build', 'view_log', ["*"], "*") + , uri_for($c, 'Build', 'view_log', ["*"]) + , uri_for($c, 'Build', 'download', ["*"], "*") + , uri_for($c, 'Root', 'nar', [], "*") + , uri_for($c, 'Root', 'status', []) + , uri_for($c, 'Root', 'all', []) + , uri_for($c, 'API', 'scmdiff', []) + , uri_for($c, 'API', 'logdiff', [],"*", "*") + , uri_for($c, 'Project', 'all', ["*"]) + , channelUris($c, 'Root', ["*"]) + , channelUris($c, 'Project', ["*", "*"]) + , channelUris($c, 'Jobset', ["*", "*", "*"]) + , channelUris($c, 'Job', ["*", "*", "*", "*"]) + , channelUris($c, 'Build', ["*"]) ); $c->stash->{'plain'} = { data => "User-agent: *\n" . join('', map { "Disallow: $_\n" } @rules) }; diff --git a/src/lib/Hydra/Helper/CatalystUtils.pm b/src/lib/Hydra/Helper/CatalystUtils.pm index 476150a1..7ec2ef06 100644 --- a/src/lib/Hydra/Helper/CatalystUtils.pm +++ b/src/lib/Hydra/Helper/CatalystUtils.pm @@ -8,7 +8,7 @@ use Hydra::Helper::Nix; our @ISA = qw(Exporter); our @EXPORT = qw( - getBuild getPreviousBuild getNextBuild getPreviousSuccessfulBuild getBuildStats getChannelData + getBuild getPreviousBuild getNextBuild getPreviousSuccessfulBuild getBuildStats error notFound requireLogin requireProjectOwner requireAdmin requirePost isAdmin isProjectOwner trim diff --git a/src/lib/Hydra/View/Plain.pm b/src/lib/Hydra/View/Plain.pm index 2c023667..764770a0 100644 --- a/src/lib/Hydra/View/Plain.pm +++ b/src/lib/Hydra/View/Plain.pm @@ -6,7 +6,8 @@ use base 'Catalyst::View::Download::Plain'; sub process { my ($self, $c) = @_; - $c->res->content_encoding("utf-8"); + $c->response->content_encoding("utf-8"); + $c->response->content_type('text/plain') unless $c->response->content_type() ne ""; $self->SUPER::process($c); }