diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2014-04-03 14:57:29 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2014-04-03 14:57:29 +0000 |
commit | dfaae12e4d85f7c6821ae4a9fbf7e463d570e7ba (patch) | |
tree | 6dcde6413d8dcd3d24b0251080c21c49fa5b81a6 | |
download | Dist-CheckConflicts-tarball-dfaae12e4d85f7c6821ae4a9fbf7e463d570e7ba.tar.gz |
Dist-CheckConflicts-0.11HEADDist-CheckConflicts-0.11master
83 files changed, 2850 insertions, 0 deletions
@@ -0,0 +1,39 @@ +Revision history for Dist-CheckConflicts + +0.11 2014-04-03 + - drop the dep on List::MoreUtils (haarg, #8) + +0.10 2013-12-17 + - we need Module::Runtime 0.009 for module_notional_filename (nnutter, + #6) + +0.09 2013-07-19 + - support Perl 5.6.x (Toby Inkster) + +0.08 2013-07-09 + - remove Test::Warnings dep + +0.07 2013-07-08 + - instead of silently ignoring conflicts that do not compile, issue a + conflict warning. (RT#75486, Karen Etheridge) + +0.06 2013-06-21 + - make the runtime conflict warnings optional, since i'm not sure how + stable of an idea this really is + - use Exporter instead of Sub::Exporter + +0.05-TRIAL 2011-01-17 + - require 5.8.1, clean up a few things and add a few more tests + +0.04-TRIAL 2011-01-13 + - fix an issue with certain other perls + +0.03-TRIAL 2011-01-13 + - add runtime conflict warnings + +0.02 2011-01-02 + - ignore 'also' packages that aren't found, and also check for a + corresponding ::Conflicts package + +0.01 2010-11-21 + - Initial release @@ -0,0 +1,379 @@ +This software is copyright (c) 2014 by Jesse Luehrs. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +Terms of the Perl programming language system itself + +a) the GNU General Public License as published by the Free + Software Foundation; either version 1, or (at your option) any + later version, or +b) the "Artistic License" + +--- The GNU General Public License, Version 1, February 1989 --- + +This software is Copyright (c) 2014 by Jesse Luehrs. + +This is free software, licensed under: + + The GNU General Public License, Version 1, February 1989 + + GNU GENERAL PUBLIC LICENSE + Version 1, February 1989 + + Copyright (C) 1989 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The license agreements of most software companies try to keep users +at the mercy of those companies. By contrast, our General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. The +General Public License applies to the Free Software Foundation's +software and to any other program whose authors commit to using it. +You can use it for your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Specifically, the General Public License is designed to make +sure that you have the freedom to give away or sell copies of free +software, that you receive source code or can get it if you want it, +that you can change the software or use pieces of it in new free +programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of a such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must tell them their rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any program or other work which +contains a notice placed by the copyright holder saying it may be +distributed under the terms of this General Public License. The +"Program", below, refers to any such program or work, and a "work based +on the Program" means either the Program or any work containing the +Program or a portion of it, either verbatim or with modifications. Each +licensee is addressed as "you". + + 1. You may copy and distribute verbatim copies of the Program's source +code as you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and +disclaimer of warranty; keep intact all the notices that refer to this +General Public License and to the absence of any warranty; and give any +other recipients of the Program a copy of this General Public License +along with the Program. You may charge a fee for the physical act of +transferring a copy. + + 2. You may modify your copy or copies of the Program or any portion of +it, and copy and distribute such modifications under the terms of Paragraph +1 above, provided that you also do the following: + + a) cause the modified files to carry prominent notices stating that + you changed the files and the date of any change; and + + b) cause the whole of any work that you distribute or publish, that + in whole or in part contains the Program or any part thereof, either + with or without modifications, to be licensed at no charge to all + third parties under the terms of this General Public License (except + that you may choose to grant warranty protection to some or all + third parties, at your option). + + c) If the modified program normally reads commands interactively when + run, you must cause it, when started running for such interactive use + in the simplest and most usual way, to print or display an + announcement including an appropriate copyright notice and a notice + that there is no warranty (or else, saying that you provide a + warranty) and that users may redistribute the program under these + conditions, and telling the user how to view a copy of this General + Public License. + + d) You may charge a fee for the physical act of transferring a + copy, and you may at your option offer warranty protection in + exchange for a fee. + +Mere aggregation of another independent work with the Program (or its +derivative) on a volume of a storage or distribution medium does not bring +the other work under the scope of these terms. + + 3. You may copy and distribute the Program (or a portion or derivative of +it, under Paragraph 2) in object code or executable form under the terms of +Paragraphs 1 and 2 above provided that you also do one of the following: + + a) accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of + Paragraphs 1 and 2 above; or, + + b) accompany it with a written offer, valid for at least three + years, to give any third party free (except for a nominal charge + for the cost of distribution) a complete machine-readable copy of the + corresponding source code, to be distributed under the terms of + Paragraphs 1 and 2 above; or, + + c) accompany it with the information you received as to where the + corresponding source code may be obtained. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form alone.) + +Source code for a work means the preferred form of the work for making +modifications to it. For an executable file, complete source code means +all the source code for all modules it contains; but, as a special +exception, it need not include source code for modules which are standard +libraries that accompany the operating system on which the executable +file runs, or for standard header files or definitions files that +accompany that operating system. + + 4. You may not copy, modify, sublicense, distribute or transfer the +Program except as expressly provided under this General Public License. +Any attempt otherwise to copy, modify, sublicense, distribute or transfer +the Program is void, and will automatically terminate your rights to use +the Program under this License. However, parties who have received +copies, or rights to use copies, from you under this General Public +License will not have their licenses terminated so long as such parties +remain in full compliance. + + 5. By copying, distributing or modifying the Program (or any work based +on the Program) you indicate your acceptance of this license to do so, +and all its terms and conditions. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the original +licensor to copy, distribute or modify the Program subject to these +terms and conditions. You may not impose any further restrictions on the +recipients' exercise of the rights granted herein. + + 7. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of the license which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +the license, you may choose any version ever published by the Free Software +Foundation. + + 8. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to humanity, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + + To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively convey +the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19xx name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the +appropriate parts of the General Public License. Of course, the +commands you use may be called something other than `show w' and `show +c'; they could even be mouse-clicks or menu items--whatever suits your +program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + program `Gnomovision' (a program to direct compilers to make passes + at assemblers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +That's all there is to it! + + +--- The Artistic License 1.0 --- + +This software is Copyright (c) 2014 by Jesse Luehrs. + +This is free software, licensed under: + + The Artistic License 1.0 + +The Artistic License + +Preamble + +The intent of this document is to state the conditions under which a Package +may be copied, such that the Copyright Holder maintains some semblance of +artistic control over the development of the package, while giving the users of +the package the right to use and distribute the Package in a more-or-less +customary fashion, plus the right to make reasonable modifications. + +Definitions: + + - "Package" refers to the collection of files distributed by the Copyright + Holder, and derivatives of that collection of files created through + textual modification. + - "Standard Version" refers to such a Package if it has not been modified, + or has been modified in accordance with the wishes of the Copyright + Holder. + - "Copyright Holder" is whoever is named in the copyright or copyrights for + the package. + - "You" is you, if you're thinking about copying or distributing this Package. + - "Reasonable copying fee" is whatever you can justify on the basis of media + cost, duplication charges, time of people involved, and so on. (You will + not be required to justify it to the Copyright Holder, but only to the + computing community at large as a market that must bear the fee.) + - "Freely Available" means that no fee is charged for the item itself, though + there may be fees involved in handling the item. It also means that + recipients of the item may redistribute it under the same conditions they + received it. + +1. You may make and give away verbatim copies of the source form of the +Standard Version of this Package without restriction, provided that you +duplicate all of the original copyright notices and associated disclaimers. + +2. You may apply bug fixes, portability fixes and other modifications derived +from the Public Domain or from the Copyright Holder. A Package modified in such +a way shall still be considered the Standard Version. + +3. You may otherwise modify your copy of this Package in any way, provided that +you insert a prominent notice in each changed file stating how and when you +changed that file, and provided that you do at least ONE of the following: + + a) place your modifications in the Public Domain or otherwise make them + Freely Available, such as by posting said modifications to Usenet or an + equivalent medium, or placing the modifications on a major archive site + such as ftp.uu.net, or by allowing the Copyright Holder to include your + modifications in the Standard Version of the Package. + + b) use the modified Package only within your corporation or organization. + + c) rename any non-standard executables so the names do not conflict with + standard executables, which must also be provided, and provide a separate + manual page for each non-standard executable that clearly documents how it + differs from the Standard Version. + + d) make other distribution arrangements with the Copyright Holder. + +4. You may distribute the programs of this Package in object code or executable +form, provided that you do at least ONE of the following: + + a) distribute a Standard Version of the executables and library files, + together with instructions (in the manual page or equivalent) on where to + get the Standard Version. + + b) accompany the distribution with the machine-readable source of the Package + with your modifications. + + c) accompany any non-standard executables with their corresponding Standard + Version executables, giving the non-standard executables non-standard + names, and clearly documenting the differences in manual pages (or + equivalent), together with instructions on where to get the Standard + Version. + + d) make other distribution arrangements with the Copyright Holder. + +5. You may charge a reasonable copying fee for any distribution of this +Package. You may charge any fee you choose for support of this Package. You +may not charge a fee for this Package itself. However, you may distribute this +Package in aggregate with other (possibly commercial) programs as part of a +larger (possibly commercial) software distribution provided that you do not +advertise this Package as a product of your own. + +6. The scripts and library files supplied as input to or produced as output +from the programs of this Package do not automatically fall under the copyright +of this Package, but belong to whomever generated them, and may be sold +commercially, and may be aggregated with this Package. + +7. C or perl subroutines supplied by you and linked into this Package shall not +be considered part of this Package. + +8. The name of the Copyright Holder may not be used to endorse or promote +products derived from this software without specific prior written permission. + +9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +The End + diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..d3bd12a --- /dev/null +++ b/MANIFEST @@ -0,0 +1,84 @@ +# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.014. +Changes +LICENSE +MANIFEST +META.json +META.yml +Makefile.PL +README +dist.ini +lib/Dist/CheckConflicts.pm +t/00-compile.t +t/also.t +t/basic.t +t/conflicts.t +t/dist.t +t/lib/also/Bar/Conflicts.pm +t/lib/also/Bar/Conflicts2.pm +t/lib/also/Foo.pm +t/lib/also/Foo/Conflicts.pm +t/lib/basic/Bar/Conflicts.pm +t/lib/basic/Bar/Conflicts2.pm +t/lib/basic/Bar/Conflicts3.pm +t/lib/basic/Foo/Conflicts.pm +t/lib/conflicts/Bar.pm +t/lib/conflicts/Bar/Conflicts/Bad.pm +t/lib/conflicts/Bar/Conflicts/Bad2.pm +t/lib/conflicts/Bar/Conflicts/Bad3.pm +t/lib/conflicts/Bar/Conflicts/Good.pm +t/lib/conflicts/Bar/Conflicts/Good2.pm +t/lib/conflicts/Bar/Conflicts/Good3.pm +t/lib/conflicts/Bar/Three.pm +t/lib/conflicts/Bar/Two.pm +t/lib/conflicts/Broken.pm +t/lib/conflicts/Foo.pm +t/lib/conflicts/Foo/Conflicts/Bad.pm +t/lib/conflicts/Foo/Conflicts/Broken.pm +t/lib/conflicts/Foo/Conflicts/Good.pm +t/lib/conflicts/Foo/Three.pm +t/lib/conflicts/Foo/Two.pm +t/lib/dist/Bar.pm +t/lib/dist/Bar/Conflicts/Bad.pm +t/lib/dist/Bar/Conflicts/Bad2.pm +t/lib/dist/Bar/Conflicts/Bad3.pm +t/lib/dist/Bar/Conflicts/Good.pm +t/lib/dist/Bar/Conflicts/Good2.pm +t/lib/dist/Bar/Conflicts/Good3.pm +t/lib/dist/Bar/Three.pm +t/lib/dist/Bar/Two.pm +t/lib/dist/Foo.pm +t/lib/dist/Foo/Conflicts/Bad.pm +t/lib/dist/Foo/Conflicts/Good.pm +t/lib/dist/Foo/Three.pm +t/lib/dist/Foo/Two.pm +t/lib/merge/Foo/Conflicts.pm +t/lib/merge/Foo/Conflicts2.pm +t/lib/runtime/Bar.pm +t/lib/runtime/Bar/Bar.pm +t/lib/runtime/Bar/Bar/Bad.pm +t/lib/runtime/Bar/Bar/Good.pm +t/lib/runtime/Bar/Baz.pm +t/lib/runtime/Bar/Baz/Bad.pm +t/lib/runtime/Bar/Baz/Good.pm +t/lib/runtime/Bar/Conflicts.pm +t/lib/runtime/Bar/Foo.pm +t/lib/runtime/Bar/Foo/Bad.pm +t/lib/runtime/Bar/Foo/Good.pm +t/lib/runtime/Bar/Quux.pm +t/lib/runtime/Bar/Quux/Bad.pm +t/lib/runtime/Bar/Quux/Good.pm +t/lib/runtime/Foo.pm +t/lib/runtime/Foo/Bar.pm +t/lib/runtime/Foo/Baz.pm +t/lib/runtime/Foo/Conflicts.pm +t/lib/runtime/Foo/Foo.pm +t/lib/runtime/Foo/Quux.pm +t/lib/warn/Foo/Conflicts.pm +t/lib/warn/Foo/Thing.pm +t/merge.t +t/runtime.t +t/warn.t +xt/release/eol.t +xt/release/no-tabs.t +xt/release/pod-coverage.t +xt/release/pod-syntax.t diff --git a/META.json b/META.json new file mode 100644 index 0000000..9ac2aa3 --- /dev/null +++ b/META.json @@ -0,0 +1,461 @@ +{ + "abstract" : "declare version conflicts for your dist", + "author" : [ + "Jesse Luehrs <doy@tozt.net>" + ], + "dynamic_config" : 0, + "generated_by" : "Dist::Zilla version 5.014, CPAN::Meta::Converter version 2.140640", + "license" : [ + "perl_5" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : "2" + }, + "name" : "Dist-CheckConflicts", + "prereqs" : { + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "6.30" + } + }, + "develop" : { + "requires" : { + "Pod::Coverage::TrustPod" : "0", + "Test::More" : "0", + "Test::NoTabs" : "0", + "Test::Pod" : "1.41", + "Test::Pod::Coverage" : "1.08" + } + }, + "runtime" : { + "requires" : { + "Carp" : "0", + "Exporter" : "0", + "Module::Runtime" : "0.009", + "base" : "0", + "perl" : "5.006", + "strict" : "0", + "warnings" : "0" + } + }, + "test" : { + "requires" : { + "File::Spec" : "0", + "IO::Handle" : "0", + "IPC::Open3" : "0", + "Test::Fatal" : "0", + "Test::More" : "0.88", + "lib" : "0" + } + } + }, + "provides" : { + "Dist::CheckConflicts" : { + "file" : "lib/Dist/CheckConflicts.pm", + "version" : "0.11" + } + }, + "release_status" : "stable", + "resources" : { + "bugtracker" : { + "web" : "https://github.com/doy/dist-checkconflicts/issues" + }, + "homepage" : "http://metacpan.org/release/Dist-CheckConflicts", + "repository" : { + "type" : "git", + "url" : "git://github.com/doy/dist-checkconflicts.git", + "web" : "https://github.com/doy/dist-checkconflicts" + } + }, + "version" : "0.11", + "x_Dist_Zilla" : { + "perl" : { + "version" : "5.018002" + }, + "plugins" : [ + { + "class" : "Dist::Zilla::Plugin::Prereqs", + "config" : { + "Dist::Zilla::Plugin::Prereqs" : { + "phase" : "test", + "type" : "requires" + } + }, + "name" : "@DOY/TestMoreDoneTesting", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::GatherDir", + "name" : "@DOY/GatherDir", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::PruneCruft", + "name" : "@DOY/PruneCruft", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::ManifestSkip", + "name" : "@DOY/ManifestSkip", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::MetaYAML", + "name" : "@DOY/MetaYAML", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::License", + "name" : "@DOY/License", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::Readme", + "name" : "@DOY/Readme", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::RunExtraTests", + "config" : { + "Dist::Zilla::Role::TestRunner" : { + "default_jobs" : 1 + } + }, + "name" : "@DOY/RunExtraTests", + "version" : "0.018" + }, + { + "class" : "Dist::Zilla::Plugin::ExecDir", + "name" : "@DOY/ExecDir", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::ShareDir", + "name" : "@DOY/ShareDir", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::MakeMaker", + "config" : { + "Dist::Zilla::Role::TestRunner" : { + "default_jobs" : 1 + } + }, + "name" : "@DOY/MakeMaker", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::Manifest", + "name" : "@DOY/Manifest", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::TestRelease", + "name" : "@DOY/TestRelease", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::ConfirmRelease", + "name" : "@DOY/ConfirmRelease", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::MetaConfig", + "name" : "@DOY/MetaConfig", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::MetaJSON", + "name" : "@DOY/MetaJSON", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::NextRelease", + "name" : "@DOY/NextRelease", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::CheckChangesHasContent", + "name" : "@DOY/CheckChangesHasContent", + "version" : "0.006" + }, + { + "class" : "Dist::Zilla::Plugin::PkgVersion", + "name" : "@DOY/PkgVersion", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::Authority", + "name" : "@DOY/Authority", + "version" : "1.006" + }, + { + "class" : "Dist::Zilla::Plugin::PodCoverageTests", + "name" : "@DOY/PodCoverageTests", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::PodSyntaxTests", + "name" : "@DOY/PodSyntaxTests", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::NoTabsTests", + "config" : { + "Dist::Zilla::Plugin::Test::NoTabs" : { + "module_finder" : [ + ":InstallModules" + ], + "script_finder" : [ + ":ExecFiles" + ] + } + }, + "name" : "@DOY/NoTabsTests", + "version" : "0.06" + }, + { + "class" : "Dist::Zilla::Plugin::EOLTests", + "name" : "@DOY/EOLTests", + "version" : "0.02" + }, + { + "class" : "Dist::Zilla::Plugin::Test::Compile", + "config" : { + "Dist::Zilla::Plugin::Test::Compile" : { + "filename" : "t/00-compile.t", + "module_finder" : [ + ":InstallModules" + ], + "script_finder" : [ + ":ExecFiles" + ] + } + }, + "name" : "@DOY/Test::Compile", + "version" : "2.039" + }, + { + "class" : "Dist::Zilla::Plugin::Metadata", + "name" : "@DOY/Metadata", + "version" : "3.03" + }, + { + "class" : "Dist::Zilla::Plugin::MetaResources", + "name" : "@DOY/MetaResources", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Check", + "name" : "@DOY/Git::Check", + "version" : "2.020" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Commit", + "name" : "@DOY/Git::Commit", + "version" : "2.020" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Tag", + "name" : "@DOY/Git::Tag", + "version" : "2.020" + }, + { + "class" : "Dist::Zilla::Plugin::Git::NextVersion", + "name" : "@DOY/Git::NextVersion", + "version" : "2.020" + }, + { + "class" : "Dist::Zilla::Plugin::ContributorsFromGit", + "name" : "@DOY/ContributorsFromGit", + "version" : "0.006" + }, + { + "class" : "Dist::Zilla::Plugin::MetaProvides::Package", + "config" : { + "Dist::Zilla::Plugin::MetaProvides::Package" : { + "finder_objects" : [ + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : "@DOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM", + "version" : "5.014" + } + ] + }, + "Dist::Zilla::Role::MetaProvider::Provider" : { + "inherit_missing" : "1", + "inherit_version" : "1", + "meta_noindex" : "1" + } + }, + "name" : "@DOY/MetaProvides::Package", + "version" : "2.000001" + }, + { + "class" : "Dist::Zilla::Plugin::PodWeaver", + "config" : { + "Dist::Zilla::Plugin::PodWeaver" : { + "finder" : [ + ":InstallModules", + ":ExecFiles" + ], + "plugins" : [ + { + "class" : "Pod::Weaver::Plugin::EnsurePod5", + "name" : "@CorePrep/EnsurePod5", + "version" : "4.006" + }, + { + "class" : "Pod::Weaver::Plugin::H1Nester", + "name" : "@CorePrep/H1Nester", + "version" : "4.006" + }, + { + "class" : "Pod::Weaver::Plugin::SingleEncoding", + "name" : "@Default/SingleEncoding", + "version" : "4.006" + }, + { + "class" : "Pod::Weaver::Section::Name", + "name" : "@Default/Name", + "version" : "4.006" + }, + { + "class" : "Pod::Weaver::Section::Version", + "name" : "@Default/Version", + "version" : "4.006" + }, + { + "class" : "Pod::Weaver::Section::Region", + "name" : "@Default/prelude", + "version" : "4.006" + }, + { + "class" : "Pod::Weaver::Section::Generic", + "name" : "SYNOPSIS", + "version" : "4.006" + }, + { + "class" : "Pod::Weaver::Section::Generic", + "name" : "DESCRIPTION", + "version" : "4.006" + }, + { + "class" : "Pod::Weaver::Section::Generic", + "name" : "OVERVIEW", + "version" : "4.006" + }, + { + "class" : "Pod::Weaver::Section::Collect", + "name" : "ATTRIBUTES", + "version" : "4.006" + }, + { + "class" : "Pod::Weaver::Section::Collect", + "name" : "METHODS", + "version" : "4.006" + }, + { + "class" : "Pod::Weaver::Section::Collect", + "name" : "FUNCTIONS", + "version" : "4.006" + }, + { + "class" : "Pod::Weaver::Section::Leftovers", + "name" : "@Default/Leftovers", + "version" : "4.006" + }, + { + "class" : "Pod::Weaver::Section::Region", + "name" : "@Default/postlude", + "version" : "4.006" + }, + { + "class" : "Pod::Weaver::Section::Authors", + "name" : "@Default/Authors", + "version" : "4.006" + }, + { + "class" : "Pod::Weaver::Section::Legal", + "name" : "@Default/Legal", + "version" : "4.006" + } + ] + } + }, + "name" : "@DOY/PodWeaver", + "version" : "4.005" + }, + { + "class" : "Dist::Zilla::Plugin::UploadToCPAN", + "name" : "@DOY/UploadToCPAN", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::AutoPrereqs", + "name" : "AutoPrereqs", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":InstallModules", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":IncModules", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":TestFiles", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":ExecFiles", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":ShareFiles", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":MainModule", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":AllFiles", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":NoFiles", + "version" : "5.014" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : "@DOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM", + "version" : "5.014" + } + ], + "zilla" : { + "class" : "Dist::Zilla::Dist::Builder", + "config" : { + "is_trial" : "0" + }, + "version" : "5.014" + } + }, + "x_authority" : "cpan:DOY", + "x_contributors" : [ + "Graham Knop <haarg@haarg.org>", + "Karen Etheridge <ether@cpan.org>", + "Toby Inkster <mail@tobyinkster.co.uk>" + ] +} + diff --git a/META.yml b/META.yml new file mode 100644 index 0000000..27e736b --- /dev/null +++ b/META.yml @@ -0,0 +1,335 @@ +--- +abstract: 'declare version conflicts for your dist' +author: + - 'Jesse Luehrs <doy@tozt.net>' +build_requires: + File::Spec: '0' + IO::Handle: '0' + IPC::Open3: '0' + Test::Fatal: '0' + Test::More: '0.88' + lib: '0' +configure_requires: + ExtUtils::MakeMaker: '6.30' +dynamic_config: 0 +generated_by: 'Dist::Zilla version 5.014, CPAN::Meta::Converter version 2.140640' +license: perl +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: '1.4' +name: Dist-CheckConflicts +provides: + Dist::CheckConflicts: + file: lib/Dist/CheckConflicts.pm + version: '0.11' +requires: + Carp: '0' + Exporter: '0' + Module::Runtime: '0.009' + base: '0' + perl: '5.006' + strict: '0' + warnings: '0' +resources: + bugtracker: https://github.com/doy/dist-checkconflicts/issues + homepage: http://metacpan.org/release/Dist-CheckConflicts + repository: git://github.com/doy/dist-checkconflicts.git +version: '0.11' +x_Dist_Zilla: + perl: + version: '5.018002' + plugins: + - + class: Dist::Zilla::Plugin::Prereqs + config: + Dist::Zilla::Plugin::Prereqs: + phase: test + type: requires + name: '@DOY/TestMoreDoneTesting' + version: '5.014' + - + class: Dist::Zilla::Plugin::GatherDir + name: '@DOY/GatherDir' + version: '5.014' + - + class: Dist::Zilla::Plugin::PruneCruft + name: '@DOY/PruneCruft' + version: '5.014' + - + class: Dist::Zilla::Plugin::ManifestSkip + name: '@DOY/ManifestSkip' + version: '5.014' + - + class: Dist::Zilla::Plugin::MetaYAML + name: '@DOY/MetaYAML' + version: '5.014' + - + class: Dist::Zilla::Plugin::License + name: '@DOY/License' + version: '5.014' + - + class: Dist::Zilla::Plugin::Readme + name: '@DOY/Readme' + version: '5.014' + - + class: Dist::Zilla::Plugin::RunExtraTests + config: + Dist::Zilla::Role::TestRunner: + default_jobs: 1 + name: '@DOY/RunExtraTests' + version: '0.018' + - + class: Dist::Zilla::Plugin::ExecDir + name: '@DOY/ExecDir' + version: '5.014' + - + class: Dist::Zilla::Plugin::ShareDir + name: '@DOY/ShareDir' + version: '5.014' + - + class: Dist::Zilla::Plugin::MakeMaker + config: + Dist::Zilla::Role::TestRunner: + default_jobs: 1 + name: '@DOY/MakeMaker' + version: '5.014' + - + class: Dist::Zilla::Plugin::Manifest + name: '@DOY/Manifest' + version: '5.014' + - + class: Dist::Zilla::Plugin::TestRelease + name: '@DOY/TestRelease' + version: '5.014' + - + class: Dist::Zilla::Plugin::ConfirmRelease + name: '@DOY/ConfirmRelease' + version: '5.014' + - + class: Dist::Zilla::Plugin::MetaConfig + name: '@DOY/MetaConfig' + version: '5.014' + - + class: Dist::Zilla::Plugin::MetaJSON + name: '@DOY/MetaJSON' + version: '5.014' + - + class: Dist::Zilla::Plugin::NextRelease + name: '@DOY/NextRelease' + version: '5.014' + - + class: Dist::Zilla::Plugin::CheckChangesHasContent + name: '@DOY/CheckChangesHasContent' + version: '0.006' + - + class: Dist::Zilla::Plugin::PkgVersion + name: '@DOY/PkgVersion' + version: '5.014' + - + class: Dist::Zilla::Plugin::Authority + name: '@DOY/Authority' + version: '1.006' + - + class: Dist::Zilla::Plugin::PodCoverageTests + name: '@DOY/PodCoverageTests' + version: '5.014' + - + class: Dist::Zilla::Plugin::PodSyntaxTests + name: '@DOY/PodSyntaxTests' + version: '5.014' + - + class: Dist::Zilla::Plugin::NoTabsTests + config: + Dist::Zilla::Plugin::Test::NoTabs: + module_finder: + - ':InstallModules' + script_finder: + - ':ExecFiles' + name: '@DOY/NoTabsTests' + version: '0.06' + - + class: Dist::Zilla::Plugin::EOLTests + name: '@DOY/EOLTests' + version: '0.02' + - + class: Dist::Zilla::Plugin::Test::Compile + config: + Dist::Zilla::Plugin::Test::Compile: + filename: t/00-compile.t + module_finder: + - ':InstallModules' + script_finder: + - ':ExecFiles' + name: '@DOY/Test::Compile' + version: '2.039' + - + class: Dist::Zilla::Plugin::Metadata + name: '@DOY/Metadata' + version: '3.03' + - + class: Dist::Zilla::Plugin::MetaResources + name: '@DOY/MetaResources' + version: '5.014' + - + class: Dist::Zilla::Plugin::Git::Check + name: '@DOY/Git::Check' + version: '2.020' + - + class: Dist::Zilla::Plugin::Git::Commit + name: '@DOY/Git::Commit' + version: '2.020' + - + class: Dist::Zilla::Plugin::Git::Tag + name: '@DOY/Git::Tag' + version: '2.020' + - + class: Dist::Zilla::Plugin::Git::NextVersion + name: '@DOY/Git::NextVersion' + version: '2.020' + - + class: Dist::Zilla::Plugin::ContributorsFromGit + name: '@DOY/ContributorsFromGit' + version: '0.006' + - + class: Dist::Zilla::Plugin::MetaProvides::Package + config: + Dist::Zilla::Plugin::MetaProvides::Package: + finder_objects: + - + class: Dist::Zilla::Plugin::FinderCode + name: '@DOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM' + version: '5.014' + Dist::Zilla::Role::MetaProvider::Provider: + inherit_missing: '1' + inherit_version: '1' + meta_noindex: '1' + name: '@DOY/MetaProvides::Package' + version: '2.000001' + - + class: Dist::Zilla::Plugin::PodWeaver + config: + Dist::Zilla::Plugin::PodWeaver: + finder: + - ':InstallModules' + - ':ExecFiles' + plugins: + - + class: Pod::Weaver::Plugin::EnsurePod5 + name: '@CorePrep/EnsurePod5' + version: '4.006' + - + class: Pod::Weaver::Plugin::H1Nester + name: '@CorePrep/H1Nester' + version: '4.006' + - + class: Pod::Weaver::Plugin::SingleEncoding + name: '@Default/SingleEncoding' + version: '4.006' + - + class: Pod::Weaver::Section::Name + name: '@Default/Name' + version: '4.006' + - + class: Pod::Weaver::Section::Version + name: '@Default/Version' + version: '4.006' + - + class: Pod::Weaver::Section::Region + name: '@Default/prelude' + version: '4.006' + - + class: Pod::Weaver::Section::Generic + name: SYNOPSIS + version: '4.006' + - + class: Pod::Weaver::Section::Generic + name: DESCRIPTION + version: '4.006' + - + class: Pod::Weaver::Section::Generic + name: OVERVIEW + version: '4.006' + - + class: Pod::Weaver::Section::Collect + name: ATTRIBUTES + version: '4.006' + - + class: Pod::Weaver::Section::Collect + name: METHODS + version: '4.006' + - + class: Pod::Weaver::Section::Collect + name: FUNCTIONS + version: '4.006' + - + class: Pod::Weaver::Section::Leftovers + name: '@Default/Leftovers' + version: '4.006' + - + class: Pod::Weaver::Section::Region + name: '@Default/postlude' + version: '4.006' + - + class: Pod::Weaver::Section::Authors + name: '@Default/Authors' + version: '4.006' + - + class: Pod::Weaver::Section::Legal + name: '@Default/Legal' + version: '4.006' + name: '@DOY/PodWeaver' + version: '4.005' + - + class: Dist::Zilla::Plugin::UploadToCPAN + name: '@DOY/UploadToCPAN' + version: '5.014' + - + class: Dist::Zilla::Plugin::AutoPrereqs + name: AutoPrereqs + version: '5.014' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':InstallModules' + version: '5.014' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':IncModules' + version: '5.014' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':TestFiles' + version: '5.014' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':ExecFiles' + version: '5.014' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':ShareFiles' + version: '5.014' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':MainModule' + version: '5.014' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':AllFiles' + version: '5.014' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':NoFiles' + version: '5.014' + - + class: Dist::Zilla::Plugin::FinderCode + name: '@DOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM' + version: '5.014' + zilla: + class: Dist::Zilla::Dist::Builder + config: + is_trial: '0' + version: '5.014' +x_authority: cpan:DOY +x_contributors: + - 'Graham Knop <haarg@haarg.org>' + - 'Karen Etheridge <ether@cpan.org>' + - 'Toby Inkster <mail@tobyinkster.co.uk>' diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..5574783 --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,74 @@ + +# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.014. +use strict; +use warnings; + +use 5.006; + +use ExtUtils::MakeMaker 6.30; + + + +my %WriteMakefileArgs = ( + "ABSTRACT" => "declare version conflicts for your dist", + "AUTHOR" => "Jesse Luehrs <doy\@tozt.net>", + "BUILD_REQUIRES" => {}, + "CONFIGURE_REQUIRES" => { + "ExtUtils::MakeMaker" => "6.30" + }, + "DISTNAME" => "Dist-CheckConflicts", + "EXE_FILES" => [], + "LICENSE" => "perl", + "NAME" => "Dist::CheckConflicts", + "PREREQ_PM" => { + "Carp" => 0, + "Exporter" => 0, + "Module::Runtime" => "0.009", + "base" => 0, + "strict" => 0, + "warnings" => 0 + }, + "TEST_REQUIRES" => { + "File::Spec" => 0, + "IO::Handle" => 0, + "IPC::Open3" => 0, + "Test::Fatal" => 0, + "Test::More" => "0.88", + "lib" => 0 + }, + "VERSION" => "0.11", + "test" => { + "TESTS" => "t/*.t" + } +); + + +my %FallbackPrereqs = ( + "Carp" => 0, + "Exporter" => 0, + "File::Spec" => 0, + "IO::Handle" => 0, + "IPC::Open3" => 0, + "Module::Runtime" => "0.009", + "Test::Fatal" => 0, + "Test::More" => "0.88", + "base" => 0, + "lib" => 0, + "strict" => 0, + "warnings" => 0 +); + + +unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { + delete $WriteMakefileArgs{TEST_REQUIRES}; + delete $WriteMakefileArgs{BUILD_REQUIRES}; + $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; +} + +delete $WriteMakefileArgs{CONFIGURE_REQUIRES} + unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; + +WriteMakefile(%WriteMakefileArgs); + + + @@ -0,0 +1,15 @@ + + +This archive contains the distribution Dist-CheckConflicts, +version 0.11: + + declare version conflicts for your dist + +This software is copyright (c) 2014 by Jesse Luehrs. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + + +This README file was generated by Dist::Zilla::Plugin::Readme v5.014. + diff --git a/dist.ini b/dist.ini new file mode 100644 index 0000000..14ad5ae --- /dev/null +++ b/dist.ini @@ -0,0 +1,12 @@ +name = Dist-CheckConflicts +author = Jesse Luehrs <doy@tozt.net> +license = Perl_5 +copyright_holder = Jesse Luehrs + +[@DOY] +:version = 0.14 +dist = Dist-CheckConflicts +repository = github + +[AutoPrereqs] +skip = ^(?:Foo|Bar|Baz)(?:$|::) diff --git a/lib/Dist/CheckConflicts.pm b/lib/Dist/CheckConflicts.pm new file mode 100644 index 0000000..8370a01 --- /dev/null +++ b/lib/Dist/CheckConflicts.pm @@ -0,0 +1,361 @@ +package Dist::CheckConflicts; +BEGIN { + $Dist::CheckConflicts::AUTHORITY = 'cpan:DOY'; +} +$Dist::CheckConflicts::VERSION = '0.11'; +use strict; +use warnings; +use 5.006; +# ABSTRACT: declare version conflicts for your dist + +use base 'Exporter'; +our @EXPORT = our @EXPORT_OK = ( + qw(conflicts check_conflicts calculate_conflicts dist) +); + +use Carp; +use Module::Runtime 0.009 'module_notional_filename', 'require_module'; + + +my %CONFLICTS; +my %HAS_CONFLICTS; +my %DISTS; + +sub import { + my $pkg = shift; + my $for = caller; + + my ($conflicts, $alsos, $dist); + ($conflicts, @_) = _strip_opt('-conflicts' => @_); + ($alsos, @_) = _strip_opt('-also' => @_); + ($dist, @_) = _strip_opt('-dist' => @_); + + my %conflicts = %{ $conflicts || {} }; + for my $also (@{ $alsos || [] }) { + eval { require_module($also) } or next; + if (!exists $CONFLICTS{$also}) { + $also .= '::Conflicts'; + eval { require_module($also) } or next; + } + if (!exists $CONFLICTS{$also}) { + next; + } + my %also_confs = $also->conflicts; + for my $also_conf (keys %also_confs) { + $conflicts{$also_conf} = $also_confs{$also_conf} + if !exists $conflicts{$also_conf} + || $conflicts{$also_conf} lt $also_confs{$also_conf}; + } + } + + $CONFLICTS{$for} = \%conflicts; + $DISTS{$for} = $dist || $for; + + if (grep { $_ eq ':runtime' } @_) { + for my $conflict (keys %conflicts) { + $HAS_CONFLICTS{$conflict} ||= []; + push @{ $HAS_CONFLICTS{$conflict} }, $for; + } + + # warn for already loaded things... + for my $conflict (keys %conflicts) { + if (exists $INC{module_notional_filename($conflict)}) { + _check_version([$for], $conflict); + } + } + + # and warn for subsequently loaded things... + @INC = grep { + !(ref($_) eq 'ARRAY' && @$_ > 1 && $_->[1] == \%CONFLICTS) + } @INC; + unshift @INC, [ + sub { + my ($sub, $file) = @_; + + (my $mod = $file) =~ s{\.pm$}{}; + $mod =~ s{/}{::}g; + return unless $mod =~ /[\w:]+/; + + return unless defined $HAS_CONFLICTS{$mod}; + + { + local $HAS_CONFLICTS{$mod}; + require $file; + } + + _check_version($HAS_CONFLICTS{$mod}, $mod); + + # the previous require already handled it + my $called; + return sub { + return 0 if $called; + $_ = "1;"; + $called = 1; + return 1; + }; + }, + \%CONFLICTS, # arbitrary but unique, see above + ]; + } + + $pkg->export_to_level(1, @_); +} + +sub _strip_opt { + my ($opt, @args) = @_; + + my $val; + for my $idx ( 0 .. $#args - 1 ) { + if (defined $args[$idx] && $args[$idx] eq $opt) { + $val = (splice @args, $idx, 2)[1]; + last; + } + } + + return ( $val, @args ); +} + +sub _check_version { + my ($fors, $mod) = @_; + + for my $for (@$fors) { + my $conflict_ver = $CONFLICTS{$for}{$mod}; + my $version = do { + no strict 'refs'; + ${ ${ $mod . '::' }{VERSION} }; + }; + + if ($version le $conflict_ver) { + warn <<EOF; +Conflict detected for $DISTS{$for}: + $mod is version $version, but must be greater than version $conflict_ver +EOF + return; + } + } +} + + +sub conflicts { + my $package = shift; + return %{ $CONFLICTS{ $package } }; +} + + +sub dist { + my $package = shift; + return $DISTS{ $package }; +} + + +sub check_conflicts { + my $package = shift; + my $dist = $package->dist; + my @conflicts = $package->calculate_conflicts; + return unless @conflicts; + + my $err = "Conflicts detected for $dist:\n"; + for my $conflict (@conflicts) { + $err .= " $conflict->{package} is version " + . "$conflict->{installed}, but must be greater than version " + . "$conflict->{required}\n"; + } + die $err; +} + + +sub calculate_conflicts { + my $package = shift; + my %conflicts = $package->conflicts; + + my @ret; + + + CONFLICT: + for my $conflict (keys %conflicts) { + my $success = do { + local $SIG{__WARN__} = sub {}; + eval { require_module($conflict) }; + }; + my $error = $@; + my $file = module_notional_filename($conflict); + next if not $success and $error =~ /Can't locate \Q$file\E in \@INC/; + + warn "Warning: $conflict did not compile" if not $success; + my $installed = $success ? $conflict->VERSION : 'unknown'; + push @ret, { + package => $conflict, + installed => $installed, + required => $conflicts{$conflict}, + } if not $success or $installed le $conflicts{$conflict}; + } + + return sort { $a->{package} cmp $b->{package} } @ret; +} + + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Dist::CheckConflicts - declare version conflicts for your dist + +=head1 VERSION + +version 0.11 + +=head1 SYNOPSIS + + use Dist::CheckConflicts + -dist => 'Class-MOP', + -conflicts => { + 'Moose' => '1.14', + 'namespace::autoclean' => '0.08', + }, + -also => [ + 'Package::Stash::Conflicts', + ]; + + __PACKAGE__->check_conflicts; + +=head1 DESCRIPTION + +One shortcoming of the CPAN clients that currently exist is that they have no +way of specifying conflicting downstream dependencies of modules. This module +attempts to work around this issue by allowing you to specify conflicting +versions of modules separately, and deal with them after the module is done +installing. + +For instance, say you have a module C<Foo>, and some other module C<Bar> uses +C<Foo>. If C<Foo> were to change its API in a non-backwards-compatible way, +this would cause C<Bar> to break until it is updated to use the new API. C<Foo> +can't just depend on the fixed version of C<Bar>, because this will cause a +circular dependency (because C<Bar> is already depending on C<Foo>), and this +doesn't express intent properly anyway - C<Foo> doesn't use C<Bar> at all. The +ideal solution would be for there to be a way to specify conflicting versions +of modules in a way that would let CPAN clients update conflicting modules +automatically after an existing module is upgraded, but until that happens, +this module will allow users to do this manually. + +This module accepts a hash of options passed to its C<use> statement, with +these keys being valid: + +=over 4 + +=item -conflicts + +A hashref of conflict specifications, where keys are module names, and values +are the last broken version - any version greater than the specified version +should work. + +=item -also + +Additional modules to get conflicts from (potentially recursively). This should +generally be a list of modules which use Dist::CheckConflicts, which correspond +to the dists that your dist depends on. (In an ideal world, this would be +intuited directly from your dependency list, but the dependency list isn't +available outside of build time). + +=item -dist + +The name of the distribution, to make the error message from check_conflicts +more user-friendly. + +=back + +The methods listed below are exported by this module into the module that uses +it, so you should call these methods on your module, not Dist::CheckConflicts. + +As an example, this command line can be used to update your modules, after +installing the C<Foo> dist (assuming that C<Foo::Conflicts> is the module in +the C<Foo> dist which uses Dist::CheckConflicts): + + perl -MFoo::Conflicts -e'print "$_\n" + for map { $_->{package} } Foo::Conflicts->calculate_conflicts' | cpanm + +As an added bonus, loading your conflicts module will provide warnings at +runtime if conflicting modules are detected (regardless of whether they are +loaded before or afterwards). + +=head1 METHODS + +=head2 conflicts + +Returns the conflict specification (the C<-conflicts> parameter to +C<import()>), as a hash. + +=head2 dist + +Returns the dist name (either as specified by the C<-dist> parameter to +C<import()>, or the package name which C<use>d this module). + +=head2 check_conflicts + +Examine the modules that are currently installed, and throw an exception with +useful information if any modules are at versions which conflict with the dist. + +=head2 calculate_conflicts + +Examine the modules that are currently installed, and return a list of modules +which conflict with the dist. The modules will be returned as a list of +hashrefs, each containing C<package>, C<installed>, and C<required> keys. + +=head1 BUGS + +No known bugs. + +Please report any bugs to GitHub Issues at +L<https://github.com/doy/dist-checkconflicts/issues>. + +=head1 SEE ALSO + +L<Module::Install::CheckConflicts> + +L<Dist::Zilla::Plugin::Conflicts> + +=head1 SUPPORT + +You can find this documentation for this module with the perldoc command. + + perldoc Dist::CheckConflicts + +You can also look for information at: + +=over 4 + +=item * MetaCPAN + +L<https://metacpan.org/release/Dist-CheckConflicts> + +=item * Github + +L<https://github.com/doy/dist-checkconflicts> + +=item * RT: CPAN's request tracker + +L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dist-CheckConflicts> + +=item * CPAN Ratings + +L<http://cpanratings.perl.org/d/Dist-CheckConflicts> + +=back + +=head1 AUTHOR + +Jesse Luehrs <doy@tozt.net> + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2014 by Jesse Luehrs. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut diff --git a/t/00-compile.t b/t/00-compile.t new file mode 100644 index 0000000..1980180 --- /dev/null +++ b/t/00-compile.t @@ -0,0 +1,50 @@ +use 5.006; +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.039 + +use Test::More tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); + + + +my @module_files = ( + 'Dist/CheckConflicts.pm' +); + + + +# no fake home requested + +my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; + +use File::Spec; +use IPC::Open3; +use IO::Handle; + +open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; + +my @warnings; +for my $lib (@module_files) +{ + # see L<perlfaq8/How can I capture STDERR from an external command?> + my $stderr = IO::Handle->new; + + my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); + binmode $stderr, ':crlf' if $^O eq 'MSWin32'; + my @_warnings = <$stderr>; + waitpid($pid, 0); + is($?, 0, "$lib loaded ok"); + + if (@_warnings) + { + warn @_warnings; + push @warnings, @_warnings; + } +} + + + +is(scalar(@warnings), 0, 'no warnings found') if $ENV{AUTHOR_TESTING}; + + diff --git a/t/also.t b/t/also.t new file mode 100644 index 0000000..b671114 --- /dev/null +++ b/t/also.t @@ -0,0 +1,32 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use Test::Fatal; +use lib 't/lib/also'; + +{ + require Bar::Conflicts; + is_deeply( + { Bar::Conflicts->conflicts }, + { + 'Bar::Local' => '0.02', + 'Foo::Thing' => '0.01', + 'Foo::Thing::Sub' => '0.05', + }, + "can detect the proper conflicts module" + ); +} + +{ + require Bar::Conflicts2; + is_deeply( + { Bar::Conflicts2->conflicts }, + { + 'Bar::Also' => '0.06', + }, + "unknown also entries are ignored" + ); +} + +done_testing; diff --git a/t/basic.t b/t/basic.t new file mode 100644 index 0000000..94b8dbd --- /dev/null +++ b/t/basic.t @@ -0,0 +1,47 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use lib 't/lib/basic'; + +{ + require Foo::Conflicts; + is_deeply( + { Foo::Conflicts->conflicts }, + { + 'Foo::Thing' => '0.01', + 'Foo::Thing::Sub' => '0.05', + }, + "basic conflicts work" + ); +} + +{ + require Bar::Conflicts; + is_deeply( + { Bar::Conflicts->conflicts }, + { + 'Bar::Local' => '0.02', + 'Bar::Also' => '0.06', + 'Bar::Also::Also' => '0.12', + }, + "nested conflicts work" + ); + is_deeply( + { Bar::Conflicts2->conflicts }, + { + 'Bar::Also' => '0.06', + 'Bar::Also::Also' => '0.12', + }, + "nested conflicts work" + ); + is_deeply( + { Bar::Conflicts3->conflicts }, + { + 'Bar::Also::Also' => '0.12', + }, + "nested conflicts work" + ); +} + +done_testing; diff --git a/t/conflicts.t b/t/conflicts.t new file mode 100644 index 0000000..f6f830c --- /dev/null +++ b/t/conflicts.t @@ -0,0 +1,112 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use Test::More; +use Test::Fatal; +use lib 't/lib/conflicts'; + +{ + require Foo::Conflicts::Good; + is_deeply( + [ Foo::Conflicts::Good->calculate_conflicts ], + [], + "correct versions for all conflicts", + ); + is( + exception { Foo::Conflicts::Good->check_conflicts }, + undef, + "no conflict error" + ); +} + +{ + require Foo::Conflicts::Bad; + + is_deeply( + [ Foo::Conflicts::Bad->calculate_conflicts ], + [ + { package => 'Foo', installed => '0.02', required => '0.03' }, + { package => 'Foo::Two', installed => '0.02', required => '0.02' }, + ], + "correct versions for all conflicts", + ); + is( + exception { Foo::Conflicts::Bad->check_conflicts }, + "Conflicts detected for Foo::Conflicts::Bad:\n Foo is version 0.02, but must be greater than version 0.03\n Foo::Two is version 0.02, but must be greater than version 0.02\n", + "correct conflict error" + ); +} + +{ + require Bar::Conflicts::Good; + is_deeply( + [ Bar::Conflicts::Good->calculate_conflicts ], + [], + "correct versions for all conflicts", + ); + is( + exception { Bar::Conflicts::Good->check_conflicts }, + undef, + "no conflict error" + ); +} + +{ + require Bar::Conflicts::Bad; + + is_deeply( + [ Bar::Conflicts::Bad->calculate_conflicts ], + [ + { package => 'Bar', installed => '0.02', required => '0.03' }, + { package => 'Bar::Two', installed => '0.02', required => '0.02' }, + ], + "correct versions for all conflicts", + ); + is( + exception { Bar::Conflicts::Bad->check_conflicts }, + "Conflicts detected for Bar::Conflicts::Bad:\n Bar is version 0.02, but must be greater than version 0.03\n Bar::Two is version 0.02, but must be greater than version 0.02\n", + "correct conflict error" + ); +} + +{ + # conflicting module is utterly broken + + require Foo::Conflicts::Broken; + + my @conflicts; + my $warning = ''; + { + local $SIG{__WARN__} = sub { $warning .= $_[0] }; + @conflicts = Foo::Conflicts::Broken->calculate_conflicts; + } + + like $warning, + qr/Warning: Broken did not compile/, + 'Warning is issued when Broken fails to compile'; + + is_deeply( + \@conflicts, + [ + { package => 'Broken', installed => 'unknown', required => '0.03' }, + ], + "correct versions for all conflicts", + ); + + $warning = ''; + { + local $SIG{__WARN__} = sub { $warning .= $_[0] }; + like( + exception { Foo::Conflicts::Broken->check_conflicts }, + qr/^Conflicts detected for Foo::Conflicts::Broken:\n Broken is version unknown, but must be greater than version 0.03\n/, + "correct conflict error", + ); + } + like $warning, + qr/Warning: Broken did not compile/, + 'Warning is also issued when Broken fails to compile', + ; +} + +done_testing; diff --git a/t/dist.t b/t/dist.t new file mode 100644 index 0000000..493de44 --- /dev/null +++ b/t/dist.t @@ -0,0 +1,76 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use Test::Fatal; +use lib 't/lib/dist'; + +{ + require Foo::Conflicts::Good; + is_deeply( + [ Foo::Conflicts::Good->calculate_conflicts ], + [], + "correct versions for all conflicts", + ); + is( + exception { Foo::Conflicts::Good->check_conflicts }, + undef, + "no conflict error" + ); + is(Foo::Conflicts::Good->dist, 'Foo', "correct dist"); +} + +{ + require Foo::Conflicts::Bad; + + is_deeply( + [ Foo::Conflicts::Bad->calculate_conflicts ], + [ + { package => 'Foo', installed => '0.02', required => '0.03' }, + { package => 'Foo::Two', installed => '0.02', required => '0.02' }, + ], + "correct versions for all conflicts", + ); + is( + exception { Foo::Conflicts::Bad->check_conflicts }, + "Conflicts detected for Foo:\n Foo is version 0.02, but must be greater than version 0.03\n Foo::Two is version 0.02, but must be greater than version 0.02\n", + "correct conflict error" + ); + is(Foo::Conflicts::Bad->dist, 'Foo', "correct dist"); +} + +{ + require Bar::Conflicts::Good; + is_deeply( + [ Bar::Conflicts::Good->calculate_conflicts ], + [], + "correct versions for all conflicts", + ); + is( + exception { Bar::Conflicts::Good->check_conflicts }, + undef, + "no conflict error" + ); + is(Bar::Conflicts::Good->dist, 'Bar', "correct dist"); +} + +{ + require Bar::Conflicts::Bad; + + is_deeply( + [ Bar::Conflicts::Bad->calculate_conflicts ], + [ + { package => 'Bar', installed => '0.02', required => '0.03' }, + { package => 'Bar::Two', installed => '0.02', required => '0.02' }, + ], + "correct versions for all conflicts", + ); + is( + exception { Bar::Conflicts::Bad->check_conflicts }, + "Conflicts detected for Bar:\n Bar is version 0.02, but must be greater than version 0.03\n Bar::Two is version 0.02, but must be greater than version 0.02\n", + "correct conflict error" + ); + is(Bar::Conflicts::Bad->dist, 'Bar', "correct dist"); +} + +done_testing; diff --git a/t/lib/also/Bar/Conflicts.pm b/t/lib/also/Bar/Conflicts.pm new file mode 100644 index 0000000..ffeb56a --- /dev/null +++ b/t/lib/also/Bar/Conflicts.pm @@ -0,0 +1,13 @@ +package Bar::Conflicts; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Bar::Local' => 0.02, + }, + -also => [ + 'Foo', + ]; + +1; diff --git a/t/lib/also/Bar/Conflicts2.pm b/t/lib/also/Bar/Conflicts2.pm new file mode 100644 index 0000000..d45754e --- /dev/null +++ b/t/lib/also/Bar/Conflicts2.pm @@ -0,0 +1,13 @@ +package Bar::Conflicts2; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Bar::Also' => 0.06, + }, + -also => [ + 'Baz', + ]; + +1; diff --git a/t/lib/also/Foo.pm b/t/lib/also/Foo.pm new file mode 100644 index 0000000..8c4dc16 --- /dev/null +++ b/t/lib/also/Foo.pm @@ -0,0 +1,5 @@ +package Foo; + +sub foo { } + +1; diff --git a/t/lib/also/Foo/Conflicts.pm b/t/lib/also/Foo/Conflicts.pm new file mode 100644 index 0000000..0d9d7ef --- /dev/null +++ b/t/lib/also/Foo/Conflicts.pm @@ -0,0 +1,11 @@ +package Foo::Conflicts; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Foo::Thing' => 0.01, + 'Foo::Thing::Sub' => 0.05, + }; + +1; diff --git a/t/lib/basic/Bar/Conflicts.pm b/t/lib/basic/Bar/Conflicts.pm new file mode 100644 index 0000000..65ba026 --- /dev/null +++ b/t/lib/basic/Bar/Conflicts.pm @@ -0,0 +1,13 @@ +package Bar::Conflicts; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Bar::Local' => 0.02, + }, + -also => [ + 'Bar::Conflicts2', + ]; + +1; diff --git a/t/lib/basic/Bar/Conflicts2.pm b/t/lib/basic/Bar/Conflicts2.pm new file mode 100644 index 0000000..a26606c --- /dev/null +++ b/t/lib/basic/Bar/Conflicts2.pm @@ -0,0 +1,13 @@ +package Bar::Conflicts2; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Bar::Also' => 0.06, + }, + -also => [ + 'Bar::Conflicts3', + ]; + +1; diff --git a/t/lib/basic/Bar/Conflicts3.pm b/t/lib/basic/Bar/Conflicts3.pm new file mode 100644 index 0000000..4c30909 --- /dev/null +++ b/t/lib/basic/Bar/Conflicts3.pm @@ -0,0 +1,10 @@ +package Bar::Conflicts3; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Bar::Also::Also' => 0.12, + }; + +1; diff --git a/t/lib/basic/Foo/Conflicts.pm b/t/lib/basic/Foo/Conflicts.pm new file mode 100644 index 0000000..0d9d7ef --- /dev/null +++ b/t/lib/basic/Foo/Conflicts.pm @@ -0,0 +1,11 @@ +package Foo::Conflicts; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Foo::Thing' => 0.01, + 'Foo::Thing::Sub' => 0.05, + }; + +1; diff --git a/t/lib/conflicts/Bar.pm b/t/lib/conflicts/Bar.pm new file mode 100644 index 0000000..0ce51ad --- /dev/null +++ b/t/lib/conflicts/Bar.pm @@ -0,0 +1,7 @@ +package Bar; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/conflicts/Bar/Conflicts/Bad.pm b/t/lib/conflicts/Bar/Conflicts/Bad.pm new file mode 100644 index 0000000..32a654e --- /dev/null +++ b/t/lib/conflicts/Bar/Conflicts/Bad.pm @@ -0,0 +1,13 @@ +package Bar::Conflicts::Bad; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Bar' => '0.03', + }, + -also => [ + 'Bar::Conflicts::Bad2', + ]; + +1; diff --git a/t/lib/conflicts/Bar/Conflicts/Bad2.pm b/t/lib/conflicts/Bar/Conflicts/Bad2.pm new file mode 100644 index 0000000..9c76862 --- /dev/null +++ b/t/lib/conflicts/Bar/Conflicts/Bad2.pm @@ -0,0 +1,13 @@ +package Bar::Conflicts::Bad2; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Bar::Two' => '0.02', + }, + -also => [ + 'Bar::Conflicts::Bad3', + ]; + +1; diff --git a/t/lib/conflicts/Bar/Conflicts/Bad3.pm b/t/lib/conflicts/Bar/Conflicts/Bad3.pm new file mode 100644 index 0000000..fb80b9e --- /dev/null +++ b/t/lib/conflicts/Bar/Conflicts/Bad3.pm @@ -0,0 +1,10 @@ +package Bar::Conflicts::Bad3; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Bar::Three' => '0.01', + }; + +1; diff --git a/t/lib/conflicts/Bar/Conflicts/Good.pm b/t/lib/conflicts/Bar/Conflicts/Good.pm new file mode 100644 index 0000000..0f74447 --- /dev/null +++ b/t/lib/conflicts/Bar/Conflicts/Good.pm @@ -0,0 +1,13 @@ +package Bar::Conflicts::Good; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Bar' => '0.01', + }, + -also => [ + 'Bar::Conflicts::Good2', + ]; + +1; diff --git a/t/lib/conflicts/Bar/Conflicts/Good2.pm b/t/lib/conflicts/Bar/Conflicts/Good2.pm new file mode 100644 index 0000000..8ba9fd3 --- /dev/null +++ b/t/lib/conflicts/Bar/Conflicts/Good2.pm @@ -0,0 +1,13 @@ +package Bar::Conflicts::Good2; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Bar::Two' => '0.01', + }, + -also => [ + 'Bar::Conflicts::Good3', + ]; + +1; diff --git a/t/lib/conflicts/Bar/Conflicts/Good3.pm b/t/lib/conflicts/Bar/Conflicts/Good3.pm new file mode 100644 index 0000000..88b542e --- /dev/null +++ b/t/lib/conflicts/Bar/Conflicts/Good3.pm @@ -0,0 +1,10 @@ +package Bar::Conflicts::Good3; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Bar::Three' => '0.01', + }; + +1; diff --git a/t/lib/conflicts/Bar/Three.pm b/t/lib/conflicts/Bar/Three.pm new file mode 100644 index 0000000..8c304fe --- /dev/null +++ b/t/lib/conflicts/Bar/Three.pm @@ -0,0 +1,7 @@ +package Bar::Three; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/conflicts/Bar/Two.pm b/t/lib/conflicts/Bar/Two.pm new file mode 100644 index 0000000..172ad51 --- /dev/null +++ b/t/lib/conflicts/Bar/Two.pm @@ -0,0 +1,7 @@ +package Bar::Two; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/conflicts/Broken.pm b/t/lib/conflicts/Broken.pm new file mode 100644 index 0000000..de400c3 --- /dev/null +++ b/t/lib/conflicts/Broken.pm @@ -0,0 +1,3 @@ +package Broken; + +die 'this module is utterly broken'; diff --git a/t/lib/conflicts/Foo.pm b/t/lib/conflicts/Foo.pm new file mode 100644 index 0000000..9660e6d --- /dev/null +++ b/t/lib/conflicts/Foo.pm @@ -0,0 +1,7 @@ +package Foo; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/conflicts/Foo/Conflicts/Bad.pm b/t/lib/conflicts/Foo/Conflicts/Bad.pm new file mode 100644 index 0000000..1cbf30f --- /dev/null +++ b/t/lib/conflicts/Foo/Conflicts/Bad.pm @@ -0,0 +1,12 @@ +package Foo::Conflicts::Bad; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Foo' => 0.03, + 'Foo::Two' => 0.02, + 'Foo::Three' => 0.01, + }; + +1; diff --git a/t/lib/conflicts/Foo/Conflicts/Broken.pm b/t/lib/conflicts/Foo/Conflicts/Broken.pm new file mode 100644 index 0000000..87043ae --- /dev/null +++ b/t/lib/conflicts/Foo/Conflicts/Broken.pm @@ -0,0 +1,11 @@ +package Foo::Conflicts::Broken; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Broken' => '0.03', + 'NotInstalled' => '0.01', + }; + +1; diff --git a/t/lib/conflicts/Foo/Conflicts/Good.pm b/t/lib/conflicts/Foo/Conflicts/Good.pm new file mode 100644 index 0000000..33d15de --- /dev/null +++ b/t/lib/conflicts/Foo/Conflicts/Good.pm @@ -0,0 +1,13 @@ +package Foo::Conflicts::Good; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Foo' => 0.01, + 'Foo::Two' => 0.01, + 'Foo::Three' => 0.01, + 'NotInstalled' => '0.01', + }; + +1; diff --git a/t/lib/conflicts/Foo/Three.pm b/t/lib/conflicts/Foo/Three.pm new file mode 100644 index 0000000..b180934 --- /dev/null +++ b/t/lib/conflicts/Foo/Three.pm @@ -0,0 +1,7 @@ +package Foo::Three; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/conflicts/Foo/Two.pm b/t/lib/conflicts/Foo/Two.pm new file mode 100644 index 0000000..7a1daff --- /dev/null +++ b/t/lib/conflicts/Foo/Two.pm @@ -0,0 +1,7 @@ +package Foo::Two; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/dist/Bar.pm b/t/lib/dist/Bar.pm new file mode 100644 index 0000000..0ce51ad --- /dev/null +++ b/t/lib/dist/Bar.pm @@ -0,0 +1,7 @@ +package Bar; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/dist/Bar/Conflicts/Bad.pm b/t/lib/dist/Bar/Conflicts/Bad.pm new file mode 100644 index 0000000..af25aab --- /dev/null +++ b/t/lib/dist/Bar/Conflicts/Bad.pm @@ -0,0 +1,14 @@ +package Bar::Conflicts::Bad; +use strict; +use warnings; + +use Dist::CheckConflicts + -dist => 'Bar', + -conflicts => { + 'Bar' => '0.03', + }, + -also => [ + 'Bar::Conflicts::Bad2', + ]; + +1; diff --git a/t/lib/dist/Bar/Conflicts/Bad2.pm b/t/lib/dist/Bar/Conflicts/Bad2.pm new file mode 100644 index 0000000..c4f1c1a --- /dev/null +++ b/t/lib/dist/Bar/Conflicts/Bad2.pm @@ -0,0 +1,14 @@ +package Bar::Conflicts::Bad2; +use strict; +use warnings; + +use Dist::CheckConflicts + -dist => 'Bar', + -conflicts => { + 'Bar::Two' => '0.02', + }, + -also => [ + 'Bar::Conflicts::Bad3', + ]; + +1; diff --git a/t/lib/dist/Bar/Conflicts/Bad3.pm b/t/lib/dist/Bar/Conflicts/Bad3.pm new file mode 100644 index 0000000..be23e3c --- /dev/null +++ b/t/lib/dist/Bar/Conflicts/Bad3.pm @@ -0,0 +1,11 @@ +package Bar::Conflicts::Bad3; +use strict; +use warnings; + +use Dist::CheckConflicts + -dist => 'Bar', + -conflicts => { + 'Bar::Three' => '0.01', + }; + +1; diff --git a/t/lib/dist/Bar/Conflicts/Good.pm b/t/lib/dist/Bar/Conflicts/Good.pm new file mode 100644 index 0000000..cd64e57 --- /dev/null +++ b/t/lib/dist/Bar/Conflicts/Good.pm @@ -0,0 +1,14 @@ +package Bar::Conflicts::Good; +use strict; +use warnings; + +use Dist::CheckConflicts + -dist => 'Bar', + -conflicts => { + 'Bar' => '0.01', + }, + -also => [ + 'Bar::Conflicts::Good2', + ]; + +1; diff --git a/t/lib/dist/Bar/Conflicts/Good2.pm b/t/lib/dist/Bar/Conflicts/Good2.pm new file mode 100644 index 0000000..ed98ddc --- /dev/null +++ b/t/lib/dist/Bar/Conflicts/Good2.pm @@ -0,0 +1,14 @@ +package Bar::Conflicts::Good2; +use strict; +use warnings; + +use Dist::CheckConflicts + -dist => 'Bar', + -conflicts => { + 'Bar::Two' => '0.01', + }, + -also => [ + 'Bar::Conflicts::Good3', + ]; + +1; diff --git a/t/lib/dist/Bar/Conflicts/Good3.pm b/t/lib/dist/Bar/Conflicts/Good3.pm new file mode 100644 index 0000000..7bb0943 --- /dev/null +++ b/t/lib/dist/Bar/Conflicts/Good3.pm @@ -0,0 +1,11 @@ +package Bar::Conflicts::Good3; +use strict; +use warnings; + +use Dist::CheckConflicts + -dist => 'Bar', + -conflicts => { + 'Bar::Three' => '0.01', + }; + +1; diff --git a/t/lib/dist/Bar/Three.pm b/t/lib/dist/Bar/Three.pm new file mode 100644 index 0000000..8c304fe --- /dev/null +++ b/t/lib/dist/Bar/Three.pm @@ -0,0 +1,7 @@ +package Bar::Three; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/dist/Bar/Two.pm b/t/lib/dist/Bar/Two.pm new file mode 100644 index 0000000..172ad51 --- /dev/null +++ b/t/lib/dist/Bar/Two.pm @@ -0,0 +1,7 @@ +package Bar::Two; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/dist/Foo.pm b/t/lib/dist/Foo.pm new file mode 100644 index 0000000..9660e6d --- /dev/null +++ b/t/lib/dist/Foo.pm @@ -0,0 +1,7 @@ +package Foo; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/dist/Foo/Conflicts/Bad.pm b/t/lib/dist/Foo/Conflicts/Bad.pm new file mode 100644 index 0000000..22905ee --- /dev/null +++ b/t/lib/dist/Foo/Conflicts/Bad.pm @@ -0,0 +1,13 @@ +package Foo::Conflicts::Bad; +use strict; +use warnings; + +use Dist::CheckConflicts + -dist => 'Foo', + -conflicts => { + 'Foo' => 0.03, + 'Foo::Two' => 0.02, + 'Foo::Three' => 0.01, + }; + +1; diff --git a/t/lib/dist/Foo/Conflicts/Good.pm b/t/lib/dist/Foo/Conflicts/Good.pm new file mode 100644 index 0000000..553c698 --- /dev/null +++ b/t/lib/dist/Foo/Conflicts/Good.pm @@ -0,0 +1,13 @@ +package Foo::Conflicts::Good; +use strict; +use warnings; + +use Dist::CheckConflicts + -dist => 'Foo', + -conflicts => { + 'Foo' => 0.01, + 'Foo::Two' => 0.01, + 'Foo::Three' => 0.01, + }; + +1; diff --git a/t/lib/dist/Foo/Three.pm b/t/lib/dist/Foo/Three.pm new file mode 100644 index 0000000..b180934 --- /dev/null +++ b/t/lib/dist/Foo/Three.pm @@ -0,0 +1,7 @@ +package Foo::Three; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/dist/Foo/Two.pm b/t/lib/dist/Foo/Two.pm new file mode 100644 index 0000000..7a1daff --- /dev/null +++ b/t/lib/dist/Foo/Two.pm @@ -0,0 +1,7 @@ +package Foo::Two; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/merge/Foo/Conflicts.pm b/t/lib/merge/Foo/Conflicts.pm new file mode 100644 index 0000000..3691702 --- /dev/null +++ b/t/lib/merge/Foo/Conflicts.pm @@ -0,0 +1,15 @@ +package Foo::Conflicts; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Foo::One' => 0.01, + 'Foo::Two' => 0.03, + 'Foo::Three' => 0.02, + }, + -also => [ + 'Foo::Conflicts2', + ]; + +1; diff --git a/t/lib/merge/Foo/Conflicts2.pm b/t/lib/merge/Foo/Conflicts2.pm new file mode 100644 index 0000000..b782a2b --- /dev/null +++ b/t/lib/merge/Foo/Conflicts2.pm @@ -0,0 +1,12 @@ +package Foo::Conflicts2; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Foo::One' => 0.03, + 'Foo::Two' => 0.01, + 'Foo::Four' => 0.02, + }; + +1; diff --git a/t/lib/runtime/Bar.pm b/t/lib/runtime/Bar.pm new file mode 100644 index 0000000..8691a44 --- /dev/null +++ b/t/lib/runtime/Bar.pm @@ -0,0 +1,13 @@ +package Bar; +use strict; +use warnings; + +use Bar::Foo; +use Bar::Baz; + +use Bar::Conflicts; + +use Bar::Bar; +use Bar::Quux; + +1; diff --git a/t/lib/runtime/Bar/Bar.pm b/t/lib/runtime/Bar/Bar.pm new file mode 100644 index 0000000..d532db6 --- /dev/null +++ b/t/lib/runtime/Bar/Bar.pm @@ -0,0 +1,18 @@ +package Bar::Bar; +use strict; +use warnings; + +use Bar::Bar::Good; +use Bar::Bar::Bad; + +our $VERSION = 0.01; + +sub contents { + local $/; + <DATA> +} + +1; + +__DATA__ +__DATA__ for Bar::Bar diff --git a/t/lib/runtime/Bar/Bar/Bad.pm b/t/lib/runtime/Bar/Bar/Bad.pm new file mode 100644 index 0000000..9a4792b --- /dev/null +++ b/t/lib/runtime/Bar/Bar/Bad.pm @@ -0,0 +1,7 @@ +package Bar::Bar::Bad; +use strict; +use warnings; + +our $VERSION = 0.01; + +1; diff --git a/t/lib/runtime/Bar/Bar/Good.pm b/t/lib/runtime/Bar/Bar/Good.pm new file mode 100644 index 0000000..58e6d78 --- /dev/null +++ b/t/lib/runtime/Bar/Bar/Good.pm @@ -0,0 +1,7 @@ +package Bar::Bar::Good; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/runtime/Bar/Baz.pm b/t/lib/runtime/Bar/Baz.pm new file mode 100644 index 0000000..b4db03b --- /dev/null +++ b/t/lib/runtime/Bar/Baz.pm @@ -0,0 +1,18 @@ +package Bar::Baz; +use strict; +use warnings; + +use Bar::Baz::Good; +use Bar::Baz::Bad; + +our $VERSION = 0.02; + +sub contents { + local $/; + <DATA> +} + +1; + +__DATA__ +__DATA__ for Bar::Baz diff --git a/t/lib/runtime/Bar/Baz/Bad.pm b/t/lib/runtime/Bar/Baz/Bad.pm new file mode 100644 index 0000000..c92da0e --- /dev/null +++ b/t/lib/runtime/Bar/Baz/Bad.pm @@ -0,0 +1,7 @@ +package Bar::Baz::Bad; +use strict; +use warnings; + +our $VERSION = 0.01; + +1; diff --git a/t/lib/runtime/Bar/Baz/Good.pm b/t/lib/runtime/Bar/Baz/Good.pm new file mode 100644 index 0000000..2205717 --- /dev/null +++ b/t/lib/runtime/Bar/Baz/Good.pm @@ -0,0 +1,7 @@ +package Bar::Baz::Good; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/runtime/Bar/Conflicts.pm b/t/lib/runtime/Bar/Conflicts.pm new file mode 100644 index 0000000..c9c6f3d --- /dev/null +++ b/t/lib/runtime/Bar/Conflicts.pm @@ -0,0 +1,22 @@ +package Bar::Conflicts; +use strict; +use warnings; + +use Dist::CheckConflicts + ':runtime', + -conflicts => { + 'Bar::Foo' => 0.01, + 'Bar::Foo::Good' => 0.01, + 'Bar::Foo::Bad' => 0.01, + 'Bar::Bar' => 0.01, + 'Bar::Bar::Good' => 0.01, + 'Bar::Bar::Bad' => 0.01, + 'Bar::Baz' => 0.01, + 'Bar::Baz::Good' => 0.01, + 'Bar::Baz::Bad' => 0.01, + 'Bar::Quux' => 0.01, + 'Bar::Quux::Good' => 0.01, + 'Bar::Quux::Bad' => 0.01, + }; + +1; diff --git a/t/lib/runtime/Bar/Foo.pm b/t/lib/runtime/Bar/Foo.pm new file mode 100644 index 0000000..99341ac --- /dev/null +++ b/t/lib/runtime/Bar/Foo.pm @@ -0,0 +1,18 @@ +package Bar::Foo; +use strict; +use warnings; + +use Bar::Foo::Good; +use Bar::Foo::Bad; + +our $VERSION = 0.01; + +sub contents { + local $/; + <DATA> +} + +1; + +__DATA__ +__DATA__ for Bar::Foo diff --git a/t/lib/runtime/Bar/Foo/Bad.pm b/t/lib/runtime/Bar/Foo/Bad.pm new file mode 100644 index 0000000..d4a58d3 --- /dev/null +++ b/t/lib/runtime/Bar/Foo/Bad.pm @@ -0,0 +1,7 @@ +package Bar::Foo::Bad; +use strict; +use warnings; + +our $VERSION = 0.01; + +1; diff --git a/t/lib/runtime/Bar/Foo/Good.pm b/t/lib/runtime/Bar/Foo/Good.pm new file mode 100644 index 0000000..f5d8b73 --- /dev/null +++ b/t/lib/runtime/Bar/Foo/Good.pm @@ -0,0 +1,7 @@ +package Bar::Foo::Good; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/runtime/Bar/Quux.pm b/t/lib/runtime/Bar/Quux.pm new file mode 100644 index 0000000..1ec6f35 --- /dev/null +++ b/t/lib/runtime/Bar/Quux.pm @@ -0,0 +1,18 @@ +package Bar::Quux; +use strict; +use warnings; + +use Bar::Quux::Good; +use Bar::Quux::Bad; + +our $VERSION = 0.02; + +sub contents { + local $/; + <DATA> +} + +1; + +__DATA__ +__DATA__ for Bar::Quux diff --git a/t/lib/runtime/Bar/Quux/Bad.pm b/t/lib/runtime/Bar/Quux/Bad.pm new file mode 100644 index 0000000..2238323 --- /dev/null +++ b/t/lib/runtime/Bar/Quux/Bad.pm @@ -0,0 +1,7 @@ +package Bar::Quux::Bad; +use strict; +use warnings; + +our $VERSION = 0.01; + +1; diff --git a/t/lib/runtime/Bar/Quux/Good.pm b/t/lib/runtime/Bar/Quux/Good.pm new file mode 100644 index 0000000..8692c2c --- /dev/null +++ b/t/lib/runtime/Bar/Quux/Good.pm @@ -0,0 +1,7 @@ +package Bar::Quux::Good; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/runtime/Foo.pm b/t/lib/runtime/Foo.pm new file mode 100644 index 0000000..5fd77ef --- /dev/null +++ b/t/lib/runtime/Foo.pm @@ -0,0 +1,13 @@ +package Foo; +use strict; +use warnings; + +use Foo::Foo; +use Foo::Baz; + +use Foo::Conflicts; + +use Foo::Bar; +use Foo::Quux; + +1; diff --git a/t/lib/runtime/Foo/Bar.pm b/t/lib/runtime/Foo/Bar.pm new file mode 100644 index 0000000..c4c6af8 --- /dev/null +++ b/t/lib/runtime/Foo/Bar.pm @@ -0,0 +1,7 @@ +package Foo::Bar; +use strict; +use warnings; + +our $VERSION = 0.01; + +1; diff --git a/t/lib/runtime/Foo/Baz.pm b/t/lib/runtime/Foo/Baz.pm new file mode 100644 index 0000000..665f3b5 --- /dev/null +++ b/t/lib/runtime/Foo/Baz.pm @@ -0,0 +1,7 @@ +package Foo::Baz; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/runtime/Foo/Conflicts.pm b/t/lib/runtime/Foo/Conflicts.pm new file mode 100644 index 0000000..34ea4b0 --- /dev/null +++ b/t/lib/runtime/Foo/Conflicts.pm @@ -0,0 +1,14 @@ +package Foo::Conflicts; +use strict; +use warnings; + +use Dist::CheckConflicts + ':runtime', + -conflicts => { + 'Foo::Foo' => 0.01, + 'Foo::Bar' => 0.01, + 'Foo::Baz' => 0.01, + 'Foo::Quux' => 0.01, + }; + +1; diff --git a/t/lib/runtime/Foo/Foo.pm b/t/lib/runtime/Foo/Foo.pm new file mode 100644 index 0000000..ca6c28e --- /dev/null +++ b/t/lib/runtime/Foo/Foo.pm @@ -0,0 +1,7 @@ +package Foo::Foo; +use strict; +use warnings; + +our $VERSION = 0.01; + +1; diff --git a/t/lib/runtime/Foo/Quux.pm b/t/lib/runtime/Foo/Quux.pm new file mode 100644 index 0000000..f813ae3 --- /dev/null +++ b/t/lib/runtime/Foo/Quux.pm @@ -0,0 +1,7 @@ +package Foo::Quux; +use strict; +use warnings; + +our $VERSION = 0.02; + +1; diff --git a/t/lib/warn/Foo/Conflicts.pm b/t/lib/warn/Foo/Conflicts.pm new file mode 100644 index 0000000..e55ead3 --- /dev/null +++ b/t/lib/warn/Foo/Conflicts.pm @@ -0,0 +1,10 @@ +package Foo::Conflicts; +use strict; +use warnings; + +use Dist::CheckConflicts + -conflicts => { + 'Foo::Thing' => 0.01, + }; + +1; diff --git a/t/lib/warn/Foo/Thing.pm b/t/lib/warn/Foo/Thing.pm new file mode 100644 index 0000000..8dfa0b4 --- /dev/null +++ b/t/lib/warn/Foo/Thing.pm @@ -0,0 +1,9 @@ +package Foo::Thing; +use strict; +use warnings; + +our $VERSION = 0.02; + +warn "Loading Foo::Thing"; + +1; diff --git a/t/merge.t b/t/merge.t new file mode 100644 index 0000000..074efaf --- /dev/null +++ b/t/merge.t @@ -0,0 +1,21 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use lib 't/lib/merge'; + +{ + require Foo::Conflicts; + is_deeply( + { Foo::Conflicts->conflicts }, + { + 'Foo::One' => '0.03', + 'Foo::Two' => '0.03', + 'Foo::Three' => '0.02', + 'Foo::Four' => '0.02', + }, + "got the right conflicts" + ); +} + +done_testing; diff --git a/t/runtime.t b/t/runtime.t new file mode 100644 index 0000000..5125e91 --- /dev/null +++ b/t/runtime.t @@ -0,0 +1,49 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use lib 't/lib/runtime'; + +use Module::Runtime 'require_module'; + +sub warnings_ok { + my ($class, @conflicts) = @_; + local $Test::Builder::Level = $Test::Builder::Level + 1; + @conflicts = sort map { "Conflict detected for $_->[0]:\n $_->[1] is version $_->[2], but must be greater than version $_->[3]\n" } @conflicts; + + my @warnings; + { + local $SIG{__WARN__} = sub { push @warnings, $_[0] }; + require_module($class); + } + @warnings = sort @warnings; + + is_deeply(\@warnings, \@conflicts, "correct runtime warnings for $class"); +} + +warnings_ok( + 'Foo', + ['Foo::Conflicts', 'Foo::Foo', '0.01', '0.01'], + ['Foo::Conflicts', 'Foo::Bar', '0.01', '0.01'], +); +warnings_ok( + 'Bar', + ['Bar::Conflicts', 'Bar::Baz::Bad', '0.01', '0.01'], + ['Bar::Conflicts', 'Bar::Foo::Bad', '0.01', '0.01'], + ['Bar::Conflicts', 'Bar::Foo', '0.01', '0.01'], + ['Bar::Conflicts', 'Bar::Bar::Bad', '0.01', '0.01'], + ['Bar::Conflicts', 'Bar::Bar', '0.01', '0.01'], + ['Bar::Conflicts', 'Bar::Quux::Bad', '0.01', '0.01'], +); + +is(Bar::Foo->contents, "__DATA__ for Bar::Foo\n", "__DATA__ sections intact"); +is(Bar::Bar->contents, "__DATA__ for Bar::Bar\n", "__DATA__ sections intact"); +is(Bar::Baz->contents, "__DATA__ for Bar::Baz\n", "__DATA__ sections intact"); +is(Bar::Quux->contents, "__DATA__ for Bar::Quux\n", "__DATA__ sections intact"); + +is(scalar(grep { ref($_) eq 'ARRAY' && @$_ > 1 && ref($_->[1]) eq 'HASH' } + @INC), + 1, + "only installed one \@INC hook"); + +done_testing; diff --git a/t/warn.t b/t/warn.t new file mode 100644 index 0000000..3f3ce33 --- /dev/null +++ b/t/warn.t @@ -0,0 +1,16 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use lib 't/lib/warn'; + +{ + require Foo::Conflicts; + + my $warning = ''; + local $SIG{__WARN__} = sub { $warning .= $_[0] }; + my $conflicts = Foo::Conflicts->calculate_conflicts; + is($warning, '', "we don't see warnings from loaded modules"); +} + +done_testing; diff --git a/xt/release/eol.t b/xt/release/eol.t new file mode 100644 index 0000000..d13c49d --- /dev/null +++ b/xt/release/eol.t @@ -0,0 +1,8 @@ +use strict; +use warnings; +use Test::More; + +eval 'use Test::EOL'; +plan skip_all => 'Test::EOL required' if $@; + +all_perl_files_ok({ trailing_whitespace => 1 }); diff --git a/xt/release/no-tabs.t b/xt/release/no-tabs.t new file mode 100644 index 0000000..9c46499 --- /dev/null +++ b/xt/release/no-tabs.t @@ -0,0 +1,14 @@ +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::NoTabsTests 0.06 + +use Test::More 0.88; +use Test::NoTabs; + +my @files = ( + 'lib/Dist/CheckConflicts.pm' +); + +notabs_ok($_) foreach @files; +done_testing; diff --git a/xt/release/pod-coverage.t b/xt/release/pod-coverage.t new file mode 100644 index 0000000..66b3b64 --- /dev/null +++ b/xt/release/pod-coverage.t @@ -0,0 +1,7 @@ +#!perl +# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. + +use Test::Pod::Coverage 1.08; +use Pod::Coverage::TrustPod; + +all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); diff --git a/xt/release/pod-syntax.t b/xt/release/pod-syntax.t new file mode 100644 index 0000000..f0468f1 --- /dev/null +++ b/xt/release/pod-syntax.t @@ -0,0 +1,6 @@ +#!perl +# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. +use Test::More; +use Test::Pod 1.41; + +all_pod_files_ok(); |