summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUtkarsh Gupta <guptautkarsh2102@gmail.com>2019-07-17 01:44:46 +0530
committerUtkarsh Gupta <guptautkarsh2102@gmail.com>2019-07-17 01:44:46 +0530
commit9519cd612d8581302a42040a81a837d08c6e45d3 (patch)
tree258ca0e745fb20cf91bf5e5596a14c0b7d902ebd
parentc4f20c07e15a33f49a75a761f5941e629254ed2c (diff)
parent1efb533a676a91751b494b1e1e85fa2542e22d66 (diff)
Update upstream source from tag 'upstream/0.20'
Update to upstream version '0.20' with Debian dir f75ffb7da37c8b94aa92eebb98e4170dd0dc6e7e
-rw-r--r--Changes20
-rw-r--r--MANIFEST17
-rw-r--r--META.json26
-rw-r--r--META.yml20
-rw-r--r--Makefile.PL126
-rw-r--r--README53
-rw-r--r--corpus/DZT/lib/DZT8.pm19
-rw-r--r--corpus/error1/dist.ini11
-rw-r--r--corpus/error1/lib/DZT0.pm6
-rw-r--r--corpus/error2/dist.ini10
-rw-r--r--corpus/error2/lib/DZT0.pm6
-rw-r--r--corpus/oDZT/dist.ini10
-rw-r--r--corpus/oDZT/lib/oDZT.pm24
-rw-r--r--corpus/semanticDZT/dist.ini10
-rw-r--r--corpus/semanticDZT/lib/semanticDZT.pm6
-rw-r--r--corpus/version_provider/dist.ini13
-rw-r--r--corpus/version_provider/lib/DZT0.pm6
-rw-r--r--dist.ini103
-rw-r--r--lib/Dist/Zilla/Plugin/OurPkgVersion.pm158
-rw-r--r--t/00-report-prereqs.dd17
-rw-r--r--t/01-basic.t24
-rw-r--r--t/06-overwrite.t51
-rw-r--r--t/07-semantic.t31
-rw-r--r--t/08-build_exceptions.t19
-rw-r--r--t/09-version_provider.t29
-rw-r--r--t/author-eol.t19
-rw-r--r--t/author-minimum-version.t4
-rw-r--r--t/author-pod-spell.t9
-rw-r--r--weaver.ini25
29 files changed, 738 insertions, 134 deletions
diff --git a/Changes b/Changes
index 7b42a1e..24070f1 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,25 @@
Revision history for Dist-Zilla-Plugin-OurPkgVersion
+0.20 2019-05-24
+ - Fix git deploy snafoo (plicease--)
+
+0.19 2019-05-24
+ - Fix regression related to version_provider plugins (gh#15, gh#16)
+
+0.18 2019-05-22
+ - Fix git deploy snafoo (plicease--)
+
+0.17 2019-05-22
+ - Fix prereqs: some developer prereqs were leaking into the list of test
+ prereqs (gh#13, gh#14)
+
+0.16 2019-05-21
+ - Add semantic_version option.
+
+0.15 2019-04-16
+ - Add overwrite option (gh#9, gh#10, nrdvana++)
+ - Require Dist::Zilla 6.00 and perl 5.14 (gh#5, gh#11)
+
0.14 2019-02-06
- Fix bug where nw underscore_eval_version may fail
- add skip_main_module option for compatibility with VersionFromMainModule
diff --git a/MANIFEST b/MANIFEST
index 6c98e8e..083eb5a 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -15,14 +15,26 @@ corpus/DZT/lib/DZT4.pm
corpus/DZT/lib/DZT5.pm
corpus/DZT/lib/DZT6.pm
corpus/DZT/lib/DZT7.pm
+corpus/DZT/lib/DZT8.pm
corpus/DZT/t/basic.t
corpus/eDZT/dist.ini
corpus/eDZT/lib/DZT0.pm
+corpus/error1/dist.ini
+corpus/error1/lib/DZT0.pm
+corpus/error2/dist.ini
+corpus/error2/lib/DZT0.pm
+corpus/oDZT/dist.ini
+corpus/oDZT/lib/oDZT.pm
corpus/sDZT/dist.ini
corpus/sDZT/lib/DZT0.pm
corpus/sDZT/lib/DZT1.pm
+corpus/semanticDZT/dist.ini
+corpus/semanticDZT/lib/semanticDZT.pm
corpus/vDZT/dist.ini
corpus/vDZT/lib/vDZT.pm
+corpus/version_provider/dist.ini
+corpus/version_provider/lib/DZT0.pm
+dist.ini
lib/Dist/Zilla/Plugin/OurPkgVersion.pm
maint/cip-before-install
perlcritic.rc
@@ -34,6 +46,10 @@ t/02-vstring.t
t/03-trial.t
t/04-underscore.t
t/05-skip_main_module.t
+t/06-overwrite.t
+t/07-semantic.t
+t/08-build_exceptions.t
+t/09-version_provider.t
t/author-critic.t
t/author-eol.t
t/author-minimum-version.t
@@ -49,3 +65,4 @@ t/release-distmeta.t
t/release-kwalitee.t
t/release-meta-json.t
t/release-unused-vars.t
+weaver.ini
diff --git a/META.json b/META.json
index 2f75e3e..167e3fd 100644
--- a/META.json
+++ b/META.json
@@ -30,6 +30,8 @@
},
"develop" : {
"requires" : {
+ "Perl::Critic::More" : "1.003",
+ "Perl::Critic::Pulp" : "96",
"Pod::Coverage::TrustPod" : "0",
"Test::CPAN::Changes" : "0.19",
"Test::CPAN::Meta" : "0",
@@ -41,7 +43,7 @@
"Test::More" : "0.88",
"Test::Perl::Critic" : "0",
"Test::Pod" : "1.41",
- "Test::Pod::Coverage" : "1.08",
+ "Test::Pod::Coverage" : "1.10",
"Test::Portability::Files" : "0",
"Test::Spelling" : "0.12",
"Test::Version" : "1"
@@ -49,8 +51,7 @@
},
"runtime" : {
"requires" : {
- "Carp" : "0",
- "Dist::Zilla" : "5.038",
+ "Dist::Zilla" : "6.00",
"Dist::Zilla::Role::FileFinderUser" : "0",
"Dist::Zilla::Role::FileMunger" : "0",
"Dist::Zilla::Role::PPI" : "0",
@@ -58,9 +59,7 @@
"MooseX::Types::Perl" : "0",
"PPI" : "0",
"namespace::autoclean" : "0",
- "perl" : "5.008",
- "strict" : "0",
- "warnings" : "0"
+ "perl" : "5.014"
}
},
"test" : {
@@ -68,13 +67,11 @@
"CPAN::Meta" : "2.120900"
},
"requires" : {
+ "Dist::Zilla::Role::VersionProvider" : "0",
"ExtUtils::MakeMaker" : "0",
- "File::Spec" : "0",
- "IO::Handle" : "0",
- "IPC::Open3" : "0",
"Path::Tiny" : "0",
"Test::DZil" : "0",
- "Test::More" : "0",
+ "Test::Exception" : "0",
"Test::Version" : "0.04"
}
}
@@ -91,8 +88,10 @@
"web" : "https://github.com/plicease/dist-zilla-plugin-ourpkgversion"
}
},
- "version" : "0.14",
+ "version" : "0.20",
"x_contributors" : [
+ "Alceu Rodrigues de Freitas Junior <alceu.junior@quintoandar.com.br>",
+ "Alceu Rodrigues de Freitas Junior <arfreitas@cpan.org>",
"Alexandr Ciornii <alexchorny@gmail.com>",
"Alexei Znamensky <russoz@cpan.org>",
"Christian Walde <walde.christian@googlemail.com>",
@@ -102,10 +101,11 @@
"Graham Ollis <plicease@cpan.org>",
"Graham\u2708\ufe0f\u2708\ufe0f <plicease@cpan.org>",
"Ian Sealy <git@iansealy.com>",
+ "Michael Conrad <mike@nrdvana.net>",
"Michael Jemmeson <mjemmeson@cpan.org>",
"Stephan Loyd <stephanloyd9@gmail.com>"
],
- "x_generated_by_perl" : "v5.26.2",
- "x_serialization_backend" : "Cpanel::JSON::XS version 4.08"
+ "x_generated_by_perl" : "v5.30.0",
+ "x_serialization_backend" : "Cpanel::JSON::XS version 4.11"
}
diff --git a/META.yml b/META.yml
index 2a90505..361aa56 100644
--- a/META.yml
+++ b/META.yml
@@ -4,13 +4,11 @@ author:
- 'Caleb Cushing <xenoterracide@gmail.com>'
- 'Grahan Ollis <plicease@cpan.org>'
build_requires:
+ Dist::Zilla::Role::VersionProvider: '0'
ExtUtils::MakeMaker: '0'
- File::Spec: '0'
- IO::Handle: '0'
- IPC::Open3: '0'
Path::Tiny: '0'
Test::DZil: '0'
- Test::More: '0'
+ Test::Exception: '0'
Test::Version: '0.04'
configure_requires:
ExtUtils::MakeMaker: '0'
@@ -27,8 +25,7 @@ no_index:
file:
- perlcritic.rc
requires:
- Carp: '0'
- Dist::Zilla: '5.038'
+ Dist::Zilla: '6.00'
Dist::Zilla::Role::FileFinderUser: '0'
Dist::Zilla::Role::FileMunger: '0'
Dist::Zilla::Role::PPI: '0'
@@ -36,15 +33,15 @@ requires:
MooseX::Types::Perl: '0'
PPI: '0'
namespace::autoclean: '0'
- perl: '5.008'
- strict: '0'
- warnings: '0'
+ perl: '5.014'
resources:
bugtracker: https://github.com/plicease/dist-zilla-plugin-ourpkgversion/issues
homepage: https://metacpan.org/dist/Dist-Zilla-Plugin-OurPkgVersion
repository: git://github.com/plicease/dist-zilla-plugin-ourpkgversion.git
-version: '0.14'
+version: '0.20'
x_contributors:
+ - 'Alceu Rodrigues de Freitas Junior <alceu.junior@quintoandar.com.br>'
+ - 'Alceu Rodrigues de Freitas Junior <arfreitas@cpan.org>'
- 'Alexandr Ciornii <alexchorny@gmail.com>'
- 'Alexei Znamensky <russoz@cpan.org>'
- 'Christian Walde <walde.christian@googlemail.com>'
@@ -54,7 +51,8 @@ x_contributors:
- 'Graham Ollis <plicease@cpan.org>'
- 'Graham✈️✈️ <plicease@cpan.org>'
- 'Ian Sealy <git@iansealy.com>'
+ - 'Michael Conrad <mike@nrdvana.net>'
- 'Michael Jemmeson <mjemmeson@cpan.org>'
- 'Stephan Loyd <stephanloyd9@gmail.com>'
-x_generated_by_perl: v5.26.2
+x_generated_by_perl: v5.30.0
x_serialization_backend: 'YAML::Tiny version 1.73'
diff --git a/Makefile.PL b/Makefile.PL
index cd34459..4f7dab5 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,74 +1,96 @@
-# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012.
+BEGIN {
+ use strict; use warnings;
+ unless(eval q{ use 5.014; 1}) {
+ print "Perl 5.014 or better required\n";
+ exit;
+ }
+}
+BEGIN {
+ use strict; use warnings;
+ my %missing = map {
+ eval qq{ require $_ };
+ $@ ? ($_=>1) : ()
+ } qw( Carp File::Spec IO::Handle IPC::Open3 Test::More strict warnings );
+ if(%missing)
+ {
+ print "Your Perl is missing core modules: @{[ sort keys %missing ]}\n";
+ print "Ideally if you are using the system Perl you can install the appropriate\n";
+ print "package which includes the core Perl modules. On at least some versions\n";
+ print "of Fedora, CentOS and RHEL, this is the `perl-core` package.\n";
+ print "\n";
+ print " % dnf install perl-core\n";
+ print " ~ or ~\n";
+ print " % yum install perl-core\n";
+ print "\n";
+ print "If you really want to install dual-life modules from CPAN, then you can\n";
+ print "use cpanm:\n";
+ print "\n";
+ print " % cpanm @{[ sort keys %missing ]}\n";
+ print "\n";
+ print "Note that some core modules are not available from CPAN.\n";
+ exit;
+ }
+}
+# This file was automatically generated by Dist::Zilla::Plugin::Author::Plicease::MakeMaker v2.36.
use strict;
use warnings;
-
-use 5.008;
-
+use 5.014;
use ExtUtils::MakeMaker;
my %WriteMakefileArgs = (
- "ABSTRACT" => "No line insertion and does Package version with our",
- "AUTHOR" => "Caleb Cushing <xenoterracide\@gmail.com>, Grahan Ollis <plicease\@cpan.org>",
+ "ABSTRACT" => "No line insertion and does Package version with our",
+ "AUTHOR" => "Caleb Cushing <xenoterracide\@gmail.com>, Grahan Ollis <plicease\@cpan.org>",
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0
},
- "DISTNAME" => "Dist-Zilla-Plugin-OurPkgVersion",
- "LICENSE" => "artistic_2",
- "MIN_PERL_VERSION" => "5.008",
- "NAME" => "Dist::Zilla::Plugin::OurPkgVersion",
+ "DISTNAME" => "Dist-Zilla-Plugin-OurPkgVersion",
+ "LICENSE" => "artistic_2",
+ "MIN_PERL_VERSION" => "5.014",
+ "NAME" => "Dist::Zilla::Plugin::OurPkgVersion",
+ "PM" => {
+ "lib/Dist/Zilla/Plugin/OurPkgVersion.pm" => "\$(INST_LIB)/Dist/Zilla/Plugin/OurPkgVersion.pm"
+ },
"PREREQ_PM" => {
- "Carp" => 0,
- "Dist::Zilla" => "5.038",
+ "Dist::Zilla" => "6.00",
"Dist::Zilla::Role::FileFinderUser" => 0,
- "Dist::Zilla::Role::FileMunger" => 0,
- "Dist::Zilla::Role::PPI" => 0,
- "Moose" => 0,
- "MooseX::Types::Perl" => 0,
- "PPI" => 0,
- "namespace::autoclean" => 0,
- "strict" => 0,
- "warnings" => 0
+ "Dist::Zilla::Role::FileMunger" => 0,
+ "Dist::Zilla::Role::PPI" => 0,
+ "Moose" => 0,
+ "MooseX::Types::Perl" => 0,
+ "PPI" => 0,
+ "namespace::autoclean" => 0
},
"TEST_REQUIRES" => {
- "ExtUtils::MakeMaker" => 0,
- "File::Spec" => 0,
- "IO::Handle" => 0,
- "IPC::Open3" => 0,
- "Path::Tiny" => 0,
- "Test::DZil" => 0,
- "Test::More" => 0,
- "Test::Version" => "0.04"
+ "Dist::Zilla::Role::VersionProvider" => 0,
+ "ExtUtils::MakeMaker" => 0,
+ "Path::Tiny" => 0,
+ "Test::DZil" => 0,
+ "Test::Exception" => 0,
+ "Test::Version" => "0.04"
},
- "VERSION" => "0.14",
- "test" => {
+ "VERSION" => "0.20",
+ "test" => {
"TESTS" => "t/*.t"
}
);
-
my %FallbackPrereqs = (
- "Carp" => 0,
- "Dist::Zilla" => "5.038",
- "Dist::Zilla::Role::FileFinderUser" => 0,
- "Dist::Zilla::Role::FileMunger" => 0,
- "Dist::Zilla::Role::PPI" => 0,
- "ExtUtils::MakeMaker" => 0,
- "File::Spec" => 0,
- "IO::Handle" => 0,
- "IPC::Open3" => 0,
- "Moose" => 0,
- "MooseX::Types::Perl" => 0,
- "PPI" => 0,
- "Path::Tiny" => 0,
- "Test::DZil" => 0,
- "Test::More" => 0,
- "Test::Version" => "0.04",
- "namespace::autoclean" => 0,
- "strict" => 0,
- "warnings" => 0
+ "Dist::Zilla" => "6.00",
+ "Dist::Zilla::Role::FileFinderUser" => 0,
+ "Dist::Zilla::Role::FileMunger" => 0,
+ "Dist::Zilla::Role::PPI" => 0,
+ "Dist::Zilla::Role::VersionProvider" => 0,
+ "ExtUtils::MakeMaker" => 0,
+ "Moose" => 0,
+ "MooseX::Types::Perl" => 0,
+ "PPI" => 0,
+ "Path::Tiny" => 0,
+ "Test::DZil" => 0,
+ "Test::Exception" => 0,
+ "Test::Version" => "0.04",
+ "namespace::autoclean" => 0
);
-
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
delete $WriteMakefileArgs{TEST_REQUIRES};
delete $WriteMakefileArgs{BUILD_REQUIRES};
@@ -78,4 +100,4 @@ unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
-WriteMakefile(%WriteMakefileArgs);
+WriteMakefile(%WriteMakefileArgs); \ No newline at end of file
diff --git a/README b/README
index b870d2c..a93bd05 100644
--- a/README
+++ b/README
@@ -5,7 +5,7 @@ NAME
VERSION
- version 0.14
+ version 0.20
SYNOPSIS
@@ -119,6 +119,10 @@ DESCRIPTION
METHODS
+ BUILD
+
+ Provides validations after object creation.
+
munge_files
Override the default provided by Dist::Zilla::Role::FileMunger to
@@ -127,7 +131,7 @@ METHODS
munge_file
- tells which files to munge, see Dist::Zilla::Role::FileMunger
+ tells which files to munge, see Dist::Zilla::Role::FileMunger.
finder
@@ -144,11 +148,28 @@ PROPERTIES
For version numbers that have an underscore in them, add this line
immediately after the our version assignment:
- $VERSION = eval $VERSION;
+ $VERSION = eval $VERSION;
This is arguably the correct thing to do, but changes the line
numbering of the generated Perl module or source, and thus optional.
+ semantic_version
+
+ Setting this property to "true" (1) will set the version of the
+ module/distribution to properly use semantic versioning. It will also
+ expect that you setup version with a v-string, without adding quotes.
+ For example:
+
+ version = v0.0.1
+
+ Beware you can't setup both underscore_eval_version and
+ semantic_version since both are mutually exclusive: if you try, your
+ code is going to die.
+
+ For more details, check this blog
+ <https://weblog.bulknews.net/how-to-correctly-use-semantic-version-vx-y-z-in-perl-modules-eb08568ab911>
+ for more details about using semantic version with Perl.
+
skip_main_module
Set to true to ignore the main module in the distribution. This
@@ -156,6 +177,16 @@ PROPERTIES
Dist::Zilla::Plugin::VersionFromMainModule to obtain the version
number instead of the dist.ini file.
+ overwrite
+
+ When enabled, this option causes any match of the # VERSION comment
+ to first check for an existing our $VERSION = ...; on the same line,
+ and if found, overwrite the value in the existing statement. (the
+ comment still gets modified for trial releases)
+
+ Currently, the value must be a single Perl token such as a string or
+ number.
+
BUGS
Please report any bugs or feature requests on the bugtracker website
@@ -166,10 +197,20 @@ BUGS
CONTRIBUTORS
- * Alexandr Ciornii <alexchorny@gmail.com>
+ * Alceu Rodrigues de Freitas Junior <alceu.junior@quintoandar.com.br>
+
+ * Ian Sealy <git@iansealy.com>
+
+ * Michael Conrad <mike@nrdvana.net>
+
+ * Michael Jemmeson <mjemmeson@cpan.org>
* Stephan Loyd <stephanloyd9@gmail.com>
+ * Alceu Rodrigues de Freitas Junior <arfreitas@cpan.org>
+
+ * Alexandr Ciornii <alexchorny@gmail.com>
+
* Alexei Znamensky <russoz@cpan.org>
* Christian Walde <walde.christian@googlemail.com>
@@ -184,10 +225,6 @@ CONTRIBUTORS
* Graham✈️✈️ <plicease@cpan.org>
- * Ian Sealy <git@iansealy.com>
-
- * Michael Jemmeson <mjemmeson@cpan.org>
-
AUTHORS
* Caleb Cushing <xenoterracide@gmail.com>
diff --git a/corpus/DZT/lib/DZT8.pm b/corpus/DZT/lib/DZT8.pm
new file mode 100644
index 0000000..e5fa730
--- /dev/null
+++ b/corpus/DZT/lib/DZT8.pm
@@ -0,0 +1,19 @@
+use strict;
+use warnings;
+package DZT8;
+<<END
+# VERSION
+END
+
+=pod
+
+# VERSION
+
+=cut
+
+our $VERSION = ''; # VERSION
+
+1;
+__END__
+
+# VERSION
diff --git a/corpus/error1/dist.ini b/corpus/error1/dist.ini
new file mode 100644
index 0000000..97f46ad
--- /dev/null
+++ b/corpus/error1/dist.ini
@@ -0,0 +1,11 @@
+name = semanticDZT
+author = Caleb Cushing <xenoterracide@gmail.com>
+license = Artistic_2_0
+version = v0.0.1
+copyright_holder = Caleb Cushing
+
+[@Basic]
+
+[OurPkgVersion]
+semantic_version = 1
+underscore_eval_version = 1
diff --git a/corpus/error1/lib/DZT0.pm b/corpus/error1/lib/DZT0.pm
new file mode 100644
index 0000000..aaf71c8
--- /dev/null
+++ b/corpus/error1/lib/DZT0.pm
@@ -0,0 +1,6 @@
+use strict;
+use warnings;
+package DZT0;
+# VERSION
+# ABSTRACT: my abstract
+1;
diff --git a/corpus/error2/dist.ini b/corpus/error2/dist.ini
new file mode 100644
index 0000000..639c03f
--- /dev/null
+++ b/corpus/error2/dist.ini
@@ -0,0 +1,10 @@
+name = semanticDZT
+author = Caleb Cushing <xenoterracide@gmail.com>
+license = Artistic_2_0
+version = v0.0;1
+copyright_holder = Caleb Cushing
+
+[@Basic]
+
+[OurPkgVersion]
+semantic_version = 1
diff --git a/corpus/error2/lib/DZT0.pm b/corpus/error2/lib/DZT0.pm
new file mode 100644
index 0000000..aaf71c8
--- /dev/null
+++ b/corpus/error2/lib/DZT0.pm
@@ -0,0 +1,6 @@
+use strict;
+use warnings;
+package DZT0;
+# VERSION
+# ABSTRACT: my abstract
+1;
diff --git a/corpus/oDZT/dist.ini b/corpus/oDZT/dist.ini
new file mode 100644
index 0000000..cdaefb0
--- /dev/null
+++ b/corpus/oDZT/dist.ini
@@ -0,0 +1,10 @@
+name = oDZT
+author = Caleb Cushing <xenoterracide@gmail.com>
+license = Artistic_2_0
+version = v0.1.0
+copyright_holder = Caleb Cushing
+
+[@Basic]
+
+[OurPkgVersion]
+overwrite = 1
diff --git a/corpus/oDZT/lib/oDZT.pm b/corpus/oDZT/lib/oDZT.pm
new file mode 100644
index 0000000..4606340
--- /dev/null
+++ b/corpus/oDZT/lib/oDZT.pm
@@ -0,0 +1,24 @@
+use strict;
+use warnings;
+package oDZT;
+# ABSTRACT: lots of false leads here
+<<END
+# VERSION
+END
+
+=pod
+
+# VERSION
+
+=cut
+
+our $VERSION = ''; # VERSION
+
+BEGIN { our $VERSION= 0; } # VERSION
+
+our $FOO = 1; our $VERSION=0; our $BAR = 2; # VERSION
+
+1;
+__END__
+
+# VERSION
diff --git a/corpus/semanticDZT/dist.ini b/corpus/semanticDZT/dist.ini
new file mode 100644
index 0000000..1c72b30
--- /dev/null
+++ b/corpus/semanticDZT/dist.ini
@@ -0,0 +1,10 @@
+name = semanticDZT
+author = Caleb Cushing <xenoterracide@gmail.com>
+license = Artistic_2_0
+version = v0.0.1
+copyright_holder = Caleb Cushing
+
+[@Basic]
+
+[OurPkgVersion]
+semantic_version = 1
diff --git a/corpus/semanticDZT/lib/semanticDZT.pm b/corpus/semanticDZT/lib/semanticDZT.pm
new file mode 100644
index 0000000..add3fe9
--- /dev/null
+++ b/corpus/semanticDZT/lib/semanticDZT.pm
@@ -0,0 +1,6 @@
+package semanticDZT;
+use warnings;
+use strict;
+# VERSION
+# ABSTRACT: my abstract
+1;
diff --git a/corpus/version_provider/dist.ini b/corpus/version_provider/dist.ini
new file mode 100644
index 0000000..6138e0d
--- /dev/null
+++ b/corpus/version_provider/dist.ini
@@ -0,0 +1,13 @@
+name = DZT0
+author = Caleb Cushing <xenoterracide@gmail.com>
+license = Artistic_2_0
+copyright_holder = Caleb Cushing
+release_status = testing
+
+[@Filter]
+-bundle = @Basic
+-remove = Readme
+
+[OurPkgVersion]
+
+[MyVersionProvider]
diff --git a/corpus/version_provider/lib/DZT0.pm b/corpus/version_provider/lib/DZT0.pm
new file mode 100644
index 0000000..aaf71c8
--- /dev/null
+++ b/corpus/version_provider/lib/DZT0.pm
@@ -0,0 +1,6 @@
+use strict;
+use warnings;
+package DZT0;
+# VERSION
+# ABSTRACT: my abstract
+1;
diff --git a/dist.ini b/dist.ini
new file mode 100644
index 0000000..6b34ebe
--- /dev/null
+++ b/dist.ini
@@ -0,0 +1,103 @@
+name = Dist-Zilla-Plugin-OurPkgVersion
+author = Caleb Cushing <xenoterracide@gmail.com>
+author = Grahan Ollis <plicease@cpan.org>
+version = 0.20
+license = Artistic_2_0
+copyright_holder = Caleb Cushing
+
+; authordep Dist::Zilla::Plugin::ContributorsFromGit
+; authordep Pod::Weaver::Section::Contributors
+; authordep Test::EOL
+
+[ReadmeAnyFromPod]
+type = text
+filename = README
+location = build
+
+[ReadmeAnyFromPod / ReadMePodInRoot]
+type = markdown
+filename = README.md
+location = root
+
+; begin: [@Basic] - Readme, s/MakeMaker/Author::Plicease::MakeMaker/;
+; s/UploadToCPAN/Author::Plicease::Upload/;
+[GatherDir]
+[PruneCruft]
+[ManifestSkip]
+[MetaYAML]
+[License]
+[ExecDir]
+[ShareDir]
+[Author::Plicease::MakeMaker]
+[Manifest]
+[TestRelease]
+[ConfirmRelease]
+[Author::Plicease::Upload]
+cpan = 1
+; end
+
+[AutoPrereqs]
+[Prereqs]
+Dist::Zilla = 6.00
+Dist::Zilla::Role::FileMunger = 0
+Dist::Zilla::Role::FileFinderUser = 0
+
+[Prereqs / TestRequires]
+Test::Version = 0.04
+
+[Prereqs / DevelopRequires]
+Test::Pod::Coverage = 1.10
+Perl::Critic::More = 1.003
+Perl::Critic::Pulp = 96
+
+[OurPkgVersion]
+[PodWeaver]
+
+[AutoMetaResources]
+homepage = https://metacpan.org/dist/%{dist}
+bugtracker.github = user:plicease
+repository.github = user:plicease
+
+[MetaNoIndex]
+directory = corpus
+file = perlcritic.rc
+
+[MetaJSON]
+
+[NextRelease]
+format = %-9v %{yyyy-MM-dd}d
+
+[Test::ReportPrereqs]
+
+[@TestingMania]
+disable = NoTabsTests,Test::Synopsis,Test::Compile,Test::Pod::LinkCheck
+
+[Test::Compile]
+:version = 2.033
+[ExtraTests]
+
+[Test::PodSpelling]
+stopwords = SubmittingPatches
+stopwords = dzil
+stopwords = OurPkgVersion
+stopwords = ini
+stopwords = executables
+stopwords = perltidy
+stopwords = FileFinder
+
+[@Git]
+tag_format = %v
+tag_message = %v
+commit_msg = %v%n%n%c
+allow_dirty = README.md
+allow_dirty = Changes
+allow_dirty = dist.ini
+
+[ContributorsFromGit]
+
+[CheckChangesHasContent]
+
+[Author::Plicease::Core]
+[Author::Plicease::MarkDownCleanup]
+travis_status = 1
+[Author::Plicease::SpecialPrereqs]
diff --git a/lib/Dist/Zilla/Plugin/OurPkgVersion.pm b/lib/Dist/Zilla/Plugin/OurPkgVersion.pm
index 00b7409..0f531ac 100644
--- a/lib/Dist/Zilla/Plugin/OurPkgVersion.pm
+++ b/lib/Dist/Zilla/Plugin/OurPkgVersion.pm
@@ -1,9 +1,9 @@
package Dist::Zilla::Plugin::OurPkgVersion;
-use 5.008;
+use 5.014;
use strict;
use warnings;
-our $VERSION = '0.14'; # VERSION
+our $VERSION = '0.20'; # VERSION
use Moose;
with (
@@ -24,13 +24,25 @@ use namespace::autoclean;
has underscore_eval_version => (
is => 'ro',
- isa => 'Int',
+ isa => 'Bool',
+ default => 0,
+);
+
+has semantic_version => (
+ is => 'ro',
+ isa => 'Bool',
default => 0,
);
has skip_main_module => (
is => 'ro',
- isa => 'Int',
+ isa => 'Bool',
+ default => 0,
+);
+
+has overwrite => (
+ is => 'ro',
+ isa => 'Bool',
default => 0,
);
@@ -44,6 +56,16 @@ sub munge_files {
return;
}
+sub BUILD {
+ my $self = shift;
+
+ if ($self->underscore_eval_version && $self->semantic_version) {
+ confess 'You cannot setup both underscore_eval_version and semantic_version';
+ }
+
+ return 1;
+}
+
sub munge_file {
my ( $self, $file ) = @_;
@@ -61,12 +83,13 @@ sub munge_file {
return unless defined $doc;
+ $doc->index_locations if $self->overwrite; # optimize calls to check line numbers
my $comments = $doc->find('PPI::Token::Comment');
my $version_regex
= q{
^
- (\s*) # capture all whitespace before comment
+ (\s*) # capture leading whitespace for whole-line comments
(
\#\#?\s*VERSION # capture # VERSION or ## VERSION
\b # and ensure it ends on a word boundary
@@ -82,18 +105,40 @@ sub munge_file {
if ( ref($comments) eq 'ARRAY' ) {
foreach ( @{ $comments } ) {
if ( /$version_regex/xms ) {
- my ( $ws, $comment ) = ( $1, $2 );
+ my ( $ws, $comment ) = ( $1, $2 );
$comment =~ s/(?=\bVERSION\b)/TRIAL /x if $self->zilla->is_trial;
my $code
- = "$ws"
- . q{our $VERSION = '}
+ = "$ws"
+ . q{our $VERSION = '}
. $version
. qq{'; $comment}
;
+
+ if ( $self->semantic_version ) {
+ confess 'Invalid semantic version syntax declaration in INI file' unless ( $version =~ /^v\d+\.\d+\.\d+$/x );
+ $code = "use version;\n" . $code;
+ }
+
+ # If the comment is not a whole-line comment, and if the user wants to overwrite
+ # existing "our $VERSION=...;", then find the other tokens from this line, looking
+ # for our $VERSION = $VALUE. If found, edit only the VALUE.
+ if ( $self->overwrite && !$_->line ) {
+ my $line_no = $_->line_number;
+ my $nodes = $doc->find( sub { $_[1]->line_number == $line_no } );
+ my $version_value_token = $nodes && $self->_identify_version_value_token(@$nodes);
+ if ( $version_value_token ) {
+ $version_value_token->set_content(qq{'$version'});
+ $code = $ws . $comment;
+ $munged_version++;
+ }
+ }
+
if ( $version =~ /_/ && $self->underscore_eval_version ) {
- $code.= "\$VERSION = eval \$VERSION;\n";
+ my $eval = "\$VERSION = eval \$VERSION;";
+ $code .= $_->line? "$eval\n" : "\n$eval";
}
- $_->set_content("$code");
+
+ $_->set_content($code);
$munged_version++;
}
}
@@ -111,6 +156,33 @@ sub munge_file {
}
return;
}
+
+sub _identify_version_value_token {
+ my ( $self, @tokens ) = @_;
+ my $val_tok;
+ my @want = ('our', '$VERSION', '=', undef, ';');
+ my $i = 0;
+ for ( @tokens ) {
+ next if $_->isa('PPI::Token::Whitespace');
+ # If the next thing we want is "undef", this is where we capture the value token.
+ if (!defined $want[$i]) {
+ $val_tok = $_;
+ ++$i;
+ }
+ # Else if the token matches the current step in the sequence, advance the sequence
+ # If sequence completely matched, return.
+ elsif ($want[$i] eq $_->content) {
+ ++$i;
+ return $val_tok if $i >= $#want;
+ }
+ # A mismatch restarts the search
+ elsif ($i) {
+ $i = 0;
+ }
+ }
+ return; # no match
+}
+
__PACKAGE__->meta->make_immutable;
1;
# ABSTRACT: No line insertion and does Package version with our
@@ -125,7 +197,7 @@ Dist::Zilla::Plugin::OurPkgVersion - No line insertion and does Package version
=head1 VERSION
-version 0.14
+version 0.20
=head1 SYNOPSIS
@@ -242,6 +314,10 @@ becomes
=over
+=item BUILD
+
+Provides validations after object creation.
+
=item munge_files
Override the default provided by L<Dist::Zilla::Role::FileMunger> to limit
@@ -249,7 +325,7 @@ the number of files to search to only be modules and executables.
=item munge_file
-tells which files to munge, see L<Dist::Zilla::Role::FileMunger>
+tells which files to munge, see L<Dist::Zilla::Role::FileMunger>.
=item finder
@@ -270,17 +346,41 @@ files are properly marked as executables for the installer.
For version numbers that have an underscore in them, add this line
immediately after the our version assignment:
- $VERSION = eval $VERSION;
+ $VERSION = eval $VERSION;
This is arguably the correct thing to do, but changes the line numbering
of the generated Perl module or source, and thus optional.
+=item semantic_version
+
+Setting this property to "true" (1) will set the version of the
+module/distribution to properly use semantic versioning. It will also expect
+that you setup C<version> with a v-string, without adding quotes. For example:
+
+ version = v0.0.1
+
+Beware you can't setup both C<underscore_eval_version> and C<semantic_version>
+since both are mutually exclusive: if you try, your code is going to C<die>.
+
+For more details, check
+L<this blog|https://weblog.bulknews.net/how-to-correctly-use-semantic-version-vx-y-z-in-perl-modules-eb08568ab911>
+for more details about using semantic version with Perl.
+
=item skip_main_module
Set to true to ignore the main module in the distribution. This prevents
a warning when using L<Dist::Zilla::Plugin::VersionFromMainModule> to
obtain the version number instead of the C<dist.ini> file.
+=item overwrite
+
+When enabled, this option causes any match of the C<< # VERSION >> comment
+to first check for an existing C<< our $VERSION = ...; >> on the same line,
+and if found, overwrite the value in the existing statement. (the comment
+still gets modified for trial releases)
+
+Currently, the value must be a single Perl token such as a string or number.
+
=back
=head1 BUGS
@@ -294,13 +394,25 @@ feature.
=head1 CONTRIBUTORS
-=for stopwords Alexandr Ciornii Stephan Loyd Alexei Znamensky Christian Walde Christopher J. Madsen David Golden Graham Ollis Graham✈️✈️ Ian Sealy Michael Jemmeson
+=for stopwords Alceu Rodrigues de Freitas Junior Ian Sealy Michael Conrad Jemmeson Stephan Loyd Alexandr Ciornii Alexei Znamensky Christian Walde Christopher J. Madsen David Golden Graham Ollis Graham✈️✈️
=over 4
=item *
-Alexandr Ciornii <alexchorny@gmail.com>
+Alceu Rodrigues de Freitas Junior <alceu.junior@quintoandar.com.br>
+
+=item *
+
+Ian Sealy <git@iansealy.com>
+
+=item *
+
+Michael Conrad <mike@nrdvana.net>
+
+=item *
+
+Michael Jemmeson <mjemmeson@cpan.org>
=item *
@@ -308,6 +420,14 @@ Stephan Loyd <stephanloyd9@gmail.com>
=item *
+Alceu Rodrigues de Freitas Junior <arfreitas@cpan.org>
+
+=item *
+
+Alexandr Ciornii <alexchorny@gmail.com>
+
+=item *
+
Alexei Znamensky <russoz@cpan.org>
=item *
@@ -334,14 +454,6 @@ Graham Ollis <plicease@cpan.org>
Graham✈️✈️ <plicease@cpan.org>
-=item *
-
-Ian Sealy <git@iansealy.com>
-
-=item *
-
-Michael Jemmeson <mjemmeson@cpan.org>
-
=back
=head1 AUTHORS
diff --git a/t/00-report-prereqs.dd b/t/00-report-prereqs.dd
index 7d77604..a85dd1e 100644
--- a/t/00-report-prereqs.dd
+++ b/t/00-report-prereqs.dd
@@ -6,6 +6,8 @@ do { my $x = {
},
'develop' => {
'requires' => {
+ 'Perl::Critic::More' => '1.003',
+ 'Perl::Critic::Pulp' => '96',
'Pod::Coverage::TrustPod' => '0',
'Test::CPAN::Changes' => '0.19',
'Test::CPAN::Meta' => '0',
@@ -17,7 +19,7 @@ do { my $x = {
'Test::More' => '0.88',
'Test::Perl::Critic' => '0',
'Test::Pod' => '1.41',
- 'Test::Pod::Coverage' => '1.08',
+ 'Test::Pod::Coverage' => '1.10',
'Test::Portability::Files' => '0',
'Test::Spelling' => '0.12',
'Test::Version' => '1'
@@ -25,8 +27,7 @@ do { my $x = {
},
'runtime' => {
'requires' => {
- 'Carp' => '0',
- 'Dist::Zilla' => '5.038',
+ 'Dist::Zilla' => '6.00',
'Dist::Zilla::Role::FileFinderUser' => '0',
'Dist::Zilla::Role::FileMunger' => '0',
'Dist::Zilla::Role::PPI' => '0',
@@ -34,9 +35,7 @@ do { my $x = {
'MooseX::Types::Perl' => '0',
'PPI' => '0',
'namespace::autoclean' => '0',
- 'perl' => '5.008',
- 'strict' => '0',
- 'warnings' => '0'
+ 'perl' => '5.014'
}
},
'test' => {
@@ -44,13 +43,11 @@ do { my $x = {
'CPAN::Meta' => '2.120900'
},
'requires' => {
+ 'Dist::Zilla::Role::VersionProvider' => '0',
'ExtUtils::MakeMaker' => '0',
- 'File::Spec' => '0',
- 'IO::Handle' => '0',
- 'IPC::Open3' => '0',
'Path::Tiny' => '0',
'Test::DZil' => '0',
- 'Test::More' => '0',
+ 'Test::Exception' => '0',
'Test::Version' => '0.04'
}
}
diff --git a/t/01-basic.t b/t/01-basic.t
index bc96bc9..43cc0eb 100644
--- a/t/01-basic.t
+++ b/t/01-basic.t
@@ -21,6 +21,7 @@ my $lib_4 = $tzil->slurp_file('build/lib/DZT4.pm');
my $lib_5 = $tzil->slurp_file('build/lib/DZT5.pm');
my $lib_6 = $tzil->slurp_file('build/lib/DZT6.pm');
my $lib_7 = $tzil->slurp_file('build/lib/DZT7.pm');
+my $lib_8 = $tzil->slurp_file('build/lib/DZT8.pm');
my $tst_0 = $tzil->slurp_file('build/t/basic.t' );
# e short for expected files
@@ -95,6 +96,28 @@ our $VERSION = '0.1.0'; ## VERSION
1;
END LIB7
+my $elib_8 = <<'END LIB8';
+use strict;
+use warnings;
+package DZT8;
+<<END
+# VERSION
+END
+
+=pod
+
+# VERSION
+
+=cut
+
+our $VERSION = ''; our $VERSION = '0.1.0'; # VERSION
+
+1;
+__END__
+
+# VERSION
+END LIB8
+
my $etst_0 = <<'END TST0';
#!/usr/bin/perl
# VERSION
@@ -109,6 +132,7 @@ is ( $lib_4, $elib_4, 'check DZT4.pm' );
is ( $lib_5, $elib_5, 'check DZT5.pm' );
is ( $lib_6, $elib_6, 'check DZT6.pm' );
is ( $lib_7, $elib_7, 'check DZT7.pm' );
+is ( $lib_8, $elib_8, 'check DZT8.pm' );
is ( $tst_0, $etst_0, 'check basic.t' );
for my $file ( qw/DZT2 DZT3/ ) {
diff --git a/t/06-overwrite.t b/t/06-overwrite.t
new file mode 100644
index 0000000..62847fe
--- /dev/null
+++ b/t/06-overwrite.t
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Test::More;
+use Test::DZil;
+use Test::Version qw( version_ok );
+use Path::Tiny qw( path );
+
+my $tzil = Builder->from_config({ dist_root => 'corpus/oDZT' });
+
+$tzil->build;
+
+version_ok( path($tzil->tempdir)->child('build/lib/oDZT.pm'));
+
+my $lib_0 = $tzil->slurp_file('build/lib/oDZT.pm');
+
+# e short for expected files
+# -------------------------------------------------------------------
+
+my $elib_0 = <<'END LIB8';
+use strict;
+use warnings;
+package oDZT;
+# ABSTRACT: lots of false leads here
+<<END
+# VERSION
+END
+
+=pod
+
+# VERSION
+
+=cut
+
+our $VERSION = 'v0.1.0'; # VERSION
+
+BEGIN { our $VERSION= 'v0.1.0'; } # VERSION
+
+our $FOO = 1; our $VERSION='v0.1.0'; our $BAR = 2; # VERSION
+
+1;
+__END__
+
+# VERSION
+END LIB8
+
+# -------------------------------------------------------------------
+
+is ( $lib_0, $elib_0, 'check oDZT.pm' );
+
+done_testing;
diff --git a/t/07-semantic.t b/t/07-semantic.t
new file mode 100644
index 0000000..def6bec
--- /dev/null
+++ b/t/07-semantic.t
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use Test::More;
+use Test::DZil;
+use Test::Version qw( version_ok );
+use Path::Tiny qw( path );
+
+my $package = 'semanticDZT';
+my $module = "$package.pm";
+my $tzil = Builder->from_config( { dist_root => "corpus/$package" } );
+$tzil->build;
+version_ok( path( $tzil->tempdir )->child("build/lib/$module") );
+my $lib_0 = $tzil->slurp_file("build/lib/$module");
+
+# e short for expected files
+# -------------------------------------------------------------------
+my $elib_0 = <<"END LIB0";
+package $package;
+use warnings;
+use strict;
+use version;
+our \$VERSION = 'v0.0.1'; # VERSION
+# ABSTRACT: my abstract
+1;
+END LIB0
+
+# -------------------------------------------------------------------
+
+is( $lib_0, $elib_0, "check $module" );
+done_testing;
diff --git a/t/08-build_exceptions.t b/t/08-build_exceptions.t
new file mode 100644
index 0000000..c5b27ca
--- /dev/null
+++ b/t/08-build_exceptions.t
@@ -0,0 +1,19 @@
+use strict;
+use warnings;
+use Test::More;
+use Test::Exception;
+use Test::DZil;
+
+my $package = 'error1';
+my $module = "$package.pm";
+
+dies_ok { Builder->from_config( { dist_root => "corpus/$package" } ) }
+'cannot use both underscore_eval_version and semantic_version attributes';
+
+$package = 'error2';
+$module = "$package.pm";
+
+dies_ok { Builder->from_config( { dist_root => "corpus/$package" } ) }
+'rejects invalid version number';
+
+done_testing;
diff --git a/t/09-version_provider.t b/t/09-version_provider.t
new file mode 100644
index 0000000..66c54dd
--- /dev/null
+++ b/t/09-version_provider.t
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use 5.014;
+use Test::More;
+use Test::DZil;
+use Test::Version qw( version_ok );
+use Path::Tiny qw( path );
+
+package Dist::Zilla::Plugin::MyVersionProvider {
+
+ use Moose;
+ with 'Dist::Zilla::Role::VersionProvider';
+
+ sub provide_version
+ {
+ '1.00';
+ }
+
+}
+
+my $tzil = Builder->from_config({ dist_root => 'corpus/version_provider' });
+
+$tzil->build;
+
+version_ok( path($tzil->tempdir)->child('build/lib/DZT0.pm'));
+
+done_testing;
+
diff --git a/t/author-eol.t b/t/author-eol.t
index a0645c0..667191f 100644
--- a/t/author-eol.t
+++ b/t/author-eol.t
@@ -24,21 +24,10 @@ my @files = (
't/03-trial.t',
't/04-underscore.t',
't/05-skip_main_module.t',
- 't/author-critic.t',
- 't/author-eol.t',
- 't/author-minimum-version.t',
- 't/author-mojibake.t',
- 't/author-pod-coverage.t',
- 't/author-pod-spell.t',
- 't/author-pod-syntax.t',
- 't/author-portability.t',
- 't/author-test-version.t',
- 't/release-cpan-changes.t',
- 't/release-dist-manifest.t',
- 't/release-distmeta.t',
- 't/release-kwalitee.t',
- 't/release-meta-json.t',
- 't/release-unused-vars.t'
+ 't/06-overwrite.t',
+ 't/07-semantic.t',
+ 't/08-build_exceptions.t',
+ 't/09-version_provider.t'
);
eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files;
diff --git a/t/author-minimum-version.t b/t/author-minimum-version.t
index db99747..db391de 100644
--- a/t/author-minimum-version.t
+++ b/t/author-minimum-version.t
@@ -1,4 +1,3 @@
-#!perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
@@ -7,8 +6,9 @@ BEGIN {
}
}
+use strict;
+use warnings;
use Test::More;
-
use Test::MinimumVersion;
all_minimum_version_from_metayml_ok();
diff --git a/t/author-pod-spell.t b/t/author-pod-spell.t
index 83fca58..553a65e 100644
--- a/t/author-pod-spell.t
+++ b/t/author-pod-spell.t
@@ -18,40 +18,49 @@ use Pod::Wordlist;
add_stopwords(<DATA>);
all_pod_files_spelling_ok( qw( bin lib ) );
__DATA__
+Alceu
Alexandr
Alexei
Caleb
Christian
Christopher
Ciornii
+Conrad
Cushing
David
Dist
FileFinder
+Freitas
Golden
Graham
Grahan
Ian
Jemmeson
+Junior
Loyd
Madsen
Michael
Ollis
OurPkgVersion
Plugin
+Rodrigues
Sealy
Stephan
SubmittingPatches
Walde
Zilla
Znamensky
+alceu
alexchorny
+arfreitas
dagolden
+de
dzil
executables
git
ini
lib
+mike
mjemmeson
perl
perltidy
diff --git a/weaver.ini b/weaver.ini
new file mode 100644
index 0000000..085fb56
--- /dev/null
+++ b/weaver.ini
@@ -0,0 +1,25 @@
+[@CorePrep]
+
+[Name]
+[Version]
+
+[Region / prelude]
+
+[Generic / SYNOPSIS]
+[Generic / DESCRIPTION]
+[Generic / OVERVIEW]
+
+[Collect / ATTRIBUTES]
+ command = attr
+
+[Collect / METHODS]
+ command = method
+
+[Leftovers]
+
+[Region / postlude]
+[Bugs]
+
+[Contributors]
+[Authors]
+[Legal]