[carton] 336/472: Builder now takes install target off of detected cpanfile location

Lucas Kanashiro kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:39:20 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 fe439cd9d2c3a6a147be092f66e3a70eb2f6948c
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date:   Mon Jul 22 14:27:09 2013 -0700

    Builder now takes install target off of detected cpanfile location
---
 lib/Carton/Builder.pm |  3 ++-
 lib/Carton/CLI.pm     |  3 +++
 xt/CLI.pm             |  6 ++++++
 xt/cli/subdir.t       | 25 +++++++++++++++++++++++++
 4 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/lib/Carton/Builder.pm b/lib/Carton/Builder.pm
index 69e2e6e..c57fd46 100644
--- a/lib/Carton/Builder.pm
+++ b/lib/Carton/Builder.pm
@@ -6,6 +6,7 @@ has mirror  => (is => 'rw');
 has index   => (is => 'rw');
 has cascade => (is => 'rw', default => sub { 1 });
 has without => (is => 'rw', default => sub { [] });
+has cpanfile => (is => 'rw');
 
 sub effective_mirrors {
     my $self = shift;
@@ -53,7 +54,7 @@ sub install {
         ( $self->custom_mirror ? "--mirror-only" : () ),
         "--save-dists", "$path/cache",
         $self->groups,
-        "--installdeps", ".",
+        "--installdeps", $self->cpanfile->dirname,
     ) or die "Installing modules failed\n";
 }
 
diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm
index 833d386..1dbad55 100644
--- a/lib/Carton/CLI.pm
+++ b/lib/Carton/CLI.pm
@@ -164,6 +164,7 @@ sub cmd_bundle {
 
     my $builder = Carton::Builder->new(
         mirror => $self->mirror,
+        cpanfile => $self->cpanfile,
     );
     $builder->bundle($self->install_path, $self->vendor_cache, $lock);
 
@@ -196,6 +197,7 @@ sub cmd_install {
         cascade => 1,
         mirror  => $self->mirror,
         without => \@without,
+        cpanfile => $self->cpanfile,
     );
 
     # TODO: --without with no .lock won't fetch the groups, resulting in insufficient requirements
@@ -341,6 +343,7 @@ sub cmd_update {
 
     my $builder = Carton::Builder->new(
         mirror => $self->mirror,
+        cpanfile => $self->cpanfile,
     );
     $builder->update($self->install_path, @modules);
 
diff --git a/xt/CLI.pm b/xt/CLI.pm
index 0b58068..f2b6f3d 100644
--- a/xt/CLI.pm
+++ b/xt/CLI.pm
@@ -31,6 +31,12 @@ sub write_cpanfile {
     $self->dir->child('cpanfile')->spew(@args);
 }
 
+sub run_in_dir {
+    my($self, $dir, @args) = @_;
+    local $self->{dir} = $self->dir->child($dir);
+    $self->run(@args);
+}
+
 sub run {
     my($self, @args) = @_;
 
diff --git a/xt/cli/subdir.t b/xt/cli/subdir.t
new file mode 100644
index 0000000..84d244f
--- /dev/null
+++ b/xt/cli/subdir.t
@@ -0,0 +1,25 @@
+use strict;
+use Test::More;
+use xt::CLI;
+
+subtest 'carton exec in subdir', sub {
+    my $app = cli();
+    $app->write_cpanfile(<<EOF);
+requires 'Try::Tiny';
+EOF
+    $app->run('install');
+
+    $app->dir->child('x')->mkpath;
+
+    $app->run_in_dir('x' => 'list');
+    like $app->stdout, qr/Try-Tiny/;
+
+    $app->run_in_dir('x' => 'check');
+    like $app->stdout, qr/are satisfied/;
+
+    $app->run_in_dir('x' => 'install');
+    like $app->stdout, qr/Complete/;
+    unlike $app->stderr, qr/failed/;
+};
+
+done_testing;

-- 
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