Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into rakudo-star

  • Loading branch information...
commit 836ba58c31af0923cc7e9cf9194732800cc68a64 2 parents 597d4bc + 60cbaa3
@tadzik tadzik authored
Showing with 47 additions and 3 deletions.
  1. +34 −2 bin/panda
  2. +10 −0 lib/Panda/Ecosystem.pm
  3. +3 −1 t/panda/ecosystem.t
View
36 bin/panda
@@ -15,7 +15,13 @@ sub installprojects($panda, @args) {
sub listprojects($panda) {
for $panda.ecosystem.project-list -> $p {
my $x = $panda.ecosystem.get-project($p);
- printf "%-20s\t%s\n", $x.name, $x.metainfo<description>;
+ my $s;
+ given $panda.ecosystem.project-get-state($x) {
+ when 'installed' { $s = '[installed]' }
+ when 'installed-dep' { $s = '[installed as a dependency]' }
+ default { $s = '' }
+ }
+ printf "%-20s\t%s\n", $x.name, $s;
}
}
@@ -24,7 +30,15 @@ sub projectinfo($panda, @args) {
my $x = $panda.ecosystem.get-project($p);
if $x {
say $x.name => $x.version;
- say "Depends on:" => $x.dependencies.Str;
+ say "Depends on:" => $x.dependencies.Str if $x.dependencies;
+ given $panda.ecosystem.project-get-state($x) {
+ when 'installed' {
+ say "State:\t\tinstalled";
+ }
+ when 'installed-dep' {
+ say "State:\t\tinstalled as a dependency";
+ }
+ }
for $x.metainfo.kv -> $k, $v {
if $k ~~ none('version', 'name', 'depends') {
say $k.ucfirst => $v;
@@ -95,4 +109,22 @@ multi MAIN () {
say ''; # the newline after exiting the REPL
}
+sub USAGE {
+ say "Usage: panda [command [args]]
+
+Options:
+ help
+ Display this message and quit
+ install [module1 module2]
+ Install a modules(s)
+ list
+ List the available packages
+ info [module1 module2]
+ Display information on a specific module(s)
+ update
+ Update the module database
+";
+ exit 0;
+}
+
# vim: ft=perl6
View
10 lib/Panda/Ecosystem.pm
@@ -8,6 +8,14 @@ class Panda::Ecosystem is Pies::Ecosystem {
has %!projects;
has %!states;
+ method !flush-states {
+ my $fh = open($!statefile, :w);
+ for %!states.kv -> $key, $val {
+ $fh.say: "$key $val";
+ }
+ $fh.close;
+ }
+
# those two methods will be called only if needed
# given the slowness of Rakudo and JSON it's better
# if they aren't called ever :)
@@ -62,7 +70,9 @@ class Panda::Ecosystem is Pies::Ecosystem {
method project-set-state(Pies::Project $p,
Pies::Project::State $s) {
+ self!init_states unless %!states;
%!states{$p.name} = $s;
+ self!flush-states;
}
}
View
4 t/panda/ecosystem.t
@@ -6,7 +6,9 @@ plan 12;
my $a = Panda::Ecosystem.new(
statefile => 't/panda/fakestate',
projectsfile => 't/panda/fakeprojects'
-);
+) but role {
+ method !flush-states { }
+};
my $b = $a.get-project('foo');
is $b.version, 1, 'get-project 1';
Please sign in to comment.
Something went wrong with that request. Please try again.