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 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(

View file

@ -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) };

View file

@ -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

View file

@ -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);
}