[carton] 72/472: Implemented show
Lucas Kanashiro
kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:38:34 UTC 2015
This is an automated email from the git hooks/post-receive script.
kanashiro-guest pushed a commit to branch master
in repository carton.
commit 728a3cbe0ad5e56975d150a93224ca4de91673b0
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date: Tue Jun 28 11:43:26 2011 -0400
Implemented show
---
lib/Carton/CLI.pm | 14 ++++++++++++++
lib/Carton/Tree.pm | 6 +++---
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm
index 62f5fae..5f4bc3c 100644
--- a/lib/Carton/CLI.pm
+++ b/lib/Carton/CLI.pm
@@ -272,6 +272,20 @@ sub has_build_file {
return $file;
}
+sub cmd_show {
+ my($self, @args) = @_;
+
+ my $lock = $self->find_lock
+ or $self->error("Can't find carton.lock: Run `carton install`\n");
+ my $index = $self->carton->build_index($lock->{modules});
+
+ for my $module (@args) {
+ my $meta = $index->{$module}{meta}
+ or $self->error("Couldn't locate $module in the carton.lock\n");
+ $self->print( Carton::Util::to_json($meta) );
+ }
+}
+
sub cmd_tree {
my $self = shift;
$self->cmd_list("--tree", @_);
diff --git a/lib/Carton/Tree.pm b/lib/Carton/Tree.pm
index 7a4e25d..ebd0fe6 100644
--- a/lib/Carton/Tree.pm
+++ b/lib/Carton/Tree.pm
@@ -138,15 +138,15 @@ sub finalize {
sub has_child {
my($self, $key) = @_;
- my $has;
+ my $child;
$self->walk_down(sub {
if ($_[0]->key eq $key) {
- $has++;
+ $child = $_[0];
return $self->abort;
}
});
- return $has;
+ return $child;
}
1;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/carton.git
More information about the Pkg-perl-cvs-commits
mailing list