Skip to content

Commit

Permalink
unbreak proto; use .IO style file tests, and fix infinite recursion i…
Browse files Browse the repository at this point in the history
…n .{ }
  • Loading branch information
moritz committed Jul 19, 2010
1 parent 31af069 commit 554d096
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
8 changes: 4 additions & 4 deletions lib/Ecosystem.pm6
Expand Up @@ -45,7 +45,7 @@ method get-info-on($project) {
# tested or test-failed # tested or test-failed
# installed or install-failed # installed or install-failed
method is-state($project,$state) { method is-state($project,$state) {
if $state eq 'fetched' { return ?( "$cache-dir/$project" ~~ :d ); } if $state eq 'fetched' { return ?( "$cache-dir/$project".IO ~~ :d ); }
if %!project-state.exists($project) if %!project-state.exists($project)
and %!project-state{$project}.exists('state') and %!project-state{$project}.exists('state')
and $state eq %!project-state{$project}<state> { and $state eq %!project-state{$project}<state> {
Expand Down Expand Up @@ -101,7 +101,7 @@ method project-dir($project) {
method files-in-cache-lib($project) { method files-in-cache-lib($project) {
my $project-dir = self.project-dir($project); my $project-dir = self.project-dir($project);


if "$project-dir/lib" !~~ :d { if "$project-dir/lib".IO !~~ :d {
return (); return ();
} }


Expand All @@ -114,12 +114,12 @@ method files-in-cache-lib($project) {


#-------------------------- fetched-projects --------------------------- #-------------------------- fetched-projects ---------------------------
method fetched-projects() { method fetched-projects() {
return self.regular-projects.grep: { "$cache-dir/$_" ~~ :d }; return self.regular-projects.grep: { "$cache-dir/$_".IO ~~ :d };
} }


#------------------------- unfetched-projects -------------------------- #------------------------- unfetched-projects --------------------------
method unfetched-projects() { method unfetched-projects() {
return self.regular-projects.grep: { "$cache-dir/$_" !~~ :d }; return self.regular-projects.grep: { "$cache-dir/$_".IO !~~ :d };
} }


#-------------------------- load-project-list -------------------------- #-------------------------- load-project-list --------------------------
Expand Down
26 changes: 13 additions & 13 deletions lib/Installer.pm6
Expand Up @@ -166,15 +166,15 @@ class Installer:auth<masak>:ver<0.2.0> {
my $project-dir = $.ecosystem.project-dir($project); my $project-dir = $.ecosystem.project-dir($project);
print "Testing $project..."; print "Testing $project...";
my $command = ''; my $command = '';
if "$project-dir/Makefile" ~~ :e { if "$project-dir/Makefile".IO ~~ :e {
if slurp("$project-dir/Makefile") ~~ /^test:/ { if slurp("$project-dir/Makefile") ~~ /^test:/ {
my $make = %!config-info{'Make utility'}; my $make = %!config-info{'Make utility'};
$command = "$make test"; $command = "$make test";
} }
} }
unless $command { unless $command {
if "$project-dir/t" ~~ :d if "$project-dir/t".IO ~~ :d
&& any(map { "$_/prove" }, %*ENV<PATH>.split(":")) ~~ :e && any(map { "$_/prove" }, %*ENV<PATH>.split(":")).IO ~~ :e
{ {
$command = 'prove -e "' $command = 'prove -e "'
~ %!config-info{'Perl 6 executable'} ~ %!config-info{'Perl 6 executable'}
Expand Down Expand Up @@ -313,7 +313,7 @@ class Installer:auth<masak>:ver<0.2.0> {
for $.ecosystem.files-in-cache-lib($project) { for $.ecosystem.files-in-cache-lib($project) {
next unless $_; next unless $_;
my $location = %!config-info{'Perl 6 library'} ~ '/' ~ $_; my $location = %!config-info{'Perl 6 library'} ~ '/' ~ $_;
if $location ~~ :f { unlink $location } if $location.IO ~~ :f { unlink $location }
else { @directories.push: $location } else { @directories.push: $location }
} }
for @directories { unlink $_ } for @directories { unlink $_ }
Expand Down Expand Up @@ -380,7 +380,7 @@ class Installer:auth<masak>:ver<0.2.0> {
# ~ '/languages/perl6/lib'; # point to Test.pm # ~ '/languages/perl6/lib'; # point to Test.pm
my $perl6 = %!config-info{'Perl 6 executable'}; my $perl6 = %!config-info{'Perl 6 executable'};
for <Makefile.PL Configure.pl Configure.p6 Configure> -> $config-file { for <Makefile.PL Configure.pl Configure.p6 Configure> -> $config-file {
if "$project-dir/$config-file" ~~ :f { if "$project-dir/$config-file".IO ~~ :f {
my $perl = $config-file eq 'Makefile.PL' my $perl = $config-file eq 'Makefile.PL'
?? 'perl' ?? 'perl'
!! $perl6; !! $perl6;
Expand All @@ -396,7 +396,7 @@ class Installer:auth<masak>:ver<0.2.0> {
last; last;
} }
} }
if "$project-dir/Makefile" ~~ :f { if "$project-dir/Makefile".IO ~~ :f {
say "project type " ~ $project.WHAT; say "project type " ~ $project.WHAT;
my $make-cmd = %!config-info{'Make utility'}; my $make-cmd = %!config-info{'Make utility'};
my $r = self.configured-run( $make-cmd, :project( $project ), :dir( $project-dir ) ); my $r = self.configured-run( $make-cmd, :project( $project ), :dir( $project-dir ) );
Expand Down Expand Up @@ -462,7 +462,7 @@ class Installer:auth<masak>:ver<0.2.0> {
} }


my $project-dir = $.ecosystem.project-dir($project); my $project-dir = $.ecosystem.project-dir($project);
if "$project-dir/Makefile" ~~ :f && slurp("$project-dir/Makefile") ~~ /^install\:/ { if "$project-dir/Makefile".IO ~~ :f && slurp("$project-dir/Makefile") ~~ /^install\:/ {
my $make = %!config-info{'Make utility'}; my $make = %!config-info{'Make utility'};
my $r = self.configured-run( "$make install", :project( $project ), :dir( $project-dir ) ); my $r = self.configured-run( "$make install", :project( $project ), :dir( $project-dir ) );
if $r != 0 { if $r != 0 {
Expand All @@ -481,7 +481,7 @@ class Installer:auth<masak>:ver<0.2.0> {
# not welcome in the shared Perl 6 library # not welcome in the shared Perl 6 library
for @files -> $file { for @files -> $file {
my $destination = $perl6lib ~ '/' ~ $file; my $destination = $perl6lib ~ '/' ~ $file;
if $destination ~~ :f { if $destination.IO ~~ :f {
say "won't install since the file '$destination' already exists"; say "won't install since the file '$destination' already exists";
return False; return False;
} }
Expand All @@ -500,7 +500,7 @@ class Installer:auth<masak>:ver<0.2.0> {
} }
# TODO: a non clobbering, OS neutral alternative to # TODO: a non clobbering, OS neutral alternative to
# cp, replace with slurp() and squirt() # cp, replace with slurp() and squirt()
if "$project-dir/lib/$file" ~~ :f { if "$project-dir/lib/$file".IO ~~ :f {
# my $command = ""; # my $command = "";
my $command = "cp $project-dir/lib/$file $perl6lib/$file"; my $command = "cp $project-dir/lib/$file $perl6lib/$file";
my $status = run($command); # TODO: check status my $status = run($command); # TODO: check status
Expand Down Expand Up @@ -540,12 +540,12 @@ class Installer:auth<masak>:ver<0.2.0> {
for @projects -> $project { for @projects -> $project {
print "Uninstalling $project..."; print "Uninstalling $project...";
my $project-dir = $.ecosystem.project-dir($project); my $project-dir = $.ecosystem.project-dir($project);
if "$project-dir/Makefile" ~~ :f && slurp("$project-dir/Makefile") ~~ /^uninstall\:/ { if "$project-dir/Makefile".IO ~~ :f && slurp("$project-dir/Makefile") ~~ /^uninstall\:/ {
my $make = %!config-info{'Make utility'}; my $make = %!config-info{'Make utility'};
self.configured-run( "$make uninstall", :project( $project ), :dir( $project-dir ) ); self.configured-run( "$make uninstall", :project( $project ), :dir( $project-dir ) );
} }
else { else {
for $.ecosystem.files-in-cache-lib($project).map({"$perl6lib/$_"}).grep({ $_ ~~ :f }) -> $file for $.ecosystem.files-in-cache-lib($project).map({"$perl6lib/$_"}).grep({ .IO ~~ :f }) -> $file
{ {
run("rm $file") run("rm $file")
} }
Expand All @@ -569,7 +569,7 @@ class Installer:auth<masak>:ver<0.2.0> {
~ "/$project/deps.proto"; ~ "/$project/deps.proto";
# WORKAROUND: !~~ does not work with :f # WORKAROUND: !~~ does not work with :f
# if $deps-file !~~ :f { return; } # if $deps-file !~~ :f { return; }
unless $deps-file ~~ :f { return; } unless $deps-file.IO ~~ :f { return; }
my &remove-line-ending-comment = { .subst(/ '#' .* $ /, '') }; my &remove-line-ending-comment = { .subst(/ '#' .* $ /, '') };
# WORKAROUND: from moritz_++ to solve an NPMCA in find_method('params') # WORKAROUND: from moritz_++ to solve an NPMCA in find_method('params')
# http://irclog.perlgeek.de/perl6/2010-04-22#i_2253823 and before # http://irclog.perlgeek.de/perl6/2010-04-22#i_2253823 and before
Expand Down Expand Up @@ -627,7 +627,7 @@ class Installer:auth<masak>:ver<0.2.0> {
# WORKAROUND: Rakudo has a backtracking bug reported in # WORKAROUND: Rakudo has a backtracking bug reported in
# http://rt.perl.org/rt3/Public/Bug/Display.html?id=73608 # http://rt.perl.org/rt3/Public/Bug/Display.html?id=73608
# when / (.*) ':' <.ws> (.*) / { %settings{$0} = $1; } # when / (.*) ':' <.ws> (.*) / { %settings{$0} = $1; }
when / (<-[:]>+) ':' <.ws> (.*) / { %settings{$0} = ~$1; } when / (<-[:]>+) ':' <.ws> (.*) / { %settings{~$0} = ~$1; }
} }
return %settings; return %settings;
} }
Expand Down
8 changes: 8 additions & 0 deletions projects.list
Expand Up @@ -229,3 +229,11 @@ file-spec:
MiniDBI: MiniDBI:
home: github home: github
owner: mberends owner: mberends

Math-RungeKutta:
home: github
owner: moritz

Math-Model:
home: github
owner: moritz

0 comments on commit 554d096

Please sign in to comment.