Skip to content

Commit

Permalink
Make Panda::Builder copy over all the files it doesn't recognize
Browse files Browse the repository at this point in the history
  • Loading branch information
Tadeusz Sośnierz committed Nov 26, 2012
1 parent 6b9161c commit 4c73acb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions lib/Panda/Builder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@ class Panda::Builder does Pies::Builder {
my $workdir = $!resources.workdir($p);
return unless "$workdir/lib".IO ~~ :d;
indir $workdir, {
my @files = find(dir => 'lib',
name => /\.p(m6?|od)$/).list;
my @files = find(dir => 'lib', type => 'file').list;
my @dirs = @files.map(*.dir).uniq;
mkpath "blib/$_" for @dirs;

my @tobuild = self.build-order(@files);
withp6lib {
for @tobuild -> $file {
$file.IO.copy: "blib/{$file.dir}/{$file.name}";
next if $file ~~ /\.pod$/;
next unless $file ~~ /\.pm6?$/;
say "Compiling $file";
shell "$*EXECUTABLE_NAME --target=pir "
~ "--output=blib/{$file.dir}/"
Expand Down
4 changes: 3 additions & 1 deletion t/panda/builder.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use Panda::Builder;
use Panda::Resources;
use Shell::Command;

plan 5;
plan 6;

my $srcdir = 'testmodules';

Expand All @@ -19,6 +19,8 @@ ok "$srcdir/dummymodule/blib/lib/foo.pir".IO ~~ :f, 'module compiled';
ok "$srcdir/dummymodule/blib/lib/foo.pm".IO ~~ :f, 'and opied to blib';
ok "$srcdir/dummymodule/blib/lib/manual.pod".IO ~~ :f, 'pod copied too';
ok "$srcdir/dummymodule/blib/lib/bar.pir".IO !~~ :f, 'pod not compiled';
ok "$srcdir/dummymodule/blib/lib/foo.js".IO ~~ :f,
'random files also copied to blib';

rm_rf "$srcdir/dummymodule/blib";

Expand Down
Empty file.

0 comments on commit 4c73acb

Please sign in to comment.