Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
4,742 additions
and
869 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: 2 | ||
jobs: | ||
criticism: | ||
docker: | ||
- image: gugod/perlcritic:latest | ||
steps: | ||
- checkout | ||
- run: perlcritic --profile .perlcriticrc t lib script | ||
test: | ||
docker: | ||
- image: perl:5.28 | ||
steps: | ||
- checkout | ||
- run: perl -V | ||
- run: cpanm --notest Test2::Harness; cpanm --notest --installdeps . | ||
- run: yath | ||
workflows: | ||
version: 2 | ||
test_and_critic: | ||
jobs: | ||
- criticism | ||
- test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
color = 0 | ||
verbose = %f:%l:%c:[%p] %m => %r\n | ||
|
||
only = 1 | ||
include = RequireUseStrict ProhibitUnused |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
|
||
use strict; | ||
use warnings; | ||
|
||
package App::Perlbrew::Path; | ||
|
||
require File::Basename; | ||
require File::Glob; | ||
require File::Path; | ||
|
||
use overload ( | ||
'""' => \& stringify, | ||
fallback => 1, | ||
); | ||
|
||
sub _joinpath { | ||
for my $entry(@_) { | ||
no warnings 'uninitialized'; | ||
die 'Received an undefined entry as a parameter (all parameters are: '. join(', ', @_). ')' unless (defined($entry)); | ||
} | ||
return join "/", @_; | ||
} | ||
|
||
sub _child { | ||
my ($self, $package, @path) = @_; | ||
|
||
$package->new ($self->{path}, @path); | ||
} | ||
|
||
sub _children { | ||
my ($self, $package) = @_; | ||
|
||
return map $package->new ($_), | ||
File::Glob::bsd_glob ($self->child ("*")) | ||
; | ||
} | ||
|
||
sub new { | ||
my ($class, @path) = @_; | ||
|
||
bless { path => _joinpath (@path) }, $class; | ||
} | ||
|
||
sub basename { | ||
my ($self, $suffix) = @_; | ||
|
||
return scalar File::Basename::fileparse ($self, ($suffix) x!! defined $suffix); | ||
} | ||
|
||
sub child { | ||
my ($self, @path) = @_; | ||
|
||
return $self->_child (__PACKAGE__, @path); | ||
} | ||
|
||
sub children { | ||
my ($self) = @_; | ||
|
||
return $self->_children (__PACKAGE__); | ||
} | ||
|
||
sub dirname { | ||
my ($self) = @_; | ||
|
||
return App::Perlbrew::Path->new (File::Basename::dirname ($self)); | ||
} | ||
|
||
sub mkpath { | ||
my ($self) = @_; | ||
File::Path::mkpath ([$self->stringify], 0, 0777); | ||
return $self; | ||
} | ||
|
||
sub readlink { | ||
my ($self) = @_; | ||
|
||
my $link = readlink $self->stringify; | ||
$link = __PACKAGE__->new ($link) if defined $link; | ||
|
||
return $link; | ||
} | ||
|
||
sub rmpath { | ||
my ($self) = @_; | ||
File::Path::rmtree([$self->stringify], 0, 0); | ||
return $self; | ||
} | ||
|
||
sub stringify { | ||
my ($self) = @_; | ||
|
||
return $self->{path}; | ||
} | ||
|
||
sub stringify_with_tilde { | ||
my ($self) = @_; | ||
my $path = $self->stringify; | ||
my $home = $ENV{HOME}; | ||
$path =~ s!\Q$home/\E!~/! if $home; | ||
return $path; | ||
} | ||
|
||
sub symlink { | ||
my ($self, $destination, $force) = @_; | ||
$destination = App::Perlbrew::Path->new ($destination) | ||
unless ref $destination; | ||
|
||
CORE::unlink $destination | ||
if $force && (-e $destination || -l $destination); | ||
|
||
$destination if CORE::symlink $self, $destination; | ||
} | ||
|
||
sub unlink { | ||
my ($self) = @_; | ||
|
||
CORE::unlink ($self); | ||
} | ||
|
||
1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
use strict; | ||
use warnings; | ||
|
||
package App::Perlbrew::Path::Installation; | ||
|
||
require App::Perlbrew::Path; | ||
|
||
our @ISA = qw( App::Perlbrew::Path ); | ||
|
||
sub name { | ||
$_[0]->basename; | ||
} | ||
|
||
sub bin { | ||
shift->child (bin => @_); | ||
} | ||
|
||
sub man { | ||
shift->child (man => @_); | ||
} | ||
|
||
sub perl { | ||
shift->bin ('perl'); | ||
} | ||
|
||
sub version_file { | ||
shift->child ('.version'); | ||
} | ||
|
||
1; | ||
|
Oops, something went wrong.