Skip to content

Commit

Permalink
Actually run new_parrot_language.pl and start creating the zip file
Browse files Browse the repository at this point in the history
  • Loading branch information
leto committed Nov 10, 2011
1 parent ce31954 commit 2643402
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Build.PL
Expand Up @@ -13,8 +13,9 @@ my $builder = Module::Build->new(
'Test::Most' => 0,
},
requires => {
'YAML' => 0,
'Dancer' => 1.3040,
'YAML' => 0,
'Dancer' => 1.3040,
'Archive::Zip' => 0,
},
add_to_cleanup => [ 'App-Parrot-Create-*' ],
meta_merge => {
Expand Down
5 changes: 2 additions & 3 deletions bin/new_parrot_language.pl
Expand Up @@ -70,8 +70,6 @@ =head1 DESCRIPTION
use File::Spec;
use Getopt::Long;

use Parrot::Config qw/ %PConfig /;

my ($with_doc, $with_ops, $with_pmc);
GetOptions(
'with-doc' => \$with_doc,
Expand Down Expand Up @@ -117,7 +115,8 @@ =head1 DESCRIPTION
s{\@no_ops\@} {$no_ops}ig;
s{\@no_pmc\@} {$no_pmc}ig;
s{\@rev\@} {$rev}ig;
if (/^__(.*)__$/) { start_new_file("$path$PConfig{slash}$1"); }
# TODO: slashitis
if (/^__(.*)__$/) { start_new_file("$path/$1"); }
elsif ($fh) { print $fh $_; }
}
## close the last file
Expand Down
17 changes: 17 additions & 0 deletions lib/App/Parrot/Create.pm
@@ -1,5 +1,6 @@
package App::Parrot::Create;
use Dancer ':syntax';
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );

our $VERSION = '0.1';

Expand All @@ -10,6 +11,22 @@ get '/' => sub {
get '/submit' => sub {
my ($name, $builder, $harness) = map { param($_) } qw/language_name builder test_harness/;

$name =~ s/[^A-z]*//g;

my $time = time;
my $tmp_base = "/tmp/app-parrot-create";
my $dir = "$tmp_base/$time/$name";

my @args = ($^X,"bin/new_parrot_language.pl",$name, $dir);
system @args;

my $zip = Archive::Zip->new();
my $dir_member = $zip->addDirectory("$dir/");

unless ( $zip->writeToFileNamed("$dir.zip") == AZ_OK ) {
die 'write error';
}

template 'submit',
{ name => $name, builder => $builder, harness => $harness };
};
Expand Down

0 comments on commit 2643402

Please sign in to comment.