| 1 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package Dist::Zilla::Plugin::StaticVersion; | ||||||||||
| 6 | 1 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | $Dist::Zilla::Plugin::StaticVersion::VERSION = '0.103521'; | |||||||||
| 8 | } | ||||||||||
| 9 | # ABSTRACT: Specify version number manually, using a plugin | ||||||||||
| 10 | |||||||||||
| 11 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 1 | ▶ | use MooseX::Has::Sugar; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 1 | ▶ | use MooseX::Types::Moose qw( Str ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 1 | with qw/ Dist::Zilla::Role::VersionProvider /; | |||||||||
| 15 | |||||||||||
| 16 | has version => ( | ||||||||||
| 17 | ro, lazy, required, | ||||||||||
| 18 | isa => Str, | ||||||||||
| 19 | 0 | ▶ | default => sub { '' }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 20 | 1 | ); | |||||||||
| 21 | |||||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | sub provide_version { | ||||||||
|
Subroutine
provide_version: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 24 | 0 | ▶ | return $_[0]->version if $_[0]->version; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 1 | 1; # Magic true value required at end of module | |||||||||
| 28 | |||||||||||
| 29 | |||||||||||
| 30 | =pod | ||||||||||
| 31 | |||||||||||
| 32 | =head1 NAME | ||||||||||
| 33 | |||||||||||
| 34 | Dist::Zilla::Plugin::StaticVersion - Specify version number manually, using a plugin | ||||||||||
| 35 | |||||||||||
| 36 | =head1 VERSION | ||||||||||
| 37 | |||||||||||
| 38 | version 0.103521 | ||||||||||
| 39 | |||||||||||
| 40 | =head1 SYNOPSIS | ||||||||||
| 41 | |||||||||||
| 42 | In a plugin bundle: | ||||||||||
| 43 | |||||||||||
| 44 | package Dist::Zilla::PluginBundle::SomePlugins; | ||||||||||
| 45 | use Moose; | ||||||||||
| 46 | with 'Dist::Zilla::Role::PluginBundle::Easy'; | ||||||||||
| 47 | sub configure { | ||||||||||
| 48 | ... | ||||||||||
| 49 | $self->add_plugins( | ||||||||||
| 50 | ['StaticVersion' => { version => "1.14.3" } ], | ||||||||||
| 51 | ); | ||||||||||
| 52 | ... | ||||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | In dist.ini: | ||||||||||
| 56 | |||||||||||
| 57 | [StaticVersion] | ||||||||||
| 58 | version = 1.14.3 | ||||||||||
| 59 | |||||||||||
| 60 | which is equivalent to: | ||||||||||
| 61 | |||||||||||
| 62 | version = 1.14.3 | ||||||||||
| 63 | |||||||||||
| 64 | =head1 DESCRIPTION | ||||||||||
| 65 | |||||||||||
| 66 | This purpose of this plugin is to allow plugin bundles or other such | ||||||||||
| 67 | things to specify a specific version number. This allows one to write | ||||||||||
| 68 | a pluginbundle that decides based on its configuration whether to | ||||||||||
| 69 | offer a specific version number. You could not otherwise do this, | ||||||||||
| 70 | because a static version number is specified before any plugins in | ||||||||||
| 71 | F<dist.ini>. | ||||||||||
| 72 | |||||||||||
| 73 | You shouldn't need to use this plugin directly in your F<dist.ini>. | ||||||||||
| 74 | |||||||||||
| 75 | =head1 METHODS | ||||||||||
| 76 | |||||||||||
| 77 | =head2 provide_version | ||||||||||
| 78 | |||||||||||
| 79 | This method simply offers the specified version. If the specified | ||||||||||
| 80 | version is false (e.g. empty string), it will not be offered. | ||||||||||
| 81 | |||||||||||
| 82 | =head1 BUGS AND LIMITATIONS | ||||||||||
| 83 | |||||||||||
| 84 | This module is under ten lines of code. It is likely provably correct. | ||||||||||
| 85 | Regardless, please report any bugs or feature requests to | ||||||||||
| 86 | C<rct+perlbug@thompsonclan.org>. | ||||||||||
| 87 | |||||||||||
| 88 | =head1 SEE ALSO | ||||||||||
| 89 | |||||||||||
| 90 | =over 4 | ||||||||||
| 91 | |||||||||||
| 92 | =item * | ||||||||||
| 93 | |||||||||||
| 94 | L<Dist::Zilla> | ||||||||||
| 95 | |||||||||||
| 96 | =back | ||||||||||
| 97 | |||||||||||
| 98 | =head1 INSTALLATION | ||||||||||
| 99 | |||||||||||
| 100 | See perlmodinstall for information and options on installing Perl modules. | ||||||||||
| 101 | |||||||||||
| 102 | =head1 AUTHOR | ||||||||||
| 103 | |||||||||||
| 104 | Ryan C. Thompson <rct@thompsonclan.org> | ||||||||||
| 105 | |||||||||||
| 106 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 107 | |||||||||||
| 108 | This software is copyright (c) 2010 by Ryan C. Thompson. | ||||||||||
| 109 | |||||||||||
| 110 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 111 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 112 | |||||||||||
| 113 | =head1 DISCLAIMER OF WARRANTY | ||||||||||
| 114 | |||||||||||
| 115 | BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY | ||||||||||
| 116 | FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT | ||||||||||
| 117 | WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER | ||||||||||
| 118 | PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, | ||||||||||
| 119 | EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE | ||||||||||
| 120 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||||||||||
| 121 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE | ||||||||||
| 122 | SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME | ||||||||||
| 123 | THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. | ||||||||||
| 124 | |||||||||||
| 125 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | ||||||||||
| 126 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR | ||||||||||
| 127 | REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE | ||||||||||
| 128 | TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR | ||||||||||
| 129 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE | ||||||||||
| 130 | SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING | ||||||||||
| 131 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A | ||||||||||
| 132 | FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF | ||||||||||
| 133 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | ||||||||||
| 134 | DAMAGES. | ||||||||||
| 135 | |||||||||||
| 136 | =cut | ||||||||||
| 137 | |||||||||||
| 138 | |||||||||||
| 139 | __END__ | ||||||||||