Permalink
Browse files

Ensure that .pirs get installed last

  • Loading branch information...
1 parent 21ed651 commit dc81db8e469598b6b8b43c6470c950a7c8561fb7 @tadzik committed Jan 9, 2013
Showing with 15 additions and 2 deletions.
  1. +8 −1 lib/Panda/Installer.pm
  2. +7 −1 t/panda/installer.t
View
@@ -11,10 +11,17 @@ class Panda::Installer does Pies::Installer {
has $.resources;
has $.destdir;
+ method sort-lib-contents(@lib) {
+ my @pirs = @lib.grep({ $_ ~~ /\.pir$/});
+ my @rest = @lib.grep({ $_ !~~ /\.pir$/});
+ return @rest, @pirs;
+ }
+
method install(Pies::Project $p) {
indir $!resources.workdir($p), {
if 'blib'.IO ~~ :d {
- for find(dir => 'blib', type => 'file').list -> $i {
+ my @lib = find(dir => 'blib', type => 'file').list;
+ for @.sort-lib-contents(@lib) -> $i {
# .substr(5) to skip 'blib/'
mkpath "$!destdir/{$i.dir.substr(5)}";
$i.IO.copy("$!destdir/{$i.Str.substr(5)}");
View
@@ -3,7 +3,7 @@ use Panda::Installer;
use Panda::Resources;
use Shell::Command;
-plan 8;
+plan 9;
my $srcdir = 'testmodules';
my $destdir = "{cwd}/removeme";
@@ -31,4 +31,10 @@ file_exists_ok "$destdir/compiled/module/doc/bardir/barfile",
rm_rf $destdir;
+my @lib = <foo.pm foo.pir bam.pir bam.pm blaz.pm blaz.pir shazam.js>;
+my @order = $b.sort-lib-contents(@lib);
+is_deeply @order,
+ [<foo.pm bam.pm blaz.pm shazam.js foo.pir bam.pir blaz.pir>],
+ 'pirs will get installed after rest of the things';
+
# vim: ft=perl6

0 comments on commit dc81db8

Please sign in to comment.