Codebase list libdist-zilla-plugin-ourpkgversion-perl / 1dc8dec
Allow using perltidy's default side comments (i.e. ## VERSION as well as # VERSION). Ian Sealy 7 years ago
6 changed file(s) with 61 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
8888 our $VERSION = '0.1.0'; # VERSION: generated by DZP::OurPkgVersion
8989 ...
9090
91 you can also use perltidy's default static side comments (##)
92
93 ...
94 ## VERSION
95 ...
96
97 becomes
98
99 ...
100 our $VERSION = '0.1.0'; ## VERSION
101 ...
102
91103 Also note, the package line is not in any way significant, it will insert the
92104 `our $VERSION` line anywhere in the file before `# VERSION` as many times as
93105 you've written `# VERSION` regardless of whether or not inserting it there is
0 use strict;
1 use warnings;
2 package DZT7;
3 ## VERSION
4 # ABSTRACT: my abstract
5 1;
5858 stopwords = OurPkgVersion
5959 stopwords = ini
6060 stopwords = executables
61 stopwords = perltidy
6162
6263 [PruneFiles]
6364 filenames = dist.ini
4646 my $version_regex
4747 = q{
4848 ^
49 (\s*) # capture all whitespace before comment
49 (\s*) # capture all whitespace before comment
5050 (
51 \#\s*VERSION # capture # VERSION
52 \b # and ensure it ends on a word boundary
53 [ # conditionally
54 [:print:] # all printable characters after VERSION
55 \s # any whitespace including newlines see GH #5
56 ]* # as many of the above as there are
51 \#\#?\s*VERSION # capture # VERSION or ## VERSION
52 \b # and ensure it ends on a word boundary
53 [ # conditionally
54 [:print:] # all printable characters after VERSION
55 \s # any whitespace including newlines - GH #5
56 ]* # as many of the above as there are
5757 )
58 $ # until the EOL}
58 $ # until the EOL}
5959 ;
6060
6161 my $munged_version = 0;
175175 our $VERSION = '0.1.0'; # VERSION: generated by DZP::OurPkgVersion
176176 ...
177177
178 you can also use perltidy's default static side comments (##)
179
180 ...
181 ## VERSION
182 ...
183
184 becomes
185
186 ...
187 our $VERSION = '0.1.0'; ## VERSION
188 ...
189
178190 Also note, the package line is not in any way significant, it will insert the
179191 C<our $VERSION> line anywhere in the file before C<# VERSION> as many times as
180192 you've written C<# VERSION> regardless of whether or not inserting it there is
1919 my $lib_4 = $tzil->slurp_file('build/lib/DZT4.pm');
2020 my $lib_5 = $tzil->slurp_file('build/lib/DZT5.pm');
2121 my $lib_6 = $tzil->slurp_file('build/lib/DZT6.pm');
22 my $lib_7 = $tzil->slurp_file('build/lib/DZT7.pm');
2223 my $tst_0 = $tzil->slurp_file('build/t/basic.t' );
2324
2425 # e short for expected files
8485 1;
8586 END LIB6
8687
88 my $elib_7 = <<'END LIB7';
89 use strict;
90 use warnings;
91 package DZT7;
92 our $VERSION = '0.1.0'; ## VERSION
93 # ABSTRACT: my abstract
94 1;
95 END LIB7
96
8797 my $etst_0 = <<'END TST0';
8898 #!/usr/bin/perl
8999 # VERSION
97107 is ( $lib_4, $elib_4, 'check DZT4.pm' );
98108 is ( $lib_5, $elib_5, 'check DZT5.pm' );
99109 is ( $lib_6, $elib_6, 'check DZT6.pm' );
110 is ( $lib_7, $elib_7, 'check DZT7.pm' );
100111 is ( $tst_0, $etst_0, 'check basic.t' );
101112
102113 for my $file ( qw/DZT2 DZT3/ ) {
2020 my $lib_3 = $tzil->slurp_file('build/lib/DZT3.pm');
2121 my $lib_4 = $tzil->slurp_file('build/lib/DZT4.pm');
2222 my $lib_5 = $tzil->slurp_file('build/lib/DZT5.pm');
23 my $lib_7 = $tzil->slurp_file('build/lib/DZT7.pm');
2324 my $tst_0 = $tzil->slurp_file('build/t/basic.t' );
2425
2526 # e short for expected files
7778 1;
7879 END LIB5
7980
81 my $elib_7 = <<'END LIB7';
82 use strict;
83 use warnings;
84 package DZT7;
85 our $VERSION = '0.1.0'; ## TRIAL VERSION
86 # ABSTRACT: my abstract
87 1;
88 END LIB7
89
8090 my $etst_0 = <<'END TST0';
8191 #!/usr/bin/perl
8292 # VERSION
8999 is ( $lib_3, $elib_3, 'check DZT3.pm' );
90100 is ( $lib_4, $elib_4, 'check DZT4.pm' );
91101 is ( $lib_5, $elib_5, 'check DZT5.pm' );
102 is ( $lib_7, $elib_7, 'check DZT7.pm' );
92103 is ( $tst_0, $etst_0, 'check basic.t' );
93104
94105 for my $file ( qw/DZT2 DZT3/ ) {