| 1 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | package Dist::Zilla::Plugin::Test::CheckBreaks; # git description: v0.019-11-g97ba44b | ||||||||||||||||||||||||||||
| 4 | # vim: set ts=8 sts=2 sw=2 tw=100 et : | ||||||||||||||||||||||||||||
| 5 | # ABSTRACT: Generate a test that shows what modules you are breaking | ||||||||||||||||||||||||||||
| 6 | # KEYWORDS: distribution prerequisites upstream dependencies modules conflicts breaks breakages metadata | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 5 | our $VERSION = '0.020'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 5 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 5 | with ( | |||||||||||||||||||||||||||
| 12 | 'Dist::Zilla::Role::FileGatherer', | ||||||||||||||||||||||||||||
| 13 | 'Dist::Zilla::Role::FileMunger', | ||||||||||||||||||||||||||||
| 14 | 'Dist::Zilla::Role::TextTemplate', | ||||||||||||||||||||||||||||
| 15 | 'Dist::Zilla::Role::PrereqSource', | ||||||||||||||||||||||||||||
| 16 | 'Dist::Zilla::Role::ModuleMetadata', | ||||||||||||||||||||||||||||
| 17 | ); | ||||||||||||||||||||||||||||
| 18 | 5 | ▶ | use Path::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 5 | ▶ | use Module::Runtime 'module_notional_filename'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 5 | ▶ | use List::Util 1.33 qw(any first); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 5 | ▶ | use Sub::Exporter::ForMethods 'method_installer'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 5 | ▶ | use Data::Section 0.004 { installer => method_installer }, '-setup'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 5 | ▶ | use Data::Dumper (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 5 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 5 | has no_forced_deps => ( | |||||||||||||||||||||||||||
| 27 | is => 'ro', isa => 'Bool', | ||||||||||||||||||||||||||||
| 28 | default => 0, | ||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 12 | ▶ | sub filename { path('t', 'zzz-check-breaks.t') } | ||||||||||||||||||||||||||
|
Subroutine
filename: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 6 | ▶ | around dump_config => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 34 | 6 | my ($orig, $self) = @_; | |||||||||||||||||||||||||||
| 35 | 6 | my $config = $self->$orig; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 6 | ▶ | $config->{+__PACKAGE__} = { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 38 | conflicts_module => [ sort $self->conflicts_module ], | ||||||||||||||||||||||||||||
| 39 | no_forced_deps => ($self->no_forced_deps ? 1 : 0), | ||||||||||||||||||||||||||||
| 40 | blessed($self) ne __PACKAGE__ ? ( version => $VERSION ) : (), | ||||||||||||||||||||||||||||
| 41 | }; | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 6 | return $config; | |||||||||||||||||||||||||||
| 44 | 5 | }; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 6 | ▶ | sub gather_files { | ||||||||||||||||||||||||||
|
Subroutine
gather_files: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 47 | 6 | my $self = shift; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 6 | require Dist::Zilla::File::InMemory; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | $self->add_file( Dist::Zilla::File::InMemory->new( | ||||||||||||||||||||||||||||
| 52 | name => $self->filename->stringify, | ||||||||||||||||||||||||||||
| 53 | 6 | content => ${$self->section_data('test-check-breaks')}, | |||||||||||||||||||||||||||
| 54 | )); | ||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 6 | ▶ | sub mvp_multivalue_args { 'conflicts_module' } | ||||||||||||||||||||||||||
|
Subroutine
mvp_multivalue_args: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | has conflicts_module => ( | ||||||||||||||||||||||||||||
| 60 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||||||||||
| 61 | traits => ['Array'], | ||||||||||||||||||||||||||||
| 62 | handles => { conflicts_module => 'elements' }, | ||||||||||||||||||||||||||||
| 63 | lazy => 1, | ||||||||||||||||||||||||||||
| 64 | 4 | ▶ | default => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 65 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 4 | $self->log_debug('no conflicts_module provided; looking for one in the distribution...'); | |||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 4 | my $mmd = $self->module_metadata_for_file($self->zilla->main_module); | |||||||||||||||||||||||||||
| 70 | 4 | my $module = ($mmd->packages_inside)[0] . '::Conflicts'; | |||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | # check that the file exists in the distribution (it should never be shipped | ||||||||||||||||||||||||||||
| 73 | # separately!) | ||||||||||||||||||||||||||||
| 74 | 4 | my $conflicts_filename = module_notional_filename($module); | |||||||||||||||||||||||||||
| 75 | 4 | ▶ | if (any { $_->name eq path('lib', $conflicts_filename) } @{ $self->zilla->files }) | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 76 | { | ||||||||||||||||||||||||||||
| 77 | 1 | $self->log_debug([ '%s found', $module ]); | |||||||||||||||||||||||||||
| 78 | 1 | return [ $module ]; | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 3 | $self->log_debug([ 'No %s found', $module ]); | |||||||||||||||||||||||||||
| 82 | 3 | return []; | |||||||||||||||||||||||||||
| 83 | }, | ||||||||||||||||||||||||||||
| 84 | 5 | ); | |||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 10 | ▶ | sub _cmc_prereq { '0.011' } | ||||||||||||||||||||||||||
|
Subroutine
_cmc_prereq: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 6 | ▶ | sub munge_files { | ||||||||||||||||||||||||||
|
Subroutine
munge_files: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 89 | 6 | my $self = shift; | |||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | # module => filename | ||||||||||||||||||||||||||||
| 92 | 6 | require Module::Runtime; | |||||||||||||||||||||||||||
| 93 | 6 | my $modules = +{ map | |||||||||||||||||||||||||||
| 94 | +($_ => Module::Runtime::module_notional_filename($_)), | ||||||||||||||||||||||||||||
| 95 | $self->conflicts_module }; | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 6 | my $breaks_data = $self->_x_breaks_data; | |||||||||||||||||||||||||||
| 98 | 6 | ▶ | $self->log_debug('no x_breaks metadata and no conflicts module found to check against: adding no-op test') | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
keys %$breaks_data or $self->conflicts_module
MC/DC100%2/2
keys %$breaks_data or $self->conflicts_module
keys %$breaks_data
$self->conflicts_module
Truth table100%3/3
A or B
A= keys %$breaks_dataB= $self->conflicts_module
| |||||||||||||||||||||||||||||
| 99 | if not keys %$breaks_data and not $self->conflicts_module; | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 6 | my $filename = $self->filename; | |||||||||||||||||||||||||||
| 102 | 6 | ▶ | my $file = first { $_->name eq $filename } @{ $self->zilla->files }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 6 | my $content = $self->fill_in_string( | |||||||||||||||||||||||||||
| 105 | $file->content, | ||||||||||||||||||||||||||||
| 106 | { | ||||||||||||||||||||||||||||
| 107 | dist => \($self->zilla), | ||||||||||||||||||||||||||||
| 108 | plugin => \$self, | ||||||||||||||||||||||||||||
| 109 | modules => \$modules, | ||||||||||||||||||||||||||||
| 110 | no_forced_deps => \($self->no_forced_deps), | ||||||||||||||||||||||||||||
| 111 | breaks => \$breaks_data, | ||||||||||||||||||||||||||||
| 112 | cmc_prereq => \($self->_cmc_prereq), | ||||||||||||||||||||||||||||
| 113 | test_count => \($self->_test_count), | ||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | ); | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | 6 | $content =~ s/\n\n\z/\n/; | |||||||||||||||||||||||||||
| 118 | 6 | $file->content($content); | |||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 6 | return; | |||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 6 | ▶ | sub register_prereqs { | ||||||||||||||||||||||||||
|
Subroutine
register_prereqs: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 124 | 6 | my $self = shift; | |||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 6 | $self->zilla->register_prereqs( | |||||||||||||||||||||||||||
| 127 | { | ||||||||||||||||||||||||||||
| 128 | phase => 'test', | ||||||||||||||||||||||||||||
| 129 | type => 'requires', | ||||||||||||||||||||||||||||
| 130 | }, | ||||||||||||||||||||||||||||
| 131 | 'Test::More' => '0', | ||||||||||||||||||||||||||||
| 132 | ); | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 6 | ▶ | return if not keys %{ $self->_x_breaks_data }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | 2 | ▶ | $self->zilla->register_prereqs( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 137 | { | ||||||||||||||||||||||||||||
| 138 | phase => 'test', | ||||||||||||||||||||||||||||
| 139 | type => $self->no_forced_deps ? 'suggests' : 'requires', | ||||||||||||||||||||||||||||
| 140 | }, | ||||||||||||||||||||||||||||
| 141 | 'CPAN::Meta::Requirements' => '0', | ||||||||||||||||||||||||||||
| 142 | 'CPAN::Meta::Check' => $self->_cmc_prereq, | ||||||||||||||||||||||||||||
| 143 | ); | ||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | has _x_breaks_data => ( | ||||||||||||||||||||||||||||
| 147 | is => 'ro', isa => 'HashRef[Str]', | ||||||||||||||||||||||||||||
| 148 | init_arg => undef, | ||||||||||||||||||||||||||||
| 149 | lazy => 1, | ||||||||||||||||||||||||||||
| 150 | 6 | ▶ | default => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 151 | 6 | my $self = shift; | |||||||||||||||||||||||||||
| 152 | 6 | my $breaks_data = $self->zilla->distmeta->{x_breaks}; | |||||||||||||||||||||||||||
| 153 | 6 | ▶ | defined $breaks_data ? $breaks_data : {}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 154 | }, | ||||||||||||||||||||||||||||
| 155 | 5 | ); | |||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | 6 | ▶ | sub _test_count { | ||||||||||||||||||||||||||
|
Subroutine
_test_count: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 158 | 6 | my $self = shift; | |||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | # 1 for each conflicts module, or 1 for none | ||||||||||||||||||||||||||||
| 161 | 6 | my $test_count = $self->conflicts_module; | |||||||||||||||||||||||||||
| 162 | 6 | ▶ | ++$test_count if not $test_count; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | # ...and one for the x_breaks section, even if empty | ||||||||||||||||||||||||||||
| 165 | 6 | ++$test_count; | |||||||||||||||||||||||||||
| 166 | 6 | return $test_count; | |||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | 5 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | #pod =pod | ||||||||||||||||||||||||||||
| 172 | #pod | ||||||||||||||||||||||||||||
| 173 | #pod =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 174 | #pod | ||||||||||||||||||||||||||||
| 175 | #pod In your F<dist.ini>: | ||||||||||||||||||||||||||||
| 176 | #pod | ||||||||||||||||||||||||||||
| 177 | #pod [Breaks] | ||||||||||||||||||||||||||||
| 178 | #pod Foo = <= 1.1 ; Foo at 1.1 or lower will break when I am installed | ||||||||||||||||||||||||||||
| 179 | #pod | ||||||||||||||||||||||||||||
| 180 | #pod [Test::CheckBreaks] | ||||||||||||||||||||||||||||
| 181 | #pod conflicts_module = Moose::Conflicts | ||||||||||||||||||||||||||||
| 182 | #pod | ||||||||||||||||||||||||||||
| 183 | #pod =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 184 | #pod | ||||||||||||||||||||||||||||
| 185 | #pod This is a L<Dist::Zilla> plugin that runs at the | ||||||||||||||||||||||||||||
| 186 | #pod L<gather files|Dist::Zilla::Role::FileGatherer> stage, providing a test file | ||||||||||||||||||||||||||||
| 187 | #pod that runs last in your test suite and checks for conflicting modules, as | ||||||||||||||||||||||||||||
| 188 | #pod indicated by C<x_breaks> in your distribution metadata. | ||||||||||||||||||||||||||||
| 189 | #pod (See the F<t/zzz-check-breaks.t> test in this distribution for an example.) | ||||||||||||||||||||||||||||
| 190 | #pod | ||||||||||||||||||||||||||||
| 191 | #pod C<x_breaks> entries are expected to be | ||||||||||||||||||||||||||||
| 192 | #pod L<version ranges|CPAN::Meta::Spec/Version Ranges>, with one | ||||||||||||||||||||||||||||
| 193 | #pod addition, for backwards compatibility with | ||||||||||||||||||||||||||||
| 194 | #pod L<[Conflicts]|Dist::Zilla::Plugin::Conflicts>: if a bare version number is | ||||||||||||||||||||||||||||
| 195 | #pod specified, it is interpreted as C<< '<= $version' >> (to preserve the intent | ||||||||||||||||||||||||||||
| 196 | #pod that versions at or below the version specified are those considered to be | ||||||||||||||||||||||||||||
| 197 | #pod broken). It is possible that this interpretation will be removed in the | ||||||||||||||||||||||||||||
| 198 | #pod future; almost certainly before C<breaks> becomes a formal part of the meta | ||||||||||||||||||||||||||||
| 199 | #pod specification. | ||||||||||||||||||||||||||||
| 200 | #pod | ||||||||||||||||||||||||||||
| 201 | #pod =head1 CONFIGURATION | ||||||||||||||||||||||||||||
| 202 | #pod | ||||||||||||||||||||||||||||
| 203 | #pod =head2 C<conflicts_module> | ||||||||||||||||||||||||||||
| 204 | #pod | ||||||||||||||||||||||||||||
| 205 | #pod The name of the conflicts module to load and upon which to invoke the C<check_conflicts> | ||||||||||||||||||||||||||||
| 206 | #pod method. Defaults to the name of the main module with 'C<::Conflicts>' | ||||||||||||||||||||||||||||
| 207 | #pod appended, such as what is generated by the | ||||||||||||||||||||||||||||
| 208 | #pod L<[Conflicts]|Dist::Zilla::Plugin::Conflicts> plugin. | ||||||||||||||||||||||||||||
| 209 | #pod | ||||||||||||||||||||||||||||
| 210 | #pod If your distribution uses L<Moose> but does not itself generate a conflicts | ||||||||||||||||||||||||||||
| 211 | #pod plugin, then C<Moose::Conflicts> is an excellent choice, as there are numerous | ||||||||||||||||||||||||||||
| 212 | #pod interoperability conflicts catalogued in that module. | ||||||||||||||||||||||||||||
| 213 | #pod | ||||||||||||||||||||||||||||
| 214 | #pod There is no error if the module does not exist. This test does not require | ||||||||||||||||||||||||||||
| 215 | #pod L<[Conflicts]|Dist::Zilla::Plugin::Conflicts> to be used in your distribution; | ||||||||||||||||||||||||||||
| 216 | #pod this is only a feature added for backwards compatibility. | ||||||||||||||||||||||||||||
| 217 | #pod | ||||||||||||||||||||||||||||
| 218 | #pod This option can be used more than once starting with version 0.017. | ||||||||||||||||||||||||||||
| 219 | #pod | ||||||||||||||||||||||||||||
| 220 | #pod =head2 C<no_forced_deps> | ||||||||||||||||||||||||||||
| 221 | #pod | ||||||||||||||||||||||||||||
| 222 | #pod Suitable for distributions that do not wish to add a C<test requires> | ||||||||||||||||||||||||||||
| 223 | #pod prerequisite on L<CPAN::Meta::Requirements> and L<CPAN::Meta::Check> -- | ||||||||||||||||||||||||||||
| 224 | #pod instead, the dependencies will be added as C<test suggests>, and the generated | ||||||||||||||||||||||||||||
| 225 | #pod test will gracefully skip checks if these modules are not available. | ||||||||||||||||||||||||||||
| 226 | #pod | ||||||||||||||||||||||||||||
| 227 | #pod Available since version 0.015. | ||||||||||||||||||||||||||||
| 228 | #pod | ||||||||||||||||||||||||||||
| 229 | #pod =for Pod::Coverage mvp_multivalue_args filename gather_files munge_files register_prereqs | ||||||||||||||||||||||||||||
| 230 | #pod | ||||||||||||||||||||||||||||
| 231 | #pod =head1 BACKGROUND | ||||||||||||||||||||||||||||
| 232 | #pod | ||||||||||||||||||||||||||||
| 233 | #pod =for stopwords irc | ||||||||||||||||||||||||||||
| 234 | #pod | ||||||||||||||||||||||||||||
| 235 | #pod I came upon this idea for a test after handling a | ||||||||||||||||||||||||||||
| 236 | #pod L<bug report|https://rt.cpan.org/Ticket/Display.html?id=92780> | ||||||||||||||||||||||||||||
| 237 | #pod I've seen many times before when dealing with L<Moose> code: "hey, when I | ||||||||||||||||||||||||||||
| 238 | #pod updated Moose, my other thing that uses Moose stopped working!" For quite | ||||||||||||||||||||||||||||
| 239 | #pod some time Moose has generated breakage information in the form of the | ||||||||||||||||||||||||||||
| 240 | #pod F<moose-outdated> executable and a check in F<Makefile.PL> (which uses the | ||||||||||||||||||||||||||||
| 241 | #pod generated module C<Moose::Conflicts>), but the output is usually buried in the | ||||||||||||||||||||||||||||
| 242 | #pod user's install log or way up in the console buffer, and so doesn't get acted | ||||||||||||||||||||||||||||
| 243 | #pod on nearly as often as it should. I realized it would be a simple matter to | ||||||||||||||||||||||||||||
| 244 | #pod re-run the executable at the very end of tests by crafting a filename that | ||||||||||||||||||||||||||||
| 245 | #pod always sorts (and runs) last, and further that we could generate this test. | ||||||||||||||||||||||||||||
| 246 | #pod This coincided nicely with conversations on irc C<#toolchain> about the | ||||||||||||||||||||||||||||
| 247 | #pod C<x_breaks> metadata field and plans for its future. Therefore, this | ||||||||||||||||||||||||||||
| 248 | #pod distribution, and its sister plugin L<[Breaks]|Dist::Zilla::Plugin::Breaks> | ||||||||||||||||||||||||||||
| 249 | #pod were born! | ||||||||||||||||||||||||||||
| 250 | #pod | ||||||||||||||||||||||||||||
| 251 | #pod =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 252 | #pod | ||||||||||||||||||||||||||||
| 253 | #pod =for :list | ||||||||||||||||||||||||||||
| 254 | #pod * L<Dist::Zilla::Plugin::Breaks> | ||||||||||||||||||||||||||||
| 255 | #pod * L<Dist::CheckConflicts> | ||||||||||||||||||||||||||||
| 256 | #pod * L<The Annotated Lancaster Consensus|http://www.dagolden.com/index.php/2098/the-annotated-lancaster-consensus/> at "Improving on 'conflicts'" | ||||||||||||||||||||||||||||
| 257 | #pod * L<Module::Install::CheckConflicts> | ||||||||||||||||||||||||||||
| 258 | #pod | ||||||||||||||||||||||||||||
| 259 | #pod =cut | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | =pod | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | =head1 NAME | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | Dist::Zilla::Plugin::Test::CheckBreaks - Generate a test that shows what modules you are breaking | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | =head1 VERSION | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | version 0.020 | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | In your F<dist.ini>: | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | [Breaks] | ||||||||||||||||||||||||||||
| 278 | Foo = <= 1.1 ; Foo at 1.1 or lower will break when I am installed | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | [Test::CheckBreaks] | ||||||||||||||||||||||||||||
| 281 | conflicts_module = Moose::Conflicts | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | This is a L<Dist::Zilla> plugin that runs at the | ||||||||||||||||||||||||||||
| 286 | L<gather files|Dist::Zilla::Role::FileGatherer> stage, providing a test file | ||||||||||||||||||||||||||||
| 287 | that runs last in your test suite and checks for conflicting modules, as | ||||||||||||||||||||||||||||
| 288 | indicated by C<x_breaks> in your distribution metadata. | ||||||||||||||||||||||||||||
| 289 | (See the F<t/zzz-check-breaks.t> test in this distribution for an example.) | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | C<x_breaks> entries are expected to be | ||||||||||||||||||||||||||||
| 292 | L<version ranges|CPAN::Meta::Spec/Version Ranges>, with one | ||||||||||||||||||||||||||||
| 293 | addition, for backwards compatibility with | ||||||||||||||||||||||||||||
| 294 | L<[Conflicts]|Dist::Zilla::Plugin::Conflicts>: if a bare version number is | ||||||||||||||||||||||||||||
| 295 | specified, it is interpreted as C<< '<= $version' >> (to preserve the intent | ||||||||||||||||||||||||||||
| 296 | that versions at or below the version specified are those considered to be | ||||||||||||||||||||||||||||
| 297 | broken). It is possible that this interpretation will be removed in the | ||||||||||||||||||||||||||||
| 298 | future; almost certainly before C<breaks> becomes a formal part of the meta | ||||||||||||||||||||||||||||
| 299 | specification. | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | =head1 CONFIGURATION | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | =head2 C<conflicts_module> | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | The name of the conflicts module to load and upon which to invoke the C<check_conflicts> | ||||||||||||||||||||||||||||
| 306 | method. Defaults to the name of the main module with 'C<::Conflicts>' | ||||||||||||||||||||||||||||
| 307 | appended, such as what is generated by the | ||||||||||||||||||||||||||||
| 308 | L<[Conflicts]|Dist::Zilla::Plugin::Conflicts> plugin. | ||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | If your distribution uses L<Moose> but does not itself generate a conflicts | ||||||||||||||||||||||||||||
| 311 | plugin, then C<Moose::Conflicts> is an excellent choice, as there are numerous | ||||||||||||||||||||||||||||
| 312 | interoperability conflicts catalogued in that module. | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | There is no error if the module does not exist. This test does not require | ||||||||||||||||||||||||||||
| 315 | L<[Conflicts]|Dist::Zilla::Plugin::Conflicts> to be used in your distribution; | ||||||||||||||||||||||||||||
| 316 | this is only a feature added for backwards compatibility. | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | This option can be used more than once starting with version 0.017. | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | =head2 C<no_forced_deps> | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | Suitable for distributions that do not wish to add a C<test requires> | ||||||||||||||||||||||||||||
| 323 | prerequisite on L<CPAN::Meta::Requirements> and L<CPAN::Meta::Check> -- | ||||||||||||||||||||||||||||
| 324 | instead, the dependencies will be added as C<test suggests>, and the generated | ||||||||||||||||||||||||||||
| 325 | test will gracefully skip checks if these modules are not available. | ||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | Available since version 0.015. | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | =for Pod::Coverage mvp_multivalue_args filename gather_files munge_files register_prereqs | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | =head1 BACKGROUND | ||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | =for stopwords irc | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | I came upon this idea for a test after handling a | ||||||||||||||||||||||||||||
| 336 | L<bug report|https://rt.cpan.org/Ticket/Display.html?id=92780> | ||||||||||||||||||||||||||||
| 337 | I've seen many times before when dealing with L<Moose> code: "hey, when I | ||||||||||||||||||||||||||||
| 338 | updated Moose, my other thing that uses Moose stopped working!" For quite | ||||||||||||||||||||||||||||
| 339 | some time Moose has generated breakage information in the form of the | ||||||||||||||||||||||||||||
| 340 | F<moose-outdated> executable and a check in F<Makefile.PL> (which uses the | ||||||||||||||||||||||||||||
| 341 | generated module C<Moose::Conflicts>), but the output is usually buried in the | ||||||||||||||||||||||||||||
| 342 | user's install log or way up in the console buffer, and so doesn't get acted | ||||||||||||||||||||||||||||
| 343 | on nearly as often as it should. I realized it would be a simple matter to | ||||||||||||||||||||||||||||
| 344 | re-run the executable at the very end of tests by crafting a filename that | ||||||||||||||||||||||||||||
| 345 | always sorts (and runs) last, and further that we could generate this test. | ||||||||||||||||||||||||||||
| 346 | This coincided nicely with conversations on irc C<#toolchain> about the | ||||||||||||||||||||||||||||
| 347 | C<x_breaks> metadata field and plans for its future. Therefore, this | ||||||||||||||||||||||||||||
| 348 | distribution, and its sister plugin L<[Breaks]|Dist::Zilla::Plugin::Breaks> | ||||||||||||||||||||||||||||
| 349 | were born! | ||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||
| 351 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | =over 4 | ||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||
| 355 | =item * | ||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | L<Dist::Zilla::Plugin::Breaks> | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | =item * | ||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | L<Dist::CheckConflicts> | ||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | =item * | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | L<The Annotated Lancaster Consensus|http://www.dagolden.com/index.php/2098/the-annotated-lancaster-consensus/> at "Improving on 'conflicts'" | ||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | =item * | ||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||
| 369 | L<Module::Install::CheckConflicts> | ||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | =back | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-Test-CheckBreaks> | ||||||||||||||||||||||||||||
| 376 | (or L<bug-Dist-Zilla-Plugin-Test-CheckBreaks@rt.cpan.org|mailto:bug-Dist-Zilla-Plugin-Test-CheckBreaks@rt.cpan.org>). | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | There is also a mailing list available for users of this distribution, at | ||||||||||||||||||||||||||||
| 379 | L<http://dzil.org/#mailing-list>. | ||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | There is also an irc channel available for users of this distribution, at | ||||||||||||||||||||||||||||
| 382 | L<C<#distzilla> on C<irc.perl.org>|irc://irc.perl.org/#distzilla>. | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | I am also usually active on irc, as 'ether' at C<irc.perl.org> and C<irc.libera.chat>. | ||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | Karen Etheridge <ether@cpan.org> | ||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||
| 390 | =head1 CONTRIBUTOR | ||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||
| 392 | =for stopwords Olivier Mengué | ||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||
| 394 | Olivier Mengué <dolmen@cpan.org> | ||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||
| 396 | =head1 COPYRIGHT AND LICENCE | ||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | This software is copyright (c) 2014 by Karen Etheridge. | ||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||
| 400 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 401 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | =cut | ||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | __DATA__ | ||||||||||||||||||||||||||||