Fix some warnings

This commit is contained in:
Eelco Dolstra 2013-01-23 12:41:57 +00:00
parent 418e57ec3f
commit e0de5de91d
4 changed files with 30 additions and 31 deletions

View file

@ -2,11 +2,9 @@ package Hydra;
use strict; use strict;
use warnings; use warnings;
use parent 'Catalyst';
use Hydra::Model::DB; use Hydra::Model::DB;
use Catalyst::Runtime '5.70'; use Catalyst::Runtime '5.70';
use parent qw/Catalyst/;
use Catalyst qw/ConfigLoader use Catalyst qw/ConfigLoader
Static::Simple Static::Simple
StackTrace StackTrace
@ -15,9 +13,9 @@ use Catalyst qw/ConfigLoader
Session Session
Session::Store::FastMmap Session::Store::FastMmap
Session::State::Cookie Session::State::Cookie
AccessLog AccessLog/,
-Log=warn,fatal,error '-Log=warn,fatal,error';
/;
our $VERSION = '0.01'; our $VERSION = '0.01';
__PACKAGE__->config( __PACKAGE__->config(

View file

@ -118,18 +118,18 @@ sub robots_txt : Path('robots.txt') {
my ($self, $c) = @_; my ($self, $c) = @_;
sub uri_for { sub uri_for {
my ($controller, $action, @args) = @_; my ($c, $controller, $action, @args) = @_;
return $c->uri_for($c->controller($controller)->action_for($action), @args)->path; return $c->uri_for($c->controller($controller)->action_for($action), @args)->path;
} }
sub channelUris { sub channelUris {
my ($controller, $bindings) = @_; my ($c, $controller, $bindings) = @_;
return return
( uri_for($controller, 'closure', $bindings, "*") ( uri_for($c, $controller, 'closure', $bindings, "*")
, uri_for($controller, 'manifest', $bindings) , uri_for($c, $controller, 'manifest', $bindings)
, uri_for($controller, 'pkg', $bindings, "*") , uri_for($c, $controller, 'pkg', $bindings, "*")
, uri_for($controller, 'nixexprs', $bindings) , uri_for($c, $controller, 'nixexprs', $bindings)
, uri_for($controller, 'channel_contents', $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. Note: wildcards are not universally supported in
# robots.txt, but apparently Google supports them. # robots.txt, but apparently Google supports them.
my @rules = my @rules =
( uri_for('Build', 'deps', ["*"]) ( uri_for($c, 'Build', 'deps', ["*"])
, uri_for('Build', 'view_nixlog', ["*"], "*") , uri_for($c, 'Build', 'view_nixlog', ["*"], "*")
, uri_for('Build', 'view_log', ["*"], "*") , uri_for($c, 'Build', 'view_log', ["*"], "*")
, uri_for('Build', 'view_log', ["*"]) , uri_for($c, 'Build', 'view_log', ["*"])
, uri_for('Build', 'download', ["*"], "*") , uri_for($c, 'Build', 'download', ["*"], "*")
, uri_for('Root', 'nar', [], "*") , uri_for($c, 'Root', 'nar', [], "*")
, uri_for('Root', 'status', []) , uri_for($c, 'Root', 'status', [])
, uri_for('Root', 'all', []) , uri_for($c, 'Root', 'all', [])
, uri_for('API', 'scmdiff', []) , uri_for($c, 'API', 'scmdiff', [])
, uri_for('API', 'logdiff', [],"*", "*") , uri_for($c, 'API', 'logdiff', [],"*", "*")
, uri_for('Project', 'all', ["*"]) , uri_for($c, 'Project', 'all', ["*"])
, channelUris('Root', ["*"]) , channelUris($c, 'Root', ["*"])
, channelUris('Project', ["*", "*"]) , channelUris($c, 'Project', ["*", "*"])
, channelUris('Jobset', ["*", "*", "*"]) , channelUris($c, 'Jobset', ["*", "*", "*"])
, channelUris('Job', ["*", "*", "*", "*"]) , channelUris($c, 'Job', ["*", "*", "*", "*"])
, channelUris('Build', ["*"]) , channelUris($c, 'Build', ["*"])
); );
$c->stash->{'plain'} = { data => "User-agent: *\n" . join('', map { "Disallow: $_\n" } @rules) }; $c->stash->{'plain'} = { data => "User-agent: *\n" . join('', map { "Disallow: $_\n" } @rules) };

View file

@ -8,7 +8,7 @@ use Hydra::Helper::Nix;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw( our @EXPORT = qw(
getBuild getPreviousBuild getNextBuild getPreviousSuccessfulBuild getBuildStats getChannelData getBuild getPreviousBuild getNextBuild getPreviousSuccessfulBuild getBuildStats
error notFound error notFound
requireLogin requireProjectOwner requireAdmin requirePost isAdmin isProjectOwner requireLogin requireProjectOwner requireAdmin requirePost isAdmin isProjectOwner
trim trim

View file

@ -6,7 +6,8 @@ use base 'Catalyst::View::Download::Plain';
sub process { sub process {
my ($self, $c) = @_; 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); $self->SUPER::process($c);
} }