Module-Faker-0.016000755000766000024 012236331710 13216 5ustar00rjbsstaff000000000000README100644000766000024 46312236331710 14142 0ustar00rjbsstaff000000000000Module-Faker-0.016 This archive contains the distribution Module-Faker, version 0.016: build fake dists for testing CPAN tools This software is copyright (c) 2008 by Ricardo Signes. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Changes100644000766000024 434112236331710 14574 0ustar00rjbsstaff000000000000Module-Faker-0.016Revision history for Module-Faker 0.016 2013-11-05 22:13:08 America/New_York - require a newer CPAN::Meta 0.015 2013-10-22 18:53:18 America/New_York [THIS MIGHT BREAK YOUR CODE] - Adds META.json and CPAN::META::Spec v2 support (thanks, David Golden!) If you were using ->provides to get objects, you should now use ->packages instead. 0.014 2013-04-29 08:00:05 America/New_York like 0.013, but with the promised change! 0.013 2013-04-29 07:58:54 America/New_York drop // use to continue to support 5.8.8 (thank Jeffrey Ryan Thalhammer for this one!) 0.012 2012-10-22 17:38:27 America/New_York allow the mtime to be set via extra info (thanks, Moritz Onken!) 0.011 2012-09-05 09:11:21 America/New_York add a VERSION to ::Module, add abstracts 0.010 2012-09-03 21:38:01 America/New_York encode append content to UTF-8 before appending it (thanks, Randy Stauner!) 0.009 2011-04-25 10:57:47 America/New_York allow content to be appended to arbitrary files (thanks, Moritz Onken!) 0.008 2011-04-18 11:02:50 Europe/Amsterdam .dist files can be used to populate entirely from distnameinfo 0.007 2011-04-16 18:02:12 Europe/Amsterdam "Faker" key in meta files is now "X_Module_Faker" build fake dists from .json files, too 0.006 2008-04-08 if source meta has "requires" put them in PREREQ_PM in Makefile.PL (thanks, HDP, for bugfix) 0.005 2008-03-20 add (possibly to-be-renamed) Faker.order key to provides 0.004 2008-03-15 add omitted_files option (and test) add some documentation crank up the Moose prereq number to support ArrayRef[Foo] 0.003 2008-03-14 renamed from ExtUtils-FakeMaker; MSCHWERN notes that ExtUtils is basically a misunderstood and deprecated namespace 0.002 2008-03-13 support perl 5.8 apparently my employers want to be able to use this code that I wrote for work! ha! 0.001 2008-03-13 first revision, basically no documentation or tests, but hey! at least I got it out the door LICENSE100644000766000024 4366112236331710 14336 0ustar00rjbsstaff000000000000Module-Faker-0.016This software is copyright (c) 2008 by Ricardo Signes. 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) 2008 by Ricardo Signes. 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, Suite 500, Boston, MA 02110-1335 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. Copyright (C) 19yy 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. , 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) 2008 by Ricardo Signes. 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 dist.ini100644000766000024 22412236331710 14721 0ustar00rjbsstaff000000000000Module-Faker-0.016name = Module-Faker author = Ricardo Signes license = Perl_5 copyright_holder = Ricardo Signes copyright_year = 2008 [@RJBS] META.yml100644000766000024 1270712236331710 14577 0ustar00rjbsstaff000000000000Module-Faker-0.016--- abstract: 'build fake dists for testing CPAN tools' author: - 'Ricardo Signes ' build_requires: Cwd: 0 Path::Class: 0.06 Test::More: 0.96 configure_requires: ExtUtils::MakeMaker: 6.30 dynamic_config: 0 generated_by: 'Dist::Zilla version 5.005, CPAN::Meta::Converter version 2.132830' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Module-Faker requires: Archive::Any::Create: 0 CPAN::DistnameInfo: 0 CPAN::Meta: 2.130880 CPAN::Meta::Requirements: 0 Carp: 0 Encode: 0 File::Next: 0 File::Path: 0 File::Temp: 0 Moose: 0.33 Moose::Role: 0 Moose::Util::TypeConstraints: 0 Parse::CPAN::Meta: 1.4401 Path::Class: 0.06 Text::Template: 0 perl: 5.008 strict: 0 warnings: 0 resources: bugtracker: https://github.com/rjbs/Module-Faker/issues homepage: https://github.com/rjbs/Module-Faker repository: https://github.com/rjbs/Module-Faker.git version: 0.016 x_Dist_Zilla: perl: version: 5.019005 plugins: - class: Dist::Zilla::Plugin::Git::GatherDir name: '@RJBS/Git::GatherDir' version: 2.017 - class: Dist::Zilla::Plugin::CheckPrereqsIndexed name: '@RJBS/CheckPrereqsIndexed' version: 0.009 - class: Dist::Zilla::Plugin::CheckExtraTests name: '@RJBS/CheckExtraTests' version: 0.015 - class: Dist::Zilla::Plugin::PromptIfStale name: '@RJBS/RJBS-Outdated' version: 0.009 - class: Dist::Zilla::Plugin::PromptIfStale name: '@RJBS/CPAN-Outdated' version: 0.009 - class: Dist::Zilla::Plugin::PruneCruft name: '@RJBS/@Filter/PruneCruft' version: 5.005 - class: Dist::Zilla::Plugin::ManifestSkip name: '@RJBS/@Filter/ManifestSkip' version: 5.005 - class: Dist::Zilla::Plugin::MetaYAML name: '@RJBS/@Filter/MetaYAML' version: 5.005 - class: Dist::Zilla::Plugin::License name: '@RJBS/@Filter/License' version: 5.005 - class: Dist::Zilla::Plugin::Readme name: '@RJBS/@Filter/Readme' version: 5.005 - class: Dist::Zilla::Plugin::ExecDir name: '@RJBS/@Filter/ExecDir' version: 5.005 - class: Dist::Zilla::Plugin::ShareDir name: '@RJBS/@Filter/ShareDir' version: 5.005 - class: Dist::Zilla::Plugin::MakeMaker name: '@RJBS/@Filter/MakeMaker' version: 5.005 - class: Dist::Zilla::Plugin::Manifest name: '@RJBS/@Filter/Manifest' version: 5.005 - class: Dist::Zilla::Plugin::TestRelease name: '@RJBS/@Filter/TestRelease' version: 5.005 - class: Dist::Zilla::Plugin::ConfirmRelease name: '@RJBS/@Filter/ConfirmRelease' version: 5.005 - class: Dist::Zilla::Plugin::UploadToCPAN name: '@RJBS/@Filter/UploadToCPAN' version: 5.005 - class: Dist::Zilla::Plugin::AutoPrereqs name: '@RJBS/AutoPrereqs' version: 5.005 - class: Dist::Zilla::Plugin::Git::NextVersion name: '@RJBS/Git::NextVersion' version: 2.017 - class: Dist::Zilla::Plugin::PkgVersion name: '@RJBS/PkgVersion' version: 5.005 - class: Dist::Zilla::Plugin::MetaConfig name: '@RJBS/MetaConfig' version: 5.005 - class: Dist::Zilla::Plugin::MetaJSON name: '@RJBS/MetaJSON' version: 5.005 - class: Dist::Zilla::Plugin::NextRelease name: '@RJBS/NextRelease' version: 5.005 - class: Dist::Zilla::Plugin::Test::ChangesHasContent name: '@RJBS/Test::ChangesHasContent' version: 0.006 - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@RJBS/PodSyntaxTests' version: 5.005 - class: Dist::Zilla::Plugin::ReportVersions::Tiny name: '@RJBS/ReportVersions::Tiny' version: 1.10 - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: '@RJBS/TestMoreWithSubtests' version: 5.005 - class: Dist::Zilla::Plugin::PodWeaver config: Dist::Zilla::Plugin::PodWeaver: config_plugin: '@RJBS' finder: - ':InstallModules' - ':ExecFiles' name: '@RJBS/PodWeaver' version: 4.001 - class: Dist::Zilla::Plugin::GithubMeta name: '@RJBS/GithubMeta' version: 0.42 - class: Dist::Zilla::Plugin::Git::Check name: '@RJBS/@Git/Check' version: 2.017 - class: Dist::Zilla::Plugin::Git::Commit name: '@RJBS/@Git/Commit' version: 2.017 - class: Dist::Zilla::Plugin::Git::Tag name: '@RJBS/@Git/Tag' version: 2.017 - class: Dist::Zilla::Plugin::Git::Push name: '@RJBS/@Git/Push' version: 2.017 - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: 5.005 - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: 5.005 - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: 5.005 - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: 5.005 - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: 5.005 - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: 5.005 zilla: class: Dist::Zilla::Dist::Builder config: is_trial: 0 version: 5.005 MANIFEST100644000766000024 121312236331710 14425 0ustar00rjbsstaff000000000000Module-Faker-0.016Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini eg/Append-UTF8.json eg/Append.yml eg/Lacks-META.json eg/Mostly-Auto.yml eg/Provides-Inner-Sorted.yml eg/Provides-Inner.yml eg/RJBS-Dist.yml eg/RJBS_Another-Dist-1.24.tar.gz.dist eg/Simple-Prereq.yml eg/V2-Prereq.yml lib/Module/Faker.pm lib/Module/Faker/Appendix.pm lib/Module/Faker/Dist.pm lib/Module/Faker/File.pm lib/Module/Faker/Heavy.pm lib/Module/Faker/Module.pm lib/Module/Faker/Package.pm t/000-report-versions-tiny.t t/append-utf8.t t/append.t t/basic.t t/meta-files.t t/omit-file.t t/provide-order.t t/requires.t xt/release/changes_has_content.t xt/release/pod-syntax.t t000755000766000024 012236331710 13402 5ustar00rjbsstaff000000000000Module-Faker-0.016basic.t100644000766000024 224212236331710 15010 0ustar00rjbsstaff000000000000Module-Faker-0.016/tuse strict; use warnings; use Test::More; use Module::Faker; use File::Temp (); my $MF = 'Module::Faker'; my $tmpdir = File::Temp::tempdir(CLEANUP => 1); $MF->make_fakes({ source => './eg', dest => $tmpdir, }); ok( -e "$tmpdir/Mostly-Auto-0.01.tar.gz", "we got the mostly-auto dist", ); is((stat("$tmpdir/Mostly-Auto-0.01.tar.gz"))[9], 100, "got mtime set"); subtest "from YAML file" => sub { my $dist = Module::Faker::Dist->from_file('./eg/RJBS-Dist.yml'); is($dist->cpan_author, 'RJBS', "get cpan author from Faker META section"); }; subtest "from .dist file" => sub { my $dist = Module::Faker::Dist->from_file('./eg/RJBS_Another-Dist-1.24.tar.gz.dist'); is($dist->cpan_author, 'RJBS', "get cpan author from .dist filename"); is($dist->name, 'Another-Dist', "correct dist name"); is($dist->version, '1.24', "correct version"); }; subtest "from struct, with undef version" => sub { my $dist = Module::Faker::Dist->new({name => 'Some-Dist', version => undef}); is($dist->name, 'Some-Dist', "correct dist name"); is($dist->version, undef, "correct version"); is($dist->archive_basename, 'Some-Dist-undef', "correct basename"); }; done_testing; META.json100644000766000024 2115412236331710 14743 0ustar00rjbsstaff000000000000Module-Faker-0.016{ "abstract" : "build fake dists for testing CPAN tools", "author" : [ "Ricardo Signes " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 5.005, CPAN::Meta::Converter version 2.132830", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Module-Faker", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.30" } }, "develop" : { "requires" : { "Test::Pod" : "1.41", "version" : "0.9901" } }, "runtime" : { "requires" : { "Archive::Any::Create" : "0", "CPAN::DistnameInfo" : "0", "CPAN::Meta" : "2.130880", "CPAN::Meta::Requirements" : "0", "Carp" : "0", "Encode" : "0", "File::Next" : "0", "File::Path" : "0", "File::Temp" : "0", "Moose" : "0.33", "Moose::Role" : "0", "Moose::Util::TypeConstraints" : "0", "Parse::CPAN::Meta" : "1.4401", "Path::Class" : "0.06", "Text::Template" : "0", "perl" : "5.008", "strict" : "0", "warnings" : "0" } }, "test" : { "requires" : { "Cwd" : "0", "Path::Class" : "0.06", "Test::More" : "0.96" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/rjbs/Module-Faker/issues" }, "homepage" : "https://github.com/rjbs/Module-Faker", "repository" : { "type" : "git", "url" : "https://github.com/rjbs/Module-Faker.git", "web" : "https://github.com/rjbs/Module-Faker" } }, "version" : "0.016", "x_Dist_Zilla" : { "perl" : { "version" : "5.019005" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Git::GatherDir", "name" : "@RJBS/Git::GatherDir", "version" : "2.017" }, { "class" : "Dist::Zilla::Plugin::CheckPrereqsIndexed", "name" : "@RJBS/CheckPrereqsIndexed", "version" : "0.009" }, { "class" : "Dist::Zilla::Plugin::CheckExtraTests", "name" : "@RJBS/CheckExtraTests", "version" : "0.015" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "name" : "@RJBS/RJBS-Outdated", "version" : "0.009" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "name" : "@RJBS/CPAN-Outdated", "version" : "0.009" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@RJBS/@Filter/PruneCruft", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@RJBS/@Filter/ManifestSkip", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@RJBS/@Filter/MetaYAML", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@RJBS/@Filter/License", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::Readme", "name" : "@RJBS/@Filter/Readme", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@RJBS/@Filter/ExecDir", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@RJBS/@Filter/ShareDir", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "name" : "@RJBS/@Filter/MakeMaker", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@RJBS/@Filter/Manifest", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@RJBS/@Filter/TestRelease", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@RJBS/@Filter/ConfirmRelease", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@RJBS/@Filter/UploadToCPAN", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "@RJBS/AutoPrereqs", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::Git::NextVersion", "name" : "@RJBS/Git::NextVersion", "version" : "2.017" }, { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "@RJBS/PkgVersion", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@RJBS/MetaConfig", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@RJBS/MetaJSON", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@RJBS/NextRelease", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::Test::ChangesHasContent", "name" : "@RJBS/Test::ChangesHasContent", "version" : "0.006" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@RJBS/PodSyntaxTests", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::ReportVersions::Tiny", "name" : "@RJBS/ReportVersions::Tiny", "version" : "1.10" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "@RJBS/TestMoreWithSubtests", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "config_plugin" : "@RJBS", "finder" : [ ":InstallModules", ":ExecFiles" ] } }, "name" : "@RJBS/PodWeaver", "version" : "4.001" }, { "class" : "Dist::Zilla::Plugin::GithubMeta", "name" : "@RJBS/GithubMeta", "version" : "0.42" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "name" : "@RJBS/@Git/Check", "version" : "2.017" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "name" : "@RJBS/@Git/Commit", "version" : "2.017" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "name" : "@RJBS/@Git/Tag", "version" : "2.017" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "name" : "@RJBS/@Git/Push", "version" : "2.017" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "5.005" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "5.005" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : "0" }, "version" : "5.005" } } } append.t100644000766000024 111212236331710 15171 0ustar00rjbsstaff000000000000Module-Faker-0.016/tuse strict; use warnings; use Test::More tests => 4; use Module::Faker::Dist; use File::Temp (); use Path::Class qw(file); my $MFD = 'Module::Faker::Dist'; my $tmpdir = File::Temp::tempdir(CLEANUP => 1); my $dist = $MFD->from_file('./eg/Append.yml'); isa_ok($dist, $MFD); my $dir = $dist->make_dist_dir({ dir => $tmpdir }); ok( -e "$dir/t/foo.t", "there's my test file", ); is( file("$dir/t/foo.t")->slurp, "use Test::More;\n\nok(1);", 'test written' ); like( file("$dir/lib/Provides/Inner.pm")->slurp, qr/1\n\n=head1 NAME\n\nAppend - here I am/, 'appended pod' );Makefile.PL100644000766000024 355012236331710 15254 0ustar00rjbsstaff000000000000Module-Faker-0.016 use strict; use warnings; use 5.008; use ExtUtils::MakeMaker 6.30; my %WriteMakefileArgs = ( "ABSTRACT" => "build fake dists for testing CPAN tools", "AUTHOR" => "Ricardo Signes ", "BUILD_REQUIRES" => {}, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.30" }, "DISTNAME" => "Module-Faker", "EXE_FILES" => [], "LICENSE" => "perl", "NAME" => "Module::Faker", "PREREQ_PM" => { "Archive::Any::Create" => 0, "CPAN::DistnameInfo" => 0, "CPAN::Meta" => "2.130880", "CPAN::Meta::Requirements" => 0, "Carp" => 0, "Encode" => 0, "File::Next" => 0, "File::Path" => 0, "File::Temp" => 0, "Moose" => "0.33", "Moose::Role" => 0, "Moose::Util::TypeConstraints" => 0, "Parse::CPAN::Meta" => "1.4401", "Path::Class" => "0.06", "Text::Template" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "Cwd" => 0, "Path::Class" => "0.06", "Test::More" => "0.96" }, "VERSION" => "0.016", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Archive::Any::Create" => 0, "CPAN::DistnameInfo" => 0, "CPAN::Meta" => "2.130880", "CPAN::Meta::Requirements" => 0, "Carp" => 0, "Cwd" => 0, "Encode" => 0, "File::Next" => 0, "File::Path" => 0, "File::Temp" => 0, "Moose" => "0.33", "Moose::Role" => 0, "Moose::Util::TypeConstraints" => 0, "Parse::CPAN::Meta" => "1.4401", "Path::Class" => "0.06", "Test::More" => "0.96", "Text::Template" => 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); requires.t100644000766000024 232412236331710 15567 0ustar00rjbsstaff000000000000Module-Faker-0.016/tuse strict; use warnings; use Test::More; use Module::Faker::Dist; use CPAN::Meta; use CPAN::Meta::Requirements; my $runtime_requires = { 'Mostly::Auto' => '1.00', 'Provides::Inner' => '0', 'Some::Other' => '2.00', }; my @cases = qw( Simple-Prereq.yml V2-Prereq.yml ); plan tests => scalar @cases * (1 + scalar keys %$runtime_requires); for my $c ( @cases ) { my $dist = Module::Faker::Dist->from_file("./eg/$c"); my $dir = $dist->make_dist_dir; open my $fh, '<', "$dir/Makefile.PL" or die "Can't open $dir/Makefile.PL: $!"; my $data = do { local $/; <$fh> }; ($data) = $data =~ /^ PREREQ_PM => \{(.+?)\n \}/ms; my %p = eval $data; die $@ if $@; is_deeply( \%p, $runtime_requires, "$c\: PREREQ_PM extracted"); my $meta = CPAN::Meta->load_file("$dir/META.json"); my $req = CPAN::Meta::Requirements->new; for my $phase ( qw/runtime build test/ ) { $req->add_requirements( $meta->effective_prereqs->requirements_for( $phase, 'requires' ) ) } for my $mod ( keys %$runtime_requires ) { my $mod_req = $req->requirements_for_module( $mod ); is( $mod_req, $runtime_requires->{$mod}, "$c\: $mod prereq in META" ); } } # vim: ts=2 sts=2 sw=2 et: eg000755000766000024 012236331710 13532 5ustar00rjbsstaff000000000000Module-Faker-0.016Append.yml100644000766000024 63412236331710 15607 0ustar00rjbsstaff000000000000Module-Faker-0.016/eg--- #YAML:1.0 name: Append abstract: nothing to see here provides: Provides::Inner: file: lib/Provides/Inner.pm version: 0.001 Provides::Inner::Util: file: lib/Provides/Inner.pm X_Module_Faker: append: - file: lib/Provides/Inner.pm content: "\n=head1 NAME\n\nAppend - here I am" - file: t/foo.t content: | use Test::More; - file: t/foo.t content: "ok(1);" omit-file.t100644000766000024 66112236331710 15577 0ustar00rjbsstaff000000000000Module-Faker-0.016/tuse strict; use warnings; use Test::More tests => 3; use Module::Faker::Dist; use File::Temp (); my $MFD = 'Module::Faker::Dist'; my $tmpdir = File::Temp::tempdir(CLEANUP => 1); my $dist = $MFD->from_file('./eg/Lacks-META.json'); isa_ok($dist, $MFD); my $dir = $dist->make_dist_dir({ dir => $tmpdir }); ok( -e "$dir/Makefile.PL", "there's a Makefile.PL", ); ok( ! -e "$dir/META.yml", "but there is no META.yml", ); meta-files.t100644000766000024 167112236331710 15762 0ustar00rjbsstaff000000000000Module-Faker-0.016/tuse strict; use warnings; use Test::More; use Module::Faker::Dist; use File::Temp (); use CPAN::Meta; my @expected = qw( Makefile.PL META.yml META.json ); plan tests => 2 + @expected; my $MFD = 'Module::Faker::Dist'; my $tmpdir = File::Temp::tempdir(CLEANUP => 1); my $dist = $MFD->from_file('./eg/Provides-Inner.yml'); isa_ok($dist, $MFD); my $dir = $dist->make_dist_dir({ dir => $tmpdir }); for my $f ( @expected ) { ok( -e "$dir/$f", "there's a $f", ); } my $meta = CPAN::Meta->load_file( "$dir/META.json" ); is_deeply( $meta->provides, { 'Provides::Inner' => { file => 'lib/Provides/Inner.pm', version => 0.001, }, 'Provides::Inner::Util' => { file => 'lib/Provides/Inner.pm', version => 0.867, }, 'Provides::Outer' => { file => 'lib/Provides/Outer.pm', }, }, "provides is correct" ); append-utf8.t100644000766000024 221012236331710 16055 0ustar00rjbsstaff000000000000Module-Faker-0.016/tuse strict; use warnings; use Test::More 0.88; # Archive::Any::Create 0.02 uses this my $extractor = 'Archive::Tar'; eval "require $extractor" or plan skip_all => "$extractor required for this test"; use Cwd (); use Encode qw( decode_utf8 encode_utf8 ); use Module::Faker::Dist; use File::Temp (); use Path::Class 0.06 qw( file ); my $MFD = 'Module::Faker::Dist'; my $tmpdir = File::Temp::tempdir(CLEANUP => 1); my $dist = $MFD->from_file(file(qw(eg Append-UTF8.json))->stringify); isa_ok($dist, $MFD); my $archive = $dist->make_archive({ dir => $tmpdir }); { my $old_pwd = Cwd::getcwd(); chdir $tmpdir or die "Failed to chdir to $tmpdir: $!"; $extractor->extract_archive($archive) or die $extractor->error; chdir $old_pwd; } (my $dir = $archive) =~ s/\.(zip|tar\.(gz|bz2))$//; my $file = file($dir, 'Changes'); ok( -e "$file", "file extracted" ); # on 5.14+ this will fail unless the file was passed through # encode_utf8 before passing to Archive::Tar like( # decode the slurped octects b/c we expect the file to be utf8 decode_utf8(scalar $file->slurp), qr/codename 'M\x{fc}nchen'/, 'file preserves utf8' ); done_testing; RJBS-Dist.yml100644000766000024 14512236331710 16036 0ustar00rjbsstaff000000000000Module-Faker-0.016/eg--- #YAML:1.0 name: Email-Infinite abstract: please make it stop X_Module_Faker: cpan_author: RJBS V2-Prereq.yml100644000766000024 32612236331710 16121 0ustar00rjbsstaff000000000000Module-Faker-0.016/eg--- #YAML:1.0 name: V2-Prereq abstract: we have needs prereqs: runtime: requires: Mostly::Auto: 1.00 Provides::Inner: ~ test: requires: Some::Other: 2.00 provide-order.t100644000766000024 144612236331710 16515 0ustar00rjbsstaff000000000000Module-Faker-0.016/tuse strict; use warnings; use Test::More tests => 4; use Module::Faker::Dist; use File::Temp (); my $MFD = 'Module::Faker::Dist'; my $tmpdir = File::Temp::tempdir(CLEANUP => 1); my $dist = $MFD->from_file('./eg/Provides-Inner-Sorted.yml'); isa_ok($dist, $MFD); my $dir = $dist->make_dist_dir({ dir => $tmpdir }); my $file = File::Spec->catfile($dir, qw(lib Provides Inner), 'Sorted.pm'); ok(-e $file, "there's a package file"); my @pkg_lines = do { open my $fh, '<', $file or die "couldn't open file $file: $!"; grep { /^package/ } <$fh>; }; chomp @pkg_lines; s/^package (.+);/$1/ for @pkg_lines; is(@pkg_lines, 4, 'there! are! four! lines!'); is_deeply( \@pkg_lines, [ map { "Provides::Inner::Sorted::$_" } qw(Alfa Charlie Delta Bravo) ], "the packages are in the right order", ); Lacks-META.json100644000766000024 20612236331710 16324 0ustar00rjbsstaff000000000000Module-Faker-0.016/eg{ "name": "Lacks-META", "abstract": "this dist has no META.yaml", "X_Module_Faker": { "omitted_files": [ "META.yml" ] } } Mostly-Auto.yml100644000766000024 11112236331710 16563 0ustar00rjbsstaff000000000000Module-Faker-0.016/eg--- #YAML:1.0 name: Mostly-Auto abstract: nothing to see here mtime: 100 Append-UTF8.json100644000766000024 53312236331710 16501 0ustar00rjbsstaff000000000000Module-Faker-0.016/eg{ "name": "Append-UTF8", "abstract": "Append a file with utf8 chars", "X_Module_Faker": { "append": [ { "file": "lib/Append/UTF8.pm", "content": "\n\n=head1 NAME\n\nAppend::UTF8 - abstract" }, { "file": "Changes", "content": "2012-01-01 0.01 First release - codename 'M\u00FCnchen'\n" } ] } } Module000755000766000024 012236331710 15132 5ustar00rjbsstaff000000000000Module-Faker-0.016/libFaker.pm100644000766000024 503312236331710 16661 0ustar00rjbsstaff000000000000Module-Faker-0.016/lib/Modulepackage Module::Faker; { $Module::Faker::VERSION = '0.016'; } use 5.008; use Moose 0.33; # ABSTRACT: build fake dists for testing CPAN tools use Module::Faker::Dist; use File::Next (); has source => (is => 'ro', required => 1); has dest => (is => 'ro', required => 1); has dist_class => ( is => 'ro', isa => 'Str', required => 1, default => sub { 'Module::Faker::Dist' }, ); sub BUILD { my ($self) = @_; for (qw(source dest)) { my $dir = $self->$_; Carp::croak "$_ directory does not exist" unless -e $dir; Carp::croak "$_ directory is not a directory" unless -d $dir; Carp::croak "$_ directory is not readable" unless -r $dir; } Carp::croak "$_ directory is not writeable" unless -w $self->dest; } sub make_fakes { my ($class, $arg) = @_; my $self = ref $class ? $class : $class->new($arg); my $iter = File::Next::files($self->source); while (my $file = $iter->()) { my $dist = $self->dist_class->from_file($file); $dist->make_archive({ dir => $self->dest }); } } no Moose; 1; __END__ =pod =head1 NAME Module::Faker - build fake dists for testing CPAN tools =head1 VERSION version 0.016 =head1 SYNOPSIS Module::Faker->make_fakes({ source => './dir-of-specs', dest => './will-contain-tarballs', }); =head2 DESCRIPTION Module::Faker is a tool for building fake CPAN modules and, perhaps more importantly, fake CPAN distributions. These are useful for running tools that operate against CPAN distributions without having to use real CPAN distributions. This is much more useful when testing an entire CPAN instance, rather than a single distribution, for which see L. =head1 METHODS =head2 make_fakes Module::Faker->make_fakes(\%arg); This method creates a new Module::Faker and builds archives in its destination directory for every dist-describing file in its source directory. See the L method below. =head2 new my $faker = Module::Faker->new(\%arg); This create the new Module::Faker. All arguments may be accessed later by methods of the same name. Valid arguments are: source - the directory in which to find source files dest - the directory in which to construct dist archives dist_class - the class used to fake dists; default: Module::Faker::Dist =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2008 by Ricardo Signes. 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 Simple-Prereq.yml100644000766000024 20212236331710 17054 0ustar00rjbsstaff000000000000Module-Faker-0.016/eg--- #YAML:1.0 name: Simple-Prereq abstract: we have needs requires: Mostly::Auto: 1.00 Provides::Inner: ~ Some::Other: 2.00 Provides-Inner.yml100644000766000024 42012236331710 17235 0ustar00rjbsstaff000000000000Module-Faker-0.016/eg--- #YAML:1.0 name: Provides-Inner abstract: nothing to see here provides: Provides::Inner: file: lib/Provides/Inner.pm version: 0.001 Provides::Inner::Util: file: lib/Provides/Inner.pm version: 0.867 Provides::Outer: file: lib/Provides/Outer.pm release000755000766000024 012236331710 15212 5ustar00rjbsstaff000000000000Module-Faker-0.016/xtpod-syntax.t100644000766000024 21212236331710 17620 0ustar00rjbsstaff000000000000Module-Faker-0.016/xt/release#!perl use Test::More; eval "use Test::Pod 1.41"; plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; all_pod_files_ok(); Faker000755000766000024 012236331710 16162 5ustar00rjbsstaff000000000000Module-Faker-0.016/lib/ModuleDist.pm100644000766000024 2402112236331710 17602 0ustar00rjbsstaff000000000000Module-Faker-0.016/lib/Module/Fakerpackage Module::Faker::Dist; { $Module::Faker::Dist::VERSION = '0.016'; } use Moose; # ABSTRACT: a fake CPAN distribution use Module::Faker::File; use Module::Faker::Heavy; use Module::Faker::Package; use Module::Faker::Module; use Archive::Any::Create; use CPAN::DistnameInfo; use CPAN::Meta 2.130880; # github issue #9 use CPAN::Meta::Requirements; use File::Temp (); use File::Path (); use Parse::CPAN::Meta 1.4401; use Path::Class; use Encode qw( encode_utf8 ); # Module::Faker options has cpan_author => (is => 'ro', isa => 'Maybe[Str]', default => 'LOCAL'); has archive_ext => (is => 'ro', isa => 'Str', default => 'tar.gz'); has append => (is => 'ro', isa => 'ArrayRef[HashRef]', default => sub {[]}); has mtime => (is => 'ro', isa => 'Int', predicate => 'has_mtime'); # required by CPAN::Meta::Spec has name => (is => 'ro', isa => 'Str', required => 1); has version => (is => 'ro', isa => 'Maybe[Str]', default => '0.01'); has abstract => (is => 'ro', isa => 'Str', default => 'a great new dist'); has release_status => (is => 'ro', isa => 'Str', default => 'stable'); has license => ( is => 'ro', isa => 'ArrayRef[Str]', default => sub { [ 'perl_5' ] }, ); has authors => ( isa => 'ArrayRef[Str]', lazy => 1, traits => [ 'Array' ], handles => { authors => 'elements' }, default => sub { my ($self) = @_; return [ sprintf '%s <%s@cpan.local>', ($self->cpan_author) x 2 ]; }, ); # optional CPAN::Meta::Spec fields has provides => ( is => 'ro', isa => 'HashRef', lazy_build => 1, ); sub _build_provides { my ($self) = @_; my $pkg = __dist_to_pkg($self->name); return { $pkg => { version => $self->version, file => __pkg_to_file($pkg), } }; }; sub __dor { defined $_[0] ? $_[0] : $_[1] } sub append_for { my ($self, $filename) = @_; return [ # YAML and JSON should both be in utf8 (if not plain ascii) map { encode_utf8($_->{content}) } grep { $filename eq $_->{file} } @{ $self->append } ]; } has archive_basename => ( is => 'ro', isa => 'Str', lazy => 1, default => sub { my ($self) = @_; return sprintf '%s-%s', $self->name, __dor($self->version, 'undef'); }, ); sub __dist_to_pkg { my $str = shift; $str =~ s/-/::/g; return $str; } sub __pkg_to_file { my $str = shift; $str =~ s{::}{/}g; return "lib/$str.pm"; } # This is stupid, but copes with MakeMaker wanting to have a module name as its # NAME parameter. Ugh! -- rjbs, 2008-03-13 sub _pkgy_name { my $name = shift->name; $name =~ s/-/::/; return $name; } has packages => ( is => 'ro', isa => 'Module::Faker::Type::Packages', lazy_build => 1, auto_deref => 1, ); sub _build_packages { my ($self) = @_; my $href = $self->provides; # do this dance so we don't autovivify X_Module_Faker in provides my %package_order = map {; $_ => (exists $href->{$_}{X_Module_Faker} ? $href->{$_}{X_Module_Faker}{order} : 0 ) } keys %$href; my @pkg_names = do { no warnings 'uninitialized'; sort { $package_order{$a} <=> $package_order{$b} } keys %package_order; }; my @packages; for my $name (@pkg_names) { push @packages, Module::Faker::Package->new({ name => $name, version => $href->{$name}{version}, in_file => $href->{$name}{file}, }); } return \@packages; } sub modules { my ($self) = @_; my %module; for my $pkg ($self->packages) { my $filename = $pkg->in_file; push @{ $module{ $filename } ||= [] }, $pkg; } my @modules = map { Module::Faker::Module->new({ packages => $module{$_}, filename => $_, append => $self->append_for($_) }); } keys %module; return @modules; } sub _mk_container_path { my ($self, $filename) = @_; my (@parts) = File::Spec->splitdir($filename); my $leaf_filename = pop @parts; File::Path::mkpath(File::Spec->catdir(@parts)); } sub make_dist_dir { my ($self, $arg) = @_; $arg ||= {}; my $dir = $arg->{dir} || File::Temp::tempdir; my $dist_dir = File::Spec->catdir($dir, $self->archive_basename); for my $file ($self->files) { my $fqfn = File::Spec->catfile($dist_dir, $file->filename); $self->_mk_container_path($fqfn); open my $fh, '>', $fqfn or die "couldn't open $fqfn for writing: $!"; print $fh $file->as_string; close $fh or die "error when closing $fqfn: $!"; } return $dist_dir; } sub _author_dir_infix { my ($self) = @_; Carp::croak "can't put archive in author dir with no author defined" unless my $pauseid = $self->cpan_author; # Sorta like pow- pow- power-wheels! -- rjbs, 2008-03-14 my ($pa, $p) = $pauseid =~ /^((.).)/; return ($p, $pa, $pauseid); } sub archive_filename { my ($self, $arg) = @_; my $base = $self->archive_basename; my $ext = $self->archive_ext; return File::Spec->catfile( ($arg->{author_prefix} ? $self->_author_dir_infix : ()), "$base.$ext", ); } sub make_archive { my ($self, $arg) = @_; $arg ||= {}; my $dir = $arg->{dir} || File::Temp::tempdir; my $archive = Archive::Any::Create->new; my $container = $self->archive_basename; $archive->container($container); for my $file ($self->files) { $archive->add_file($file->filename, $file->as_string); } my $archive_filename = File::Spec->catfile( $dir, $self->archive_filename({ author_prefix => $arg->{author_prefix} }) ); $self->_mk_container_path($archive_filename); $archive->write_file($archive_filename); utime time, $self->mtime, $archive_filename if $self->has_mtime; return $archive_filename; } sub files { my ($self) = @_; my @files = ($self->modules, $self->_extras, $self->_manifest_file); for my $file (@{$self->append}) { next if(grep { $_->filename eq $file->{file} } @files); push(@files, $self->_file_class->new( filename => $file->{file}, content => '', append => $self->append_for($file->{file}), ) ); } return @files; } sub _file_class { 'Module::Faker::File' } has omitted_files => ( is => 'ro', isa => 'ArrayRef[Str]', auto_deref => 1, ); around BUILDARGS => sub { my ($orig, $self, @rest) = @_; my $arg = $self->$orig(@rest); confess "can't supply both requires and prereqs" if $arg->{prereqs} && $arg->{requires}; if ($arg->{requires}) { $arg->{prereqs} = { runtime => { requires => delete $arg->{requires} } }; } return $arg; }; has prereqs => ( is => 'ro', isa => 'HashRef', default => sub { {} }, auto_deref => 1, ); has _manifest_file => ( is => 'ro', isa => 'Module::Faker::File', lazy => 1, default => sub { my ($self) = @_; my @files = ($self->modules, $self->_extras); return $self->_file_class->new({ filename => 'MANIFEST', content => join("\n", 'MANIFEST', map { $_->filename } @files ), }); }, ); has _cpan_meta => ( is => 'ro', isa => 'CPAN::Meta', lazy_build => 1, ); sub _build__cpan_meta { my ($self) = @_; my $meta = { 'meta-spec' => { version => '2' }, dynamic_config => 0, author => [ $self->authors ], # plural attribute that derefs }; # required fields for my $key ( qw/abstract license name release_status version/ ) { $meta->{$key} = $self->$key; } # optional fields for my $key ( qw/provides prereqs/ ) { $meta->{$key} = $self->$key; } return CPAN::Meta->new( $meta, {lazy_validation => 1} ); } has _extras => ( is => 'ro', isa => 'ArrayRef[Module::Faker::File]', lazy => 1, auto_deref => 1, default => sub { my ($self) = @_; my @files; for my $filename (qw(Makefile.PL t/00-nop.t)) { next if grep { $_ eq $filename } $self->omitted_files; push @files, $self->_file_class->new({ filename => $filename, content => Module::Faker::Heavy->_render( $filename, { dist => $self }, ), }); } unless ( grep { $_ eq 'META.json' } $self->omitted_files ) { push @files, $self->_file_class->new({ filename => 'META.json', content => $self->_cpan_meta->as_string( { version => "2" } ), }); } unless ( grep { $_ eq 'META.yml' } $self->omitted_files ) { push @files, $self->_file_class->new({ filename => 'META.yml', content => $self->_cpan_meta->as_string( { version => "1.4" } ), }); } return \@files; }, ); # TODO: make this a registry -- rjbs, 2008-03-12 my %HANDLER_FOR = ( yaml => '_from_meta_file', yml => '_from_meta_file', json => '_from_meta_file', dist => '_from_distnameinfo' ); sub from_file { my ($self, $filename) = @_; my ($ext) = $filename =~ /.*\.(.+?)\z/; Carp::croak "don't know how to handle file $filename" unless $ext and my $method = $HANDLER_FOR{$ext}; $self->$method($filename); } sub _from_distnameinfo { my ($self, $filename) = @_; $filename = file($filename)->basename; $filename =~ s/\.dist$//; my ($author, $path) = split /_/, $filename, 2; my $dni = CPAN::DistnameInfo->new($path); return $self->new({ name => $dni->dist, version => $dni->version, abstract => sprintf('the %s dist', $dni->dist), archive_ext => $dni->extension, cpan_author => $author, }); } sub _from_meta_file { my ($self, $filename) = @_; my $data = Parse::CPAN::Meta->load_file($filename); my $extra = (delete $data->{X_Module_Faker}) || {}; my $dist = $self->new({ %$data, %$extra }); } sub _flat_prereqs { my ($self) = @_; my $prereqs = $self->_cpan_meta->effective_prereqs; my $req = CPAN::Meta::Requirements->new; for my $phase ( qw/runtime build test/ ) { $req->add_requirements( $prereqs->requirements_for( $phase, 'requires' ) ); } return %{ $req->as_string_hash }; } 1; # vim: ts=2 sts=2 sw=2 et: __END__ =pod =head1 NAME Module::Faker::Dist - a fake CPAN distribution =head1 VERSION version 0.016 =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2008 by Ricardo Signes. 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 File.pm100644000766000024 130512236331710 17536 0ustar00rjbsstaff000000000000Module-Faker-0.016/lib/Module/Fakerpackage Module::Faker::File; { $Module::Faker::File::VERSION = '0.016'; } use Moose; with 'Module::Faker::Appendix'; # ABSTRACT: a fake file in a fake dist has filename => (is => 'ro', isa => 'Str', required => 1); has content => (is => 'ro', isa => 'Str', required => 1); sub as_string { shift->content } no Moose; 1; __END__ =pod =head1 NAME Module::Faker::File - a fake file in a fake dist =head1 VERSION version 0.016 =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2008 by Ricardo Signes. 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 Heavy.pm100644000766000024 456612236331710 17747 0ustar00rjbsstaff000000000000Module-Faker-0.016/lib/Module/Fakeruse strict; use warnings; package Module::Faker::Heavy; { $Module::Faker::Heavy::VERSION = '0.016'; } # ABSTRACT: where the fake sausage gets made use Carp (); use Text::Template; my $template; sub _template { return $template if $template; my $current; while (my $line = ) { chomp $line; if ($line =~ /\A__([^_]+)__\z/) { my $filename = $1; if ($filename !~ /\A(?:DATA|END)\z/) { $current = $filename; next; } } Carp::confess "bogus data section: text outside of file" unless $current; ($template->{$current} ||= '') .= "$line\n"; } return $template; } sub _render { my ($self, $name, $stash) = @_; Carp::confess "no file template for $name" unless my $template = $self->_template->{ $name }; my $text = Text::Template->fill_this_in( $template, DELIMITERS => [ '{{', '}}' ], HASH => { map {; $_ => \($stash->{$_}) } keys %$stash }, ); return $text; } 1; =pod =head1 NAME Module::Faker::Heavy - where the fake sausage gets made =head1 VERSION version 0.016 =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2008 by Ricardo Signes. 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 __DATA__ __META.yml__ --- name: {{ $dist->name }} version: {{ $dist->version }} abstract: {{ $dist->abstract }} author: {{ $OUT .= sprintf " - %s\n", $_ for $dist->authors; chomp $OUT; return }} generated_by: Module::Faker version {{ $Module::Faker::VERSION }} license: unknown{{ if (my %requires = $dist->requires) { $OUT .= "\nrequires:"; $OUT .= sprintf "\n %s: %s", $_, (defined $requires{$_} ? $requires{$_} : '~') for keys %requires; chomp $OUT; } return; }} meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.3.html version: 1.3 __Makefile.PL__ use ExtUtils::MakeMaker; WriteMakefile( DISTNAME => "{{ $dist->name }}", NAME => "{{ $dist->_pkgy_name }}", VERSION => "{{ $dist->version }}", ABSTRACT => '{{ my $abs = $dist->abstract; $abs =~ s/'/\'/g; $abs }}', PREREQ_PM => { {{ if (my %requires = $dist->_flat_prereqs ) { $OUT .= sprintf "\n '%s' => '%s',", $_, (defined $requires{$_} ? $requires{$_} : 0) for sort keys %requires; } return; }} }, ); __t/00-nop.t__ #!perl use Test::More tests => 1; ok(1); Module.pm100644000766000024 223212236331710 20104 0ustar00rjbsstaff000000000000Module-Faker-0.016/lib/Module/Fakerpackage Module::Faker::Module; { $Module::Faker::Module::VERSION = '0.016'; } use Moose; with 'Module::Faker::Appendix'; # ABSTRACT: a faked module use Module::Faker::Package; has filename => ( is => 'ro', isa => 'Str', required => 1, ); has packages => ( is => 'ro', isa => 'ArrayRef[Module::Faker::Package]', required => 1, auto_deref => 1, ); sub as_string { my ($self) = @_; my $string = ''; for my $pkg ($self->packages) { $string .= sprintf "package %s;\n", $pkg->name; $string .= sprintf "our \$VERSION = '%s';\n", $pkg->version if defined $pkg->version; if (defined $pkg->abstract) { $string .= sprintf "\n=head1 NAME\n\n%s - %s\n\n=cut\n\n", $pkg->name, $pkg->abstract } } $string .= "1\n"; } no Moose; 1; __END__ =pod =head1 NAME Module::Faker::Module - a faked module =head1 VERSION version 0.016 =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2008 by Ricardo Signes. 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 Package.pm100644000766000024 200712236331710 20212 0ustar00rjbsstaff000000000000Module-Faker-0.016/lib/Module/Fakerpackage Module::Faker::Package; { $Module::Faker::Package::VERSION = '0.016'; } use Moose; # ABSTRACT: a faked package in a faked module use Moose::Util::TypeConstraints; has name => (is => 'ro', isa => 'Str', required => 1); has version => (is => 'ro', isa => 'Maybe[Str]'); has abstract => (is => 'ro', isa => 'Maybe[Str]'); has in_file => ( is => 'ro', isa => 'Str', lazy => 1, default => sub { my ($self) = @_; my $name = $self->name; $name =~ s{::}{/}g; return "lib/$name"; }, ); subtype 'Module::Faker::Type::Packages' => as 'ArrayRef[Module::Faker::Package]'; no Moose; 1; __END__ =pod =head1 NAME Module::Faker::Package - a faked package in a faked module =head1 VERSION version 0.016 =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2008 by Ricardo Signes. 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 Provides-Inner-Sorted.yml100644000766000024 116612236331710 20523 0ustar00rjbsstaff000000000000Module-Faker-0.016/eg--- #YAML:1.0 name: Provides-Inner-Sorted abstract: test the Faker/sorted attribute in provides version: 0.001 provides: Provides::Inner::Sorted::Charlie: file: lib/Provides/Inner/Sorted.pm version: 0.008 X_Module_Faker: order: 2 Provides::Inner::Sorted::Alfa: file: lib/Provides/Inner/Sorted.pm version: 0.001 X_Module_Faker: order: 1 Provides::Inner::Sorted::Bravo: file: lib/Provides/Inner/Sorted.pm version: 0.002 X_Module_Faker: order: 4 Provides::Inner::Sorted::Delta: file: lib/Provides/Inner/Sorted.pm version: 0.001 X_Module_Faker: order: 3 Appendix.pm100644000766000024 134612236331710 20434 0ustar00rjbsstaff000000000000Module-Faker-0.016/lib/Module/Fakerpackage Module::Faker::Appendix; { $Module::Faker::Appendix::VERSION = '0.016'; } use Moose::Role; # ABSTRACT: a thing that appends has append => ( is => 'ro', isa => 'ArrayRef', default => sub {[]}, ); around as_string => sub { my ($orig, $self) = (shift, shift); my $string = $self->$orig(@_); $string .= join("\n", @{$self->append}); }; 1; __END__ =pod =head1 NAME Module::Faker::Appendix - a thing that appends =head1 VERSION version 0.016 =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2008 by Ricardo Signes. 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 000-report-versions-tiny.t100644000766000024 550112236331710 20367 0ustar00rjbsstaff000000000000Module-Faker-0.016/tuse strict; use warnings; use Test::More 0.88; # This is a relatively nice way to avoid Test::NoWarnings breaking our # expectations by adding extra tests, without using no_plan. It also helps # avoid any other test module that feels introducing random tests, or even # test plans, is a nice idea. our $success = 0; END { $success && done_testing; } # List our own version used to generate this my $v = "\nGenerated by Dist::Zilla::Plugin::ReportVersions::Tiny v1.10\n"; eval { # no excuses! # report our Perl details my $want = '5.008'; $v .= "perl: $] (wanted $want) on $^O from $^X\n\n"; }; defined($@) and diag("$@"); # Now, our module version dependencies: sub pmver { my ($module, $wanted) = @_; $wanted = " (want $wanted)"; my $pmver; eval "require $module;"; if ($@) { if ($@ =~ m/Can't locate .* in \@INC/) { $pmver = 'module not found.'; } else { diag("${module}: $@"); $pmver = 'died during require.'; } } else { my $version; eval { $version = $module->VERSION; }; if ($@) { diag("${module}: $@"); $pmver = 'died during VERSION check.'; } elsif (defined $version) { $pmver = "$version"; } else { $pmver = ''; } } # So, we should be good, right? return sprintf('%-45s => %-10s%-15s%s', $module, $pmver, $wanted, "\n"); } eval { $v .= pmver('Archive::Any::Create','any version') }; eval { $v .= pmver('CPAN::DistnameInfo','any version') }; eval { $v .= pmver('CPAN::Meta','2.130880') }; eval { $v .= pmver('CPAN::Meta::Requirements','any version') }; eval { $v .= pmver('Carp','any version') }; eval { $v .= pmver('Cwd','any version') }; eval { $v .= pmver('Encode','any version') }; eval { $v .= pmver('ExtUtils::MakeMaker','6.30') }; eval { $v .= pmver('File::Next','any version') }; eval { $v .= pmver('File::Path','any version') }; eval { $v .= pmver('File::Temp','any version') }; eval { $v .= pmver('Moose','0.33') }; eval { $v .= pmver('Moose::Role','any version') }; eval { $v .= pmver('Moose::Util::TypeConstraints','any version') }; eval { $v .= pmver('Parse::CPAN::Meta','1.4401') }; eval { $v .= pmver('Path::Class','0.06') }; eval { $v .= pmver('Test::More','0.96') }; eval { $v .= pmver('Text::Template','any version') }; eval { $v .= pmver('strict','any version') }; eval { $v .= pmver('warnings','any version') }; # All done. $v .= <<'EOT'; Thanks for using my code. I hope it works for you. If not, please try and include this output in the bug report. That will help me reproduce the issue and solve your problem. EOT diag($v); ok(1, "we really didn't test anything, just reporting data"); $success = 1; # Work around another nasty module on CPAN. :/ no warnings 'once'; $Template::Test::NO_FLUSH = 1; exit 0; changes_has_content.t100644000766000024 201112236331710 21526 0ustar00rjbsstaff000000000000Module-Faker-0.016/xt/release#!perl use Test::More tests => 2; note 'Checking Changes'; my $changes_file = 'Changes'; my $newver = '0.016'; my $trial_token = '-TRIAL'; SKIP: { ok(-e $changes_file, "$changes_file file exists") or skip 'Changes is missing', 1; ok(_get_changes($newver), "$changes_file has content for $newver"); } done_testing; # _get_changes copied and adapted from Dist::Zilla::Plugin::Git::Commit # by Jerome Quelin sub _get_changes { my $newver = shift; # parse changelog to find commit message open(my $fh, '<', $changes_file) or die "cannot open $changes_file: $!"; my $changelog = join('', <$fh>); close $fh; my @content = grep { /^$newver(?:$trial_token)?(?:\s+|$)/ ... /^\S/ } # from newver to un-indented split /\n/, $changelog; shift @content; # drop the version line # drop unindented last line and trailing blank lines pop @content while ( @content && $content[-1] =~ /^(?:\S|\s*$)/ ); # return number of non-blank lines return scalar @content; } RJBS_Another-Dist-1.24.tar.gz.dist100644000766000024 012236331710 21374 0ustar00rjbsstaff000000000000Module-Faker-0.016/eg