App-GitGot
view release on metacpan or search on metacpan
lib/App/GitGot/Command.pm view on Meta::CPAN
active_repos => 'elements' ,
} ,
);
sub _build_active_repo_list {
my ( $self ) = @_;
return $self->full_repo_list
if $self->all or ! $self->tags and ! $self->skip_tags and ! @{ $self->args };
my $list = _expand_arg_list( $self->args );
my @repos;
REPO: foreach my $repo ( $self->all_repos ) {
if ( grep { $_ eq $repo->number or $_ eq $repo->name } @$list ) {
push @repos, $repo;
next REPO;
}
if ( $self->skip_tags ) {
foreach my $tag ( @{ $self->skip_tags } ) {
lib/App/GitGot/Command.pm view on Meta::CPAN
DumpFile(
$self->configfile,
[
sort { $a->{name} cmp $b->{name} }
map { $_->in_writable_format } $self->all_repos
] ,
);
}
sub _expand_arg_list {
my $args = shift;
## no critic
return [
map {
s!/$!!;
if (/^(\d+)-(\d+)?$/) { ( $1 .. $2 ) }
else { ($_) }
} @$args
lib/App/GitGot/Command/lib.pm view on Meta::CPAN
return (
[ 'gotlib=s' => 'gotlib file' => { default => '.gotlib' } ] ,
[ 'libvar=s' => 'library environment variable' => { default => 'PERL5LIB' } ] ,
[ 'separator=s' => 'library path separator' => { default => ':' } ] ,
);
}
sub _execute {
my( $self, $opt, $args ) = @_;
my @libs = map { $self->_expand_lib($_) } $self->_raw_libs( $args );
no warnings; # $ENV{$self->opt->libvar} can be undefined
say join $self->opt->separator, uniq @libs, split ':', $ENV{$self->opt->libvar};
}
sub _expand_lib {
my( $self, $lib ) = @_;
return path($lib)->absolute if $lib =~ m#^(?:\.|/)#;
if ( $lib =~ s/^\@(\w+)// ) {
# it's a tag
return map { $_->path . $lib } $self->search_repos->tags($1)->all;
}
# it's a repo name
lib/App/GitGot/Command/lib.pm view on Meta::CPAN
where those directories are prepended to I<PERL5LIB> (command-line entries
first, then the ones from the I<gotlib> file).
Libraries can be given in three different ways:
=over
=item absolute or relative path
If the value begins with a '/' or a '.', it is assumed to be a straight path.
It will be expanded to its absolute value, but otherwise left untouched.
For example './lib' will be expanded to '/path/to/current/directory/lib'
=item tag
If the value begins with I<@>, it is assumed to be a tag, and will be replaced
by the path to all repositories having that tag.
For example '@dancer/lib' will be expanded to
'/path/to/dancer/project1/lib:/path/to/dancer/project2/lib:...'
=item project name
If not a path nor a tag, the value is assumed to be a project name.
For example 'vim-x/lib' will be expanded to
'/path/to/vim-x/lib'
=back
=head1 OPTIONS
=head2 --separator
Separator printed between library directories in the output.
Defaults to ':' (colon).
( run in 1.569 second using v1.01-cache-2.11-cpan-5623c5533a1 )