Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
A bit of code restructuring for readability
  • Loading branch information
niner committed Nov 15, 2015
1 parent d991d92 commit 4a64a9c
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/core/CompUnit/Repository/Installation.pm
Expand Up @@ -139,20 +139,7 @@ sub MAIN(:$name, :$auth, :$ver, *@, *%) {
$file-id++;
}

if !$has-provides && $d.files.keys.first(/^blib\W/) {
my $color = %*ENV<RAKUDO_ERROR_COLOR> // !$is-win;
my ($red, $green, $yellow, $clear) = $color
?? ("\e[31m", "\e[32m", "\e[33m", "\e[0m")
!! ("", "", "", "");
my $eject = $is-win ?? "<HERE>" !! "\x[23CF]";

note "$red==={$clear}WARNING!$red===$clear
The distribution $d.name() does not seem to have a \"provides\" section in its META.info file,
and so the packages will not be installed in the correct location.
Please ask the author to add a \"provides\" section, mapping every exposed namespace to a
file location in the distribution.
See http://design.perl6.org/S22.html#provides for more information.\n";
}
provides-warning($is-win, $d.name) if !$has-provides and $d.files.keys.first(/^blib\W/);

$repo<dists>[$d.id] = $d.Hash;

Expand Down Expand Up @@ -240,6 +227,21 @@ See http://design.perl6.org/S22.html#provides for more information.\n";
method loaded() returns Iterable {
return %!loaded.values;
}

sub provides-warning($is-win, $name) {
my $color = %*ENV<RAKUDO_ERROR_COLOR> // !$is-win;
my ($red, $green, $yellow, $clear) = $color
?? ("\e[31m", "\e[32m", "\e[33m", "\e[0m")
!! ("", "", "", "");
my $eject = $is-win ?? "<HERE>" !! "\x[23CF]";

note "$red==={$clear}WARNING!$red===$clear
The distribution $name does not seem to have a \"provides\" section in its META.info file,
and so the packages will not be installed in the correct location.
Please ask the author to add a \"provides\" section, mapping every exposed namespace to a
file location in the distribution.
See http://design.perl6.org/S22.html#provides for more information.\n";
}
}

# vim: ft=perl6 expandtab sw=4

0 comments on commit 4a64a9c

Please sign in to comment.