-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathapp-parrot-create
executable file
·53 lines (42 loc) · 1.78 KB
/
app-parrot-create
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env perl
use Mojolicious::Lite;
use Mojo::Home;
use lib 'lib';
use App::Parrot::Create::HLL;
use App::Parrot::Create::Library;
# Read configuration file
plugin 'yaml_config';
# Send file to the client
plugin 'RenderFile';
app->secret(app->config->{passphrase});
get '/' => 'index';
post '/' => sub {
my $self = shift;
my ($name, $builder, $harness, $parrot_revision, $with_pmc, $with_ops, $with_doc, $archive_path);
if (defined $self->param("hll")) {
($name, $builder, $harness, $parrot_revision, $with_pmc, $with_ops, $with_doc)
= map { $self->param($_) } qw/hll_name hll_builder hll_test
hll_parrot_revision with_pmc with_ops with_doc/;
my $hll = App::Parrot::Create::HLL->new();
$hll->init($name, $builder, $harness, $parrot_revision,
$with_pmc, $with_ops, $with_doc, $self->app->config->{hll_template});
if ($archive_path = $hll->generate()) {
$self->app->log->debug("The HLL created!");
}
}
elsif(defined $self->param("lib")){
($name, $builder, $harness, $parrot_revision)
= map { $self->param($_) } qw/lib_name lib_builder
lib_test lib_parrot_revision/;
my $library = App::Parrot::Create::Library->new();
$library->init($name, $builder, $harness, $parrot_revision, $self->app->config->{library_template});
if ($archive_path = $library->generate()) {
$self->app->log->debug("The Library created!");
}
}
$self->render_file(
'filepath' => $archive_path,
'format' => 'zip'
);
} => 'index';
app->start;