diff options
author | Tatsuhiko Miyagawa <miyagawa@bulknews.net> | 2013-07-22 10:23:24 -0700 |
---|---|---|
committer | Tatsuhiko Miyagawa <miyagawa@bulknews.net> | 2013-07-22 10:23:24 -0700 |
commit | 5f805c82e7fd1eea9a0450a697f3dc2ad7fbaeef (patch) | |
tree | 7f78f9cef1d0817521dd43192f7407d2677d7fb2 | |
parent | dfadaeebafcf97c6d9a59bb7c05bb452abfe0363 (diff) | |
download | carton-without.tar.gz |
Enable without for 'features' as wellwithout
-rw-r--r-- | lib/Carton/Builder.pm | 11 | ||||
-rw-r--r-- | xt/cli/without.t | 30 |
2 files changed, 37 insertions, 4 deletions
diff --git a/lib/Carton/Builder.pm b/lib/Carton/Builder.pm index dadae87..5e8160a 100644 --- a/lib/Carton/Builder.pm +++ b/lib/Carton/Builder.pm @@ -60,9 +60,14 @@ sub install { sub groups { my $self = shift; - my @options; - unless (grep $_ eq 'develop', @{$self->without}) { - push @options, '--with-develop'; + my @options = ('--with-all-features', '--with-develop'); + + for my $group (@{$self->without}) { + if ($group eq 'develop') { + push @options, '--without-develop'; + } else { + push @options, "--without-feature=$group"; + } } return @options; diff --git a/xt/cli/without.t b/xt/cli/without.t index f1d5b0e..d9c51f7 100644 --- a/xt/cli/without.t +++ b/xt/cli/without.t @@ -2,7 +2,7 @@ use strict; use Test::More; use xt::CLI; -subtest 'carton install and check' => sub { +subtest 'carton install --without develop' => sub { my $app = cli(); $app->write_cpanfile(<<EOF); requires 'Try::Tiny'; @@ -35,5 +35,33 @@ EOF unlike $app->stderr, qr/Hash::MultiValue .* version 0.14/; }; +subtest 'without features' => sub { + my $app = cli(); + $app->write_cpanfile(<<EOF); +requires 'Try::Tiny'; + +feature 'stream' => sub { + requires 'Stream::Buffered', '== 0.01'; +}; +EOF + + $app->run("install"); + $app->run("list"); + like $app->stdout, qr/Stream-Buffered-0\.01/; + + $app->clean_local; + + $app->run("install", "--deployment"); + $app->run("exec", "perl", "-e", "use Stream::Buffered 1"); + like $app->stderr, qr/Stream::Buffered .* version 0\.01/; + + $app->clean_local; + + $app->run("install", "--without", "stream"); + + $app->run("exec", "perl", "-e", "use Stream::Buffered 1"); + unlike $app->stderr, qr/Stream::Buffered .* version 0\.01/; +}; + done_testing; |