App-LintPrereqs
view release on metacpan or search on metacpan
0.42 2016-06-03 Released-By: PERLANCAR
- Allow specifying minimum version of modules in [versions] of
lint-prereqs.conf.
0.41 2016-03-17 Released-By: PERLANCAR
- Change backup dist.ini from dist.ini.bak to dist.ini~.
0.40 2016-03-13 Released-By: PERLANCAR
- Recognize test modules from same dist (in t/lib/).
0.39 2016-03-04 Released-By: PERLANCAR
- Add --fix option.
0.21 2015-01-04 Released-By: PERLANCAR
- Revert back to using Perl::PrereqScanner by default (due to
::Lite still misses detecting some modules), but offer --lite to
switch to ::Lite.
0.20 2015-01-04 Released-By: PERLANCAR
- Skip scanning backup files.
0.19 2015-01-04 Released-By: PERLANCAR
- Replace Perl::PrereqScanner with Perl::PrereqScanner::Lite for
performance.
0.18 2014-12-18 Released-By: PERLANCAR
* extra_test_dirs => *array[str]*
Add extra directories to scan for test requirements.
* fix => *bool*
Attempt to automatically fix the errors.
"lint-prereqs" can attempt to automatically fix the errors by
adding/removing/moving prereqs in "dist.ini". Not all errors can be
automatically fixed. When modifying "dist.ini", a backup in
"dist.ini~" will be created.
* perl_version => *str*
Perl version to use (overrides scan_prereqs/dist.ini).
* scanner => *str* (default: "regular")
Which scanner to use.
lib/App/LintPrereqs.pm view on Meta::CPAN
use 5.010001;
use strict;
use warnings;
use Log::ger;
use Config::IOD;
use Fcntl qw(:DEFAULT);
use File::Find;
use File::Which;
use Filename::Backup qw(check_backup_filename);
use IPC::System::Options 'system', -log=>1;
use Module::CoreList::More;
use Proc::ChildError qw(explain_child_error);
use Scalar::Util 'looks_like_number';
use Sort::Sub qw(prereq_ala_perlancar);
use Version::Util qw(version_gt version_ne);
our %SPEC;
require Exporter;
our @ISA = qw(Exporter);
lib/App/LintPrereqs.pm view on Meta::CPAN
my @dirs = (grep {-d} (
"lib", "bin", "script", "scripts",
#"sample", "samples", "example", "examples" # decidedly not included
#"share", # decidedly not included
@{ $args{extra_runtime_dirs} // [] },
));
last unless @dirs;
find(
sub {
return unless -f;
return if check_backup_filename(filename=>$_);
push @{$files{Runtime}}, "$File::Find::dir/$_";
},
@dirs
);
}
{
my @dirs = (grep {-d} (
"t", "xt",
@{ $args{extra_test_dirs} // [] },
));
last unless @dirs;
find(
sub {
return unless -f;
return if check_backup_filename(filename=>$_);
return unless /\.(t|pl|pm)$/;
push @{$files{Test}}, "$File::Find::dir/$_";
},
@dirs
);
}
my %res; # key=phase, value=hash of {mod=>version , ...}
for my $phase (keys %files) {
$res{$phase} = {};
lib/App/LintPrereqs.pm view on Meta::CPAN
_
},
fix => {
schema => 'bool',
summary => 'Attempt to automatically fix the errors',
cmdline_aliases => {F=>{}},
description => <<'_',
`lint-prereqs` can attempt to automatically fix the errors by
adding/removing/moving prereqs in `dist.ini`. Not all errors can be
automatically fixed. When modifying `dist.ini`, a backup in `dist.ini~` will be
created.
_
},
},
};
sub lint_prereqs {
my %args = @_;
(-f "dist.ini")
lib/App/LintPrereqs.pm view on Meta::CPAN
# add sort-prereqs at the end
push @{ $errs[-1]{remedy_cmds} }, ["pdrutil", "sort-prereqs"];
ERR:
for my $e (@errs) {
for my $cmd (@{ $e->{remedy_cmds} }) {
system @$cmd;
if ($?) {
$e->{remedy} = "(FIX FAILED: ".explain_child_error().") $e->{remedy}";
$resmeta->{'cmdline.exit_code'} = 1;
# restore dist.ini from backup
rename "dist.ini~", "dist.ini";
last FIX;
}
}
}
for my $e (@errs) {
$e->{remedy} = "(DONE) $e->{remedy}";
}
$resmeta->{'cmdline.exit_code'} = 0;
# remove dist.ini~
lib/App/LintPrereqs.pm view on Meta::CPAN
=item * B<extra_test_dirs> => I<array[str]>
Add extra directories to scan for test requirements.
=item * B<fix> => I<bool>
Attempt to automatically fix the errors.
C<lint-prereqs> can attempt to automatically fix the errors by
adding/removing/moving prereqs in C<dist.ini>. Not all errors can be
automatically fixed. When modifying C<dist.ini>, a backup in C<dist.ini~> will be
created.
=item * B<perl_version> => I<str>
Perl version to use (overrides scan_prereqsE<sol>dist.ini).
=item * B<scanner> => I<str> (default: "regular")
Which scanner to use.
script/lint-prereqs view on Meta::CPAN
Add extra directories to scan for test requirements (JSON-encoded).
See C<--extra-test-dir>.
=item B<--fix>, B<-F>
Attempt to automatically fix the errors.
`lint-prereqs` can attempt to automatically fix the errors by
adding/removing/moving prereqs in `dist.ini`. Not all errors can be
automatically fixed. When modifying `dist.ini`, a backup in `dist.ini~` will be
created.
=item B<--no-core-prereqs>
If set to 0 (the default), will complain if there are prerequisites to core
modules. If set to 1, prerequisites to core modules are required just like other
modules.
( run in 0.760 second using v1.01-cache-2.11-cpan-49f99fa48dc )