| 1 |
NAME |
| 2 |
|
| 3 |
Dist::Zilla::Plugin::OurPkgVersion - No line insertion and does Package |
| 4 |
version with our |
| 5 |
|
| 6 |
VERSION |
| 7 |
|
| 8 |
version 0.21 |
| 9 |
|
| 10 |
SYNOPSIS |
| 11 |
|
| 12 |
in dist.ini |
| 13 |
|
| 14 |
[OurPkgVersion] |
| 15 |
|
| 16 |
in your modules |
| 17 |
|
| 18 |
# VERSION |
| 19 |
|
| 20 |
DESCRIPTION |
| 21 |
|
| 22 |
This module was created as an alternative to |
| 23 |
Dist::Zilla::Plugin::PkgVersion and uses some code from that module. |
| 24 |
This module is designed to use a the more readable format our $VERSION |
| 25 |
= $version; as well as not change then number of lines of code in your |
| 26 |
files, which will keep your repository more in sync with your CPAN |
| 27 |
release. It also allows you slightly more freedom in how you specify |
| 28 |
your version. |
| 29 |
|
| 30 |
EXAMPLES |
| 31 |
|
| 32 |
in dist.ini |
| 33 |
|
| 34 |
... |
| 35 |
version = 0.01; |
| 36 |
[OurPkgVersion] |
| 37 |
|
| 38 |
in lib/My/Module.pm |
| 39 |
|
| 40 |
package My::Module; |
| 41 |
# VERSION |
| 42 |
... |
| 43 |
|
| 44 |
output lib/My/Module.pm |
| 45 |
|
| 46 |
package My::Module; |
| 47 |
our $VERSION = '0.01'; # VERSION |
| 48 |
... |
| 49 |
|
| 50 |
please note that whitespace before the comment is significant so |
| 51 |
|
| 52 |
package My::Module; |
| 53 |
BEGIN { |
| 54 |
# VERSION |
| 55 |
} |
| 56 |
... |
| 57 |
|
| 58 |
becomes |
| 59 |
|
| 60 |
package My::Module; |
| 61 |
BEGIN { |
| 62 |
our $VERSION = '0.01'; # VERSION |
| 63 |
} |
| 64 |
... |
| 65 |
|
| 66 |
while |
| 67 |
|
| 68 |
package My::Module; |
| 69 |
BEGIN { |
| 70 |
# VERSION |
| 71 |
} |
| 72 |
... |
| 73 |
|
| 74 |
becomes |
| 75 |
|
| 76 |
package My::Module; |
| 77 |
BEGIN { |
| 78 |
our $VERSION = '0.01'; # VERSION |
| 79 |
} |
| 80 |
... |
| 81 |
|
| 82 |
you can also add additional comments to your comment |
| 83 |
|
| 84 |
... |
| 85 |
# VERSION: generated by DZP::OurPkgVersion |
| 86 |
... |
| 87 |
|
| 88 |
becomes |
| 89 |
|
| 90 |
... |
| 91 |
our $VERSION = '0.1.0'; # VERSION: generated by DZP::OurPkgVersion |
| 92 |
... |
| 93 |
|
| 94 |
you can also use perltidy's default static side comments (##) |
| 95 |
|
| 96 |
... |
| 97 |
## VERSION |
| 98 |
... |
| 99 |
|
| 100 |
becomes |
| 101 |
|
| 102 |
... |
| 103 |
our $VERSION = '0.1.0'; ## VERSION |
| 104 |
... |
| 105 |
|
| 106 |
Also note, the package line is not in any way significant, it will |
| 107 |
insert the our $VERSION line anywhere in the file before # VERSION as |
| 108 |
many times as you've written # VERSION regardless of whether or not |
| 109 |
inserting it there is a good idea. OurPkgVersion will not insert a |
| 110 |
version unless you have # VERSION so it is a bit more work. |
| 111 |
|
| 112 |
If you make a trial release, the comment will be altered to say so: |
| 113 |
|
| 114 |
# VERSION |
| 115 |
|
| 116 |
becomes |
| 117 |
|
| 118 |
our $VERSION = '0.01'; # TRIAL VERSION |
| 119 |
|
| 120 |
METHODS |
| 121 |
|
| 122 |
BUILD |
| 123 |
|
| 124 |
Provides validations after object creation. |
| 125 |
|
| 126 |
munge_files |
| 127 |
|
| 128 |
Override the default provided by Dist::Zilla::Role::FileMunger to |
| 129 |
limit the number of files to search to only be modules and |
| 130 |
executables. |
| 131 |
|
| 132 |
munge_file |
| 133 |
|
| 134 |
tells which files to munge, see Dist::Zilla::Role::FileMunger. |
| 135 |
|
| 136 |
finder |
| 137 |
|
| 138 |
Override the default FileFinder for finding files to check and |
| 139 |
update. The default value is :InstallModules and :PerlExecFiles (when |
| 140 |
available; otherwise :ExecFiles) -- see also |
| 141 |
Dist::Zilla::Plugin::ExecDir, to make sure the script files are |
| 142 |
properly marked as executables for the installer. |
| 143 |
|
| 144 |
PROPERTIES |
| 145 |
|
| 146 |
underscore_eval_version |
| 147 |
|
| 148 |
For version numbers that have an underscore in them, add this line |
| 149 |
immediately after the our version assignment: |
| 150 |
|
| 151 |
$VERSION = eval $VERSION; |
| 152 |
|
| 153 |
This is arguably the correct thing to do, but changes the line |
| 154 |
numbering of the generated Perl module or source, and thus optional. |
| 155 |
|
| 156 |
semantic_version |
| 157 |
|
| 158 |
Setting this property to "true" (1) will set the version of the |
| 159 |
module/distribution to properly use semantic versioning. It will also |
| 160 |
expect that you setup version with a v-string, without adding quotes. |
| 161 |
For example: |
| 162 |
|
| 163 |
version = v0.0.1 |
| 164 |
|
| 165 |
Beware you can't setup both underscore_eval_version and |
| 166 |
semantic_version since both are mutually exclusive: if you try, your |
| 167 |
code is going to die. |
| 168 |
|
| 169 |
For more details, check this blog |
| 170 |
<https://weblog.bulknews.net/how-to-correctly-use-semantic-version-vx-y-z-in-perl-modules-eb08568ab911> |
| 171 |
for more details about using semantic version with Perl. |
| 172 |
|
| 173 |
skip_main_module |
| 174 |
|
| 175 |
Set to true to ignore the main module in the distribution. This |
| 176 |
prevents a warning when using |
| 177 |
Dist::Zilla::Plugin::VersionFromMainModule to obtain the version |
| 178 |
number instead of the dist.ini file. |
| 179 |
|
| 180 |
overwrite |
| 181 |
|
| 182 |
When enabled, this option causes any match of the # VERSION comment |
| 183 |
to first check for an existing our $VERSION = ...; on the same line, |
| 184 |
and if found, overwrite the value in the existing statement. (the |
| 185 |
comment still gets modified for trial releases) |
| 186 |
|
| 187 |
Currently, the value must be a single Perl token such as a string or |
| 188 |
number. |
| 189 |
|
| 190 |
no_critic |
| 191 |
|
| 192 |
When underscore_eval_version is used the generated code for dev |
| 193 |
versions may not technically be Perl::Critic compliant due to string |
| 194 |
eval, but is nevertheless pretty safe. This option will add the |
| 195 |
appropriate no critic directive to save you the hassle. |
| 196 |
|
| 197 |
BUGS |
| 198 |
|
| 199 |
Please report any bugs or feature requests on the bugtracker website |
| 200 |
https://github.com/plicease/dist-zilla-plugin-ourpkgversion/issues |
| 201 |
|
| 202 |
When submitting a bug or request, please include a test-file or a patch |
| 203 |
to an existing test-file that illustrates the bug or desired feature. |
| 204 |
|
| 205 |
CONTRIBUTORS |
| 206 |
|
| 207 |
* Alceu Rodrigues de Freitas Junior <[email protected]> |
| 208 |
|
| 209 |
* Ian Sealy <[email protected]> |
| 210 |
|
| 211 |
* Michael Conrad <[email protected]> |
| 212 |
|
| 213 |
* Michael Jemmeson <[email protected]> |
| 214 |
|
| 215 |
* Stephan Loyd <[email protected]> |
| 216 |
|
| 217 |
* Alceu Rodrigues de Freitas Junior <[email protected]> |
| 218 |
|
| 219 |
* Alexandr Ciornii <[email protected]> |
| 220 |
|
| 221 |
* Alexei Znamensky <[email protected]> |
| 222 |
|
| 223 |
* Christian Walde <[email protected]> |
| 224 |
|
| 225 |
* Christopher J. Madsen <[email protected]> |
| 226 |
|
| 227 |
* David Golden <[email protected]> |
| 228 |
|
| 229 |
* Graham Ollis <[email protected]> |
| 230 |
|
| 231 |
* Graham Ollis <[email protected]> |
| 232 |
|
| 233 |
* Graham✈️✈️ <[email protected]> |
| 234 |
|
| 235 |
AUTHORS |
| 236 |
|
| 237 |
* Caleb Cushing <[email protected]> |
| 238 |
|
| 239 |
* Grahan Ollis <[email protected]> |
| 240 |
|
| 241 |
COPYRIGHT AND LICENSE |
| 242 |
|
| 243 |
This software is Copyright (c) 2019 by Caleb Cushing. |
| 244 |
|
| 245 |
This is free software, licensed under: |
| 246 |
|
| 247 |
The Artistic License 2.0 (GPL Compatible) |
| 248 |
|