Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created September 11, 2010 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tadzik/575338 to your computer and use it in GitHub Desktop.
Save tadzik/575338 to your computer and use it in GitHub Desktop.
use File::Copy;
use File::Find;
use File::Mkdir;
module Module::Install;
sub install(Str $dir = '.', Str $dest = "%*ENV<HOME>/.perl6/") is export {
if $*VM<config><osname> ne 'MSWin32'
&& "$dir/Makefile".IO ~~ :f {
run 'make install' and die "'make install' failed";
} else {
for find(dir => "$dir/lib", name => /[\.pm6?$] | [\.pir$]/).list -> $pmfile {
say "toying with $pmfile";
my $target-dir = $pmfile.dir.subst(/\.\//, $dest);
say "target dir is $target-dir";
mkdir $target-dir, :p;
say "Starting copying, time is {time}";
cp ~$pmfile, "$target-dir/{$pmfile.name}";
say "Done copying, time is {time}";
}
}
}
# vim: ft=perl6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment