ListBuilds: Simplify nix channel dispatcher.

We only allow channel/latest anyway, so it really doesn't make sense to
explicitly specify this in the PathPart and provide other dispatcher
once we have more than just "latest", which greatly simplifies the
dispatch tree.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2015-04-25 03:53:57 +02:00
parent ed361a0145
commit 1fdc258de0
No known key found for this signature in database
GPG key ID: D0EBD0EC8C2DC961

View file

@ -32,10 +32,9 @@ sub all : Chained('get_builds') PathPart {
}
sub nix : Chained('get_builds') PathPart('channel') CaptureArgs(1) {
sub nix : Chained('get_builds') PathPart('channel/latest') CaptureArgs(1) {
my ($self, $c, $channelName) = @_;
eval {
if ($channelName eq "latest") {
$c->stash->{channelName} = $c->stash->{channelBaseName} . "-latest";
$c->stash->{channelBuilds} = $c->stash->{latestSucceeded}
->search_literal("exists (select 1 from buildproducts where build = me.id and type = 'nix-build')")
@ -43,12 +42,6 @@ sub nix : Chained('get_builds') PathPart('channel') CaptureArgs(1) {
, join => ["buildoutputs"]
, order_by => ["me.id", "buildoutputs.name"]
, '+select' => ['buildoutputs.path', 'buildoutputs.name'], '+as' => ['outpath', 'outname'] });
}
else {
notFound($c, "Unknown channel `$channelName'.");
}
};
error($c, $@) if $@;
}