Channel.pm: Actually deliver channel expressions.

So this is the final part which is needed in order to be able to deliver
custom channels, everything else is now just polishing.

We do this by simply redirecting to the build product download URL and
we use binary_cache_url the same way as in NixChannel.pm.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2015-04-27 04:55:13 +02:00
parent db0ef9e49b
commit 8b4f51f657
No known key found for this signature in database
GPG key ID: D0EBD0EC8C2DC961

View file

@ -54,4 +54,30 @@ sub overview : Chained('channel') PathPart('') Args(0) {
} }
sub nixexprs : Chained('channel') PathPart('') Args(1) {
my ($self, $c, $productName) = @_;
my $product = $c->stash->{lastSuccessful}->buildproducts->find(
{ type => "channel", name => $productName }
);
my $url = $c->uri_for(
$c->controller("Build")->action_for("download"),
[$c->stash->{lastSuccessful}->id],
$product->productnr,
$productName
);
$c->res->redirect($url);
}
sub binary_cache_url : Chained('channel') PathPart('binary-cache-url') Args(0) {
my ($self, $c) = @_;
$c->stash->{'plain'} = { data => $c->uri_for('/') };
$c->response->content_type('text/plain');
$c->forward('Hydra::View::Plain');
}
1; 1;