Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can select cpanm "-l" or "-L" #181

Open
wants to merge 1 commit into
base: 1.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/Carton/Builder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ has cascade => (is => 'rw', default => sub { 1 });
has without => (is => 'rw', default => sub { [] });
has cpanfile => (is => 'rw');
has fatscript => (is => 'lazy');
has skip_installed => (is => 'rw', default => sub { 0 });

sub effective_mirrors {
my $self = shift;
Expand Down Expand Up @@ -49,7 +50,7 @@ sub install {
my($self, $path) = @_;

$self->run_cpanm(
"-L", $path,
( $self->skip_installed ? "-l" : "-L" ), $path,
(map { ("--mirror", $_->url) } $self->effective_mirrors),
( $self->index ? ("--mirror-index", $self->index) : () ),
( $self->cascade ? "--cascade-search" : () ),
Expand Down Expand Up @@ -79,7 +80,7 @@ sub update {
my($self, $path, @modules) = @_;

$self->run_cpanm(
"-L", $path,
( $self->skip_installed ? "-l" : "-L" ), $path,
(map { ("--mirror", $_->url) } $self->effective_mirrors),
( $self->custom_mirror ? "--mirror-only" : () ),
"--save-dists", "$path/cache",
Expand Down
12 changes: 7 additions & 5 deletions lib/Carton/CLI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,12 @@ sub cmd_install {

$self->parse_options(
\@args,
"p|path=s" => \$install_path,
"cpanfile=s" => \$cpanfile_path,
"without=s" => sub { push @without, split /,/, $_[1] },
"deployment!" => \my $deployment,
"cached!" => \my $cached,
"p|path=s" => \$install_path,
"cpanfile=s" => \$cpanfile_path,
"without=s" => sub { push @without, split /,/, $_[1] },
"deployment!" => \my $deployment,
"cached!" => \my $cached,
"skip-installed!" => \my $skip_installed,
);

my $env = Carton::Environment->build($cpanfile_path, $install_path);
Expand All @@ -188,6 +189,7 @@ sub cmd_install {
mirror => $self->mirror,
without => \@without,
cpanfile => $env->cpanfile,
skip_installed => $skip_installed,
);

# TODO: --without with no .lock won't fetch the groups, resulting in insufficient requirements
Expand Down