├── .github └── workflows │ └── dzil-matrix.yaml ├── .gitignore ├── .mailmap ├── .perltidyrc ├── Changes ├── bin └── dzil ├── corpus ├── README ├── dist │ ├── AuthorDeps │ │ ├── LocalPlugin.pm │ │ └── dist.ini │ ├── AutoPrereqs │ │ ├── bin │ │ │ └── foobar │ │ ├── dist.ini │ │ ├── lib │ │ │ └── DZPA │ │ │ │ ├── Empty.pm │ │ │ │ └── Main.pm │ │ └── t │ │ │ └── data.bin │ ├── DZ-NonAscii │ │ ├── Changes │ │ ├── dist.ini │ │ └── lib │ │ │ └── DZ1.pm │ ├── DZ1 │ │ ├── dist.ini │ │ └── lib │ │ │ └── DZ1.pm │ ├── DZ2 │ │ ├── dist.pl │ │ └── lib │ │ │ └── DZ1.pm │ ├── DZT │ │ ├── lib │ │ │ └── DZT │ │ │ │ └── Sample.pm │ │ └── t │ │ │ └── basic.t │ ├── DZT_Bin │ │ ├── another_perl_script │ │ ├── test.bash │ │ └── test.pl │ ├── DZT_Inc │ │ ├── Foo.pm │ │ └── Foo │ │ │ └── Bar.pm │ ├── DZT_NoPm │ │ ├── lib │ │ │ └── DZT │ │ │ │ └── Sample.pod │ │ └── t │ │ │ └── basic.t │ └── DZT_Share │ │ └── my_data.dat ├── extra │ ├── subdir │ │ └── index.html │ └── vader.txt └── global │ └── config.ini ├── dist.ini ├── lib ├── Dist │ ├── Zilla.pm │ └── Zilla │ │ ├── App.pm │ │ ├── App │ │ ├── Command.pm │ │ ├── Command │ │ │ ├── add.pm │ │ │ ├── authordeps.pm │ │ │ ├── build.pm │ │ │ ├── clean.pm │ │ │ ├── install.pm │ │ │ ├── listdeps.pm │ │ │ ├── new.pm │ │ │ ├── nop.pm │ │ │ ├── release.pm │ │ │ ├── run.pm │ │ │ ├── setup.pm │ │ │ ├── smoke.pm │ │ │ ├── test.pm │ │ │ └── version.pm │ │ └── Tester.pm │ │ ├── Chrome │ │ ├── Term.pm │ │ └── Test.pm │ │ ├── Dist │ │ ├── Builder.pm │ │ └── Minter.pm │ │ ├── File │ │ ├── FromCode.pm │ │ ├── InMemory.pm │ │ └── OnDisk.pm │ │ ├── MVP │ │ ├── Assembler.pm │ │ ├── Assembler │ │ │ ├── GlobalConfig.pm │ │ │ └── Zilla.pm │ │ ├── Reader │ │ │ ├── Finder.pm │ │ │ └── Perl.pm │ │ ├── RootSection.pm │ │ └── Section.pm │ │ ├── MintingProfile │ │ └── Default.pm │ │ ├── Path.pm │ │ ├── Plugin │ │ ├── AutoPrereqs.pm │ │ ├── AutoVersion.pm │ │ ├── CPANFile.pm │ │ ├── ConfirmRelease.pm │ │ ├── DistINI.pm │ │ ├── Encoding.pm │ │ ├── ExecDir.pm │ │ ├── ExtraTests.pm │ │ ├── FakeRelease.pm │ │ ├── FileFinder │ │ │ ├── ByName.pm │ │ │ └── Filter.pm │ │ ├── FinderCode.pm │ │ ├── GatherDir.pm │ │ ├── GatherDir │ │ │ └── Template.pm │ │ ├── GatherFile.pm │ │ ├── GenerateFile.pm │ │ ├── InlineFiles.pm │ │ ├── License.pm │ │ ├── MakeMaker.pm │ │ ├── MakeMaker │ │ │ └── Runner.pm │ │ ├── Manifest.pm │ │ ├── ManifestSkip.pm │ │ ├── MetaConfig.pm │ │ ├── MetaJSON.pm │ │ ├── MetaNoIndex.pm │ │ ├── MetaResources.pm │ │ ├── MetaTests.pm │ │ ├── MetaYAML.pm │ │ ├── ModuleBuild.pm │ │ ├── ModuleShareDirs.pm │ │ ├── NextRelease.pm │ │ ├── PkgDist.pm │ │ ├── PkgVersion.pm │ │ ├── PodCoverageTests.pm │ │ ├── PodSyntaxTests.pm │ │ ├── PodVersion.pm │ │ ├── Prereqs.pm │ │ ├── PruneCruft.pm │ │ ├── PruneFiles.pm │ │ ├── Readme.pm │ │ ├── RemovePrereqs.pm │ │ ├── ShareDir.pm │ │ ├── TemplateModule.pm │ │ ├── TestRelease.pm │ │ └── UploadToCPAN.pm │ │ ├── PluginBundle │ │ ├── Basic.pm │ │ ├── Classic.pm │ │ ├── FakeClassic.pm │ │ └── Filter.pm │ │ ├── Pragmas.pm │ │ ├── Prereqs.pm │ │ ├── Role │ │ ├── AfterBuild.pm │ │ ├── AfterMint.pm │ │ ├── AfterRelease.pm │ │ ├── ArchiveBuilder.pm │ │ ├── BeforeArchive.pm │ │ ├── BeforeBuild.pm │ │ ├── BeforeMint.pm │ │ ├── BeforeRelease.pm │ │ ├── BuildPL.pm │ │ ├── BuildRunner.pm │ │ ├── Chrome.pm │ │ ├── ConfigDumper.pm │ │ ├── EncodingProvider.pm │ │ ├── ExecFiles.pm │ │ ├── File.pm │ │ ├── FileFinder.pm │ │ ├── FileFinderUser.pm │ │ ├── FileGatherer.pm │ │ ├── FileInjector.pm │ │ ├── FileMunger.pm │ │ ├── FilePruner.pm │ │ ├── InstallTool.pm │ │ ├── LicenseProvider.pm │ │ ├── MetaProvider.pm │ │ ├── MintingProfile.pm │ │ ├── MintingProfile │ │ │ └── ShareDir.pm │ │ ├── ModuleMaker.pm │ │ ├── MutableFile.pm │ │ ├── NameProvider.pm │ │ ├── PPI.pm │ │ ├── Plugin.pm │ │ ├── PluginBundle.pm │ │ ├── PluginBundle │ │ │ └── Easy.pm │ │ ├── PrereqScanner.pm │ │ ├── PrereqSource.pm │ │ ├── ReleaseStatusProvider.pm │ │ ├── Releaser.pm │ │ ├── ShareDir.pm │ │ ├── Stash.pm │ │ ├── Stash │ │ │ ├── Authors.pm │ │ │ └── Login.pm │ │ ├── StubBuild.pm │ │ ├── TestRunner.pm │ │ ├── TextTemplate.pm │ │ └── VersionProvider.pm │ │ ├── Stash │ │ ├── Mint.pm │ │ ├── PAUSE.pm │ │ ├── Rights.pm │ │ └── User.pm │ │ ├── Tester.pm │ │ ├── Tutorial.pm │ │ ├── Types.pm │ │ ├── Util.pm │ │ └── Util │ │ └── AuthorDeps.pm └── Test │ └── DZil.pm ├── misc ├── DZ.graffle ├── dzil-bash_completion ├── dzil_bootstrap └── lib │ └── Dist │ └── Zilla │ └── App │ └── Command │ ├── gconf.pm │ └── input.pm ├── profiles └── default │ ├── extra-dist.ini │ └── profile.ini ├── t ├── commands │ ├── authordeps.t │ └── listdeps.t ├── compile.t ├── diagnostics │ ├── main-module.t │ └── plugin-fail.t ├── distpl.t ├── empty-abstract.t ├── file-addedby.t ├── file.t ├── lib │ └── Dist │ │ └── Zilla │ │ ├── Plugin │ │ ├── BrokenPlugin.pm │ │ ├── BrokenPlugin2.pm │ │ ├── BrokenPlugin3.pm │ │ ├── BrokenPlugin4.pm │ │ ├── JustForManifestSkipTests.pm │ │ ├── MungerThatPrunesPodFiles.pm │ │ ├── TestArchiveBuilder.pm │ │ ├── TestAutoLicense.pm │ │ ├── TestAutoName.pm │ │ ├── TestReleaseProvider.pm │ │ └── Versioned.pm │ │ └── Stash │ │ └── Heap.pm ├── load_config.t ├── minter.t ├── plugins │ ├── archive_builder.t │ ├── autolicense.t │ ├── autoname.t │ ├── autoprereqs.t │ ├── autoversion.t │ ├── confirmrelease.t │ ├── cpanfile.t │ ├── distmeta-merge.t │ ├── distmeta.t │ ├── encoding.t │ ├── extratests.t │ ├── fakerelease.t │ ├── ffbyname.t │ ├── filefinders.t │ ├── filter-b.t │ ├── gatherdir.t │ ├── gatherfile.t │ ├── generatefile.t │ ├── installdirs.t │ ├── license.t │ ├── makemaker.t │ ├── manifest.t │ ├── metanoindex.t │ ├── metaresources.t │ ├── misctests.t │ ├── modulebuild.t │ ├── munger-that-prunes.t │ ├── nextrelease.t │ ├── pkgdist.t │ ├── pkgversion.t │ ├── podsyntaxtests.t │ ├── podversion.t │ ├── prereqs.t │ ├── prunes.t │ ├── readme.t │ ├── release_status.t │ ├── testrelease.t │ └── uploadtocpan.t ├── tester-demo.t ├── tester-local-plugins.t ├── tester-sort.t ├── tester.t └── util.t └── todo ├── CHECKLIST-testing.mkdn ├── command-plugins.mkdn ├── config-arg-prefix.mkdn ├── delay-core-attrs.mkdn ├── external-core-attr.mkdn ├── version-from-prev.mkdn ├── vfs-for-files.mkdn └── xs-improvement.mkdn /.github/workflows/dzil-matrix.yaml: -------------------------------------------------------------------------------- 1 | name: "dzil matrix" 2 | on: 3 | workflow_dispatch: ~ 4 | push: 5 | branches: "*" 6 | tags-ignore: "*" 7 | pull_request: ~ 8 | 9 | jobs: 10 | build-and-test: 11 | name: dzil-matrix 12 | uses: rjbs/dzil-actions/.github/workflows/dzil-matrix.yaml@v0 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Dist-Zilla-* 2 | .build 3 | tmp 4 | *.patch 5 | .DS_Store 6 | 7 | .gitnxtver_cache 8 | 9 | # avoid temp and backup files 10 | *~ 11 | *# 12 | *.bak 13 | *.old 14 | *.rej 15 | *.swp 16 | *.tmp 17 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | # https://www.kernel.org/pub/software/scm/git/docs/git-shortlog.html 2 | Apocalypse Apocalypse 3 | Christopher J. Madsen Christopher J. Madsen 4 | Fayland Lam 5 | John Napiorkowski John Napiorkowski 6 | Jonathan Rockway Jonathan Rockway 7 | Jonathan Rockway jrockway 8 | Mike Doherty Mike Doherty 9 | Nickolay Platonov 10 | Randy Stauner 11 | Ricardo Signes 12 | Steven Haryanto Steven Haryanto (on Asus Zenbook) 13 | -------------------------------------------------------------------------------- /.perltidyrc: -------------------------------------------------------------------------------- 1 | -i=2 # standard indent 2 | -ce # cuddly elses 3 | -pt=2 # parentheses should be tight 4 | -nsfs # no space before "for" loop semicolon 5 | -nolq # don't outdent long quotes 6 | -b # edit file in place, leave .bak file 7 | -nola # don't outdent labels 8 | -msc=2 # two spaces for post-line comments (not 4) 9 | -bok # keep old breaks before map/grep/sort (we're smarter than perltidy) 10 | 11 | -sot # stack opening/closing delims (but not for blocks) 12 | -sct 13 | 14 | # we always want to break BEFORE operators 15 | -wbb="+ - * / x != == >= <= =~ !~ < > | & >= <" 16 | -wbb="= **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=" 17 | -------------------------------------------------------------------------------- /bin/dzil: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | package dzil; 3 | use Dist::Zilla::App; 4 | 5 | use Dist::Zilla::Pragmas; 6 | 7 | # Let dzil --version know what to report: 8 | $main::VERSION = $Dist::Zilla::App::VERSION; 9 | 10 | # PODNAME: dzil 11 | # ABSTRACT: do stuff with your dist 12 | Dist::Zilla::App->run; 13 | 14 | =head1 OVERVIEW 15 | 16 | For help with L, start with L or 17 | by running C. 18 | 19 | =cut 20 | 21 | -------------------------------------------------------------------------------- /corpus/README: -------------------------------------------------------------------------------- 1 | 2 | This directory contains a set of distributions used by testing. Since the 3 | distributions contain *.t files, it's easier to put them outside of ./t so that 4 | recursive test harnesses do not try running their dists. 5 | 6 | 7 | -------------------------------------------------------------------------------- /corpus/dist/AuthorDeps/LocalPlugin.pm: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | 1; 8 | -------------------------------------------------------------------------------- /corpus/dist/AuthorDeps/dist.ini: -------------------------------------------------------------------------------- 1 | name = Foo 2 | version = 1.23 3 | author = foobar 4 | license = Perl_5 5 | copyright_holder = foobar 6 | copyright_year = 2009 7 | 8 | ; authordep perl = 5.005 9 | ; authordep List::Util = 1.45 10 | ; authordep Foo::Bar = 1.23 ; this is an explanation for this dep 11 | 12 | :version = 5.001 13 | 14 | [GatherDir] 15 | [ExecDir/BadlyPaddedName] 16 | :version = 5.0 17 | 18 | [AutoPrereqs] 19 | :version = 5.0 20 | skip = ^DZPA::Skip 21 | 22 | [MetaYAML] 23 | 24 | [Encoding / WithDescription] 25 | :version = 5.0 26 | encoding = bytes 27 | filename = t/data.bin 28 | 29 | [=LocalPlugin] 30 | -------------------------------------------------------------------------------- /corpus/dist/AutoPrereqs/bin/foobar: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | use lib 'mylib'; 6 | 7 | # require in a script 8 | use DZPA::ScriptUse; 9 | 10 | # module shipped by dist 11 | use DZPA::Main; 12 | 13 | # DZPA::Skip should be trimmed 14 | require DZPA::Skip::Foo; 15 | -------------------------------------------------------------------------------- /corpus/dist/AutoPrereqs/dist.ini: -------------------------------------------------------------------------------- 1 | name = Foo 2 | version = 1.23 3 | author = foobar 4 | license = Perl_5 5 | copyright_holder = foobar 6 | copyright_year = 2009 7 | 8 | ; authordep perl = 5.005 9 | 10 | [GatherDir] 11 | [ExecDir] 12 | [AutoPrereqs] 13 | skip = ^DZPA::Skip 14 | 15 | [Encoding] 16 | encoding = bytes 17 | filename = t/data.bin 18 | 19 | [Prereqs / DevelopRequires] 20 | String::Formatter = 0 21 | 22 | [Prereqs / RuntimeRecommends] 23 | Term::ReadLine::Gnu = 0 24 | Archive::Tar::Wrapper = 0.15 25 | 26 | [Prereqs / RuntimeSuggests] 27 | PPI::XS = 1.23 28 | -------------------------------------------------------------------------------- /corpus/dist/AutoPrereqs/lib/DZPA/Empty.pm: -------------------------------------------------------------------------------- 1 | package DZPA::Main; 2 | # ABSTRACT: dumb module to test DZPA 3 | 4 | # look, no prereq! this used to crash autoprereq 5 | 6 | 1; 7 | __END__ 8 | -------------------------------------------------------------------------------- /corpus/dist/AutoPrereqs/lib/DZPA/Main.pm: -------------------------------------------------------------------------------- 1 | package DZPA::Main; 2 | # ABSTRACT: dumb module to test DZPA 3 | 4 | # perl minimum version 5 | use 5.008; 6 | 7 | # under DZPA::, but not shipped by the dist 8 | use DZPA::NotInDist; 9 | 10 | # minimum version + comment after the semicolon. 11 | use DZPA::MinVerComment 0.50; # comment 12 | 13 | # Moose features 14 | with 'DZPA::Role'; 15 | extends 'DZPA::Base::Moose1', 'DZPA::Base::Moose2'; 16 | 17 | # inheritance 18 | use base "DZPA::Base::base1"; 19 | use base qw{ DZPA::Base::base2 DZPA::Base::base3 }; 20 | use parent "DZPA::Base::parent1"; 21 | use parent qw{ DZPA::Base::parent2 DZPA::Base::parent3 }; 22 | 23 | # DZPA::Skip should be trimmed 24 | use DZPA::Skip::Blah; 25 | 26 | # and this comment should not cause a package to be trimmed: 27 | # package foobar DZPA::Role 28 | 29 | # require in a module 30 | require DZPA::ModRequire; 31 | 32 | # indented 33 | { 34 | use DZPA::IndentedUse 0.13; 35 | require DZPA::IndentedRequire 3.45; 36 | } 37 | 38 | use DZPA::IgnoreAPI 39 | require => 1; # module pluggable has such an api 40 | print qw{ 41 | use !! 42 | }; 43 | 44 | # multiple namespaces; some referencing local packages 45 | package DZPA::Second; 46 | 47 | package DZPA::Third; 48 | use parent -norequire => 'DZPA::Second'; 49 | 50 | use DZPA::Empty; 51 | 52 | package # hide from PAUSE 53 | DZPA::Fourth; 54 | 55 | 56 | __END__ 57 | =head1 FOO 58 | 59 | this pod should not be taken in to account, with: 60 | use fake; 61 | require blah; 62 | with 'fubar'; 63 | 64 | nor should this statement here, but that is still a TODO! 65 | pack age strict; XXX remove this space 66 | -------------------------------------------------------------------------------- /corpus/dist/AutoPrereqs/t/data.bin: -------------------------------------------------------------------------------- 1 | pretend this is binary, OK? 2 | -------------------------------------------------------------------------------- /corpus/dist/DZ-NonAscii/Changes: -------------------------------------------------------------------------------- 1 | Revision history for {{$dist->name}} 2 | 3 | {{$NEXT}} 4 | - Olivier Mengué was here! 5 | -------------------------------------------------------------------------------- /corpus/dist/DZ-NonAscii/dist.ini: -------------------------------------------------------------------------------- 1 | name = DZ-NonAscii 2 | version = 0.001 3 | author = Olivier Mengué 4 | author = 김도형 5 | license = Perl_5 6 | copyright_holder = ภูมิพลอดุลยเดช 7 | 8 | [@Classic] 9 | [MetaJSON] 10 | [NextRelease] 11 | -------------------------------------------------------------------------------- /corpus/dist/DZ-NonAscii/lib/DZ1.pm: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | package DZ1; 4 | # ABSTRACT: this is a sample package for testing Dist::Zilla; 5 | 6 | sub main { 7 | return 1; 8 | } 9 | 10 | 1; 11 | -------------------------------------------------------------------------------- /corpus/dist/DZ1/dist.ini: -------------------------------------------------------------------------------- 1 | name = DZ1 2 | version = 0.001 3 | author = E. Xavier Ample 4 | license = Perl_5 5 | copyright_holder = E. Xavier Ample 6 | 7 | [@Classic] 8 | -------------------------------------------------------------------------------- /corpus/dist/DZ1/lib/DZ1.pm: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | package DZ1; 4 | # ABSTRACT: this is a sample package for testing Dist::Zilla; 5 | 6 | sub main { 7 | return 1; 8 | } 9 | 10 | 1; 11 | -------------------------------------------------------------------------------- /corpus/dist/DZ2/dist.pl: -------------------------------------------------------------------------------- 1 | name => 'DZ2', 2 | version => '0.001', 3 | author => 'E. Xavier Ample ', 4 | license => 'Perl_5', 5 | copyright_holder => 'E. Xavier Ample', 6 | [ 7 | '@Classic', 8 | ] 9 | -------------------------------------------------------------------------------- /corpus/dist/DZ2/lib/DZ1.pm: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | package DZ1; 4 | 5 | sub main { 6 | return 1; 7 | } 8 | 9 | 1; 10 | __END__ 11 | 12 | =head1 NAME 13 | 14 | DZ1 - this is a sample package for testing Dist::Zilla; 15 | 16 | =head1 HEY, MAINTAINER 17 | 18 | Note that we have C<< =head1 NAME >> here, and not an ABSTRACT comment. That's 19 | to exercize C. 20 | 21 | -- rjbs, 2011-11-18 22 | 23 | =cut 24 | -------------------------------------------------------------------------------- /corpus/dist/DZT/lib/DZT/Sample.pm: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | package DZT::Sample; 4 | 5 | sub return_arrayref_of_values_passed { 6 | my $invocant = shift; 7 | return \@_; 8 | } 9 | 10 | 1; 11 | -------------------------------------------------------------------------------- /corpus/dist/DZT/t/basic.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More 0.88; 5 | use DZT::Sample; 6 | 7 | is_deeply( 8 | DZT::Sample->return_arrayref_of_values_passed(1, [ 2 ], { 3 => 4 }), 9 | [ 1, [ 2 ], { 3 => 4 } ], 10 | "we do what we say on the tin", 11 | ); 12 | 13 | done_testing; 14 | -------------------------------------------------------------------------------- /corpus/dist/DZT_Bin/another_perl_script: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | print "Hello World!\n"; 3 | exit; 4 | 5 | -------------------------------------------------------------------------------- /corpus/dist/DZT_Bin/test.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | echo 'Hello World!' 3 | 4 | -------------------------------------------------------------------------------- /corpus/dist/DZT_Bin/test.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | print "Hello World!\n"; 3 | exit; 4 | -------------------------------------------------------------------------------- /corpus/dist/DZT_Inc/Foo.pm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | package Foo; 3 | 4 | sub baz { 5 | 'baz'; 6 | } 7 | 8 | 1; 9 | -------------------------------------------------------------------------------- /corpus/dist/DZT_Inc/Foo/Bar.pm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | package Foo::Bar; 3 | 4 | sub baz { 5 | 'bar'; 6 | } 7 | 8 | 1; 9 | -------------------------------------------------------------------------------- /corpus/dist/DZT_NoPm/lib/DZT/Sample.pod: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | package DZT::Sample; 4 | 5 | sub return_arrayref_of_values_passed { 6 | my $invocant = shift; 7 | return \@_; 8 | } 9 | 10 | 1; 11 | -------------------------------------------------------------------------------- /corpus/dist/DZT_NoPm/t/basic.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More 0.88; 5 | use DZT::Sample; 6 | 7 | is_deeply( 8 | DZT::Sample->return_arrayref_of_values_passed(1, [ 2 ], { 3 => 4 }), 9 | [ 1, [ 2 ], { 3 => 4 } ], 10 | "we do what we say on the tin", 11 | ); 12 | 13 | done_testing; 14 | -------------------------------------------------------------------------------- /corpus/dist/DZT_Share/my_data.dat: -------------------------------------------------------------------------------- 1 | some random data that should be shared... 2 | -------------------------------------------------------------------------------- /corpus/extra/subdir/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

SUPPLIES

4 | 5 | 6 | -------------------------------------------------------------------------------- /corpus/extra/vader.txt: -------------------------------------------------------------------------------- 1 | 2 | (breathing sounds) 3 | 4 | -------------------------------------------------------------------------------- /corpus/global/config.ini: -------------------------------------------------------------------------------- 1 | 2 | [%User] 3 | name = E. Xavier Ample 4 | email = ea@example.com 5 | 6 | [%Rights] 7 | license_class = BSD 8 | copyright_holder = A. U. Thor 9 | 10 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/App/Command.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::App::Command; 2 | # ABSTRACT: base class for dzil commands 3 | 4 | use Dist::Zilla::Pragmas; 5 | 6 | use App::Cmd::Setup -command; 7 | 8 | =method zilla 9 | 10 | This returns the Dist::Zilla object in use by the command. If none has yet 11 | been constructed, one will be by calling C<< Dist::Zilla->from_config >>. 12 | 13 | (This method just delegates to the Dist::Zilla::App object!) 14 | 15 | =cut 16 | 17 | sub zilla { 18 | return $_[0]->app->zilla; 19 | } 20 | 21 | =method log 22 | 23 | This method calls the C method of the application's chrome. 24 | 25 | =cut 26 | 27 | sub log { 28 | $_[0]->app->chrome->logger->log($_[1]); 29 | } 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/App/Command/add.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::App::Command::add; 2 | # ABSTRACT: add a module to a dist 3 | 4 | use Dist::Zilla::Pragmas; 5 | 6 | use Dist::Zilla::App -command; 7 | use Dist::Zilla::Path; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 SYNOPSIS 12 | 13 | Adds a new module to a Dist::Zilla-based distribution 14 | 15 | $ dzil add Some::New::Module 16 | 17 | There are two arguments, C<-p> and C<-P>. C<-P> specify the minting profile 18 | provider and C<-p> - the profile name. These work just like C. 19 | 20 | =cut 21 | 22 | sub abstract { 'add modules to an existing dist' } 23 | 24 | sub usage_desc { '%c %o ' } 25 | 26 | sub opt_spec { 27 | [ 'profile|p=s', 'name of the profile to use' ], 28 | 29 | [ 'provider|P=s', 'name of the profile provider to use' ], 30 | 31 | # [ 'module|m=s@', 'module(s) to create; may be given many times' ], 32 | } 33 | 34 | sub validate_args { 35 | my ($self, $opt, $args) = @_; 36 | 37 | require MooseX::Types::Perl; 38 | 39 | $self->usage_error('dzil add takes one or more arguments') if @$args < 1; 40 | 41 | for my $name ( @$args ) { 42 | $self->usage_error("$name is not a valid module name") 43 | unless MooseX::Types::Perl::is_ModuleName($name); 44 | } 45 | } 46 | 47 | sub execute { 48 | my ($self, $opt, $arg) = @_; 49 | 50 | my $zilla = $self->zilla; 51 | my $dist = $zilla->name; 52 | 53 | require File::pushd; 54 | 55 | my $mint_stash = $zilla->stash_named('%Mint'); 56 | 57 | my $provider = $opt->provider 58 | // ($mint_stash && $mint_stash->provider) 59 | // 'Default'; 60 | 61 | my $profile = $opt->profile 62 | // ($mint_stash && $mint_stash->profile) 63 | // 'default'; 64 | 65 | require Dist::Zilla::Dist::Minter; 66 | my $minter = Dist::Zilla::Dist::Minter->_new_from_profile( 67 | [ $provider, $profile ], 68 | { 69 | chrome => $self->app->chrome, 70 | name => $dist, 71 | _global_stashes => $self->app->_build_global_stashes, 72 | }, 73 | ); 74 | 75 | my $root = path($zilla->root)->absolute; 76 | my $wd = File::pushd::pushd($minter->root); 77 | 78 | my $factory = $minter->plugin_named(':DefaultModuleMaker'); 79 | 80 | for my $name ( @$arg ) { 81 | $factory->make_module({ name => $name }); 82 | } 83 | 84 | for my $file ( @{ $factory->zilla->files} ) { 85 | $zilla->_write_out_file($file, $root); 86 | } 87 | } 88 | 89 | 1; 90 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/App/Command/authordeps.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::App::Command::authordeps; 2 | # ABSTRACT: List your distribution's author dependencies 3 | 4 | use Dist::Zilla::Pragmas; 5 | 6 | use Dist::Zilla::App -command; 7 | 8 | =head1 SYNOPSIS 9 | 10 | $ dzil authordeps 11 | 12 | This will scan the F file and print a list of plugin modules that 13 | probably need to be installed for the dist to be buildable. This is a very 14 | naive scan, but tends to be pretty accurate. Modules can be added to its 15 | results by using special comments in the form: 16 | 17 | ; authordep Some::Package 18 | 19 | In order to add authordeps to all distributions that use a certain plugin bundle 20 | (or plugin), just list them as prereqs of that bundle (e.g.: using 21 | L ). 22 | 23 | =cut 24 | 25 | sub abstract { "list your distribution's author dependencies" } 26 | 27 | sub opt_spec { 28 | return ( 29 | [ 'root=s' => 'the root of the dist; defaults to .' ], 30 | [ 'missing' => 'list only the missing dependencies' ], 31 | [ 'versions' => 'include required version numbers in listing' ], 32 | ); 33 | } 34 | 35 | sub execute { 36 | my ($self, $opt, $arg) = @_; 37 | 38 | require Dist::Zilla::Path; 39 | require Dist::Zilla::Util::AuthorDeps; 40 | 41 | my $deps = Dist::Zilla::Util::AuthorDeps::format_author_deps( 42 | Dist::Zilla::Util::AuthorDeps::extract_author_deps( 43 | Dist::Zilla::Path::path($opt->root // '.'), 44 | $opt->missing, 45 | ), $opt->versions 46 | ); 47 | 48 | $self->log($deps) if $deps; 49 | 50 | return; 51 | } 52 | 53 | 1; 54 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/App/Command/clean.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::App::Command::clean; 2 | # ABSTRACT: clean up after build, test, or install 3 | 4 | use Dist::Zilla::Pragmas; 5 | 6 | use Dist::Zilla::App -command; 7 | 8 | =head1 SYNOPSIS 9 | 10 | dzil clean [ --dry-run|-n ] 11 | 12 | This command removes some files that are created during build, test, and 13 | install. It's a very thin layer over the C> method 14 | on the Dist::Zilla object. The documentation for that method gives more 15 | information about the files that will be removed. 16 | 17 | =cut 18 | 19 | sub opt_spec { 20 | [ 'dry-run|n' => 'don\'t actually remove anything, just show what would be done' ], 21 | } 22 | 23 | =head1 OPTIONS 24 | 25 | =head2 -n, --dry-run 26 | 27 | Nothing is removed; instead, everything that would be removed will be listed. 28 | 29 | =cut 30 | 31 | sub abstract { 'clean up after build, test, or install' } 32 | 33 | sub execute { 34 | my ($self, $opt, $arg) = @_; 35 | 36 | $self->zilla->clean($opt->dry_run); 37 | } 38 | 39 | 1; 40 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/App/Command/install.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::App::Command::install; 2 | # ABSTRACT: install your dist 3 | 4 | use Dist::Zilla::Pragmas; 5 | 6 | use Dist::Zilla::App -command; 7 | 8 | =head1 SYNOPSIS 9 | 10 | Installs your distribution using a specified command. 11 | 12 | dzil install [--install-command="cmd"] 13 | 14 | =cut 15 | sub abstract { 'install your dist' } 16 | 17 | =head1 EXAMPLE 18 | 19 | $ dzil install 20 | $ dzil install --install-command="cpan ." 21 | 22 | =cut 23 | 24 | sub opt_spec { 25 | [ 'install-command=s', 'command to run to install (e.g. "cpan .")' ], 26 | [ 'keep-build-dir|keep' => 'keep the build directory even after a success' ], 27 | } 28 | 29 | =head1 OPTIONS 30 | 31 | =head2 --install-command 32 | 33 | This defines what command to run after building the dist in the dist dir. 34 | 35 | Any value that works with L|perlfunc/system> is accepted. 36 | 37 | If not specified, calls (roughly): 38 | 39 | cpanm . 40 | 41 | For more information, look at the L method in 42 | Dist::Zilla. 43 | 44 | =cut 45 | 46 | sub execute { 47 | my ($self, $opt, $arg) = @_; 48 | 49 | $self->zilla->install({ 50 | $opt->install_command 51 | ? (install_command => [ $opt->install_command ]) 52 | : (), 53 | $opt->keep_build_dir 54 | ? (keep_build_dir => 1) 55 | : (), 56 | }); 57 | } 58 | 59 | 1; 60 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/App/Command/new.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::App::Command::new; 2 | # ABSTRACT: mint a new dist 3 | 4 | use Dist::Zilla::Pragmas; 5 | 6 | use Dist::Zilla::App -command; 7 | 8 | =head1 SYNOPSIS 9 | 10 | Creates a new Dist-Zilla based distribution under the current directory. 11 | 12 | $ dzil new Main::Module::Name 13 | 14 | There are two arguments, C<-p> and C<-P>. C<-P> specify the minting profile 15 | provider and C<-p> - the profile name. 16 | 17 | The default profile provider first looks in the 18 | F<~/.dzil/profiles/$profile_name> and then among standard profiles, shipped 19 | with Dist::Zilla. For example: 20 | 21 | $ dzil new -p work Corporate::Library 22 | 23 | This command would instruct C to look in F<~/.dzil/profiles/work> for a 24 | F (or other "profile" config file). If no profile name is given, 25 | C will look for the C profile. If no F directory 26 | exists, it will use a very simple configuration shipped with Dist::Zilla. 27 | 28 | $ dzil new -P Foo Corporate::Library 29 | 30 | This command would instruct C to consult the Foo provider about the 31 | directory of 'default' profile. 32 | 33 | Furthermore, it is possible to specify the default minting provider and profile 34 | in the F<~/.dzil/config.ini> file, for example: 35 | 36 | [%Mint] 37 | provider = FooCorp 38 | profile = work 39 | 40 | =cut 41 | 42 | sub abstract { 'mint a new dist' } 43 | 44 | sub usage_desc { '%c new %o ' } 45 | 46 | sub opt_spec { 47 | [ 'profile|p=s', 'name of the profile to use' ], 48 | 49 | [ 'provider|P=s', 'name of the profile provider to use' ], 50 | 51 | # [ 'module|m=s@', 'module(s) to create; may be given many times' ], 52 | } 53 | 54 | sub validate_args { 55 | my ($self, $opt, $args) = @_; 56 | 57 | require MooseX::Types::Perl; 58 | 59 | $self->usage_error('dzil new takes exactly one argument') if @$args != 1; 60 | 61 | my $name = $args->[0]; 62 | 63 | $name =~ s/::/-/g if MooseX::Types::Perl::is_ModuleName($name) 64 | and not MooseX::Types::Perl::is_DistName($name); 65 | 66 | $self->usage_error("$name is not a valid distribution name") 67 | unless MooseX::Types::Perl::is_DistName($name); 68 | 69 | $args->[0] = $name; 70 | } 71 | 72 | sub execute { 73 | my ($self, $opt, $arg) = @_; 74 | 75 | my $dist = $arg->[0]; 76 | 77 | my $stash = $self->app->_build_global_stashes; 78 | my $mint_stash = $stash->{'%Mint'}; 79 | 80 | my $provider = $opt->provider // ($mint_stash && $mint_stash->provider) // 'Default'; 81 | my $profile = $opt->profile // ($mint_stash && $mint_stash->profile) // 'default'; 82 | 83 | require Dist::Zilla::Dist::Minter; 84 | my $minter = Dist::Zilla::Dist::Minter->_new_from_profile( 85 | [ $provider, $profile ], 86 | { 87 | chrome => $self->app->chrome, 88 | name => $dist, 89 | _global_stashes => $stash, 90 | }, 91 | ); 92 | 93 | $minter->mint_dist({ 94 | # modules => $opt->module, 95 | }); 96 | } 97 | 98 | 1; 99 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/App/Command/nop.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::App::Command::nop; 2 | # ABSTRACT: initialize dzil, then exit 3 | 4 | use Dist::Zilla::Pragmas; 5 | 6 | use Dist::Zilla::App -command; 7 | 8 | =head1 SYNOPSIS 9 | 10 | This command does nothing. It initializes Dist::Zilla, then exits. This is 11 | useful to see the logging output of plugin initialization. 12 | 13 | dzil nop -v 14 | 15 | Seriously, this command is almost entirely for diagnostic purposes. Don't 16 | overthink it, okay? 17 | 18 | =cut 19 | 20 | sub abstract { 'do nothing: initialize dzil, then exit' } 21 | 22 | sub description { 23 | "This command does nothing but initialize Dist::Zilla and exit.\n" . 24 | "It is sometimes useful for diagnostic purposes." 25 | } 26 | 27 | sub execute { 28 | my ($self, $opt, $arg) = @_; 29 | 30 | $self->zilla; 31 | } 32 | 33 | 1; 34 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/App/Command/release.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::App::Command::release; 2 | # ABSTRACT: release your dist to the CPAN 3 | 4 | use Dist::Zilla::Pragmas; 5 | 6 | use Dist::Zilla::App -command; 7 | 8 | =head1 SYNOPSIS 9 | 10 | dzil release 11 | 12 | dzil release --trial 13 | 14 | # long form, jobs takes an integer 15 | dzil release --jobs 9 16 | 17 | # short form, same as above 18 | dzil release -j 9 19 | 20 | This command is a very, very thin wrapper around the 21 | C> method on the Dist::Zilla object. It will 22 | build, archive, and release your distribution using your Releaser plugins. 23 | 24 | Available options are: 25 | 26 | =over 27 | 28 | =item C<--trial>, will cause it to build a trial build. 29 | 30 | =item C<--jobs|-j=i>, number of test jobs run in parallel using L. 31 | 32 | =back 33 | 34 | The default for L is C<9>. The number of parallel jobs can also be specified setting C. 35 | 36 | HARNESS_OPTIONS=j9 37 | 38 | See L for more details. 39 | 40 | =cut 41 | 42 | sub abstract { 'release your dist' } 43 | 44 | sub opt_spec { 45 | [ 'trial' => 'build a trial release that PAUSE will not index' ], 46 | [ 'jobs|j=i' => 'number of parallel test jobs to run' ], 47 | } 48 | 49 | sub execute { 50 | my ($self, $opt, $arg) = @_; 51 | 52 | my $zilla; 53 | { 54 | # isolate changes to RELEASE_STATUS to zilla construction 55 | local $ENV{RELEASE_STATUS} = $ENV{RELEASE_STATUS}; 56 | $ENV{RELEASE_STATUS} = 'testing' if $opt->trial; 57 | $zilla = $self->zilla; 58 | } 59 | 60 | local $ENV{HARNESS_OPTIONS} = join ':', split(':', $ENV{HARNESS_OPTIONS} // ''), 'j'.$opt->jobs if $opt->jobs; 61 | $self->zilla->release; 62 | } 63 | 64 | 1; 65 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/App/Command/run.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::App::Command::run; 2 | # ABSTRACT: run stuff in a dir where your dist is built 3 | 4 | use Dist::Zilla::Pragmas; 5 | 6 | use Dist::Zilla::App -command; 7 | 8 | =head1 SYNOPSIS 9 | 10 | $ dzil run ./bin/myscript 11 | $ dzil run prove -bv t/mytest.t 12 | $ dzil run bash 13 | 14 | =head1 DESCRIPTION 15 | 16 | This command will build your dist with Dist::Zilla, then build the 17 | distribution and then run a command in the build directory. It's something 18 | like doing this: 19 | 20 | dzil build 21 | rsync -avp My-Project-version/ .build/ 22 | cd .build 23 | perl Makefile.PL # or perl Build.PL 24 | make # or ./Build 25 | export PERL5LIB=$PWD/blib/lib:$PWD/blib/arch 26 | 27 | 28 | Except for the fact it's built directly in a subdir of .build (like 29 | F<.build/69105y2>). 30 | 31 | A command returning with an non-zero error code will left the build directory 32 | behind for analysis, and C will exit with a non-zero status. Otherwise, 33 | the build directory will be removed and dzil will exit with status zero. 34 | 35 | If no run command is provided, a new default shell is invoked. This can be 36 | useful for testing your distribution as if it were installed. 37 | 38 | =cut 39 | 40 | sub abstract { 'run stuff in a dir where your dist is built' } 41 | 42 | sub opt_spec { 43 | [ 'build!' => 'do the Build actions before running the command; done by default', 44 | { default => 1 } ], 45 | [ 'trial' => 'build a trial release that PAUSE will not index' ], 46 | } 47 | 48 | sub description { 49 | "This will build your dist and run the given 'command' in the build dir.\n" . 50 | "If no command was specified, your shell will be run there instead." 51 | } 52 | 53 | sub usage_desc { 54 | return '%c run %o [ command [ arg1 arg2 ... ] ]'; 55 | } 56 | 57 | sub execute { 58 | my ($self, $opt, $args) = @_; 59 | 60 | unless (@$args) { 61 | my $envname = $^O eq 'MSWin32' ? 'COMSPEC' : 'SHELL'; 62 | unless ($ENV{$envname}) { 63 | $self->usage_error("no command supplied to run and no \$$envname set"); 64 | } 65 | $args = [ $ENV{$envname} ]; 66 | $self->log("no command supplied to run so using \$$envname: $args->[0]"); 67 | } 68 | 69 | $self->zilla->run_in_build($args, { build => $opt->build, trial => $opt->trial }); 70 | } 71 | 72 | 1; 73 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/App/Command/smoke.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::App::Command::smoke; 2 | # ABSTRACT: smoke your dist 3 | 4 | use Dist::Zilla::Pragmas; 5 | 6 | use Dist::Zilla::App -command; 7 | 8 | =head1 SYNOPSIS 9 | 10 | dzil smoke [ --release ] [ --author ] [ --no-automated ] 11 | 12 | =head1 DESCRIPTION 13 | 14 | This command builds and tests the distribution in "smoke testing mode." 15 | 16 | This command is a thin wrapper around the L method in 17 | Dist::Zilla. It builds your dist and runs the tests with the AUTOMATED_TESTING 18 | environment variable turned on, so it's like doing this: 19 | 20 | export AUTOMATED_TESTING=1 21 | dzil build --no-tgz 22 | cd $BUILD_DIRECTORY 23 | perl Makefile.PL 24 | make 25 | make test 26 | 27 | A build that fails tests will be left behind for analysis, and F will 28 | exit a non-zero value. If the tests are successful, the build directory will 29 | be removed and F will exit with status 0. 30 | 31 | =cut 32 | 33 | sub opt_spec { 34 | [ 'release' => 'enables the RELEASE_TESTING env variable', { default => 0 } ], 35 | [ 'automated!' => 'enables the AUTOMATED_TESTING env variable (default behavior)', { default => 1 } ], 36 | [ 'author' => 'enables the AUTHOR_TESTING env variable', { default => 0 } ] 37 | } 38 | 39 | =head1 OPTIONS 40 | 41 | =head2 --release 42 | 43 | This will run the test suite with RELEASE_TESTING=1 44 | 45 | =head2 --no-automated 46 | 47 | This will run the test suite without setting AUTOMATED_TESTING 48 | 49 | =head2 --author 50 | 51 | This will run the test suite with AUTHOR_TESTING=1 52 | 53 | =cut 54 | 55 | sub abstract { 'smoke your dist' } 56 | 57 | sub execute { 58 | my ($self, $opt, $arg) = @_; 59 | 60 | local $ENV{RELEASE_TESTING} = 1 if $opt->release; 61 | local $ENV{AUTHOR_TESTING} = 1 if $opt->author; 62 | local $ENV{AUTOMATED_TESTING} = 1 if $opt->automated; 63 | 64 | $self->zilla->test; 65 | } 66 | 67 | 1; 68 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/App/Command/test.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::App::Command::test; 2 | # ABSTRACT: test your dist 3 | 4 | use Dist::Zilla::Pragmas; 5 | 6 | use Dist::Zilla::App -command; 7 | 8 | =head1 SYNOPSIS 9 | 10 | dzil test [ --release ] [ --no-author ] [ --automated ] [ --extended ] [ --all ] 11 | 12 | =head1 DESCRIPTION 13 | 14 | This command is a thin wrapper around the L method in 15 | Dist::Zilla. It builds your dist and runs the tests with the AUTHOR_TESTING 16 | environment variable turned on, so it's like doing this: 17 | 18 | export AUTHOR_TESTING=1 19 | dzil build --no-tgz 20 | cd $BUILD_DIRECTORY 21 | perl Makefile.PL 22 | make 23 | make test 24 | 25 | A build that fails tests will be left behind for analysis, and F will 26 | exit a non-zero value. If the tests are successful, the build directory will 27 | be removed and F will exit with status 0. 28 | 29 | =cut 30 | 31 | sub opt_spec { 32 | [ 'release' => 'enables the RELEASE_TESTING env variable', { default => 0 } ], 33 | [ 'automated' => 'enables the AUTOMATED_TESTING env variable', { default => 0 } ], 34 | [ 'extended' => 'enables the EXTENDED_TESTING env variable', { default => 0 } ], 35 | [ 'author!' => 'enables the AUTHOR_TESTING env variable (default behavior)', { default => 1 } ], 36 | [ 'all' => 'enables the RELEASE_TESTING, AUTOMATED_TESTING, EXTENDED_TESTING and AUTHOR_TESTING env variables', { default => 0 } ], 37 | [ 'keep-build-dir|keep' => 'keep the build directory even after a success' ], 38 | [ 'jobs|j=i' => 'number of parallel test jobs to run' ], 39 | [ 'test-verbose' => 'enables verbose testing (TEST_VERBOSE env variable on Makefile.PL, --verbose on Build.PL', { default => 0 } ], 40 | } 41 | 42 | =head1 OPTIONS 43 | 44 | =head2 --release 45 | 46 | This will run the test suite with RELEASE_TESTING=1 47 | 48 | =head2 --automated 49 | 50 | This will run the test suite with AUTOMATED_TESTING=1 51 | 52 | =head2 --extended 53 | 54 | This will run the test suite with EXTENDED_TESTING=1 55 | 56 | =head2 --no-author 57 | 58 | This will run the test suite without setting AUTHOR_TESTING 59 | 60 | =head2 --all 61 | 62 | Equivalent to --release --automated --extended --author 63 | 64 | =cut 65 | 66 | sub abstract { 'test your dist' } 67 | 68 | sub execute { 69 | my ($self, $opt, $arg) = @_; 70 | 71 | local $ENV{RELEASE_TESTING} = 1 if $opt->release or $opt->all; 72 | local $ENV{AUTHOR_TESTING} = 1 if $opt->author or $opt->all; 73 | local $ENV{AUTOMATED_TESTING} = 1 if $opt->automated or $opt->all; 74 | local $ENV{EXTENDED_TESTING} = 1 if $opt->extended or $opt->all; 75 | 76 | $self->zilla->test({ 77 | $opt->keep_build_dir 78 | ? (keep_build_dir => 1) 79 | : (), 80 | $opt->jobs 81 | ? (jobs => $opt->jobs) 82 | : (), 83 | $opt->test_verbose 84 | ? (test_verbose => $opt->test_verbose) 85 | : (), 86 | }); 87 | } 88 | 89 | 1; 90 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/App/Command/version.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::App::Command::version; 2 | # ABSTRACT: display dzil's version 3 | 4 | use Dist::Zilla::Pragmas; 5 | 6 | use Dist::Zilla::App -command; 7 | use App::Cmd::Command::version; 8 | BEGIN { 9 | ## parent and base dont work here. ??? -- kentnl 2014-10-31 10 | our @ISA; 11 | unshift @ISA, 'App::Cmd::Command::version'; 12 | } 13 | 14 | =head1 SYNOPSIS 15 | 16 | Print dzil version 17 | 18 | $ dzil --version or $dzil version 19 | 20 | =cut 21 | 22 | sub version_for_display { 23 | my $version_pkg = $_[0]->version_package; 24 | my $version = ( $version_pkg->VERSION ? 25 | $version_pkg->VERSION : 26 | 'dev' ); 27 | } 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Chrome/Test.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Chrome::Test; 2 | # ABSTRACT: the chrome used by Dist::Zilla::Tester 3 | 4 | use Moose; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | use MooseX::Types::Moose qw(ArrayRef HashRef Str); 9 | use Dist::Zilla::Types qw(OneZero); 10 | use Log::Dispatchouli 1.102220; 11 | 12 | use namespace::autoclean; 13 | 14 | has logger => ( 15 | is => 'ro', 16 | default => sub { 17 | Log::Dispatchouli->new({ 18 | ident => 'Dist::Zilla::Tester', 19 | log_pid => 0, 20 | to_self => 1, 21 | }); 22 | } 23 | ); 24 | 25 | =attr response_for 26 | 27 | The response_for attribute (which exists only in the Test chrome) is a 28 | hashref that lets you specify the answer to questions asked by 29 | C or C. The key is the prompt string. If the 30 | value is a string, it is returned every time that question is asked. 31 | If the value is an arrayref, the first element is shifted off and 32 | returned every time the question is asked. If the arrayref is empty 33 | (or the prompt is not listed in the hash), the default answer (if any) 34 | is returned. 35 | 36 | Since you can't pass arguments to the Chrome constructor, response_for 37 | is initialized to an empty hash, and you can add entries after 38 | construction with the C method: 39 | 40 | $chrome->set_response_for($prompt => $response); 41 | 42 | =cut 43 | 44 | has response_for => ( 45 | isa => HashRef[ ArrayRef | Str ], 46 | traits => [ 'Hash' ], 47 | default => sub { {} }, 48 | handles => { 49 | response_for => 'get', 50 | set_response_for => 'set', 51 | }, 52 | ); 53 | 54 | sub prompt_str { 55 | my ($self, $prompt, $arg) = @_; 56 | $arg ||= {}; 57 | 58 | my $response = $self->response_for($prompt); 59 | 60 | $response = shift @$response if ref $response; 61 | 62 | $response = $arg->{default} unless defined $response; 63 | 64 | $self->logger->log_fatal("no response for test prompt '$prompt'") 65 | unless defined $response; 66 | 67 | return $response; 68 | } 69 | 70 | sub prompt_yn { 71 | my $self = shift; 72 | 73 | return OneZero->coerce( $self->prompt_str(@_) ); 74 | } 75 | 76 | sub prompt_any_key { return } 77 | 78 | with 'Dist::Zilla::Role::Chrome'; 79 | __PACKAGE__->meta->make_immutable; 80 | 1; 81 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/File/FromCode.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::File::FromCode; 2 | # ABSTRACT: a file whose content is (re-)built on demand 3 | 4 | use Moose; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | use Moose::Util::TypeConstraints; 9 | 10 | use namespace::autoclean; 11 | 12 | =head1 DESCRIPTION 13 | 14 | This represents a file whose contents will be generated on demand from a 15 | callback or method name. 16 | 17 | It has one attribute, C, which may be a method name (string) or a 18 | coderef. When the file's C method is called, the code is used to 19 | generate the content. This content is I cached. It is recomputed every 20 | time the content is requested. 21 | 22 | =cut 23 | 24 | with 'Dist::Zilla::Role::File'; 25 | 26 | has code => ( 27 | is => 'rw', 28 | isa => 'CodeRef|Str', 29 | required => 1, 30 | ); 31 | 32 | =attr code_return_type 33 | 34 | 'text' or 'bytes' 35 | 36 | =cut 37 | 38 | has code_return_type => ( 39 | is => 'ro', 40 | isa => enum([ qw(text bytes) ]), 41 | default => 'text', 42 | ); 43 | 44 | =attr encoding 45 | 46 | =cut 47 | 48 | sub encoding; 49 | 50 | has encoding => ( 51 | is => 'ro', 52 | isa => 'Str', 53 | lazy => 1, 54 | builder => "_build_encoding", 55 | ); 56 | 57 | sub _build_encoding { 58 | my ($self) = @_; 59 | return $self->code_return_type eq 'text' ? 'UTF-8' : 'bytes'; 60 | } 61 | 62 | =attr content 63 | 64 | =cut 65 | 66 | sub content { 67 | my ($self) = @_; 68 | 69 | confess("cannot set content of a FromCode file") if @_ > 1; 70 | 71 | my $code = $self->code; 72 | my $result = $self->$code; 73 | 74 | if ( $self->code_return_type eq 'text' ) { 75 | return $result; 76 | } 77 | else { 78 | $self->_decode($result); 79 | } 80 | } 81 | 82 | =attr encoded_content 83 | 84 | =cut 85 | 86 | sub encoded_content { 87 | my ($self) = @_; 88 | 89 | confess( "cannot set encoded_content of a FromCode file" ) if @_ > 1; 90 | 91 | my $code = $self->code; 92 | my $result = $self->$code; 93 | 94 | if ( $self->code_return_type eq 'bytes' ) { 95 | return $result; 96 | } 97 | else { 98 | $self->_encode($result); 99 | } 100 | } 101 | 102 | sub _set_added_by { 103 | my ($self, $value) = @_; 104 | return $self->_push_added_by(sprintf("%s from coderef added by %s", $self->code_return_type, $value)); 105 | }; 106 | 107 | __PACKAGE__->meta->make_immutable; 108 | 1; 109 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/File/InMemory.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::File::InMemory; 2 | # ABSTRACT: a file that you build entirely in memory 3 | 4 | use Moose; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | use namespace::autoclean; 9 | 10 | =head1 DESCRIPTION 11 | 12 | This represents a file created in memory -- it's not much more than a glorified 13 | string. 14 | 15 | See L for details. 16 | 17 | =cut 18 | 19 | with 'Dist::Zilla::Role::MutableFile', 'Dist::Zilla::Role::StubBuild'; 20 | 21 | after 'BUILD' => sub { 22 | my ($self,$opts) = @_; 23 | my @sources = qw/encoded_content content/; 24 | my @given = grep { exists $opts->{$_} } @sources; 25 | unless ( @given == 1 ) { 26 | $self->log_fatal(__PACKAGE__ . " requires have one and only one of: @sources"); 27 | } 28 | my $source = $given[0]; 29 | my $setter = "_$source"; 30 | $self->_content_source($source); 31 | $self->$setter( $opts->{$source} ); 32 | }; 33 | 34 | # these should never be called since we ensure one of _content or 35 | # _encoded_content content is set in BUILD and set the source accordingly 36 | 37 | sub _build_content { die "shouldn't reach here" } 38 | sub _build_encoded_content { die "shouldn't reach here" } 39 | sub _build_content_source { die "shouldn't reach here" } 40 | 41 | __PACKAGE__->meta->make_immutable; 42 | 1; 43 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/File/OnDisk.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::File::OnDisk; 2 | # ABSTRACT: a file that comes from your filesystem 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::MutableFile', 'Dist::Zilla::Role::StubBuild'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use Dist::Zilla::Path; 10 | 11 | use namespace::autoclean; 12 | 13 | =head1 DESCRIPTION 14 | 15 | This represents a file stored on disk. Its C attribute is read from 16 | the originally given file name when first read, but is then kept in memory and 17 | may be altered by plugins. 18 | 19 | =cut 20 | 21 | has _original_name => ( 22 | is => 'ro', 23 | writer => '_set_original_name', 24 | isa => 'Str', 25 | init_arg => undef, 26 | ); 27 | 28 | after 'BUILD' => sub { 29 | my ($self) = @_; 30 | $self->_set_original_name( $self->name ); 31 | }; 32 | 33 | sub _build_encoded_content { 34 | my ($self) = @_; 35 | return path($self->_original_name)->slurp_raw; 36 | } 37 | 38 | sub _build_content_source { return "encoded_content" } 39 | 40 | # should never be called, as content will always be generated from 41 | # encoded content 42 | sub _build_content { die "shouldn't reach here" } 43 | 44 | __PACKAGE__->meta->make_immutable; 45 | 1; 46 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/MVP/Assembler.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::MVP::Assembler; 2 | # ABSTRACT: Dist::Zilla-specific subclass of Config::MVP::Assembler 3 | 4 | use Moose; 5 | extends 'Config::MVP::Assembler'; 6 | with 'Config::MVP::Assembler::WithBundles' => { -version => '2.200010' }; 7 | 8 | use Dist::Zilla::Pragmas; 9 | 10 | use namespace::autoclean; 11 | 12 | use Dist::Zilla::Util; 13 | 14 | =head1 DESCRIPTION 15 | 16 | B If you don't understand how L 17 | works, reading about how the Dist::Zilla-specific Assembler works is not going 18 | to be useful. 19 | 20 | Dist::Zilla::MVP::Assembler extends L and composes 21 | L. For potential plugin bundles (things 22 | composing L) 23 | 24 | The Assembler has chrome, so it can log and will (eventually) be able to get 25 | input from the user. 26 | 27 | The Assembler's C method delegates to Dist::Zilla::Util's 28 | L 29 | method. 30 | 31 | The Assembler will throw an exception if it is instructed to add a value for 32 | C or C. 33 | 34 | =cut 35 | 36 | has chrome => ( 37 | is => 'rw', 38 | does => 'Dist::Zilla::Role::Chrome', 39 | required => 1, 40 | ); 41 | 42 | has logger => ( 43 | is => 'ro', 44 | isa => 'Log::Dispatchouli::Proxy', # could be duck typed, I guess 45 | lazy => 1, 46 | handles => [ qw(log log_debug log_fatal) ], 47 | default => sub { 48 | $_[0]->chrome->logger->proxy({ proxy_prefix => '[DZ] ' }) 49 | }, 50 | ); 51 | 52 | sub expand_package { 53 | return scalar Dist::Zilla::Util->expand_config_package_name($_[1]); 54 | } 55 | 56 | sub package_bundle_method { 57 | my ($self, $pkg) = @_; 58 | return unless $pkg->isa('Moose::Object') 59 | and $pkg->does('Dist::Zilla::Role::PluginBundle'); 60 | return 'bundle_config'; 61 | } 62 | 63 | before add_value => sub { 64 | my ($self, $name) = @_; 65 | 66 | return unless $name =~ /\A(?:plugin_name|zilla)\z/; 67 | 68 | my $section_name = $self->current_section->name; 69 | $self->log_fatal( 70 | "$section_name arguments attempted to provide reserved argument $name" 71 | ); 72 | }; 73 | 74 | __PACKAGE__->meta->make_immutable; 75 | 1; 76 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::MVP::Assembler::GlobalConfig; 2 | # ABSTRACT: Dist::Zilla::MVP::Assembler for global configuration 3 | 4 | use Moose; 5 | extends 'Dist::Zilla::MVP::Assembler'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 OVERVIEW 12 | 13 | This is a subclass of L used when assembling the 14 | global configuration. It has a C attribute, a hashref, into 15 | which stashes will be registered. 16 | 17 | They get registered via the C method, below, generally called 18 | by the C method on L-performing 19 | class. 20 | 21 | =cut 22 | 23 | has stash_registry => ( 24 | is => 'ro', 25 | isa => 'HashRef[Object]', 26 | default => sub { {} }, 27 | ); 28 | 29 | =method register_stash 30 | 31 | $assembler->register_stash($name => $stash_object); 32 | 33 | This adds a stash to the assembler's stash registry -- unless the name is 34 | already taken, in which case an exception is raised. 35 | 36 | =cut 37 | 38 | sub register_stash { 39 | my ($self, $name, $object) = @_; 40 | 41 | # $self->log_fatal("tried to register $name stash entry twice") 42 | confess("tried to register $name stash entry twice") 43 | if $self->stash_registry->{ $name }; 44 | 45 | $self->stash_registry->{ $name } = $object; 46 | return; 47 | } 48 | 49 | __PACKAGE__->meta->make_immutable; 50 | 1; 51 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/MVP/Assembler/Zilla.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::MVP::Assembler::Zilla; 2 | # ABSTRACT: Dist::Zilla::MVP::Assembler for the Dist::Zilla object 3 | 4 | use Moose; 5 | extends 'Dist::Zilla::MVP::Assembler'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 OVERVIEW 12 | 13 | This is a subclass of L used when assembling the 14 | Dist::Zilla object. 15 | 16 | It has a C attribute, which is used to determine what class of 17 | Dist::Zilla object to create. (This isn't very useful now, but will be in the 18 | future when minting and building use different subclasses of Dist::Zilla.) 19 | 20 | Upon construction, the assembler will create a L 21 | as the initial section. 22 | 23 | =cut 24 | 25 | use MooseX::Types::Perl qw(PackageName); 26 | use Dist::Zilla::MVP::RootSection; 27 | 28 | sub BUILD { 29 | my ($self) = @_; 30 | 31 | my $root = Dist::Zilla::MVP::RootSection->new; 32 | $self->sequence->add_section($root); 33 | } 34 | 35 | has zilla_class => ( 36 | is => 'ro', 37 | isa => PackageName, 38 | required => 1 39 | ); 40 | 41 | =method zilla 42 | 43 | This method is a shortcut for retrieving the C from the root section. 44 | If called before that section has been finalized, it will result in an 45 | exception. 46 | 47 | =cut 48 | 49 | sub zilla { 50 | my ($self) = @_; 51 | $self->sequence->section_named('_')->zilla; 52 | } 53 | 54 | =method register_stash 55 | 56 | $assembler->register_stash($name => $stash_object); 57 | 58 | This adds a stash to the assembler's zilla's stash registry -- unless the name 59 | is already taken, in which case an exception is raised. 60 | 61 | =cut 62 | 63 | sub register_stash { 64 | my ($self, $name, $object) = @_; 65 | $self->log_fatal("tried to register $name stash entry twice") 66 | if $self->zilla->_local_stashes->{ $name }; 67 | 68 | $self->zilla->_local_stashes->{ $name } = $object; 69 | return; 70 | } 71 | 72 | __PACKAGE__->meta->make_immutable; 73 | 1; 74 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/MVP/Reader/Finder.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::MVP::Reader::Finder; 2 | # ABSTRACT: the reader for dist.ini files 3 | 4 | use Moose; 5 | use Config::MVP::Reader 2.101540; # if_none 6 | extends 'Config::MVP::Reader::Finder'; 7 | 8 | use Dist::Zilla::Pragmas; 9 | 10 | use namespace::autoclean; 11 | 12 | use Dist::Zilla::MVP::Assembler; 13 | 14 | sub default_search_path { 15 | return qw(Dist::Zilla::MVP::Reader Config::MVP::Reader); 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | 1; 20 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/MVP/Reader/Perl.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::MVP::Reader::Perl; 2 | # ABSTRACT: the reader for dist.pl files 3 | 4 | use Moose; 5 | extends 'Config::MVP::Reader'; 6 | with qw(Config::MVP::Reader::Findable::ByExtension); 7 | 8 | use Dist::Zilla::Pragmas; 9 | 10 | use namespace::autoclean; 11 | 12 | =head1 DESCRIPTION 13 | 14 | Dist::Zilla::Config reads in the F file for a distribution. 15 | 16 | =cut 17 | 18 | sub default_extension { 'pl' } 19 | 20 | sub read_into_assembler { 21 | my ($self, $location, $asm) = @_; 22 | 23 | my @input = do File::Spec->rel2abs($location); 24 | while (@input and ! ref $input[0]) { 25 | my ($key, $value) = (shift(@input), shift(@input)); 26 | $asm->add_value($key => $value); 27 | } 28 | 29 | my $plugins = shift @input; 30 | 31 | confess "too much input" if @input; 32 | 33 | while (my ($ident, $arg) = splice @$plugins, 0, 2) { 34 | unless (ref $arg) { 35 | unshift @$plugins, $arg if defined $arg; 36 | $arg = []; 37 | } 38 | 39 | my ($moniker, $name) = ref $ident ? @$ident : (($ident) x 2); 40 | $asm->change_section($moniker, $name); 41 | my @to_iter = ref $arg eq 'HASH' ? %$arg : @$arg; 42 | while (my ($key, $value) = splice @to_iter, 0, 2) { 43 | $asm->add_value($key, $value); 44 | } 45 | } 46 | 47 | # should be done ... elsewhere? -- rjbs, 2009-08-24 48 | $asm->end_section if $asm->current_section; 49 | 50 | return $asm->sequence; 51 | } 52 | 53 | __PACKAGE__->meta->make_immutable; 54 | 1; 55 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/MVP/RootSection.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::MVP::RootSection; 2 | # ABSTRACT: a standard section in Dist::Zilla's configuration sequence 3 | 4 | use Moose; 5 | extends 'Config::MVP::Section'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | This is a subclass of L, used as the starting section by 14 | L. It has a number of useful defaults, as 15 | well as a C attribute which will, after section finalization, contain a 16 | Dist::Zilla object with which subsequent plugin sections may register. 17 | 18 | Those useful defaults are: 19 | 20 | =for :list 21 | * name defaults to _ 22 | * aliases defaults to { author => 'authors' } 23 | * multivalue_args defaults to [ 'authors' ] 24 | 25 | =cut 26 | 27 | use MooseX::LazyRequire; 28 | use MooseX::SetOnce; 29 | use Moose::Util::TypeConstraints; 30 | 31 | has '+name' => (default => '_'); 32 | 33 | has '+aliases' => (default => sub { return { author => 'authors' } }); 34 | 35 | has '+multivalue_args' => (default => sub { [ qw(authors) ] }); 36 | 37 | has zilla => ( 38 | is => 'ro', 39 | isa => class_type('Dist::Zilla'), 40 | traits => [ qw(SetOnce) ], 41 | writer => 'set_zilla', 42 | lazy_required => 1, 43 | ); 44 | 45 | after finalize => sub { 46 | my ($self) = @_; 47 | 48 | my $assembler = $self->sequence->assembler; 49 | 50 | my %payload = %{ $self->payload }; 51 | 52 | my %dzil; 53 | $dzil{$_} = delete $payload{":$_"} for grep { s/\A:// } keys %payload; 54 | 55 | my $zilla = $assembler->zilla_class->new( \%payload ); 56 | 57 | if (defined $dzil{version}) { 58 | Dist::Zilla::Util->_assert_loaded_class_version_ok( 59 | 'Dist::Zilla', 60 | $dzil{version}, 61 | ); 62 | } 63 | 64 | $self->set_zilla($zilla); 65 | }; 66 | 67 | __PACKAGE__->meta->make_immutable; 68 | 1; 69 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/MVP/Section.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::MVP::Section; 2 | # ABSTRACT: a standard section in Dist::Zilla's configuration sequence 3 | 4 | use Moose; 5 | extends 'Config::MVP::Section'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | use Config::MVP::Section 2.200009; # not-installed error with section_name 12 | 13 | around add_value => sub { 14 | my ($orig, $self, $name, $value) = @_; 15 | 16 | if ($name =~ s/\A://) { 17 | if ($name eq 'version') { 18 | Dist::Zilla::Util->_assert_loaded_class_version_ok( 19 | $self->package, 20 | $value, 21 | ); 22 | } 23 | 24 | return; 25 | } 26 | 27 | $self->$orig($name, $value); 28 | }; 29 | 30 | after finalize => sub { 31 | my ($self) = @_; 32 | 33 | my ($name, $plugin_class, $arg) = ( 34 | $self->name, 35 | $self->package, 36 | $self->payload, 37 | ); 38 | 39 | my %payload = %{ $self->payload }; 40 | 41 | $plugin_class->register_component($name, \%payload, $self); 42 | 43 | return; 44 | }; 45 | 46 | __PACKAGE__->meta->make_immutable; 47 | 1; 48 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/MintingProfile/Default.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::MintingProfile::Default; 2 | # ABSTRACT: Default minting profile provider 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::MintingProfile::ShareDir'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | use Dist::Zilla::Util; 12 | 13 | =head1 DESCRIPTION 14 | 15 | Default minting profile provider. 16 | 17 | This provider looks first in the F<~/.dzil/profiles/$profile_name> directory, 18 | if not found it looks among the default profiles shipped with Dist::Zilla. 19 | 20 | =cut 21 | 22 | around profile_dir => sub { 23 | my ($orig, $self, $profile_name) = @_; 24 | 25 | $profile_name ||= 'default'; 26 | 27 | # shouldn't look in user's config when testing 28 | if (!$ENV{DZIL_TESTING}) { 29 | my $profile_dir = Dist::Zilla::Util->_global_config_root 30 | ->child('profiles', $profile_name); 31 | 32 | return $profile_dir if -d $profile_dir; 33 | } 34 | 35 | return $self->$orig($profile_name); 36 | }; 37 | 38 | __PACKAGE__->meta->make_immutable; 39 | 1; 40 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Path.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Path; 2 | # ABSTRACT: a helper to get Path::Tiny objects 3 | 4 | use Dist::Zilla::Pragmas; 5 | 6 | use parent 'Path::Tiny'; 7 | 8 | use Path::Tiny 0.052 qw(); # issue 427 9 | use Scalar::Util qw( blessed ); 10 | use Sub::Exporter -setup => { 11 | exports => [ qw( path ) ], 12 | groups => { default => [ qw( path ) ] }, 13 | }; 14 | 15 | use namespace::autoclean -except => 'import'; 16 | 17 | sub path { 18 | my ($thing, @rest) = @_; 19 | 20 | if (@rest == 0 && blessed $thing) { 21 | return $thing if $thing->isa(__PACKAGE__); 22 | 23 | return bless(Path::Tiny::path("$thing"), __PACKAGE__) 24 | if $thing->isa('Path::Class::Entity') || $thing->isa('Path::Tiny'); 25 | } 26 | 27 | return bless(Path::Tiny::path($thing, @rest), __PACKAGE__); 28 | } 29 | 30 | my %warned; 31 | 32 | sub file { 33 | my ($self, @file) = @_; 34 | 35 | my ($package, $pmfile, $line) = caller; 36 | 37 | my $key = join qq{\0}, $pmfile, $line; 38 | unless ($warned{ $key }++) { 39 | Carp::carp("->file called on a Dist::Zilla::Path object; this will cease to work in Dist::Zilla v7; downstream code should be updated to use Path::Tiny API, not Path::Class"); 40 | } 41 | 42 | require Path::Class; 43 | Path::Class::dir($self)->file(@file); 44 | } 45 | 46 | sub subdir { 47 | my ($self, @subdir) = @_; 48 | Carp::carp("->subdir called on a Dist::Zilla::Path object; this will cease to work in Dist::Zilla v7; downstream code should be updated to use Path::Tiny API, not Path::Class"); 49 | require Path::Class; 50 | Path::Class::dir($self)->subdir(@subdir); 51 | } 52 | 53 | 1; 54 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/ConfirmRelease.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::ConfirmRelease; 2 | # ABSTRACT: prompt for confirmation before releasing 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::BeforeRelease'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | sub before_release { 12 | my ($self, $tgz) = @_; 13 | 14 | my $releasers = join q{, }, 15 | map {; $_->plugin_name } 16 | @{ $self->zilla->plugins_with(-Releaser) }; 17 | 18 | $self->log("*** Preparing to release $tgz with $releasers ***"); 19 | my $prompt = "Do you want to continue the release process?"; 20 | 21 | my $default = exists $ENV{DZIL_CONFIRMRELEASE_DEFAULT} 22 | ? $ENV{DZIL_CONFIRMRELEASE_DEFAULT} 23 | : 0; 24 | 25 | my $confirmed = $self->zilla->chrome->prompt_yn( 26 | $prompt, 27 | { default => $default } 28 | ); 29 | 30 | $self->log_fatal("Aborting release") unless $confirmed; 31 | } 32 | 33 | __PACKAGE__->meta->make_immutable; 34 | 1; 35 | 36 | =head1 DESCRIPTION 37 | 38 | This plugin prompts the author whether or not to continue before releasing 39 | the distribution to CPAN. It gives authors a chance to abort before 40 | they upload. 41 | 42 | The default is "no", but you can set the environment variable 43 | C to "yes" if you just want to hit enter to 44 | release. 45 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/DistINI.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::DistINI; 2 | # ABSTRACT: a plugin to add a dist.ini to newly-minted dists 3 | 4 | use Moose; 5 | with qw(Dist::Zilla::Role::FileGatherer); 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use Dist::Zilla::File::FromCode; 10 | 11 | use MooseX::Types::Moose qw(ArrayRef Str); 12 | use Dist::Zilla::Path; 13 | 14 | use namespace::autoclean; 15 | 16 | =head1 DESCRIPTION 17 | 18 | This plugins produces a F file in a new dist, specifying the required 19 | core attributes from the dist being minted. 20 | 21 | This plugin is dead simple and pretty stupid, but should get better as dist 22 | minting facilities improve. For example, it will not specify any plugins. 23 | 24 | In the meantime, you may be happier with a F template. 25 | 26 | =attr append_file 27 | 28 | This parameter may be a filename in the profile's directory to append to the 29 | generated F with things like plugins. In other words, if your make 30 | this file, called F: 31 | 32 | [@Basic] 33 | [NextRelease] 34 | [@Git] 35 | 36 | ...and your F includes: 37 | 38 | [DistINI] 39 | append_file = plugins.ini 40 | 41 | ...then the generated C in a newly-minted dist will look something 42 | like this: 43 | 44 | name = My-New-Dist 45 | author = E. Xavier Ample 46 | license = Perl_5 47 | copyright_holder = E. Xavier Ample 48 | copyright_year = 2010 49 | 50 | [@Basic] 51 | [NextRelease] 52 | [@Git] 53 | 54 | =cut 55 | 56 | sub mvp_multivalue_args { qw(append_file) } 57 | 58 | has append_file => ( 59 | is => 'ro', 60 | isa => ArrayRef[ Str ], 61 | default => sub { [] }, 62 | ); 63 | 64 | sub gather_files { 65 | my ($self, $arg) = @_; 66 | 67 | my $zilla = $self->zilla; 68 | 69 | my $postlude = ''; 70 | 71 | for (@{ $self->append_file }) { 72 | my $fn = $self->zilla->root->child($_); 73 | 74 | $postlude .= path($fn)->slurp_utf8; 75 | } 76 | 77 | my $code = sub { 78 | my @core_attrs = qw(name authors copyright_holder); 79 | 80 | my $license = ref $zilla->license; 81 | if ($license =~ /^Software::License::(.+)$/) { 82 | $license = $1; 83 | } else { 84 | $license = "=$license"; 85 | } 86 | 87 | my $content = ''; 88 | $content .= sprintf "name = %s\n", $zilla->name; 89 | $content .= sprintf "author = %s\n", $_ for @{ $zilla->authors }; 90 | $content .= sprintf "license = %s\n", $license; 91 | $content .= sprintf "copyright_holder = %s\n", $zilla->copyright_holder; 92 | $content .= sprintf "copyright_year = %s\n", (localtime)[5] + 1900; 93 | $content .= "\n"; 94 | 95 | $content .= $postlude; 96 | }; 97 | 98 | my $file = Dist::Zilla::File::FromCode->new({ 99 | name => 'dist.ini', 100 | code => $code, 101 | }); 102 | 103 | $self->add_file($file); 104 | } 105 | 106 | __PACKAGE__->meta->make_immutable; 107 | 1; 108 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/Encoding.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::Encoding; 2 | # ABSTRACT: set the encoding of arbitrary files 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::EncodingProvider'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 SYNOPSIS 12 | 13 | This plugin allows you to explicitly set the encoding on some files in your 14 | distribution. You can either specify the exact set of files (with the 15 | "filenames" parameter) or provide the regular expressions to check (using 16 | "match"). 17 | 18 | In your F: 19 | 20 | [Encoding] 21 | encoding = Latin-3 22 | 23 | filename = t/esperanto.t ; this file is Esperanto 24 | match = ^t/urkish/ ; these are all Turkish 25 | 26 | =cut 27 | 28 | sub mvp_multivalue_args { qw(filenames matches ignore) } 29 | sub mvp_aliases { return { filename => 'filenames', match => 'matches' } } 30 | 31 | =attr encoding 32 | 33 | This is the encoding to set on the selected files. The special value "bytes" 34 | can be used to indicate raw files that should not be encoded. 35 | 36 | =cut 37 | 38 | has encoding => ( 39 | is => 'ro', 40 | isa => 'Str', 41 | required => 1, 42 | ); 43 | 44 | =attr filenames 45 | 46 | This is an arrayref of filenames to have their encoding set. 47 | 48 | =cut 49 | 50 | has filenames => ( 51 | is => 'ro', 52 | isa => 'ArrayRef', 53 | default => sub { [] }, 54 | ); 55 | 56 | =attr matches 57 | 58 | This is an arrayref of regular expressions. Any file whose name matches one of 59 | these regex will have its encoding set. 60 | 61 | =cut 62 | 63 | has matches => ( 64 | is => 'ro', 65 | isa => 'ArrayRef', 66 | default => sub { [] }, 67 | ); 68 | 69 | =attr ignore 70 | 71 | This is an arrayref of regular expressions. Any file whose name matches one of 72 | these regex will B have its encoding set. Useful to ignore a few files 73 | that would otherwise be selected by C. 74 | 75 | =cut 76 | 77 | has ignore => ( 78 | is => 'ro', 79 | isa => 'ArrayRef', 80 | default => sub { [] }, 81 | ); 82 | 83 | sub set_file_encodings { 84 | my ($self) = @_; 85 | 86 | # never match (at least the filename characters) 87 | my $matches_regex = qr/\000/; 88 | 89 | $matches_regex = qr/$matches_regex|$_/ for @{$self->matches}; 90 | 91 | # \A\Q$_\E should also handle the `eq` check 92 | $matches_regex = qr/$matches_regex|\A\Q$_\E/ for @{$self->filenames}; 93 | 94 | my( $ignore_regex ) = map { $_ && qr/$_/ } join '|', @{ $self->ignore }; 95 | 96 | for my $file (@{$self->zilla->files}) { 97 | next unless $file->name =~ $matches_regex; 98 | 99 | next if $ignore_regex and $file->name =~ $ignore_regex; 100 | 101 | $self->log_debug([ 102 | 'setting encoding of %s to %s', 103 | $file->name, 104 | $self->encoding, 105 | ]); 106 | 107 | $file->encoding($self->encoding); 108 | } 109 | 110 | return; 111 | } 112 | 113 | __PACKAGE__->meta->make_immutable; 114 | 1; 115 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/ExecDir.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::ExecDir; 2 | # ABSTRACT: install a directory's contents as executables 3 | 4 | use Moose; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | use namespace::autoclean; 9 | 10 | =head1 SYNOPSIS 11 | 12 | In your F: 13 | 14 | [ExecDir] 15 | dir = scripts 16 | 17 | If no C is provided, the default is F. 18 | 19 | =cut 20 | 21 | has dir => ( 22 | is => 'ro', 23 | isa => 'Str', 24 | default => 'bin', 25 | ); 26 | 27 | with 'Dist::Zilla::Role::ExecFiles'; 28 | __PACKAGE__->meta->make_immutable; 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/ExtraTests.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::ExtraTests; 2 | # ABSTRACT: rewrite ./xt tests to ./t tests with skips 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::FileMunger'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | This plugin rewrites tests found in the following directories: 14 | 15 | ./xt/author - tests for author testing (env AUTHOR_TESTING is true) 16 | ./xt/release - tests for pre-release testers (env RELEASE_TESTING is true) 17 | ./xt/smoke - tests for automated testers (env AUTOMATED_TESTING is true) 18 | 19 | The tests are renamed and moved to F<./t>, and they are rewritten to include 20 | some simple Perl code to skip all included tests if the correct env vars are 21 | not set. 22 | 23 | =cut 24 | 25 | sub munge_file { 26 | my ($self, $file) = @_; 27 | 28 | return unless $file->name =~ m{\Axt/(smoke|author|release)/.+\.t\z}; 29 | my $method = "_rewrite_$1\_test"; 30 | 31 | $self->log("rewriting $1 test " . $file->name); 32 | 33 | $self->$method($file); 34 | } 35 | 36 | sub _rewrite_smoke_test { 37 | my ($self, $file) = @_; 38 | $self->_rewrite($file, 'AUTOMATED_TESTING', '"smoke bot" testing'); 39 | } 40 | 41 | sub _rewrite_author_test { 42 | my ($self, $file) = @_; 43 | $self->_rewrite($file, 'AUTHOR_TESTING', 'testing by the author'); 44 | } 45 | 46 | sub _rewrite_release_test { 47 | my ($self, $file) = @_; 48 | $self->_rewrite($file, 'RELEASE_TESTING', 'release candidate testing'); 49 | } 50 | 51 | sub _rewrite { 52 | my ($self, $file, $env, $msg) = @_; 53 | 54 | my $name = $file->name =~ s{^xt/([^/]+)/}{t/$1-}r; 55 | 56 | $file->name($name); 57 | 58 | my @lines = split /\n/, $file->content; 59 | my $after = $lines[0] =~ /\A#!/ ? 1 : 0; 60 | splice @lines, $after, 0, qq| 61 | BEGIN { 62 | unless (\$ENV{$env}) { 63 | print qq{1..0 # SKIP these tests are for $msg\\n}; 64 | exit 65 | } 66 | } 67 | |; 68 | 69 | $file->content(join "\n", @lines, ''); 70 | } 71 | 72 | __PACKAGE__->meta->make_immutable; 73 | 1; 74 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/FakeRelease.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::FakeRelease; 2 | # ABSTRACT: fake plugin to test release 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::Releaser'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | has user => ( 12 | is => 'ro', 13 | isa => 'Str', 14 | required => 1, 15 | default => 'AUTHORID', 16 | ); 17 | 18 | sub cpanid { shift->user } 19 | 20 | sub release { 21 | my $self = shift; 22 | 23 | for my $env ( 24 | 'DIST_ZILLA_FAKERELEASE_FAIL', # old 25 | 'DZIL_FAKERELEASE_FAIL', # new 26 | ) { 27 | $self->log_fatal("$env set, aborting") if $ENV{$env}; 28 | } 29 | 30 | $self->log('Fake release happening (nothing was really done)'); 31 | } 32 | 33 | __PACKAGE__->meta->make_immutable; 34 | 1; 35 | 36 | =head1 SYNOPSIS 37 | 38 | [FakeRelease] 39 | user = CPANAUTHORID ; # optional. 40 | 41 | =head1 DESCRIPTION 42 | 43 | This plugin is a L that does nothing. It 44 | is directed to plugin authors, who may need a dumb release plugin to test their 45 | shiny plugin implementing L 46 | and L. 47 | 48 | When this plugin does the release, it will just log a message and finish. 49 | 50 | If you set the environment variable C to a true value, 51 | the plugin will die instead of doing nothing. This can be useful for 52 | authors wanting to test reliably that release failed. 53 | 54 | You can optionally provide the 'user' parameter, which defaults to 'AUTHORID', 55 | which will allow things that depend on this metadata 56 | ( Sometimes provided by L ) to still work. 57 | ( For example: L ) 58 | 59 | =head1 SEE ALSO 60 | 61 | Core Dist::Zilla plugins: 62 | L, 63 | L. 64 | 65 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/FileFinder/Filter.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::FileFinder::Filter; 2 | # ABSTRACT: filter matches from other FileFinders 3 | 4 | use Moose; 5 | with( 6 | 'Dist::Zilla::Role::FileFinder', 7 | 'Dist::Zilla::Role::FileFinderUser' => { 8 | default_finders => [], 9 | }, 10 | ); 11 | 12 | use Dist::Zilla::Pragmas; 13 | 14 | use namespace::autoclean; 15 | 16 | =head1 SYNOPSIS 17 | 18 | In your F: 19 | 20 | [FileFinder::Filter / MyFiles] 21 | finder = :InstallModules ; find files from :InstallModules 22 | finder = :ExecFiles ; or :ExecFiles 23 | skip = ignore ; that don't have "ignore" in the path 24 | 25 | =head1 CREDITS 26 | 27 | This plugin was originally contributed by Christopher J. Madsen. 28 | 29 | =cut 30 | 31 | use Moose::Util::TypeConstraints; 32 | use MooseX::Types::Moose qw(ArrayRef RegexpRef Str); 33 | 34 | { 35 | my $type = subtype as ArrayRef[RegexpRef]; 36 | coerce $type, from ArrayRef[Str], via { [map { qr/$_/ } @$_] }; 37 | 38 | =attr finder 39 | 40 | A FileFinder to supply the initial list of files. 41 | May occur multiple times. 42 | 43 | =attr skip 44 | 45 | The pathname must I match any of these regular expressions. 46 | May occur multiple times. 47 | 48 | =cut 49 | 50 | has skips => ( 51 | is => 'ro', 52 | isa => $type, 53 | coerce => 1, 54 | default => sub { [] }, 55 | ); 56 | } 57 | 58 | sub mvp_aliases { +{ qw( 59 | skip skips 60 | ) } } 61 | 62 | sub mvp_multivalue_args { qw(skips) } 63 | 64 | sub find_files { 65 | my $self = shift; 66 | 67 | my $files = $self->found_files; 68 | 69 | foreach my $re (@{ $self->skips }) { 70 | @$files = grep { $_->name !~ $re } @$files; 71 | } 72 | 73 | $self->log_debug("No files found") unless @$files; 74 | $self->log_debug("Found " . $_->name) for @$files; 75 | 76 | $files; 77 | } 78 | 79 | __PACKAGE__->meta->make_immutable; 80 | 1; 81 | 82 | =head1 DESCRIPTION 83 | 84 | FileFinder::Filter is a L that 85 | selects files by filtering the selections of other FileFinders. 86 | 87 | You specify one or more FileFinders to generate the initial list of 88 | files. Any file whose pathname matches any of the C regexs is 89 | removed from that list. 90 | 91 | =for Pod::Coverage 92 | mvp_aliases 93 | mvp_multivalue_args 94 | find_files 95 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/FinderCode.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::FinderCode; 2 | # ABSTRACT: a callback-based FileFinder plugin 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::FileFinder'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | use Moose::Util::TypeConstraints; 12 | 13 | has code => ( 14 | is => 'ro', 15 | isa => 'CodeRef', 16 | required => 1, 17 | ); 18 | 19 | has style => ( 20 | is => 'ro', 21 | isa => enum([ qw(grep list) ]), 22 | required => 1, 23 | ); 24 | 25 | sub find_files { 26 | my ($self) = @_; 27 | 28 | my $method = '_find_via_' . $self->style; 29 | 30 | $self->$method; 31 | } 32 | 33 | sub _find_via_grep { 34 | my ($self) = @_; 35 | 36 | my @files = grep { $self->code->($_, $self) } @{ $self->zilla->files }; 37 | return \@files; 38 | } 39 | 40 | sub _find_via_list { 41 | my ($self) = @_; 42 | 43 | my $code = $self->code; 44 | $self->$code; 45 | } 46 | 47 | __PACKAGE__->meta->make_immutable; 48 | 1; 49 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/InlineFiles.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::InlineFiles; 2 | # ABSTRACT: files in a data section 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::FileGatherer'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | This plugin exists only to be extended, and gathers all files contained in its 14 | data section and those of its ancestors. For more information, see 15 | L. 16 | 17 | =cut 18 | 19 | use Sub::Exporter::ForMethods; 20 | use Data::Section 0.200002 # encoding and bytes 21 | { installer => Sub::Exporter::ForMethods::method_installer }, 22 | '-setup' => { encoding => 'bytes' }; 23 | use Dist::Zilla::File::InMemory; 24 | 25 | sub gather_files { 26 | my ($self) = @_; 27 | 28 | my $data = $self->merged_section_data; 29 | return unless $data and %$data; 30 | 31 | for my $name (keys %$data) { 32 | $self->add_file( 33 | Dist::Zilla::File::InMemory->new({ 34 | name => $name, 35 | content => ${ $data->{$name} }, 36 | }), 37 | ); 38 | } 39 | 40 | return; 41 | } 42 | 43 | __PACKAGE__->meta->make_immutable; 44 | 1; 45 | 46 | =head1 SEE ALSO 47 | 48 | Core Dist::Zilla plugins inheriting from L: 49 | L, 50 | L, 51 | L. 52 | 53 | =cut 54 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/License.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::License; 2 | # ABSTRACT: output a LICENSE file 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::FileGatherer'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | This plugin adds a F file containing the full text of the 14 | distribution's license, as produced by the C method of the 15 | dist's L object. 16 | 17 | =attr filename 18 | 19 | This attribute can be used to specify a name other than F to be used. 20 | 21 | =cut 22 | 23 | use Dist::Zilla::File::InMemory; 24 | 25 | has filename => ( 26 | is => 'ro', 27 | isa => 'Str', 28 | default => 'LICENSE', 29 | ); 30 | 31 | sub gather_files { 32 | my ($self, $arg) = @_; 33 | 34 | my $file = Dist::Zilla::File::InMemory->new({ 35 | name => $self->filename, 36 | content => $self->zilla->license->fulltext, 37 | }); 38 | 39 | $self->add_file($file); 40 | return; 41 | } 42 | 43 | __PACKAGE__->meta->make_immutable; 44 | 1; 45 | 46 | =head1 SEE ALSO 47 | 48 | =over 4 49 | 50 | =item * 51 | 52 | the C attribute of the L object to select the license 53 | to use. 54 | 55 | =item * 56 | 57 | Dist::Zilla roles: 58 | L. 59 | 60 | =item * 61 | 62 | Other modules: 63 | L, 64 | L. 65 | 66 | =back 67 | 68 | =cut 69 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::MakeMaker::Runner; 2 | # ABSTRACT: Test and build dists with a Makefile.PL 3 | 4 | use Moose; 5 | with( 6 | 'Dist::Zilla::Role::BuildRunner', 7 | 'Dist::Zilla::Role::TestRunner', 8 | ); 9 | 10 | use Dist::Zilla::Pragmas; 11 | 12 | use namespace::autoclean; 13 | 14 | use Config; 15 | 16 | has 'make_path' => ( 17 | isa => 'Str', 18 | is => 'ro', 19 | default => $Config{make} || 'make', 20 | ); 21 | 22 | sub build { 23 | my $self = shift; 24 | 25 | my $make = $self->make_path; 26 | 27 | my $makefile = $^O eq 'VMS' ? 'Descrip.MMS' : 'Makefile'; 28 | 29 | return 30 | if -e $makefile and (stat 'Makefile.PL')[9] <= (stat $makefile)[9]; 31 | 32 | $self->log_debug("running $^X Makefile.PL"); 33 | system($^X => qw(Makefile.PL INSTALLMAN1DIR=none INSTALLMAN3DIR=none)) and die "error with Makefile.PL\n"; 34 | 35 | $self->log_debug("running $make"); 36 | system($make) and die "error running $make\n"; 37 | 38 | return; 39 | } 40 | 41 | sub test { 42 | my ($self, $target, $arg) = @_; 43 | 44 | my $make = $self->make_path; 45 | $self->build; 46 | 47 | my $job_count = $arg && exists $arg->{jobs} 48 | ? $arg->{jobs} 49 | : $self->default_jobs; 50 | 51 | my $jobs = "j$job_count"; 52 | my $ho = "HARNESS_OPTIONS"; 53 | local $ENV{$ho} = $ENV{$ho} ? "$ENV{$ho}:$jobs" : $jobs; 54 | 55 | $self->log_debug(join(' ', "running $make test", ( $self->zilla->logger->get_debug ? 'TEST_VERBOSE=1' : () ))); 56 | system($make, 'test', 57 | ( $self->zilla->logger->get_debug || $arg->{test_verbose} ? 'TEST_VERBOSE=1' : () ), 58 | ) and die "error running $make test\n"; 59 | 60 | return; 61 | } 62 | 63 | __PACKAGE__->meta->make_immutable; 64 | 1; 65 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/Manifest.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::Manifest; 2 | # ABSTRACT: build a MANIFEST file 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::FileGatherer'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | use Dist::Zilla::File::FromCode; 12 | 13 | =head1 DESCRIPTION 14 | 15 | If included, this plugin will produce a F file for the distribution, 16 | listing all of the files it contains. For obvious reasons, it should be 17 | included as close to last as possible. 18 | 19 | This plugin is included in the L<@Basic|Dist::Zilla::PluginBundle::Basic> 20 | bundle. 21 | 22 | =head1 SEE ALSO 23 | 24 | Dist::Zilla core plugins: 25 | L<@Basic|Dist::Zilla::PluginBundle::Manifest>, 26 | L. 27 | 28 | Other modules: L. 29 | 30 | =cut 31 | 32 | sub __fix_filename { 33 | my ($name) = @_; 34 | return $name unless $name =~ /[ '\\]/; 35 | $name =~ s/\\/\\\\/g; 36 | $name =~ s/'/\\'/g; 37 | return qq{'$name'}; 38 | } 39 | 40 | sub gather_files { 41 | my ($self, $arg) = @_; 42 | 43 | my $zilla = $self->zilla; 44 | 45 | my $file = Dist::Zilla::File::FromCode->new({ 46 | name => 'MANIFEST', 47 | code_return_type => 'bytes', 48 | code => sub { 49 | my $generated_by = sprintf "%s v%s", ref($self), $self->VERSION || '(dev)'; 50 | 51 | return "# This file was automatically generated by $generated_by.\n" 52 | . join("\n", map { __fix_filename($_) } sort map { $_->name } @{ $zilla->files }) 53 | . "\n", 54 | }, 55 | }); 56 | 57 | $self->add_file($file); 58 | } 59 | 60 | __PACKAGE__->meta->make_immutable; 61 | 1; 62 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/ManifestSkip.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::ManifestSkip; 2 | # ABSTRACT: decline to build files that appear in a MANIFEST.SKIP-like file 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::FilePruner'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | This plugin reads a MANIFEST.SKIP-like file, as used by L 14 | and L, and prunes any files that it declares should be 15 | skipped. 16 | 17 | This plugin is included in the L<@Basic|Dist::Zilla::PluginBundle::Basic> 18 | bundle. 19 | 20 | =attr skipfile 21 | 22 | This is the name of the file to read for MANIFEST.SKIP-like content. It 23 | defaults, unsurprisingly, to F. 24 | 25 | =head1 SEE ALSO 26 | 27 | Dist::Zilla core plugins: 28 | L<@Basic|Dist::Zilla::PluginBundle::Basic>, 29 | L, 30 | L. 31 | 32 | Other modules: L. 33 | 34 | =cut 35 | 36 | has skipfile => (is => 'ro', required => 1, default => 'MANIFEST.SKIP'); 37 | 38 | sub prune_files { 39 | my ($self) = @_; 40 | my $files = $self->zilla->files; 41 | 42 | my $skipfile_name = $self->skipfile; 43 | my ($skipfile) = grep { $_->name eq $skipfile_name } @$files; 44 | unless (defined $skipfile) { 45 | $self->log_debug([ 'file %s not found', $skipfile_name ]); 46 | return; 47 | } 48 | 49 | my $content = $skipfile->content; 50 | 51 | # If the content has been generated in memory or changed from disk, 52 | # create a temp file with the content. 53 | # (Unfortunately maniskip can't read from a string ref) 54 | my $fh; 55 | if (! -f $skipfile_name || (-s $skipfile_name) != length($content)) { 56 | $fh = File::Temp->new; 57 | $skipfile_name = $fh->filename; 58 | $self->log_debug([ 'create temporary %s', $skipfile_name ]); 59 | print $fh $content; 60 | close $fh; 61 | } 62 | 63 | require ExtUtils::Manifest; 64 | ExtUtils::Manifest->VERSION('1.54'); 65 | 66 | my $skip = ExtUtils::Manifest::maniskip($skipfile_name); 67 | 68 | # Copy list (break reference) so we can mutate. 69 | for my $file ((), @{ $files }) { 70 | next unless $skip->($file->name); 71 | 72 | $self->log_debug([ 'pruning %s', $file->name ]); 73 | 74 | $self->zilla->prune_file($file); 75 | } 76 | 77 | return; 78 | } 79 | 80 | __PACKAGE__->meta->make_immutable; 81 | 1; 82 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/MetaConfig.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::MetaConfig; 2 | # ABSTRACT: summarize Dist::Zilla configuration into distmeta 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::MetaProvider'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | This plugin adds a top-level C key to the 14 | L for the distribution. It describe the 15 | Dist::Zilla version used as well as all the plugins used. Each plugin's name, 16 | package, and version will be included. Plugins may augment their 17 | implementation of the L role methods to add 18 | more data to this dump. 19 | 20 | More information may be added to the top-level of this metadata as time goes 21 | on. 22 | 23 | =cut 24 | 25 | sub metadata { 26 | my ($self) = @_; 27 | 28 | my $dump = { }; 29 | 30 | my @plugins; 31 | $dump->{plugins} = \@plugins; 32 | 33 | my $config = $self->zilla->dump_config; 34 | $dump->{zilla} = { 35 | class => $self->zilla->meta->name, 36 | version => $self->zilla->VERSION, 37 | (keys %$config ? (config => $config) : ()), 38 | }; 39 | 40 | $dump->{perl} = { 41 | version => "$]", 42 | }; 43 | 44 | for my $plugin (@{ $self->zilla->plugins }) { 45 | my $config = $plugin->dump_config; 46 | 47 | push @plugins, { 48 | class => $plugin->meta->name, 49 | name => $plugin->plugin_name, 50 | version => $plugin->VERSION, 51 | (keys %$config ? (config => $config) : ()), 52 | }; 53 | } 54 | 55 | return { x_Dist_Zilla => $dump }; 56 | } 57 | 58 | __PACKAGE__->meta->make_immutable; 59 | 1; 60 | 61 | =head1 SEE ALSO 62 | 63 | Dist::Zilla roles: L. 64 | 65 | =cut 66 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/MetaResources.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::MetaResources; 2 | # ABSTRACT: provide arbitrary "resources" for distribution metadata 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::MetaProvider'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | This plugin adds resources entries to the distribution's metadata. 14 | 15 | [MetaResources] 16 | homepage = https://example.com/~dude/project.asp 17 | bugtracker.web = https://rt.cpan.org/Public/Dist/Display.html?Name=Project 18 | bugtracker.mailto = bug-Project@rt.cpan.org 19 | repository.url = git://github.com/dude/project.git 20 | repository.web = https://github.com/dude/project 21 | repository.type = git 22 | 23 | =cut 24 | 25 | has resources => ( 26 | is => 'ro', 27 | isa => 'HashRef', 28 | required => 1, 29 | ); 30 | 31 | around BUILDARGS => sub { 32 | my $orig = shift; 33 | my ($class, @arg) = @_; 34 | 35 | my $args = $class->$orig(@arg); 36 | my %copy = %{ $args }; 37 | 38 | my $zilla = delete $copy{zilla}; 39 | my $name = delete $copy{plugin_name}; 40 | 41 | if (exists $copy{license} && ref($copy{license}) ne 'ARRAY') { 42 | $copy{license} = [ $copy{license} ]; 43 | } 44 | 45 | if (exists $copy{bugtracker}) { 46 | my $tracker = delete $copy{bugtracker}; 47 | $copy{bugtracker}{web} = $tracker; 48 | } 49 | 50 | if (exists $copy{repository}) { 51 | my $repo = delete $copy{repository}; 52 | $copy{repository}{url} = $repo; 53 | } 54 | 55 | for my $multi (qw( bugtracker repository )) { 56 | for my $key (grep { /^\Q$multi\E\./ } keys %copy) { 57 | my $subkey = (split /\./, $key, 2)[1]; 58 | $copy{$multi}{$subkey} = delete $copy{$key}; 59 | } 60 | } 61 | 62 | return { 63 | zilla => $zilla, 64 | plugin_name => $name, 65 | resources => \%copy, 66 | }; 67 | }; 68 | 69 | sub metadata { 70 | my ($self) = @_; 71 | 72 | return { resources => $self->resources }; 73 | } 74 | 75 | __PACKAGE__->meta->make_immutable; 76 | 1; 77 | 78 | =head1 SEE ALSO 79 | 80 | Dist::Zilla roles: L. 81 | 82 | Dist::Zilla plugins on the CPAN: L. 83 | 84 | =cut 85 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/MetaTests.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::MetaTests; 2 | # ABSTRACT: common extra tests for META.yml 3 | 4 | use Moose; 5 | extends 'Dist::Zilla::Plugin::InlineFiles'; 6 | with 'Dist::Zilla::Role::PrereqSource'; 7 | 8 | use Dist::Zilla::Pragmas; 9 | 10 | use namespace::autoclean; 11 | 12 | =head1 DESCRIPTION 13 | 14 | This is an extension of L, providing the 15 | following files: 16 | 17 | xt/author/meta-yaml.t - a standard Test::CPAN::Meta test 18 | 19 | L will be added as a C dependency (which 20 | can be installed via C<< dzil listdeps --author | cpanm >>). 21 | 22 | =head1 SEE ALSO 23 | 24 | Core Dist::Zilla plugins: 25 | L, 26 | L, 27 | L, 28 | L, 29 | L. 30 | 31 | =cut 32 | 33 | # Register the author test prereq as a "develop requires" 34 | # so it will be listed in "dzil listdeps --author" 35 | sub register_prereqs { 36 | my ($self) = @_; 37 | 38 | $self->zilla->register_prereqs( 39 | { 40 | phase => 'develop', type => 'requires', 41 | }, 42 | 'Test::CPAN::Meta' => 0, 43 | ); 44 | } 45 | 46 | __PACKAGE__->meta->make_immutable; 47 | 1; 48 | 49 | __DATA__ 50 | ___[ xt/author/distmeta.t ]___ 51 | #!perl 52 | # This file was automatically generated by Dist::Zilla::Plugin::MetaTests. 53 | use strict; 54 | use warnings; 55 | use Test::CPAN::Meta; 56 | 57 | meta_yaml_ok(); 58 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/MetaYAML.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::MetaYAML; 2 | # ABSTRACT: produce a META.yml 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::FileGatherer'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use Try::Tiny; 10 | use namespace::autoclean; 11 | 12 | =head1 DESCRIPTION 13 | 14 | This plugin will add a F file to the distribution. 15 | 16 | For more information on this file, see L and L. 17 | 18 | =attr filename 19 | 20 | If given, parameter allows you to specify an alternate name for the generated 21 | file. It defaults, of course, to F. 22 | 23 | =cut 24 | 25 | has filename => ( 26 | is => 'ro', 27 | isa => 'Str', 28 | default => 'META.yml', 29 | ); 30 | 31 | sub gather_files { 32 | my ($self, $arg) = @_; 33 | 34 | require Dist::Zilla::File::FromCode; 35 | require YAML::Tiny; 36 | require CPAN::Meta::Converter; 37 | CPAN::Meta::Converter->VERSION(2.101550); # improved downconversion 38 | require CPAN::Meta::Validator; 39 | CPAN::Meta::Validator->VERSION(2.101550); # improved downconversion 40 | 41 | my $zilla = $self->zilla; 42 | 43 | my $file = Dist::Zilla::File::FromCode->new({ 44 | name => $self->filename, 45 | code_return_type => 'text', 46 | code => sub { 47 | my $distmeta = $zilla->distmeta; 48 | 49 | my $validator = CPAN::Meta::Validator->new($distmeta); 50 | 51 | unless ($validator->is_valid) { 52 | my $msg = "Invalid META structure. Errors found:\n"; 53 | $msg .= join( "\n", $validator->errors ); 54 | $self->log_fatal($msg); 55 | } 56 | 57 | my $converter = CPAN::Meta::Converter->new($distmeta); 58 | my $output = $converter->convert(version => '1.4'); 59 | $output->{x_serialization_backend} = sprintf '%s version %s', 60 | 'YAML::Tiny', YAML::Tiny->VERSION; 61 | 62 | my $yaml = try { 63 | YAML::Tiny->new($output)->write_string; # text! 64 | } 65 | catch { 66 | $self->log_fatal("Could not create YAML string: " . YAML::Tiny->errstr) 67 | }; 68 | return $yaml; 69 | }, 70 | }); 71 | 72 | $self->add_file($file); 73 | return; 74 | } 75 | 76 | __PACKAGE__->meta->make_immutable; 77 | 1; 78 | 79 | =head1 SEE ALSO 80 | 81 | Core Dist::Zilla plugins: 82 | L<@Basic|Dist::Zilla::PluginBundle::Basic>, 83 | L. 84 | 85 | Dist::Zilla roles: 86 | L. 87 | 88 | Other modules: 89 | L, 90 | L, L. 91 | 92 | =cut 93 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/ModuleShareDirs.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::ModuleShareDirs; 2 | # ABSTRACT: install a directory's contents as module-based "ShareDir" content 3 | 4 | use Moose; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | use namespace::autoclean; 9 | 10 | =head1 SYNOPSIS 11 | 12 | In your F: 13 | 14 | [ModuleShareDirs] 15 | Foo::Bar = shares/foo_bar 16 | Foo::Baz = shares/foo_baz 17 | 18 | =cut 19 | 20 | has _module_map => ( 21 | is => 'ro', 22 | isa => 'HashRef', 23 | default => sub { {} }, 24 | ); 25 | 26 | sub find_files { 27 | my ($self) = @_; 28 | my $modmap = $self->_module_map; 29 | my @files; 30 | 31 | for my $mod ( keys %$modmap ) { 32 | my $dir = $modmap->{$mod}; 33 | my @mod_files = grep { index($_->name, "$dir/") == 0 } 34 | @{ $self->zilla->files }; 35 | push @files, @mod_files; 36 | } 37 | 38 | return \@files; 39 | } 40 | 41 | sub share_dir_map { 42 | my ($self) = @_; 43 | my $modmap = $self->_module_map; 44 | 45 | return unless keys %$modmap; 46 | return { module => $modmap }; 47 | } 48 | 49 | around BUILDARGS => sub { 50 | my $orig = shift; 51 | my ($class, @arg) = @_; 52 | 53 | my $args = $class->$orig(@arg); 54 | my %copy = %{ $args }; 55 | 56 | my $zilla = delete $copy{zilla}; 57 | my $name = delete $copy{plugin_name}; 58 | 59 | return { 60 | zilla => $zilla, 61 | plugin_name => $name, 62 | _module_map => \%copy, 63 | } 64 | }; 65 | 66 | with 'Dist::Zilla::Role::ShareDir'; 67 | __PACKAGE__->meta->make_immutable; 68 | 1; 69 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/PodCoverageTests.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::PodCoverageTests; 2 | # ABSTRACT: a author test for Pod coverage 3 | 4 | use Moose; 5 | extends 'Dist::Zilla::Plugin::InlineFiles'; 6 | with 'Dist::Zilla::Role::PrereqSource'; 7 | 8 | use Dist::Zilla::Pragmas; 9 | 10 | use namespace::autoclean; 11 | 12 | =head1 SYNOPSIS 13 | 14 | # Add this line to dist.ini 15 | [PodCoverageTests] 16 | 17 | # Run this in the command line to test for POD coverage: 18 | $ dzil test --release 19 | 20 | =head1 DESCRIPTION 21 | 22 | This is an extension of L, providing the 23 | following files: 24 | 25 | xt/author/pod-coverage.t - a standard Test::Pod::Coverage test 26 | 27 | This test uses L to check your Pod coverage. This 28 | means that to indicate that some subs should be treated as covered, even if no 29 | documentation can be found, you can add: 30 | 31 | =for Pod::Coverage sub_name other_sub this_one_too 32 | 33 | L C<1.08> and L will be added as 34 | C dependencies. 35 | 36 | One can run the release tests by invoking C. 37 | 38 | =cut 39 | 40 | # Register the author test prereq as a "develop requires" 41 | # so it will be listed in "dzil listdeps --author" 42 | sub register_prereqs { 43 | my ($self) = @_; 44 | 45 | $self->zilla->register_prereqs( 46 | { 47 | type => 'requires', 48 | phase => 'develop', 49 | }, 50 | 'Test::Pod::Coverage' => '1.08', 51 | 'Pod::Coverage::TrustPod' => 0, 52 | ); 53 | } 54 | 55 | __PACKAGE__->meta->make_immutable; 56 | 1; 57 | 58 | __DATA__ 59 | ___[ xt/author/pod-coverage.t ]___ 60 | #!perl 61 | # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. 62 | use strict; 63 | use warnings; 64 | use Test::Pod::Coverage 1.08; 65 | use Pod::Coverage::TrustPod; 66 | 67 | all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); 68 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/PodSyntaxTests.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::PodSyntaxTests; 2 | # ABSTRACT: a author test for Pod syntax 3 | 4 | use Moose; 5 | extends 'Dist::Zilla::Plugin::InlineFiles'; 6 | with 'Dist::Zilla::Role::PrereqSource'; 7 | 8 | use Dist::Zilla::Pragmas; 9 | 10 | use namespace::autoclean; 11 | 12 | =head1 SYNTAX 13 | 14 | # Add this to your dist.ini. 15 | [PodSyntaxTests] 16 | 17 | # To test for POD validity, run this in the shell: 18 | $ dzil test --release 19 | 20 | =head1 DESCRIPTION 21 | 22 | This is an extension of L, providing the 23 | following files: 24 | 25 | xt/author/pod-syntax.t - a standard Test::Pod test 26 | 27 | L C<1.41> will be added as a C dependency. 28 | 29 | One can run the release tests by invoking C. 30 | 31 | =cut 32 | 33 | 34 | # Register the author test prereq as a "develop requires" 35 | # so it will be listed in "dzil listdeps --author" 36 | sub register_prereqs { 37 | my ($self) = @_; 38 | 39 | $self->zilla->register_prereqs( 40 | { 41 | type => 'requires', 42 | phase => 'develop', 43 | }, 44 | 'Test::Pod' => '1.41', 45 | ); 46 | } 47 | 48 | 49 | __PACKAGE__->meta->make_immutable; 50 | 1; 51 | 52 | __DATA__ 53 | ___[ xt/author/pod-syntax.t ]___ 54 | #!perl 55 | # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. 56 | use strict; use warnings; 57 | use Test::More; 58 | use Test::Pod 1.41; 59 | 60 | all_pod_files_ok(); 61 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/PodVersion.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::PodVersion; 2 | # ABSTRACT: add a VERSION head1 to each Perl document 3 | 4 | use Moose; 5 | with( 6 | 'Dist::Zilla::Role::FileMunger', 7 | 'Dist::Zilla::Role::FileFinderUser' => { 8 | default_finders => [ ':InstallModules', ':ExecFiles' ], 9 | }, 10 | ); 11 | 12 | use Dist::Zilla::Pragmas; 13 | 14 | use namespace::autoclean; 15 | 16 | =head1 DESCRIPTION 17 | 18 | This plugin adds a C<=head1 VERSION> section to most perl files in the 19 | distribution, indicating the version of the dist being built. This section is 20 | added after C<=head1 NAME>. If there is no such section, the version section 21 | will not be added. 22 | 23 | Note that this plugin is not useful if you are using the 24 | L<[PodWeaver]|Dist::Zilla::Plugin::PodWeaver> plugin, as it also adds a 25 | C<=head1 VERSION> section (via the L<[Version]|Pod::Weaver::Section::Version> 26 | section). 27 | 28 | =cut 29 | 30 | sub munge_files { 31 | my ($self) = @_; 32 | 33 | $self->munge_file($_) for @{ $self->found_files }; 34 | } 35 | 36 | sub munge_file { 37 | my ($self, $file) = @_; 38 | 39 | return $self->munge_pod($file); 40 | } 41 | 42 | sub munge_pod { 43 | my ($self, $file) = @_; 44 | 45 | my @content = split /\n/, $file->content; 46 | 47 | require List::Util; 48 | List::Util->VERSION('1.33'); 49 | if (List::Util::any(sub { $_ =~ /^=head1 VERSION\b/ }, @content)) { 50 | $self->log($file->name . ' already has a VERSION section in POD'); 51 | return; 52 | } 53 | 54 | for (0 .. $#content) { 55 | next until $content[$_] =~ /^=head1 NAME/; 56 | 57 | $_++; # move past the =head1 line itself 58 | $_++ while $content[$_] =~ /^\s*$/; 59 | 60 | $_++ while $content[$_] !~ /^\s*$/; # move past the abstract 61 | $_++ while $content[$_] =~ /^\s*$/; 62 | 63 | splice @content, $_ - 1, 0, ( 64 | q{}, 65 | "=head1 VERSION", 66 | q{}, 67 | "version " . $self->zilla->version . q{}, 68 | ); 69 | 70 | $self->log_debug([ 'adding VERSION Pod section to %s', $file->name ]); 71 | 72 | my $content = join "\n", @content; 73 | $content .= "\n" if length $content; 74 | $file->content($content); 75 | return; 76 | } 77 | 78 | $self->log([ 79 | "couldn't find '=head1 NAME' in %s, not adding '=head1 VERSION'", 80 | $file->name, 81 | ]); 82 | } 83 | 84 | __PACKAGE__->meta->make_immutable; 85 | 1; 86 | 87 | =head1 SEE ALSO 88 | 89 | Core Dist::Zilla plugins: 90 | L, 91 | L, 92 | L. 93 | 94 | =cut 95 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/PruneFiles.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::PruneFiles; 2 | # ABSTRACT: prune arbitrary files from the dist 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::FilePruner'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 SYNOPSIS 12 | 13 | This plugin allows you to explicitly prune some files from your 14 | distribution. You can either specify the exact set of files (with the 15 | "filenames" parameter) or provide the regular expressions to 16 | check (using "match"). 17 | 18 | This is useful if another plugin (maybe a FileGatherer) adds a 19 | bunch of files, and you only want a subset of them. 20 | 21 | In your F: 22 | 23 | [PruneFiles] 24 | filename = xt/release/pod-coverage.t ; pod coverage tests are for jerks 25 | filename = todo-list.txt ; keep our secret plans to ourselves 26 | 27 | match = ^test_data/ 28 | match = ^test.cvs$ 29 | 30 | =cut 31 | 32 | sub mvp_multivalue_args { qw(filenames matches) } 33 | sub mvp_aliases { return { filename => 'filenames', match => 'matches' } } 34 | 35 | =attr filenames 36 | 37 | This is an arrayref of filenames to be pruned from the distribution. 38 | 39 | =cut 40 | 41 | has filenames => ( 42 | is => 'ro', 43 | isa => 'ArrayRef', 44 | default => sub { [] }, 45 | ); 46 | 47 | =attr matches 48 | 49 | This is an arrayref of regular expressions and files matching any of them, 50 | will be pruned from the distribution. 51 | 52 | =cut 53 | 54 | has matches => ( 55 | is => 'ro', 56 | isa => 'ArrayRef', 57 | default => sub { [] }, 58 | ); 59 | 60 | sub prune_files { 61 | my ($self) = @_; 62 | 63 | # never match (at least the filename characters) 64 | my $matches_regex = qr/\000/; 65 | 66 | $matches_regex = qr/$matches_regex|$_/ for (@{ $self->matches }); 67 | 68 | # \A\Q$_\E should also handle the `eq` check 69 | $matches_regex = qr/$matches_regex|\A\Q$_\E/ for (@{ $self->filenames }); 70 | 71 | # Copy list (break reference) so we can mutate. 72 | for my $file ((), @{ $self->zilla->files }) { 73 | next unless $file->name =~ $matches_regex; 74 | 75 | $self->log_debug([ 'pruning %s', $file->name ]); 76 | 77 | $self->zilla->prune_file($file); 78 | } 79 | 80 | return; 81 | } 82 | 83 | __PACKAGE__->meta->make_immutable; 84 | 1; 85 | 86 | =head1 SEE ALSO 87 | 88 | Dist::Zilla plugins: 89 | L, 90 | L, 91 | L. 92 | 93 | =cut 94 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/Readme.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::Readme; 2 | # ABSTRACT: build a README file 3 | 4 | use Moose; 5 | with qw/Dist::Zilla::Role::FileGatherer 6 | Dist::Zilla::Role::TextTemplate 7 | Dist::Zilla::Role::FileMunger/; 8 | 9 | use Dist::Zilla::Pragmas; 10 | 11 | use Moose::Util::TypeConstraints; 12 | use namespace::autoclean; 13 | 14 | =head1 DESCRIPTION 15 | 16 | This plugin adds a very simple F file to the distribution, citing the 17 | dist's name, version, abstract, and license. It may be more useful or 18 | informative in the future. 19 | 20 | =cut 21 | 22 | has _file_obj => ( 23 | is => 'rw', isa => role_type('Dist::Zilla::Role::File'), 24 | ); 25 | 26 | sub gather_files { 27 | my ($self, $arg) = @_; 28 | 29 | require Dist::Zilla::File::InMemory; 30 | 31 | my $template = q| 32 | 33 | This archive contains the distribution {{ $dist->name }}, 34 | version {{ $dist->version }}: 35 | 36 | {{ $dist->abstract }} 37 | 38 | {{ $dist->license->notice }} 39 | 40 | This README file was generated by {{ $generated_by }}. 41 | 42 | |; 43 | $template =~ s/\A\n+//; 44 | $template =~ s/\n+\z/\n/; 45 | 46 | $self->add_file( 47 | $self->_file_obj( 48 | Dist::Zilla::File::InMemory->new( 49 | name => 'README', 50 | content => $template, 51 | ) 52 | ) 53 | ); 54 | 55 | return; 56 | } 57 | 58 | sub munge_files { 59 | my $self = shift; 60 | 61 | my $file = $self->_file_obj; 62 | 63 | $file->content( 64 | $self->fill_in_string( 65 | $file->content, 66 | { 67 | dist => \($self->zilla), 68 | generated_by => \sprintf("%s v%s", 69 | ref($self), $self->VERSION || '(dev)'), 70 | } 71 | ) 72 | ); 73 | 74 | return; 75 | } 76 | 77 | __PACKAGE__->meta->make_immutable; 78 | 1; 79 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/RemovePrereqs.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::RemovePrereqs; 2 | # ABSTRACT: a plugin to remove gathered prereqs 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::PrereqSource'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | use MooseX::Types::Moose qw(ArrayRef); 12 | use MooseX::Types::Perl qw(ModuleName); 13 | 14 | =head1 SYNOPSIS 15 | 16 | In your F: 17 | 18 | [RemovePrereqs] 19 | remove = Foo::Bar 20 | remove = MRO::Compat 21 | 22 | This will remove any prerequisite of any type from any prereq phase. This is 23 | useful for eliminating incorrectly detected prereqs. 24 | 25 | =head1 SEE ALSO 26 | 27 | Dist::Zilla plugins: 28 | L, 29 | L. 30 | 31 | =cut 32 | 33 | sub mvp_multivalue_args { qw(modules_to_remove) } 34 | 35 | sub mvp_aliases { 36 | return { remove => 'modules_to_remove' } 37 | } 38 | 39 | has modules_to_remove => ( 40 | is => 'ro', 41 | isa => ArrayRef[ ModuleName ], 42 | required => 1, 43 | ); 44 | 45 | around dump_config => sub { 46 | my ($orig, $self) = @_; 47 | my $config = $self->$orig; 48 | 49 | my $this_config = { 50 | modules_to_remove => [ sort @{ $self->modules_to_remove } ], 51 | }; 52 | 53 | $config->{'' . __PACKAGE__} = $this_config; 54 | 55 | return $config; 56 | }; 57 | 58 | my @phases = qw(configure build test runtime develop); 59 | my @types = qw(requires recommends suggests conflicts); 60 | 61 | sub register_prereqs { 62 | my ($self) = @_; 63 | 64 | my $prereqs = $self->zilla->prereqs; 65 | 66 | for my $p (@phases) { 67 | for my $t (@types) { 68 | for my $m (@{ $self->modules_to_remove }) { 69 | $prereqs->requirements_for($p, $t)->clear_requirement($m); 70 | } 71 | } 72 | } 73 | } 74 | 75 | __PACKAGE__->meta->make_immutable; 76 | 1; 77 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/ShareDir.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::ShareDir; 2 | # ABSTRACT: install a directory's contents as "ShareDir" content 3 | 4 | use Moose; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | use namespace::autoclean; 9 | 10 | =head1 SYNOPSIS 11 | 12 | In your F: 13 | 14 | [ShareDir] 15 | dir = share 16 | 17 | If no C is provided, the default is F. 18 | 19 | =cut 20 | 21 | has dir => ( 22 | is => 'ro', 23 | isa => 'Str', 24 | default => 'share', 25 | ); 26 | 27 | sub find_files { 28 | my ($self) = @_; 29 | 30 | my $dir = $self->dir; 31 | my $files = [ 32 | grep { index($_->name, "$dir/") == 0 } 33 | @{ $self->zilla->files } 34 | ]; 35 | } 36 | 37 | sub share_dir_map { 38 | my ($self) = @_; 39 | my $files = $self->find_files; 40 | return unless @$files; 41 | 42 | return { dist => $self->dir }; 43 | } 44 | 45 | with 'Dist::Zilla::Role::ShareDir'; 46 | __PACKAGE__->meta->make_immutable; 47 | 1; 48 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Plugin/TestRelease.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::TestRelease; 2 | # ABSTRACT: extract archive and run tests before releasing the dist 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::BeforeRelease'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | This plugin runs before a release happens. It will extract the to-be-released 14 | archive into a temporary directory and use the TestRunner plugins to run its 15 | tests. If the tests fail, the release is aborted and the temporary directory 16 | is left in place. If the tests pass, the temporary directory is cleaned up and 17 | the release process continues. 18 | 19 | This will set the RELEASE_TESTING and AUTHOR_TESTING env vars while running the 20 | test suite. 21 | 22 | =head1 CREDITS 23 | 24 | This plugin was originally contributed by Christopher J. Madsen. 25 | 26 | =cut 27 | 28 | use File::pushd (); 29 | use Dist::Zilla::Path; 30 | 31 | sub before_release { 32 | my ($self, $tgz) = @_; 33 | $tgz = $tgz->absolute; 34 | 35 | my $build_root = $self->zilla->root->child('.build'); 36 | $build_root->mkpath unless -d $build_root; 37 | 38 | my $tmpdir = path( File::Temp::tempdir(DIR => $build_root) ); 39 | 40 | $self->log("Extracting $tgz to $tmpdir"); 41 | 42 | require Archive::Tar; 43 | 44 | my @files = do { 45 | my $wd = File::pushd::pushd($tmpdir); 46 | Archive::Tar->extract_archive("$tgz"); 47 | }; 48 | 49 | $self->log_fatal([ "Failed to extract archive: %s", Archive::Tar->error ]) 50 | unless @files; 51 | 52 | # Run tests on the extracted tarball: 53 | my $target = $tmpdir->child( $self->zilla->dist_basename ); 54 | 55 | local $ENV{RELEASE_TESTING} = 1; 56 | local $ENV{AUTHOR_TESTING} = 1; 57 | $self->zilla->run_tests_in($target); 58 | 59 | $self->log("all's well; removing $tmpdir"); 60 | $tmpdir->remove_tree({ safe => 0 }); 61 | } 62 | 63 | __PACKAGE__->meta->make_immutable; 64 | 1; 65 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/PluginBundle/Basic.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::PluginBundle::Basic; 2 | # ABSTRACT: the basic plugins to maintain and release CPAN dists 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::PluginBundle::Easy'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | sub configure { 12 | my ($self) = @_; 13 | 14 | $self->add_plugins(qw( 15 | GatherDir 16 | PruneCruft 17 | ManifestSkip 18 | MetaYAML 19 | License 20 | Readme 21 | ExtraTests 22 | ExecDir 23 | ShareDir 24 | 25 | MakeMaker 26 | Manifest 27 | 28 | TestRelease 29 | ConfirmRelease 30 | UploadToCPAN 31 | )); 32 | } 33 | 34 | __PACKAGE__->meta->make_immutable; 35 | 1; 36 | 37 | =head1 DESCRIPTION 38 | 39 | This plugin is meant to be a basic "first step" bundle for using Dist::Zilla. 40 | It won't munge any of your code, but will generate a F and allows 41 | easy, reliable releasing of distributions. 42 | 43 | It includes the following plugins with their default configuration: 44 | 45 | =for :list 46 | * L 47 | * L 48 | * L 49 | * L 50 | * L 51 | * L 52 | * L 53 | * L 54 | * L 55 | * L 56 | * L 57 | * L 58 | * L 59 | * L 60 | 61 | =head1 SEE ALSO 62 | 63 | Core Dist::Zilla plugins: L<@Filter|Dist::Zilla::PluginBundle::Filter>. 64 | 65 | Dist::Zilla roles: 66 | L, 67 | L. 68 | 69 | =cut 70 | 71 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/PluginBundle/Classic.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::PluginBundle::Classic; 2 | # ABSTRACT: the classic (old) default configuration for Dist::Zilla 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::PluginBundle::Easy'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | sub configure { 12 | my ($self) = @_; 13 | 14 | $self->add_plugins(qw( 15 | GatherDir 16 | PruneCruft 17 | ManifestSkip 18 | MetaYAML 19 | License 20 | Readme 21 | PkgVersion 22 | PodVersion 23 | PodCoverageTests 24 | PodSyntaxTests 25 | ExtraTests 26 | ExecDir 27 | ShareDir 28 | 29 | MakeMaker 30 | Manifest 31 | 32 | ConfirmRelease 33 | UploadToCPAN 34 | )); 35 | } 36 | 37 | __PACKAGE__->meta->make_immutable; 38 | 1; 39 | 40 | =head1 DESCRIPTION 41 | 42 | This bundle is more or less the original configuration bundled with 43 | Dist::Zilla. More than likely, you'd rather be using 44 | L<@Basic|Dist::Zilla::PluginBundle::Basic> or a more complex bundle. This one 45 | will muck around with your code by adding C<$VERSION> declarations and will 46 | mess with you Pod by adding a C<=head1 VERSION> section, but it won't get you a 47 | lot of more useful features like autoversioning, autoprereqs, or Pod::Weaver. 48 | 49 | It includes the following plugins with their default configuration: 50 | 51 | =for :list 52 | * L 53 | * L 54 | * L 55 | * L 56 | * L 57 | * L 58 | * L 59 | * L 60 | * L 61 | * L 62 | * L 63 | * L 64 | * L 65 | * L 66 | * L 67 | * L 68 | * L 69 | 70 | =head1 SEE ALSO 71 | 72 | L<@Basic|Dist::Zilla::PluginBundle::Basic> 73 | 74 | =cut 75 | 76 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/PluginBundle/FakeClassic.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::PluginBundle::FakeClassic; 2 | # ABSTRACT: build something more or less like a "classic" CPAN dist 3 | 4 | use Moose; 5 | extends 'Dist::Zilla::PluginBundle::Classic'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | around bundle_config => sub { 12 | my ($orig, $self, $arg) = @_; 13 | 14 | my @config = $self->$orig($arg); 15 | 16 | for my $i (0 .. $#config) { 17 | if ($config[ $i ][1] eq 'Dist::Zilla::Plugin::UploadToCPAN') { 18 | require Dist::Zilla::Plugin::FakeRelease; 19 | $config[ $i ] = [ 20 | "$arg->{name}/FakeRelease", 21 | 'Dist::Zilla::Plugin::FakeRelease', 22 | $config[ $i ][2] 23 | ]; 24 | } 25 | } 26 | 27 | return @config; 28 | }; 29 | 30 | __PACKAGE__->meta->make_immutable; 31 | 1; 32 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/PluginBundle/Filter.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::PluginBundle::Filter; 2 | # ABSTRACT: use another bundle, with some plugins removed 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::PluginBundle'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | use List::Util 1.33 qw(any); 12 | use Module::Runtime qw(use_module); 13 | use Dist::Zilla::Util; 14 | 15 | =head1 SYNOPSIS 16 | 17 | In your F: 18 | 19 | [@Filter] 20 | -bundle = @Basic 21 | -version = 5.031 22 | -remove = ShareDir 23 | -remove = UploadToCPAN 24 | option = for_basic 25 | 26 | =head1 DESCRIPTION 27 | 28 | This plugin bundle actually wraps and modifies another plugin bundle. It 29 | includes all the configuration for the bundle named in the C<-bundle> attribute, 30 | but removes all the entries whose package is given in the C<-remove> attributes. 31 | 32 | A minimum required version of the bundle can be specified with the C<-version> 33 | attribute. 34 | 35 | Options not prefixed with C<-> will be passed to the bundle to be filtered. 36 | 37 | B When you filter a bundle you B include it directly in 38 | your C file. This plugin will take care of including it for you. 39 | 40 | =head1 SEE ALSO 41 | 42 | Core Dist::Zilla plugins: L<@Basic|Dist::Zilla::PluginBundle::Basic>. 43 | 44 | Dist::Zilla roles: L. 45 | 46 | =cut 47 | 48 | sub mvp_multivalue_args { qw(remove -remove) } 49 | 50 | sub bundle_config { 51 | my ($self, $section) = @_; 52 | my $class = (ref $self) || $self; 53 | 54 | my $config = {}; 55 | 56 | my $has_filter_args = any { /^-/ } keys %{ $section->{payload} }; 57 | for my $key (keys %{ $section->{payload} }) { 58 | my $val = $section->{payload}->{$key}; 59 | my $target = $has_filter_args && ($key !~ /^-/) 60 | ? 'bundle' 61 | : 'filter'; 62 | $key =~ s/^-// if $target eq 'filter'; 63 | $config->{$target}->{$key} = $val; 64 | } 65 | 66 | Carp::croak("no bundle given for bundle filter") 67 | unless my $bundle = $config->{filter}->{bundle}; 68 | 69 | my $pkg = Dist::Zilla::Util->expand_config_package_name($bundle); 70 | 71 | my $version = $config->{filter}->{version}; 72 | 73 | unless (eval { &use_module($pkg, $version ? $version : ()); 1 }) { 74 | # XXX Naughty! -- rjbs, 2013-07-23 75 | Config::MVP::Section->missing_package($pkg, $bundle); 76 | } 77 | 78 | my @plugins = $pkg->bundle_config({ 79 | name => $section->{name}, # not 100% sure about this -- rjbs, 2010-03-06 80 | package => $pkg, 81 | payload => $config->{bundle} || {}, 82 | }); 83 | 84 | return @plugins unless my $remove = $config->{filter}->{remove}; 85 | 86 | for my $i (reverse 0 .. $#plugins) { 87 | splice @plugins, $i, 1 if any(sub { 88 | $plugins[$i][1] eq Dist::Zilla::Util->expand_config_package_name($_) 89 | }, @$remove); 90 | } 91 | 92 | return @plugins; 93 | } 94 | 95 | __PACKAGE__->meta->make_immutable; 96 | 1; 97 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Pragmas.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Pragmas; 2 | # ABSTRACT: the pragmas (boilerplate!) to enable in each Dist::Zilla module 3 | 4 | use v5.20.0; 5 | use warnings; 6 | use utf8; 7 | 8 | use experimental qw(signatures); 9 | 10 | sub import { 11 | warnings->import; 12 | utf8->import; 13 | 14 | feature->unimport(':all'); 15 | feature->import(':5.20'); 16 | feature->unimport('switch'); 17 | 18 | experimental->import(qw( 19 | lexical_subs 20 | postderef 21 | postderef_qq 22 | signatures 23 | )); 24 | 25 | feature->unimport('multidimensional') if $] >= 5.034; 26 | } 27 | 28 | 1; 29 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/AfterBuild.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::AfterBuild; 2 | # ABSTRACT: something that runs after building is mostly complete 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | Plugins implementing this role have their C method called once all 14 | the files have been written out. It is passed a hashref with the following 15 | data: 16 | 17 | build_root - the directory in which the dist was built 18 | 19 | =cut 20 | 21 | requires 'after_build'; 22 | 23 | 1; 24 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/AfterMint.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::AfterMint; 2 | # ABSTRACT: something that runs after minting is mostly complete 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | Plugins implementing this role have their C method called once all 14 | the files have been written out. It is passed a hashref with the following 15 | data: 16 | 17 | mint_root - the directory in which the dist was minted 18 | 19 | =cut 20 | 21 | requires 'after_mint'; 22 | 23 | 1; 24 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/AfterRelease.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::AfterRelease; 2 | # ABSTRACT: something that runs after release is mostly complete 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | Plugins implementing this role have their C method called once 14 | the release is done. The archive filename, if one was built, is passed as the 15 | sole argument. 16 | 17 | =cut 18 | 19 | requires 'after_release'; 20 | 21 | 1; 22 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/ArchiveBuilder.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::ArchiveBuilder; 2 | # ABSTRACT: something that builds archives 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | requires 'build_archive'; 10 | 11 | =head1 DESCRIPTION 12 | 13 | Plugins implementing this role have their C method called 14 | when it is time to build the archive. 15 | 16 | =method build_archive 17 | 18 | This method takes three arguments, and returns a L instance 19 | containing the path to the archive. 20 | 21 | =over 4 22 | 23 | =item archive_basename 24 | 25 | This is the name of the archive (including C<-TRIAL> if appropriate) without 26 | the format extension (that is the C<.tar.gz> part). The plugin implementing 27 | this role should add the appropriate full path including extension as the 28 | returned L instance. Not including the extension allows the 29 | plugin to choose its own format. 30 | 31 | =item built_in 32 | 33 | This is a L where the distribution has been built. 34 | 35 | =item dist_basename 36 | 37 | This method will return the dist's basename (e.g. C as a 38 | L. The basename is used as the top-level directory in the 39 | tarball. It does not include C<-TRIAL>, even if building a trial dist. 40 | 41 | =back 42 | 43 | =cut 44 | 45 | no Moose::Role; 46 | 1; 47 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/BeforeArchive.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::BeforeArchive; 2 | # ABSTRACT: something that runs before the archive file is built 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | Plugins implementing this role have their C method 14 | called before the archive is actually built. 15 | 16 | =cut 17 | 18 | requires 'before_archive'; 19 | 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/BeforeBuild.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::BeforeBuild; 2 | # ABSTRACT: something that runs before building really begins 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | Plugins implementing this role have their C method called 14 | before any other plugins are consulted. 15 | 16 | =cut 17 | 18 | requires 'before_build'; 19 | 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/BeforeMint.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::BeforeMint; 2 | # ABSTRACT: something that runs before minting really begins 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | Plugins implementing this role have their C method called 14 | before any other plugins are consulted. 15 | 16 | =cut 17 | 18 | requires 'before_mint'; 19 | 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/BeforeRelease.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::BeforeRelease; 2 | # ABSTRACT: something that runs before release really begins 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | Plugins implementing this role have their C method 14 | called before the release is actually done. 15 | 16 | =cut 17 | 18 | requires 'before_release'; 19 | 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/BuildPL.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::BuildPL; 2 | # ABSTRACT: Common ground for Build.PL based builders 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::InstallTool', 6 | 'Dist::Zilla::Role::BuildRunner', 7 | 'Dist::Zilla::Role::TestRunner'; 8 | 9 | use Dist::Zilla::Pragmas; 10 | 11 | use namespace::autoclean; 12 | 13 | =head1 DESCRIPTION 14 | 15 | This role is a helper for Build.PL based installers. It implements the 16 | L and L 17 | roles, and requires you to implement the L 18 | and L roles yourself. 19 | 20 | =cut 21 | 22 | sub build { 23 | my $self = shift; 24 | 25 | return 26 | if -e 'Build' and (stat 'Build.PL')[9] <= (stat 'Build')[9]; 27 | 28 | $self->log_debug("running $^X Build.PL"); 29 | system $^X, 'Build.PL' and die "error with Build.PL\n"; 30 | 31 | $self->log_debug("running $^X Build"); 32 | system $^X, 'Build' and die "error running $^X Build\n"; 33 | 34 | return; 35 | } 36 | 37 | sub test { 38 | my ($self, $target, $arg) = @_; 39 | 40 | $self->build; 41 | 42 | my $job_count = $arg && exists $arg->{jobs} 43 | ? $arg->{jobs} 44 | : $self->default_jobs; 45 | my $jobs = "j$job_count"; 46 | my $ho = "HARNESS_OPTIONS"; 47 | local $ENV{$ho} = $ENV{$ho} ? "$ENV{$ho}:$jobs" : $jobs; 48 | 49 | my @testing = $self->zilla->logger->get_debug || $arg->{test_verbose} ? '--verbose' : (); 50 | 51 | $self->log_debug('running ' . join(' ', $^X, 'Build', 'test', @testing)); 52 | system $^X, 'Build', 'test', @testing and die "error running $^X Build test\n"; 53 | 54 | return; 55 | } 56 | 57 | 1; 58 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/BuildRunner.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::BuildRunner; 2 | # ABSTRACT: something used as a delegating agent during 'dzil run' 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | Plugins implementing this role have their C method called during 14 | C. It's passed the root directory of the build test dir. 15 | 16 | =head1 REQUIRED METHODS 17 | 18 | =head2 build 19 | 20 | This method will throw an exception on failure. 21 | 22 | =cut 23 | 24 | requires 'build'; 25 | 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/Chrome.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::Chrome; 2 | # ABSTRACT: something that provides a user interface for Dist::Zilla 3 | 4 | use Moose::Role; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | use namespace::autoclean; 9 | 10 | requires 'logger'; 11 | 12 | requires 'prompt_str'; 13 | requires 'prompt_yn'; 14 | requires 'prompt_any_key'; 15 | 16 | 1; 17 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/ConfigDumper.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::ConfigDumper; 2 | # ABSTRACT: something that can dump its (public, simplified) configuration 3 | 4 | use Moose::Role; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | use namespace::autoclean; 9 | 10 | sub dump_config { return {}; } 11 | 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/EncodingProvider.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::EncodingProvider; 2 | # ABSTRACT: something that sets a files' encoding 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | EncodingProvider plugins do their work after files are gathered, but before 14 | they're munged. They're meant to set the C on files. 15 | 16 | The method C is called with no arguments. 17 | 18 | =cut 19 | 20 | requires 'set_file_encodings'; 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/ExecFiles.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::ExecFiles; 2 | # ABSTRACT: something that finds files to install as executables 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::FileFinder'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | requires 'dir'; 12 | 13 | sub find_files { 14 | my ($self) = @_; 15 | 16 | my $dir = $self->dir; 17 | my $files = [ 18 | grep { index($_->name, "$dir/") == 0 } 19 | @{ $self->zilla->files } 20 | ]; 21 | } 22 | 23 | 1; 24 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/FileFinder.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::FileFinder; 2 | # ABSTRACT: something that finds files within the distribution 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | A FileFinder plugin locates files within the distribution. This role exists so 14 | that sets of files can be easily described in one configuration section and 15 | then used by one or more other plugin. 16 | 17 | Plugins implementing this role must provide a C method which will 18 | be called with no arguments and must return an arrayref of files. (This 19 | arrayref should not be re-used, as it may be altered once returned.) 20 | 21 | For example, imagine a simple glob-like FileFinder that expects configuration 22 | like this: 23 | 24 | [Glob / RootModules] 25 | glob = *.pm 26 | 27 | This sets up a FileFinder named "RootModules" which will contain all F 28 | files in the root directory. 29 | 30 | Another plugin that knows how to use FileFinder plugins might be configured 31 | like this: 32 | 33 | [ModuleRelocator] 34 | finder = RootModules 35 | relocate_to = attic 36 | 37 | Finders may operate on any rules they like, checking file size, content, name, 38 | or other properties. They should re-perform their "finding" on each call to 39 | C as the files in the distribution may have changed. 40 | 41 | =cut 42 | 43 | requires 'find_files'; 44 | 45 | 1; 46 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/FileGatherer.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::FileGatherer; 2 | # ABSTRACT: something that gathers files into the distribution 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin', 6 | 'Dist::Zilla::Role::FileInjector'; 7 | 8 | use Dist::Zilla::Pragmas; 9 | 10 | use namespace::autoclean; 11 | 12 | =head1 DESCRIPTION 13 | 14 | A FileGatherer plugin is a special sort of 15 | L that runs early in the build 16 | cycle, finding files to include in the distribution. It is expected to call 17 | its C method to add one or more files to inclusion. 18 | 19 | Plugins implementing FileGatherer must provide a C method, which 20 | will be called during the build process. 21 | 22 | =cut 23 | 24 | requires 'gather_files'; 25 | 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/FileInjector.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::FileInjector; 2 | # ABSTRACT: something that can add files to the distribution 3 | 4 | use Moose::Role; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | use namespace::autoclean; 9 | 10 | =head1 DESCRIPTION 11 | 12 | This role should be implemented by any plugin that plans to add files into the 13 | distribution. It provides one method (C>, documented below), 14 | which adds a file to the distribution, noting the place of addition. 15 | 16 | =method add_file 17 | 18 | $plugin->add_file($dzil_file); 19 | 20 | This adds a file to the distribution, setting the file's C attribute 21 | as it does so. 22 | 23 | =cut 24 | 25 | sub add_file { 26 | my ($self, $file) = @_; 27 | my ($pkg, undef, $line) = caller; 28 | 29 | $file->_set_added_by( 30 | sprintf("%s (%s line %s)", $self->plugin_name, $pkg, $line), 31 | ); 32 | 33 | $self->log_debug([ 'adding file %s', $file->name ]); 34 | push @{ $self->zilla->files }, $file; 35 | } 36 | 37 | 1; 38 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/FileMunger.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::FileMunger; 2 | # ABSTRACT: something that alters a file's destination or content 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | A FileMunger has an opportunity to mess around with each file that will be 14 | included in the distribution. Each FileMunger's C method is 15 | called once. By default, this method will just call the C method 16 | (note the missing terminal 's') once for each file, excluding files with an 17 | encoding attribute of 'bytes'. 18 | 19 | The C method is expected to change attributes about the file before 20 | it is written out to the built distribution. 21 | 22 | If you want to modify all files (including ones with an encoding of 'bytes') or 23 | want to select a more limited set of files, you can provide your own 24 | C method. 25 | 26 | =cut 27 | 28 | sub munge_files { 29 | my ($self) = @_; 30 | 31 | $self->log_fatal("no munge_file behavior implemented!") 32 | unless $self->can('munge_file'); 33 | 34 | my @files = @{ $self->zilla->files }; 35 | for my $file ( @files ) { 36 | if ($file->is_bytes) { 37 | $self->log_debug($file->name . " has 'bytes' encoding, skipping..."); 38 | next; 39 | } 40 | 41 | $self->munge_file($file); 42 | } 43 | } 44 | 45 | 1; 46 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/FilePruner.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::FilePruner; 2 | # ABSTRACT: something that removes found files from the distribution 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | Plugins implementing FilePruner have their C method called once 14 | all the L plugins have been 15 | called. They are expected to (optionally) remove files from the list of files 16 | to be included in the distribution. 17 | 18 | =cut 19 | 20 | requires 'prune_files'; 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/InstallTool.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::InstallTool; 2 | # ABSTRACT: something that creates an install program for a dist 3 | 4 | use Moose::Role; 5 | with qw( 6 | Dist::Zilla::Role::Plugin 7 | Dist::Zilla::Role::FileInjector 8 | ); 9 | 10 | use Dist::Zilla::Pragmas; 11 | 12 | use namespace::autoclean; 13 | 14 | =head1 DESCRIPTION 15 | 16 | Plugins implementing InstallTool have their C method called to 17 | inject files after all other file injection and munging has taken place. 18 | They're expected to produce files needed to make the distribution 19 | installable, like F or F and add them with the 20 | C method provided by L, which is 21 | also composed by this role. 22 | 23 | =cut 24 | 25 | requires 'setup_installer'; 26 | 27 | 1; 28 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/LicenseProvider.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::LicenseProvider; 2 | # ABSTRACT: something that provides a license for the dist 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | =head1 DESCRIPTION 10 | 11 | Plugins implementing this role must provide a C method that 12 | will be called when setting the dist's license. 13 | 14 | If a LicenseProvider offers a license but one has already been set, an 15 | exception will be raised. If C returns undef, it will be 16 | ignored. 17 | 18 | =head1 REQUIRED METHODS 19 | 20 | =head2 C<< provide_license({ copyright_holder => $holder, copyright_year => $year }) >> 21 | 22 | Generate license object. Returned object should be an instance of 23 | L. 24 | 25 | Plugins are responsible for injecting C<$copyright_holder> and 26 | C<$copyright_year> arguments into the license if these arguments are defined. 27 | 28 | =cut 29 | 30 | requires 'provide_license'; 31 | 32 | no Moose::Role; 33 | 1; 34 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/MetaProvider.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::MetaProvider; 2 | # ABSTRACT: something that provides metadata (for META.yml/json) 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | This role provides data to merge into the distribution metadata. 14 | 15 | =method metadata 16 | 17 | This method (which must be provided by classes implementing this role) 18 | returns a hashref of data to be (deeply) merged together with pre-existing 19 | metadata. 20 | 21 | =cut 22 | 23 | requires 'metadata'; 24 | 25 | 1; 26 | __END__ 27 | 28 | =head1 SEE ALSO 29 | 30 | Core Dist::Zilla plugins implementing this role: 31 | L. 32 | L. 33 | 34 | Dist::Zilla plugins on the CPAN: 35 | L... 36 | 37 | =cut 38 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/MintingProfile.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::MintingProfile; 2 | # ABSTRACT: something that can find a minting profile dir 3 | 4 | use Moose::Role; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | use namespace::autoclean; 9 | 10 | use Dist::Zilla::Path; 11 | use File::ShareDir; 12 | 13 | =head1 DESCRIPTION 14 | 15 | Plugins implementing this role should provide C method, which, 16 | given a minting profile name, returns its directory. 17 | 18 | The minting profile is a directory, containing arbitrary files used during 19 | creation of new distribution. Among other things notably, it should contain the 20 | 'profile.ini' file, listing the plugins used for minter initialization. 21 | 22 | The default implementation C looks in the module's 23 | L. 24 | 25 | After installing your profile, users will be able to start a new distribution, 26 | based on your profile with the: 27 | 28 | $ dzil new -P Provider -p profile_name Distribution::Name 29 | 30 | =cut 31 | 32 | requires 'profile_dir'; 33 | 34 | around profile_dir => sub { 35 | my ($orig, $self, @args) = @_; 36 | path($self->$orig(@args)); 37 | }; 38 | 39 | 1; 40 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/MintingProfile/ShareDir.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::MintingProfile::ShareDir; 2 | # ABSTRACT: something that keeps its minting profile in a sharedir 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::MintingProfile'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | use File::ShareDir; 12 | use Dist::Zilla::Path; 13 | 14 | =head1 DESCRIPTION 15 | 16 | This role includes L, providing a 17 | C method that looks in the I's L. 18 | 19 | =cut 20 | 21 | sub profile_dir { 22 | my ($self, $profile_name) = @_; 23 | 24 | my $profile_dir = path( File::ShareDir::module_dir($self->meta->name) ) 25 | ->child( $profile_name ); 26 | 27 | return $profile_dir if -d $profile_dir; 28 | 29 | confess "Can't find profile $profile_name via $self"; 30 | } 31 | 32 | 1; 33 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/ModuleMaker.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::ModuleMaker; 2 | # ABSTRACT: something that injects module files into the dist 3 | 4 | use Moose::Role; 5 | with qw( 6 | Dist::Zilla::Role::Plugin 7 | Dist::Zilla::Role::FileInjector 8 | ); 9 | 10 | use Dist::Zilla::Pragmas; 11 | 12 | use namespace::autoclean; 13 | 14 | =head1 DESCRIPTION 15 | 16 | Plugins implementing this role have their C method called for each 17 | module requesting creation by the plugin with this name. It is passed a 18 | hashref with the following data: 19 | 20 | name - the name of the module to make (a MooseX::Types::Perl::ModuleName) 21 | 22 | Classes composing this role also compose 23 | L and are expected to inject a 24 | file for the module being created. 25 | 26 | =cut 27 | 28 | requires 'make_module'; 29 | 30 | 1; 31 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/NameProvider.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::NameProvider; 2 | # ABSTRACT: something that provides a name for the dist 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | =head1 DESCRIPTION 10 | 11 | Plugins implementing this role must provide a C method that 12 | will be called when setting the dist's name. 13 | 14 | If a NameProvider offers a name but one has already been set, an 15 | exception will be raised. If C returns undef, it will be 16 | ignored. 17 | 18 | =cut 19 | 20 | requires 'provide_name'; 21 | 22 | no Moose::Role; 23 | 1; 24 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/Plugin.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::Plugin; 2 | # ABSTRACT: something that gets plugged in to Dist::Zilla 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::ConfigDumper'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use Params::Util qw(_HASHLIKE); 10 | use Moose::Util::TypeConstraints 'class_type'; 11 | 12 | use namespace::autoclean; 13 | 14 | =head1 DESCRIPTION 15 | 16 | The Plugin role should be applied to all plugin classes. It provides a few key 17 | methods and attributes that all plugins will need. 18 | 19 | =attr plugin_name 20 | 21 | The plugin name is generally determined when configuration is read. 22 | 23 | =cut 24 | 25 | has plugin_name => ( 26 | is => 'ro', 27 | isa => 'Str', 28 | required => 1, 29 | ); 30 | 31 | =attr zilla 32 | 33 | This attribute contains the Dist::Zilla object into which the plugin was 34 | plugged. 35 | 36 | =cut 37 | 38 | has zilla => ( 39 | is => 'ro', 40 | isa => class_type('Dist::Zilla'), 41 | required => 1, 42 | weak_ref => 1, 43 | ); 44 | 45 | =method log 46 | 47 | The plugin's C method delegates to the Dist::Zilla object's 48 | L method after including a bit of argument-munging. 49 | 50 | =cut 51 | 52 | has logger => ( 53 | is => 'ro', 54 | lazy => 1, 55 | handles => [ qw(log log_debug log_fatal) ], 56 | default => sub { 57 | $_[0]->zilla->chrome->logger->proxy({ 58 | proxy_prefix => '[' . $_[0]->plugin_name . '] ', 59 | }); 60 | }, 61 | ); 62 | 63 | # We define these effectively-pointless subs here to allow other roles to 64 | # modify them with around. -- rjbs, 2010-03-21 65 | sub mvp_multivalue_args {}; 66 | sub mvp_aliases { return {} }; 67 | 68 | sub plugin_from_config { 69 | my ($class, $name, $arg, $section) = @_; 70 | 71 | my $self = $class->new({ 72 | %$arg, 73 | plugin_name => $name, 74 | zilla => $section->sequence->assembler->zilla, 75 | }); 76 | } 77 | 78 | sub register_component { 79 | my ($class, $name, $arg, $section) = @_; 80 | 81 | my $self = $class->plugin_from_config($name, $arg, $section); 82 | 83 | my $version = $self->VERSION || 0; 84 | 85 | $self->log_debug([ 'online, %s v%s', $self->meta->name, $version ]); 86 | 87 | push @{ $self->zilla->plugins }, $self; 88 | 89 | return; 90 | } 91 | 92 | 1; 93 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/PluginBundle.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::PluginBundle; 2 | # ABSTRACT: something that bundles a bunch of plugins 3 | 4 | use Moose::Role; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | use namespace::autoclean; 9 | 10 | =head1 DESCRIPTION 11 | 12 | When loading configuration, if the config reader encounters a PluginBundle, it 13 | will replace its place in the plugin list with the result of calling its 14 | C method, which will be passed a Config::MVP::Section to 15 | configure the bundle. 16 | 17 | =cut 18 | 19 | sub register_component { 20 | my ($class, $name, $arg, $self) = @_; 21 | # ... we should register a placeholder so MetaConfig can tell us about the 22 | # pluginbundle that was loaded 23 | } 24 | 25 | requires 'bundle_config'; 26 | 27 | 1; 28 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/PrereqSource.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::PrereqSource; 2 | # ABSTRACT: something that registers prerequisites 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | PrereqSource plugins have a C method that should register 14 | prereqs with the Dist::Zilla object. 15 | 16 | =cut 17 | 18 | requires 'register_prereqs'; 19 | 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/ReleaseStatusProvider.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::ReleaseStatusProvider; 2 | # ABSTRACT: something that provides a release status for the dist 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | Plugins implementing this role must provide a C 14 | method that will be called when setting the dist's version. 15 | 16 | If C returns undef, it will be ignored. 17 | 18 | =cut 19 | 20 | requires 'provide_release_status'; 21 | 22 | 1; 23 | 24 | =head1 SEE ALSO 25 | 26 | Core Dist::Zilla plugins implementing this role: 27 | L. 28 | 29 | =cut 30 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/Releaser.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::Releaser; 2 | # ABSTRACT: something that makes a release of the dist 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | Plugins implementing this role have their C method called when 14 | releasing. It's passed the distribution tarball to be released. 15 | 16 | =cut 17 | 18 | requires 'release'; 19 | 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/ShareDir.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::ShareDir; 2 | # ABSTRACT: something that picks a directory to install as shared files 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::FileFinder'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | # Must return a hashref with any of the keys 'dist' and 'module'. The 'dist' 12 | # must be a scalar with a directory to include and 'module' must be a hashref 13 | # mapping module names to directories to include. If there are no directories 14 | # to include, it must return undef. 15 | requires 'share_dir_map'; 16 | 17 | 1; 18 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/Stash.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::Stash; 2 | # ABSTRACT: something that stores options or data for later reference 3 | 4 | use Moose::Role; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | use namespace::autoclean; 9 | 10 | sub register_component { 11 | my ($class, $name, $arg, $section) = @_; 12 | 13 | # $self->log_debug([ 'online, %s v%s', $self->meta->name, $version ]); 14 | my $entry = $class->stash_from_config($name, $arg, $section); 15 | 16 | $section->sequence->assembler->register_stash($name, $entry); 17 | 18 | return; 19 | } 20 | 21 | sub stash_from_config { 22 | my ($class, $name, $arg, $section) = @_; 23 | 24 | my $self = $class->new($arg); 25 | return $self; 26 | } 27 | 28 | 1; 29 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/Stash/Authors.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::Stash::Authors; 2 | # ABSTRACT: a stash that provides a list of author strings 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Stash'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 OVERVIEW 12 | 13 | An Authors stash must provide an C method that returns an arrayref of 14 | author strings, generally in the form "Name ". 15 | 16 | =cut 17 | 18 | requires 'authors'; 19 | 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/Stash/Login.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::Stash::Login; 2 | # ABSTRACT: a stash with username/password credentials 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Stash'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 OVERVIEW 12 | 13 | A Login stash must provide a C and C method. 14 | 15 | =cut 16 | 17 | requires 'username'; 18 | requires 'password'; 19 | 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/StubBuild.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::StubBuild; 2 | # ABSTRACT: provides an empty BUILD methods 3 | 4 | use Moose::Role; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | sub BUILD {} 9 | 10 | no Moose::Role; 11 | 1; 12 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/TestRunner.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::TestRunner; 2 | # ABSTRACT: something used as a delegating agent to 'dzil test' 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | Plugins implementing this role have their C method called when 14 | testing. It's passed the root directory of the build test dir and an 15 | optional hash reference of arguments. Valid arguments include: 16 | 17 | =for :list 18 | * jobs -- if parallel testing is supported, this indicates how many to run at once 19 | 20 | =method test 21 | 22 | This method should throw an exception on failure. 23 | 24 | =cut 25 | 26 | requires 'test'; 27 | 28 | =attr default_jobs 29 | 30 | This attribute is the default value that should be used as the C argument 31 | to the C method. 32 | 33 | =cut 34 | 35 | has default_jobs => ( 36 | is => 'ro', 37 | isa => 'Int', # non-negative 38 | lazy => 1, 39 | default => sub { 40 | return ($ENV{HARNESS_OPTIONS} // '') =~ / \b j(\d+) \b /x ? $1 : 1; 41 | }, 42 | ); 43 | 44 | around dump_config => sub { 45 | my ($orig, $self) = @_; 46 | my $config = $self->$orig; 47 | 48 | $config->{'' . __PACKAGE__} = { default_jobs => $self->default_jobs }; 49 | 50 | return $config; 51 | }; 52 | 53 | 1; 54 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/TextTemplate.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::TextTemplate; 2 | # ABSTRACT: something that renders a Text::Template template string 3 | 4 | use Moose::Role; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | use namespace::autoclean; 9 | 10 | =head1 DESCRIPTION 11 | 12 | Plugins implementing TextTemplate may call their own C> 13 | method to render templates using L. 14 | 15 | =cut 16 | 17 | use Text::Template; 18 | 19 | =attr delim 20 | 21 | This attribute (which can't easily be set!) is a two-element array reference 22 | returning the Text::Template delimiters to use. It defaults to C<{{> and 23 | C<}}>. 24 | 25 | =cut 26 | 27 | # XXX: Later, add a way to set this in config. -- rjbs, 2008-06-02 28 | has delim => ( 29 | is => 'ro', 30 | isa => 'ArrayRef', 31 | lazy => 1, 32 | init_arg => undef, 33 | default => sub { [ qw( {{ }} ) ] }, 34 | ); 35 | 36 | =method fill_in_string 37 | 38 | my $rendered = $plugin->fill_in_string($template, \%stash, \%arg); 39 | 40 | This uses Text::Template to fill in the given template using the variables 41 | given in the C<%stash>. The stash becomes the HASH argument to Text::Template, 42 | so scalars must be scalar references rather than plain scalars. 43 | 44 | C<%arg> is dereferenced and passed in as extra arguments to Text::Template's 45 | C routine. 46 | 47 | =cut 48 | 49 | sub fill_in_string { 50 | my ($self, $string, $stash, $arg) = @_; 51 | 52 | $self->log_fatal("Cannot use undef as a template string") 53 | unless defined $string; 54 | 55 | my $tmpl = Text::Template->new( 56 | TYPE => 'STRING', 57 | SOURCE => $string, 58 | DELIMITERS => $self->delim, 59 | BROKEN => sub { my %hash = @_; die $hash{error}; }, 60 | %$arg, 61 | ); 62 | 63 | $self->log_fatal("Could not create a Text::Template object from:\n$string") 64 | unless $tmpl; 65 | 66 | my $content = $tmpl->fill_in(%$arg, HASH => $stash); 67 | 68 | $self->log_fatal("Filling in the template returned undef for:\n$string") 69 | unless defined $content; 70 | 71 | return $content; 72 | } 73 | 74 | 1; 75 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Role/VersionProvider.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Role::VersionProvider; 2 | # ABSTRACT: something that provides a version number for the dist 3 | 4 | use Moose::Role; 5 | with 'Dist::Zilla::Role::Plugin'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | =head1 DESCRIPTION 12 | 13 | Plugins implementing this role must provide a C method that 14 | will be called when setting the dist's version. 15 | 16 | If a VersionProvider offers a version but one has already been set, an 17 | exception will be raised. If C returns undef, it will be 18 | ignored. 19 | 20 | =cut 21 | 22 | requires 'provide_version'; 23 | 24 | 1; 25 | 26 | =head1 SEE ALSO 27 | 28 | Core Dist::Zilla plugins implementing this role: 29 | L. 30 | 31 | =cut 32 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Stash/Mint.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Stash::Mint; 2 | # ABSTRACT: a stash of your default minting provider/profile 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::Stash'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | has provider => ( 12 | is => 'ro', 13 | isa => 'Str', 14 | required => 0, 15 | default => 'Default', 16 | ); 17 | 18 | has profile => ( 19 | is => 'ro', 20 | isa => 'Str', 21 | required => 0, 22 | default => 'default', 23 | ); 24 | 25 | __PACKAGE__->meta->make_immutable; 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Stash/PAUSE.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Stash::PAUSE; 2 | # ABSTRACT: a stash of your PAUSE credentials 3 | 4 | use Moose; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | use namespace::autoclean; 9 | 10 | =head1 OVERVIEW 11 | 12 | The PAUSE stash is a L stash generally 13 | used for uploading to PAUSE. 14 | 15 | =cut 16 | 17 | sub mvp_aliases { 18 | return { user => 'username' }; 19 | } 20 | 21 | has username => ( 22 | is => 'ro', 23 | isa => 'Str', 24 | required => 1, 25 | ); 26 | 27 | has password => ( 28 | is => 'ro', 29 | isa => 'Str', 30 | required => 1, 31 | ); 32 | 33 | with 'Dist::Zilla::Role::Stash::Login'; 34 | __PACKAGE__->meta->make_immutable; 35 | 1; 36 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Stash/Rights.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Stash::Rights; 2 | # ABSTRACT: a stash of your default licensing terms 3 | 4 | use Moose; 5 | with 'Dist::Zilla::Role::Stash'; 6 | 7 | use Dist::Zilla::Pragmas; 8 | 9 | use namespace::autoclean; 10 | 11 | has license_class => ( 12 | is => 'ro', 13 | isa => 'Str', 14 | required => 1, 15 | ); 16 | 17 | has copyright_holder => ( 18 | is => 'ro', 19 | isa => 'Str', 20 | required => 1, 21 | ); 22 | 23 | has copyright_year => ( 24 | is => 'ro', 25 | isa => 'Int', 26 | ); 27 | 28 | __PACKAGE__->meta->make_immutable; 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Stash/User.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Stash::User; 2 | # ABSTRACT: a stash of user name and email 3 | 4 | use Moose; 5 | 6 | use Dist::Zilla::Pragmas; 7 | 8 | use namespace::autoclean; 9 | 10 | has name => ( 11 | is => 'ro', 12 | isa => 'Str', 13 | required => 1, 14 | ); 15 | 16 | has email => ( 17 | is => 'ro', 18 | isa => 'Str', 19 | required => 1, 20 | ); 21 | 22 | sub authors { 23 | my ($self) = @_; 24 | return [ sprintf "%s <%s>", $self->name, $self->email ]; 25 | } 26 | 27 | with 'Dist::Zilla::Role::Stash::Authors'; 28 | __PACKAGE__->meta->make_immutable; 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Dist/Zilla/Types.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Types; 2 | # ABSTRACT: dzil-specific type library 3 | 4 | use Dist::Zilla::Pragmas; 5 | 6 | use namespace::autoclean; 7 | 8 | =head1 OVERVIEW 9 | 10 | This library provides L types for use by Dist::Zilla. These 11 | types are not (yet?) for public consumption, and you should not rely on them. 12 | 13 | Dist::Zilla uses a number of types found in L. Maybe 14 | that's what you want. 15 | 16 | =cut 17 | 18 | use MooseX::Types -declare => [qw( 19 | License OneZero YesNoStr ReleaseStatus 20 | Path ArrayRefOfPaths 21 | _Filename 22 | )]; 23 | use MooseX::Types::Moose qw(Str Int Defined ArrayRef); 24 | use Path::Tiny; 25 | 26 | subtype License, as class_type('Software::License'); 27 | 28 | subtype Path, as class_type('Path::Tiny'); 29 | coerce Path, from Defined, via { 30 | require Dist::Zilla::Path; 31 | Dist::Zilla::Path::path($_); 32 | }; 33 | 34 | subtype ArrayRefOfPaths, as ArrayRef[Path]; 35 | coerce ArrayRefOfPaths, from ArrayRef[Defined], via { 36 | require Dist::Zilla::Path; 37 | [ map { Dist::Zilla::Path::path($_) } @$_ ]; 38 | }; 39 | 40 | subtype OneZero, as Str, where { $_ eq '0' or $_ eq '1' }; 41 | 42 | subtype YesNoStr, as Str, where { /\A(?:y|ye|yes)\Z/i or /\A(?:n|no)\Z/i }; 43 | 44 | subtype ReleaseStatus, as Str, where { /\A(?:stable|testing|unstable)\z/ }; 45 | 46 | coerce OneZero, from YesNoStr, via { /\Ay/i ? 1 : 0 }; 47 | 48 | subtype _Filename, as Str, 49 | where { $_ !~ qr/(?:\x{0a}|\x{0b}|\x{0c}|\x{0d}|\x{85}|\x{2028}|\x{2029})/ }, 50 | message { "Filename not a Str, or contains a newline or other vertical whitespace" }; 51 | 52 | 1; 53 | -------------------------------------------------------------------------------- /misc/DZ.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rjbs/Dist-Zilla/3a2a76568e2236c6d98d5d825620d8241d110be5/misc/DZ.graffle -------------------------------------------------------------------------------- /misc/dzil-bash_completion: -------------------------------------------------------------------------------- 1 | # dzil(1) completion 2 | # 3 | 4 | _dzil_actions() 5 | { 6 | COMPREPLY=( $( compgen -W 'commands help authordeps build clean install listdeps new nop release run setup smoke test' \ 7 | -- $cur ) ) 8 | } 9 | 10 | _dzil() 11 | { 12 | local cur 13 | 14 | COMPREPLY=() 15 | cur=${COMP_WORDS[COMP_CWORD]} 16 | 17 | if [[ $COMP_CWORD -eq 1 ]] ; then 18 | _dzil_actions 19 | else 20 | return 0 21 | fi 22 | } 23 | complete -F _dzil dzil 24 | -------------------------------------------------------------------------------- /misc/dzil_bootstrap: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use CPAN; 7 | use CPAN::Version; 8 | 9 | sub _uptodate { 10 | my ($mod, $modname, $modver) = @_; 11 | 12 | return unless $mod and defined $mod->inst_version; 13 | return CPAN::Version->vge($mod->inst_version, $modver); 14 | } 15 | 16 | sub _install { 17 | for (@_) { 18 | my ($modname, $modver); 19 | if (ref $_ eq 'ARRAY') { 20 | ($modname, $modver) = @$_; 21 | } else { 22 | $modname = $_; 23 | $modver = 0; 24 | } 25 | print "Looking for $modname $modver\n"; 26 | my $mod = CPAN::Shell->expand(Module => $modname); 27 | next if _uptodate($mod, $modname, $modver); 28 | CPAN::Shell->install($modname); 29 | $mod = CPAN::Shell->expand(Module => $modname); 30 | die "$modname had failures, aborting" 31 | unless _uptodate($mod, $modname, $modver); 32 | } 33 | } 34 | 35 | unless (-e "dist.ini") { 36 | die "No 'dist.ini' file; is this really a Dist::Zilla distribution?\n" 37 | } 38 | 39 | unless (eval "require Config::INI::Reader; 1") { 40 | _install('Config::INI::Reader'); 41 | require Config::INI::Reader; 42 | } 43 | 44 | my $data = Config::INI::Reader->read_file('dist.ini'); 45 | 46 | _install( 47 | map { [ $_ => $data->{Prereq}->{$_} ] } 48 | keys %{ $data->{Prereq} } 49 | ); 50 | -------------------------------------------------------------------------------- /misc/lib/Dist/Zilla/App/Command/gconf.pm: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | package Dist::Zilla::App::Command::gconf; 4 | # ABSTRACT: dump global config 5 | use Dist::Zilla::App -command; 6 | 7 | sub abstract { 'dump global config' } 8 | 9 | sub opt_spec { 10 | } 11 | 12 | sub execute { 13 | my ($self, $opt, $arg) = @_; 14 | 15 | require Data::Dumper; 16 | for my $name (keys %{ $self->zilla->_global_stashes }) { 17 | print "[ $name ]\n"; 18 | print Data::Dumper::Dumper($self->zilla->_global_stashes->{ $name }); 19 | } 20 | } 21 | 22 | 1; 23 | -------------------------------------------------------------------------------- /misc/lib/Dist/Zilla/App/Command/input.pm: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | package Dist::Zilla::App::Command::input; 4 | # ABSTRACT: demonstrate how input chrome works 5 | use Dist::Zilla::App -command; 6 | 7 | sub abstract { 'demonstrate chrome input methods' } 8 | 9 | sub opt_spec { 10 | } 11 | 12 | sub execute { 13 | my ($self, $opt, $arg) = @_; 14 | 15 | my $zilla = $self->zilla; 16 | 17 | $zilla->log("beginning input tests"); 18 | 19 | for my $default (undef, 'y', 'n') { 20 | my $yn = $zilla->chrome->prompt_yn( 21 | "yes or no?", 22 | defined($default) ? { default => $default } : () 23 | ); 24 | 25 | $zilla->log([ "yes or no: %s", $yn ]); 26 | } 27 | 28 | $zilla->chrome->prompt_any_key; 29 | $zilla->chrome->prompt_any_key("smack one"); 30 | } 31 | 32 | 1; 33 | -------------------------------------------------------------------------------- /profiles/default/extra-dist.ini: -------------------------------------------------------------------------------- 1 | version = 0.001 2 | 3 | [@Basic] 4 | -------------------------------------------------------------------------------- /profiles/default/profile.ini: -------------------------------------------------------------------------------- 1 | 2 | [DistINI] 3 | append_file = extra-dist.ini 4 | -------------------------------------------------------------------------------- /t/commands/authordeps.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | use Test::Deep; 5 | 6 | use autodie; 7 | 8 | use Dist::Zilla::Util::AuthorDeps; 9 | 10 | my $authordeps = Dist::Zilla::Util::AuthorDeps::extract_author_deps( 11 | 'corpus/dist/AuthorDeps', 12 | 0, 13 | ); 14 | 15 | cmp_deeply( 16 | $authordeps, 17 | [ 18 | +{ perl => '5.005' }, 19 | +{ 'List::Util' => '1.45' }, 20 | +{ 'Foo::Bar' => '1.23' }, 21 | +{ 'Dist::Zilla' => '5.001' }, 22 | ( map { +{"Dist::Zilla::Plugin::$_" => '5.0'} } qw ), 23 | ( map { +{"Dist::Zilla::Plugin::$_" => 0} } qw ), 24 | +{ 'LocalPlugin' => '0' }, 25 | +{ 'Software::License::Perl_5' => '0' }, 26 | ], 27 | "authordeps in corpus/dist/AuthorDeps" 28 | ) or diag explain $authordeps; 29 | 30 | SKIP: { 31 | 32 | skip 'this test requires the local plugins to have a $VERSION assigned', 1 33 | if not eval { require Dist::Zilla::Plugin::Encoding; Dist::Zilla::Plugin::Encoding->VERSION('5.000'); 1 }; 34 | 35 | my $missing_authordeps = Dist::Zilla::Util::AuthorDeps::extract_author_deps( 36 | 'corpus/dist/AuthorDeps', 37 | 1 38 | ); 39 | 40 | cmp_deeply( 41 | $missing_authordeps, 42 | [ 43 | +{ 'Foo::Bar' => '1.23' }, 44 | ], 45 | "missing authordeps in corpus/dist/AuthorDeps" 46 | ) or diag explain $missing_authordeps; 47 | } 48 | 49 | done_testing; 50 | -------------------------------------------------------------------------------- /t/compile.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | 5 | use File::Find::Rule; 6 | use Try::Tiny; 7 | 8 | my @files = File::Find::Rule->name('*.pm')->in('lib'); 9 | plan tests => @files - 1; 10 | 11 | for (@files) { 12 | next if /Tutorial.pm/; 13 | s/^lib.//; 14 | s/.pm$//; 15 | s{[\\/]}{::}g; 16 | 17 | require_ok($_); 18 | } 19 | -------------------------------------------------------------------------------- /t/diagnostics/plugin-fail.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More 0.88; 5 | use Test::DZil; 6 | use Test::Fatal; 7 | 8 | use lib 't/lib'; 9 | 10 | 11 | sub mkconfig { 12 | my $root = shift; 13 | my $t = Builder->from_config( { dist_root => $root }, { add_files => { 'source/dist.ini' => simple_ini(@_) } } ); 14 | $t->build; 15 | return $t; 16 | } 17 | 18 | subtest "BrokenPlugin" => sub { 19 | my $error = exception { mkconfig( 'corpus/dist/DZT', [ 'BrokenPlugin' => {} ] ) }; 20 | 21 | ok( $error, "Failure occurs when a plugin is broken" ); 22 | like( $error, qr{Compilation failed in require}, "Exception is a compilation failure" ); 23 | like( $error, qr{This plugin is broken!}, "Exception reports the original problem" ); 24 | }; 25 | 26 | subtest "BrokenPlugin2" => sub { 27 | my $error = exception { mkconfig( 'corpus/dist/DZT', [ 'BrokenPlugin2' => {} ] ) }; 28 | 29 | ok( $error, "Failure occurs when a plugin is broken" ); 30 | like( $error, qr{Compilation failed in require}, "Exception is a compilation failure" ); 31 | like( $error, qr{This plugin is broken!}, "Exception reports the original problem" ); 32 | }; 33 | 34 | subtest "BrokenPlugin3" => sub { 35 | my $error = exception { mkconfig( 'corpus/dist/DZT', [ 'BrokenPlugin3' => {} ] ) }; 36 | 37 | ok( $error, "Failure occurs when a plugin is broken" ); 38 | like( $error, qr{Compilation failed}, "Exception explains that it couldn't load the plugin" ); 39 | like( $error, qr{Missing right curly or square bracket}, "Exception reports the original problem" ); 40 | }; 41 | 42 | subtest "BrokenPlugin4" => sub { 43 | my $error = exception { mkconfig( 'corpus/dist/DZT', [ 'BrokenPlugin4' => {} ] ) }; 44 | 45 | ok( $error, "Failure occurs when a plugin is broken" ); 46 | like( $error, qr{Some(/|::)Package(/|::)That(/|::)Does(/|::)Not(/|::)Exist}, "Exception reports the original problem" ); 47 | }; 48 | 49 | subtest "Not::A::Plugin" => sub { 50 | my $error = exception { mkconfig( 'corpus/dist/DZT', [ 'Not::A::Plugin' => {} ] ) }; 51 | 52 | ok( $error, "Failure occurs when a plugin is missing" ); 53 | like( $error, qr{Not::A::Plugin.*isn't installed}, "Exception explains that the plugin is not installed" ); 54 | like( $error, qr{dzil authordeps}, "Exception suggests using authordeps" ); 55 | }; 56 | 57 | subtest ":version, good" => sub { 58 | my $error = exception { mkconfig( 'corpus/dist/DZT', [ 'Versioned' => { ':version' => '1.0' } ] ) }; 59 | ok(!$error, 'plugin satisfies requested version'); 60 | }; 61 | 62 | subtest ":version, bad" => sub { 63 | my $error = exception { mkconfig( 'corpus/dist/DZT', [ 'Versioned' => { ':version' => '1.4' } ] ) }; 64 | ok($error, 'plugin does not satisfy requested version'); 65 | like($error, qr/\QDist::Zilla::Plugin::Versioned version (1.234) does not match required version: 1.4\E/, 'exception tells us why'); 66 | }; 67 | 68 | done_testing; 69 | -------------------------------------------------------------------------------- /t/distpl.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | 5 | use Test::DZil; 6 | 7 | my $tzil = Builder->from_config( 8 | { dist_root => 'corpus/dist/DZ2' }, 9 | ); 10 | 11 | $tzil->chrome->logger->set_debug(1); 12 | $tzil->build; 13 | pass(); 14 | done_testing; 15 | -------------------------------------------------------------------------------- /t/empty-abstract.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::DZil; 6 | use Test::Fatal; 7 | use Path::Tiny; 8 | use List::Util 'first'; 9 | 10 | my $tzil = Builder->from_config( 11 | { dist_root => 't/does_not_exist' }, 12 | { 13 | add_files => { 14 | path(qw(source dist.ini)) => simple_ini( 15 | 'GatherDir', 16 | ), 17 | path(qw(source lib DZT Sample.pm)) => <> here, and an empty ABSTRACT comment. 32 | 33 | The empty ABSTRACT comment should be skipped, and the NAME one used. 34 | 35 | =cut 36 | MODULE 37 | }, 38 | }, 39 | ); 40 | 41 | is( 42 | exception { $tzil->build }, 43 | undef, 44 | 'build proceeds normally', 45 | ); 46 | 47 | is( 48 | Dist::Zilla::Util->abstract_from_file(first { $_->name eq 'lib/DZT/Sample.pm' } @{$tzil->files}), 49 | 'a sample module for testing handling of empty ABSTRACT comment', 50 | 'We should see the abstract from the =head NAME section in pod', 51 | ); 52 | 53 | done_testing; 54 | -------------------------------------------------------------------------------- /t/file-addedby.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::DZil; 6 | use Test::Deep; 7 | use Test::Fatal; 8 | use Path::Tiny; 9 | use List::Util 'first'; 10 | 11 | my $tzil = Builder->from_config( 12 | { dist_root => 't/does_not_exist' }, 13 | { 14 | add_files => { 15 | path(qw(source dist.ini)) => simple_ini( 16 | 'GatherDir', # a file gatherer (adds OnDisk file) 17 | 'PodSyntaxTests', # a file gatherer (adds InMemory file) 18 | 'Manifest', # a file gatherer (adds FromCode file) 19 | 20 | # a file munger that changes content 21 | [ PkgVersion => { finder => ':AllFiles' } ], 22 | 23 | 'ExtraTests', # a file munger that changes filename 24 | ), 25 | path(qw(source lib DZT Sample.pm)) => "package DZT::Sample;\n\n1", 26 | }, 27 | }, 28 | ); 29 | 30 | $tzil->chrome->logger->set_debug(1); 31 | is( 32 | exception { $tzil->build }, 33 | undef, 34 | 'build proceeds normally', 35 | ) or diag 'saw log messages: ', explain $tzil->log_messages; 36 | 37 | my $module = first { $_->name eq path(qw(lib DZT Sample.pm)) } 38 | @{ $tzil->files }; 39 | 40 | cmp_deeply( 41 | $module, 42 | methods( 43 | added_by => all( 44 | re(qr/\bencoded_content added by GatherDir \(Dist::Zilla::Plugin::GatherDir line \d+\)(;|$)/), 45 | re(qr/\bcontent set by PkgVersion \(Dist::Zilla::Plugin::PkgVersion line \d+\)(;|$)/), 46 | ), 47 | ), 48 | 'OnDisk file added by GatherDir, set by PkgVersion has correct properties', 49 | ); 50 | 51 | my $test = first { $_->name eq path(qw(t author-pod-syntax.t)) } 52 | @{ $tzil->files }; 53 | 54 | cmp_deeply( 55 | $test, 56 | methods( 57 | added_by => all( 58 | re(qr/^content added by PodSyntaxTests \(Dist::Zilla::Plugin::InlineFiles line \d+\)(;|$)/), 59 | re(qr/\bcontent set by ExtraTests \(Dist::Zilla::Plugin::ExtraTests line \d+\)(;|$)/), 60 | re(qr/\bfilename set by ExtraTests \(Dist::Zilla::Plugin::ExtraTests line \d+\)(;|$)/), 61 | ), 62 | ), 63 | 'InMemory file altered by all of PodSyntaxTests, PkgVersion and ExtraTests has correct properties', 64 | ); 65 | 66 | my $manifest = first { $_->name eq path('MANIFEST') } @{ $tzil->files }; 67 | cmp_deeply( 68 | $manifest, 69 | methods( 70 | added_by => re(qr/^bytes from coderef added by Manifest \(Dist::Zilla::Plugin::Manifest line \d+\)$/), 71 | ), 72 | 'FromCode file added by Manifest has correct properties', 73 | ); 74 | 75 | done_testing; 76 | -------------------------------------------------------------------------------- /t/lib/Dist/Zilla/Plugin/BrokenPlugin.pm: -------------------------------------------------------------------------------- 1 | 2 | use strict; 3 | use warnings; 4 | 5 | package Dist::Zilla::Plugin::BrokenPlugin; 6 | 7 | die "This plugin is broken!"; 8 | 9 | 0; 10 | 11 | -------------------------------------------------------------------------------- /t/lib/Dist/Zilla/Plugin/BrokenPlugin2.pm: -------------------------------------------------------------------------------- 1 | use strict; 2 | 3 | use warnings; 4 | 5 | package Dist::Zilla::Plugin::BrokenPlugin; 6 | 7 | BEGIN { 8 | die "This plugin is broken!"; 9 | } 10 | 11 | 0; 12 | 13 | -------------------------------------------------------------------------------- /t/lib/Dist/Zilla/Plugin/BrokenPlugin3.pm: -------------------------------------------------------------------------------- 1 | use strict; 2 | 3 | use warnings; 4 | 5 | package Dist::Zilla::Plugin::BrokenPlugin; 6 | 7 | sub { 8 | 9 | 0; 10 | 11 | -------------------------------------------------------------------------------- /t/lib/Dist/Zilla/Plugin/BrokenPlugin4.pm: -------------------------------------------------------------------------------- 1 | use strict; 2 | 3 | use warnings; 4 | 5 | package Dist::Zilla::Plugin::BrokenPlugin; 6 | 7 | use Moose; 8 | with "Some::Package::That::Does::Not::Exist::Due::To::A::Typo"; 9 | 10 | 0; 11 | 12 | -------------------------------------------------------------------------------- /t/lib/Dist/Zilla/Plugin/JustForManifestSkipTests.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::JustForManifestSkipTests; 2 | use Moose; 3 | extends 'Dist::Zilla::Plugin::InlineFiles'; 4 | 5 | use namespace::autoclean; 6 | 7 | __PACKAGE__->meta->make_immutable; 8 | 1; 9 | 10 | __DATA__ 11 | ___[ foo.txt ]___ 12 | Just for tests... 13 | ___[ FOO.SKIP ]___ 14 | dist.ini 15 | foo.tx? 16 | bonus/vader.txt 17 | FOO.SKIP 18 | -------------------------------------------------------------------------------- /t/lib/Dist/Zilla/Plugin/MungerThatPrunesPodFiles.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::MungerThatPrunesPodFiles; 2 | 3 | use Moose; 4 | with( 5 | 'Dist::Zilla::Role::FileMunger', 6 | ); 7 | 8 | sub munge_file { 9 | my ( $self, $file ) = @_; 10 | return unless $file->name =~ m/\.pod$/; 11 | 12 | $self->zilla->prune_file($file); 13 | } 14 | 15 | __PACKAGE__->meta->make_immutable; 16 | no Moose; 17 | 1; 18 | -------------------------------------------------------------------------------- /t/lib/Dist/Zilla/Plugin/TestArchiveBuilder.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::TestArchiveBuilder; 2 | 3 | use Moose; 4 | use Path::Tiny qw( path ); 5 | use JSON::MaybeXS qw( encode_json ); 6 | with( 7 | 'Dist::Zilla::Role::ArchiveBuilder', 8 | ); 9 | 10 | sub build_archive { 11 | my ($self, $archive_basename, $built_in, $basedir) = @_; 12 | 13 | # instead of archiving in gzip compressed tarball 14 | # we are writing a fooball archive. 15 | my $fooball = path($archive_basename . ".foo"); 16 | 17 | $fooball->spew_raw( 18 | encode_json( 19 | [ $archive_basename, "$built_in", "$basedir" ], 20 | ), 21 | ); 22 | 23 | return $fooball; 24 | } 25 | 26 | __PACKAGE__->meta->make_immutable; 27 | 1; 28 | -------------------------------------------------------------------------------- /t/lib/Dist/Zilla/Plugin/TestAutoLicense.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::TestAutoLicense; 2 | 3 | use Moose; 4 | with( 5 | 'Dist::Zilla::Role::LicenseProvider', 6 | ); 7 | 8 | use Software::License::None; 9 | 10 | sub provide_license { 11 | my ($self, $arg) = @_; 12 | return Software::License::None->new({ 13 | holder => $arg->{copyright_holder} || 'Vyacheslav Matjukhin', 14 | year => $arg->{copyright_year} || 2010, 15 | }); 16 | } 17 | 18 | __PACKAGE__->meta->make_immutable; 19 | no Moose; 20 | 1; 21 | -------------------------------------------------------------------------------- /t/lib/Dist/Zilla/Plugin/TestAutoName.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::TestAutoName; 2 | 3 | use Moose; 4 | with( 5 | 'Dist::Zilla::Role::NameProvider', 6 | ); 7 | 8 | sub provide_name { 9 | my ($self) = @_; 10 | return 'FooBar'; 11 | } 12 | 13 | __PACKAGE__->meta->make_immutable; 14 | no Moose; 15 | 1; 16 | -------------------------------------------------------------------------------- /t/lib/Dist/Zilla/Plugin/TestReleaseProvider.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::TestReleaseProvider; 2 | 3 | use Moose; 4 | with( 5 | 'Dist::Zilla::Role::ReleaseStatusProvider', 6 | ); 7 | 8 | sub provide_release_status { 'unstable' } 9 | 10 | __PACKAGE__->meta->make_immutable; 11 | 1; 12 | -------------------------------------------------------------------------------- /t/lib/Dist/Zilla/Plugin/Versioned.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Plugin::Versioned; 2 | 3 | use Moose; 4 | with 'Dist::Zilla::Role::Plugin'; 5 | 6 | our $VERSION = '1.234'; 7 | 8 | 1; 9 | -------------------------------------------------------------------------------- /t/lib/Dist/Zilla/Stash/Heap.pm: -------------------------------------------------------------------------------- 1 | package Dist::Zilla::Stash::Heap; 2 | use Moose; 3 | with 'Dist::Zilla::Role::Stash'; 4 | # ABSTRACT: a stash that's just a big heap of names and values 5 | 6 | has payload => ( 7 | is => 'ro', 8 | isa => 'HashRef', 9 | required => 1, 10 | ); 11 | 12 | sub value { 13 | my ($self, $name) = @_; 14 | $self->payload->{ $name }; 15 | } 16 | 17 | sub stash_from_config { 18 | my ($class, $name, $arg, $section) = @_; 19 | 20 | my $self = $class->new({ payload => $arg }); 21 | return $self; 22 | } 23 | 24 | 1; 25 | -------------------------------------------------------------------------------- /t/load_config.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::DZil; 6 | use Test::Fatal; 7 | 8 | { 9 | package Dist::Zilla::PluginBundle::Bunk; 10 | use Moose; 11 | with 'Dist::Zilla::Role::PluginBundle::Easy'; 12 | sub configure { 13 | my $self = shift; 14 | $self->add_plugins('DoesNotExist'); 15 | } 16 | } 17 | 18 | like( 19 | exception { 20 | Builder->from_config( 21 | { dist_root => 't/does-not-exist' }, 22 | { 23 | add_files => { 24 | 'source/dist.ini' => simple_ini( 25 | 'DoesNotExist', 26 | ), 27 | }, 28 | }, 29 | ); 30 | }, 31 | qr/Required plugin Dist::Zilla::Plugin::DoesNotExist isn't installed\.\n\n/, 32 | 'missing plugin is detected properly', 33 | ); 34 | 35 | like( 36 | exception { 37 | Builder->from_config( 38 | { dist_root => 't/does-not-exist' }, 39 | { 40 | add_files => { 41 | 'source/dist.ini' => simple_ini( 42 | '@DoesNotExist', 43 | ), 44 | }, 45 | }, 46 | ); 47 | }, 48 | qr/Required plugin bundle Dist::Zilla::PluginBundle::DoesNotExist isn't installed\.\n\n/, 49 | 'missing plugin bundle is detected properly', 50 | ); 51 | 52 | like( 53 | exception { 54 | Builder->from_config( 55 | { dist_root => 't/does-not-exist' }, 56 | { 57 | add_files => { 58 | 'source/dist.ini' => simple_ini( 59 | '@Bunk', 60 | ), 61 | }, 62 | }, 63 | ); 64 | }, 65 | # with Config::MVP 2.200009, we get: 66 | # 'Can't locate object method "section_name" via package "Moose::Meta::Class::__ANON__::SERIAL::17" at lib/Dist/Zilla/Dist/Builder.pm line 269. 67 | qr/Required plugin Dist::Zilla::Plugin::DoesNotExist isn't installed\.\n\n/, 68 | 'missing plugin within a bundle is detected properly', 69 | ); 70 | 71 | done_testing; 72 | -------------------------------------------------------------------------------- /t/minter.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More 0.88; 5 | 6 | use File::pushd qw/pushd/; 7 | use Dist::Zilla::Path; 8 | use Test::DZil; 9 | use Dist::Zilla::App::Tester; 10 | use YAML::Tiny; 11 | 12 | use Test::File::ShareDir -share => { 13 | -module => { 'Dist::Zilla::MintingProfile::Default' => 'profiles' }, 14 | }; 15 | 16 | my $tzil = Minter->_new_from_profile( 17 | [ Default => 'default' ], 18 | { name => 'DZT-Minty', }, 19 | { global_config_root => 'corpus/global' }, 20 | ); 21 | 22 | $tzil->mint_dist; 23 | 24 | my $pm = $tzil->slurp_file('mint/lib/DZT/Minty.pm'); 25 | 26 | like( 27 | $pm, 28 | qr/package DZT::Minty;/, 29 | "our new module has the package declaration we want", 30 | ); 31 | 32 | my $distini = $tzil->slurp_file('mint/dist.ini'); 33 | 34 | like( 35 | $distini, 36 | qr/copyright_holder = A. U. Thor/, 37 | "copyright_holder in dist.ini", 38 | ); 39 | 40 | { 41 | my $result = test_dzil( $tzil->tempdir->child('mint')->absolute, [qw(add Foo::Bar)] ); 42 | ok(!$result->{exit_code}) || diag($result->{error}); 43 | my $pm = path($result->{tempdir})->child('source/lib/Foo/Bar.pm')->slurp; 44 | 45 | like( 46 | $pm, 47 | qr/package Foo::Bar;/, 48 | "our second module has the package declaration we want", 49 | ); 50 | } 51 | 52 | done_testing; 53 | -------------------------------------------------------------------------------- /t/plugins/archive_builder.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | use experimental qw( postderef ); 5 | 6 | use lib 't/lib'; 7 | 8 | use Test::DZil; 9 | use JSON::MaybeXS; 10 | 11 | my $tzil = Builder->from_config( 12 | { dist_root => 'corpus/dist/DZT' }, 13 | { 14 | add_files => { 15 | 'source/dist.ini' => simple_ini( 16 | 'GatherDir', 17 | 'TestArchiveBuilder', 18 | 'TestReleaseProvider', 19 | ), 20 | }, 21 | }, 22 | ); 23 | 24 | my $fooball = $tzil->build_archive; 25 | 26 | note "fooball = $fooball"; 27 | note "is_trial = @{[ $tzil->is_trial ]}"; 28 | 29 | my @payload = JSON::MaybeXS->new->decode( $fooball->slurp_raw )->@*; 30 | 31 | is $payload[0], 'DZT-Sample-0.001-TRIAL'; 32 | ok -d $payload[1]; 33 | is $payload[2], 'DZT-Sample-0.001'; 34 | 35 | unlink $fooball; 36 | 37 | done_testing; 38 | -------------------------------------------------------------------------------- /t/plugins/autolicense.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | 5 | use lib 't/lib'; 6 | 7 | use Test::DZil; 8 | use YAML::Tiny; 9 | 10 | { 11 | my $tzil = Builder->from_config( 12 | { dist_root => 'corpus/dist/DZT' }, 13 | { 14 | add_files => { 15 | 'source/dist.ini' => simple_ini( 16 | { 17 | license => undef, 18 | copyright_year => 2012, 19 | }, 20 | 'GatherDir', 21 | 'TestAutoLicense', 22 | ), 23 | }, 24 | }, 25 | ); 26 | 27 | $tzil->build; 28 | 29 | is($tzil->license->name, '"No License" License', "dist license is set by plugin"); 30 | is($tzil->license->year, 2012, "copyright_year used instead of default year"); 31 | } 32 | 33 | done_testing; 34 | -------------------------------------------------------------------------------- /t/plugins/autoname.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | 5 | use lib 't/lib'; 6 | 7 | use Test::DZil; 8 | use YAML::Tiny; 9 | 10 | { 11 | my $tzil = Builder->from_config( 12 | { dist_root => 'corpus/dist/DZT' }, 13 | { 14 | add_files => { 15 | 'source/dist.ini' => simple_ini( 16 | { name => undef }, 17 | 'GatherDir', 18 | 'TestAutoName', 19 | ), 20 | }, 21 | }, 22 | ); 23 | 24 | $tzil->build; 25 | 26 | is($tzil->name, 'FooBar', "dist name is set (in DZ obj)"); 27 | } 28 | 29 | done_testing; 30 | -------------------------------------------------------------------------------- /t/plugins/autoversion.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | 5 | use Test::DZil; 6 | use YAML::Tiny; 7 | 8 | delete $ENV{V}; 9 | 10 | { 11 | my $tzil = Builder->from_config( 12 | { dist_root => 'corpus/dist/DZT' }, 13 | { 14 | add_files => { 15 | 'source/dist.ini' => simple_ini( 16 | { version => undef }, 17 | 'GatherDir', 18 | [ AutoVersion => { major => 6, format => '{{$major}}.{{$^T}}' } ], 19 | ), 20 | }, 21 | }, 22 | ); 23 | 24 | $tzil->build; 25 | 26 | my $want_version = "6." . $^T; 27 | 28 | is($tzil->version, $want_version, "dist version is set (in DZ obj)"); 29 | } 30 | 31 | { 32 | my $tzil = Builder->from_config( 33 | { dist_root => 'corpus/dist/DZT' }, 34 | { 35 | add_files => { 36 | 'source/dist.ini' => simple_ini( 37 | { version => undef }, 38 | 'GatherDir', 39 | [ AutoVersion => { 40 | major => 7, 41 | format => q<{{$major}}.{{ cldr('y') }}> } ], 42 | ), 43 | }, 44 | }, 45 | ); 46 | 47 | $tzil->build; 48 | 49 | like($tzil->version, qr/^7\.20[1-9][0-9]$/, "dist version is set using CLDR"); 50 | } 51 | 52 | { 53 | local $ENV{V} = '1.23'; 54 | my $tzil = Builder->from_config( 55 | { dist_root => 'corpus/dist/DZT' }, 56 | { 57 | add_files => { 58 | 'source/dist.ini' => simple_ini( 59 | { version => undef }, 60 | 'GatherDir', 61 | [ AutoVersion => { major => 6, format => '{{$major}}.{{$^T}}' } ], 62 | ), 63 | }, 64 | }, 65 | ); 66 | 67 | $tzil->build; 68 | 69 | is($tzil->version, '1.23', "dist version is set from \$V override"); 70 | } 71 | done_testing; 72 | -------------------------------------------------------------------------------- /t/plugins/confirmrelease.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | use Test::Fatal; 5 | use Test::Deep; 6 | use Test::DZil; 7 | 8 | sub new_tzil { 9 | my $tzil = Builder->from_config( 10 | { dist_root => 'corpus/dist/DZT' }, 11 | { 12 | add_files => { 13 | 'source/dist.ini' => 14 | simple_ini(qw(GatherDir ConfirmRelease FakeRelease)), 15 | }, 16 | }, 17 | ); 18 | } 19 | 20 | sub release_happened { 21 | scalar grep({/Fake release happening/i} @{ shift->log_messages }),; 22 | } 23 | 24 | my $release_aborted = qr/aborting release/i; 25 | 26 | { 27 | my $tzil = new_tzil; 28 | 29 | like( 30 | exception { $tzil->release }, 31 | $release_aborted, 32 | "ConfirmRelease aborts by default", 33 | ); 34 | 35 | ok(!release_happened($tzil), "release did not happen by default"); 36 | } 37 | 38 | for my $no (qw(n no)) { 39 | local $ENV{DZIL_CONFIRMRELEASE_DEFAULT} = $no; 40 | 41 | my $tzil = new_tzil; 42 | 43 | like( 44 | exception { $tzil->release }, 45 | $release_aborted, 46 | "ConfirmRelease aborts when DZIL_CONFIRMRELEASE_DEFAULT=$no", 47 | ); 48 | 49 | ok( 50 | !release_happened($tzil), 51 | "release did not happen when DZIL_CONFIRMRELEASE_DEFAULT=$no", 52 | ); 53 | } 54 | 55 | for my $yes (qw(y yes)) { 56 | local $ENV{DZIL_CONFIRMRELEASE_DEFAULT} = $yes; 57 | 58 | my $tzil = new_tzil; 59 | 60 | is( 61 | exception { $tzil->release }, 62 | undef, 63 | "DZIL_CONFIRMRELEASE_DEFAULT=$yes no exception", 64 | ); 65 | 66 | ok( 67 | release_happened($tzil), 68 | "DZIL_CONFIRMRELEASE_DEFAULT=$yes allows release", 69 | ); 70 | } 71 | 72 | 73 | my $prompt = "Do you want to continue the release process?"; 74 | 75 | for my $no (qw(n no)) { 76 | my $tzil = new_tzil; 77 | 78 | $tzil->chrome->set_response_for($prompt, $no); 79 | 80 | like( 81 | exception { $tzil->release }, 82 | $release_aborted, 83 | "ConfirmRelease aborts when answering '$no'", 84 | ); 85 | 86 | cmp_deeply( 87 | $tzil->log_messages, 88 | supersetof("[ConfirmRelease] *** Preparing to release DZT-Sample-0.001.tar.gz with FakeRelease ***"), 89 | 'supplementary information was also displayed', 90 | ) or diag explain $tzil->log_messages; 91 | 92 | ok(!release_happened($tzil), "release did not happen when answering '$no'"); 93 | } 94 | 95 | for my $yes (qw(y yes)) { 96 | my $tzil = new_tzil; 97 | 98 | $tzil->chrome->set_response_for($prompt, $yes); 99 | 100 | is( 101 | exception { $tzil->release }, 102 | undef, 103 | "ConfirmRelease no exception when answering '$yes'", 104 | ); 105 | 106 | cmp_deeply( 107 | $tzil->log_messages, 108 | supersetof("[ConfirmRelease] *** Preparing to release DZT-Sample-0.001.tar.gz with FakeRelease ***"), 109 | 'supplementary information was also displayed', 110 | ) or diag explain $tzil->log_messages; 111 | 112 | ok(release_happened($tzil), "answering '$yes' allows release"); 113 | } 114 | 115 | done_testing; 116 | -------------------------------------------------------------------------------- /t/plugins/cpanfile.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::DZil; 6 | 7 | use Dist::Zilla::Plugin::CPANFile; 8 | 9 | # unfortunately this is a copy from the tested code 10 | my $version = $Dist::Zilla::Plugin::CPANFile::VERSION // ''; 11 | 12 | is( 13 | cpanfile('build/cpanfile') => <<"INI", 14 | # This file is generated by Dist::Zilla::Plugin::CPANFile v$version 15 | # Do not edit this file directly. To change prereqs, edit the `dist.ini` file. 16 | 17 | requires "strict" => "0"; 18 | requires "warnings" => "0"; 19 | INI 20 | "cpanfile contains requirements" 21 | ); 22 | 23 | ok( 24 | cpanfile('build/otherfile' => { filename => 'otherfile' }), 25 | "non-default filename" 26 | ); 27 | 28 | is( 29 | cpanfile('build/cpanfile' => { comment => ["foobar"] }) => 30 | <<"INI", 31 | # foobar 32 | 33 | requires "strict" => "0"; 34 | requires "warnings" => "0"; 35 | INI 36 | "simple comment" 37 | ); 38 | 39 | is( 40 | cpanfile('build/cpanfile' => { comment => [ "foo", "bar" ] }), 41 | <<"INI", 42 | # foo 43 | # bar 44 | 45 | requires "strict" => "0"; 46 | requires "warnings" => "0"; 47 | INI 48 | "multiline comment" 49 | ); 50 | 51 | sub cpanfile { 52 | my $filename = shift; 53 | 54 | my $opts = @_ ? [ map { (CPANFile => $_) } @_ ] : 'CPANFile'; 55 | 56 | my $tzil = Builder->from_config( 57 | { dist_root => 'corpus/dist/DZ1' }, 58 | { 59 | add_files => { 60 | 'source/dist.ini' => simple_ini(qw< GatherDir AutoPrereqs >, $opts), 61 | }, 62 | }, 63 | ); 64 | 65 | $tzil->build; 66 | 67 | return $tzil->slurp_file($filename); 68 | } 69 | 70 | done_testing; 71 | -------------------------------------------------------------------------------- /t/plugins/distmeta-merge.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | 5 | use Test::DZil; 6 | use Test::Deep; 7 | 8 | { 9 | package Keywords; # see also Dist::Zilla::Plugin::Keywords ;) 10 | use Moose; 11 | with 'Dist::Zilla::Role::MetaProvider'; 12 | 13 | sub mvp_multivalue_args { qw(keywords) } 14 | 15 | has keywords => ( 16 | is => 'ro', isa => 'ArrayRef[Str]', 17 | lazy => 1, 18 | default => sub { [] }, 19 | ); 20 | 21 | sub metadata 22 | { 23 | my $self = shift; 24 | my $keywords = $self->keywords; 25 | return { @$keywords ? ( keywords => $keywords ) : () }; 26 | } 27 | } 28 | 29 | { 30 | my $tzil = Builder->from_config( 31 | { dist_root => 'corpus/dist/DZT' }, 32 | { 33 | add_files => { 34 | 'source/dist.ini' => simple_ini( 35 | [ '=Keywords' => 'plugin 1' => { keywords => [ qw(foo bar) ] } ], 36 | [ '=Keywords' => 'plugin 2' => { keywords => [ qw(dog cat) ] } ], 37 | ), 38 | }, 39 | }, 40 | ); 41 | 42 | 43 | cmp_deeply( 44 | $tzil->distmeta, 45 | { 46 | abstract => 'Sample DZ Dist', 47 | author => ['E. Xavier Ample '], 48 | dynamic_config => 0, 49 | generated_by => ignore, 50 | license => [ 'perl_5' ], 51 | 'meta-spec' => { 52 | url => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec', 53 | version => 2 54 | }, 55 | name => 'DZT-Sample', 56 | release_status => 'stable', 57 | version => '0.001', 58 | keywords => [ qw(foo bar dog cat) ], 59 | x_generated_by_perl => "$^V", 60 | x_spdx_expression => 'Artistic-1.0-Perl OR GPL-1.0-or-later', 61 | }, 62 | 'metadata is correctly merged together', 63 | ); 64 | } 65 | 66 | done_testing; 67 | -------------------------------------------------------------------------------- /t/plugins/encoding.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | use utf8; 5 | 6 | use autodie; 7 | use Test::DZil; 8 | 9 | my $ini = <<'END_INI'; 10 | license = Perl_5 11 | author = E. Xavier Ample 12 | abstract = Sample DZ Dist 13 | name = DZT-Sample 14 | copyright_holder = E. Xavier Ample 15 | version = 0.001 16 | 17 | [GatherDir] 18 | 19 | [Encoding / general] 20 | encoding=utf8 21 | match=^ 22 | ignore=^t/ 23 | 24 | [Encoding / subset] 25 | encoding=bytes 26 | match=^t/ 27 | 28 | END_INI 29 | 30 | 31 | my $tzil = Builder->from_config( 32 | { dist_root => 'corpus/dist/DZT' }, 33 | { 34 | add_files => { 35 | 'source/dist.ini' => $ini 36 | }, 37 | }, 38 | ); 39 | 40 | $tzil->build; 41 | 42 | 43 | pass; 44 | 45 | done_testing; 46 | 47 | -------------------------------------------------------------------------------- /t/plugins/extratests.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | 5 | use autodie; 6 | use Test::DZil; 7 | use Test::Deep; 8 | 9 | my $generic_test = <<'END_TEST'; 10 | #!perl 11 | 12 | use strict; 13 | use warnings; 14 | 15 | use Test::More 0.88; 16 | 17 | use Foo::%s 392; 18 | 19 | ok(0, "stop building me!"); 20 | 21 | done_testing; 22 | END_TEST 23 | 24 | my @xt_types = qw(smoke author release); 25 | 26 | my $tzil = Builder->from_config( 27 | { dist_root => 'corpus/dist/DZT' }, 28 | { 29 | add_files => { 30 | 'source/dist.ini' => simple_ini(qw), 31 | (map {; "source/xt/$_/huffer.t" => sprintf($generic_test, $_) } 32 | @xt_types, qw(blort)) 33 | }, 34 | }, 35 | ); 36 | 37 | $tzil->build; 38 | 39 | my @files = map {; $_->name } @{ $tzil->files }; 40 | 41 | cmp_deeply( 42 | \@files, 43 | bag(qw( 44 | dist.ini lib/DZT/Sample.pm t/basic.t 45 | t/smoke-huffer.t 46 | t/author-huffer.t 47 | t/release-huffer.t 48 | xt/blort/huffer.t 49 | )), 50 | "filenames rewritten by ExtraTests", 51 | ); 52 | 53 | for my $type (@xt_types) { 54 | my $test_program = $tzil->slurp_file("build/t/$type-huffer.t"); 55 | my $env = uc sprintf "%s_TESTING", $type eq 'smoke' ? 'automated' : $type; 56 | 57 | like( 58 | $test_program, 59 | qr/\$ENV\{$env\}/, 60 | "we mention $env in the rewritten $type test", 61 | ); 62 | } 63 | 64 | cmp_deeply( 65 | $tzil->distmeta, 66 | superhashof({ 67 | prereqs => { 68 | runtime => { 69 | requires => { 70 | strict => 0, 71 | warnings => 0, 72 | }, 73 | }, 74 | test => { 75 | requires => { 76 | 'Test::More' => '0.88', 77 | 'Foo::smoke' => '392', 78 | # Foo::author and Foo::release are 79 | # not here because they are not required by the end user 80 | # (See RT#76305) 81 | }, 82 | }, 83 | develop => { 84 | requires => { 85 | # remaining xt/ files were moved aside and not scanned 86 | 'Foo::blort' => '392', 87 | 'Test::More' => '0.88', 88 | }, 89 | }, 90 | }, 91 | }), 92 | 'dependencies ok', 93 | ) or diag $tzil->distmeta; 94 | 95 | done_testing; 96 | -------------------------------------------------------------------------------- /t/plugins/fakerelease.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | 5 | use Test::DZil qw(Builder simple_ini); 6 | use Test::Fatal qw(exception); 7 | 8 | { 9 | my $tzil = Builder->from_config( 10 | { dist_root => 'corpus/dist/DZT' }, 11 | { 12 | add_files => { 13 | 'source/dist.ini' => simple_ini(qw(GatherDir FakeRelease)), 14 | }, 15 | }, 16 | ); 17 | 18 | $tzil->release; 19 | 20 | ok( 21 | grep({ /fake release happen/i } @{ $tzil->log_messages }), 22 | "we log a fake release when we fake release", 23 | ); 24 | } 25 | 26 | { 27 | my $tzil = Builder->from_config( 28 | { dist_root => 'corpus/dist/DZT' }, 29 | { 30 | add_files => { 31 | 'source/dist.ini' => simple_ini( 32 | [ '@Filter' => { 33 | bundle => '@FakeClassic', 34 | remove => 'ConfirmRelease', 35 | } ] 36 | ), 37 | }, 38 | }, 39 | ); 40 | 41 | $tzil->release; 42 | 43 | ok( 44 | grep({ /fake release happen/i } @{ $tzil->log_messages }), 45 | "we log a fake release when we fake release", 46 | ); 47 | } 48 | 49 | { 50 | like( exception { 51 | my $tzil = Builder->from_config( 52 | { dist_root => 'corpus/dist/DZT' }, 53 | { 54 | add_files => { 55 | 'source/dist.ini' => simple_ini(qw(GatherDir FakeRelease)), 56 | }, 57 | }, 58 | ); 59 | 60 | local $ENV{DZIL_FAKERELEASE_FAIL} = 1; 61 | $tzil->release; 62 | }, 63 | qr/DZIL_FAKERELEASE_FAIL set, aborting/i, 64 | "we can make FakeRelease fail when we want!" 65 | ); 66 | } 67 | 68 | done_testing; 69 | -------------------------------------------------------------------------------- /t/plugins/filter-b.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | 5 | use Dist::Zilla::PluginBundle::Classic; 6 | use Dist::Zilla::PluginBundle::Filter; 7 | 8 | my @classic = Dist::Zilla::PluginBundle::Classic->bundle_config({ 9 | name => '@Classic', 10 | package => 'Dist::Zilla::PluginBundle::Classic', 11 | payload => { }, 12 | }); 13 | 14 | my @filtered = Dist::Zilla::PluginBundle::Filter->bundle_config({ 15 | name => '@CF', 16 | package => 'Dist::Zilla::PluginBundle::Filter', 17 | payload => { 18 | bundle => '@Classic', 19 | remove => [ qw(ManifestSkip PkgVersion) ], 20 | }, 21 | }); 22 | 23 | is(@filtered, @classic - 2, "filtering 2 plugins gets us 2 fewer plugins!"); 24 | 25 | my $before_count = 26 | grep { $_->[1] =~ /\ADist::Zilla::Plugin::(?:ManifestSkip|PkgVersion)\z/ } 27 | @classic; 28 | 29 | is($before_count, 2, "we started with the 2 we wanted to remove"); 30 | 31 | my $after_count = 32 | grep { $_->[1] =~ /\ADist::Zilla::Plugin::(?:ManifestSkip|PkgVersion)\z/ } 33 | @filtered; 34 | 35 | is($after_count, 0, "...then we removed them"); 36 | 37 | done_testing; 38 | -------------------------------------------------------------------------------- /t/plugins/license.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | use utf8; 5 | 6 | use autodie; 7 | use Test::DZil; 8 | 9 | subtest "ASCII-only author" => sub { 10 | my $tzil = Builder->from_config( 11 | { dist_root => 'corpus/dist/DZT' }, 12 | { 13 | add_files => { 14 | 'source/dist.ini' => simple_ini('License'), 15 | }, 16 | }, 17 | ); 18 | 19 | $tzil->build; 20 | 21 | my $contents = $tzil->slurp_file('build/LICENSE'); 22 | 23 | like( 24 | $contents, 25 | qr{This software is copyright .c. [0-9]+ by E\. Xavier Ample}i, 26 | "copyright appears in LICENSE file", 27 | ); 28 | 29 | like( 30 | $contents, 31 | qr{same terms as (the )?perl.*itself}i, 32 | "'same terms as perl'-ish text appears in LICENSE", 33 | ); 34 | }; 35 | 36 | subtest "non-ASCII author" => sub { 37 | my $tzil = Builder->from_config( 38 | { dist_root => 'corpus/dist/DZ-NonAscii' }, 39 | ); 40 | 41 | $tzil->build; 42 | 43 | my $contents = $tzil->slurp_file('build/LICENSE'); 44 | 45 | like( 46 | $contents, 47 | qr{This software is copyright .c. [0-9]+ by ภูมิพลอดุลยเดช}, 48 | "copyright appears in LICENSE file", 49 | ); 50 | }; 51 | 52 | done_testing; 53 | -------------------------------------------------------------------------------- /t/plugins/manifest.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | use Test::Deep; 5 | 6 | use ExtUtils::Manifest 1.66; # or maniread can't cope with quoting properly 7 | 8 | use Test::DZil; 9 | 10 | my $tzil = Builder->from_config( 11 | { dist_root => 'corpus/dist/DZT' }, 12 | { 13 | add_files => { 14 | q{source/file with spaces.txt} => "foo\n", 15 | q{source/'file-with-ticks.txt'} => "baz\n", 16 | 'source/dist.ini' => simple_ini( 17 | 'GatherDir', 18 | 'Manifest', 19 | ), 20 | $^O =~ /^(MSWin32|cygwin|msys)$/ ? () : ( 21 | q{source/file\\with some\\whacks.txt} => "bar\n", 22 | q{source/file'with'quotes\\or\\backslash.txt} => "quux\n", 23 | q{source/dir\\with some\\/whacks.txt} => "mar\n", 24 | ), 25 | }, 26 | }, 27 | ); 28 | 29 | $tzil->build; 30 | 31 | my $manihash = ExtUtils::Manifest::maniread($tzil->built_in->child('MANIFEST')); 32 | 33 | cmp_deeply( 34 | [ keys %$manihash ], 35 | bag( 36 | 'MANIFEST', 37 | q{file with spaces.txt}, 38 | q{'file-with-ticks.txt'}, 39 | 'dist.ini', 40 | 'lib/DZT/Sample.pm', 41 | 't/basic.t', 42 | $^O =~ /^(MSWin32|cygwin|msys)$/ ? () : ( 43 | q{file\\with some\\whacks.txt}, 44 | q{file'with'quotes\\or\\backslash.txt}, 45 | q{dir\\with some\\/whacks.txt}, 46 | ), 47 | ), 48 | 'manifest quotes files with spaces' 49 | ); 50 | 51 | my @manilines = grep { ! /^#/ } split /\n/, $tzil->slurp_file('build/MANIFEST'); 52 | chomp @manilines; 53 | 54 | cmp_deeply( 55 | \@manilines, 56 | bag( 57 | 'MANIFEST', 58 | q{'file with spaces.txt'}, 59 | q{'\\'file-with-ticks.txt\\''}, 60 | 'dist.ini', 61 | 'lib/DZT/Sample.pm', 62 | 't/basic.t', 63 | $^O =~ /^(MSWin32|cygwin|msys)$/ ? () : ( 64 | q{'file\\\\with some\\\\whacks.txt'}, 65 | q{'file\\'with\\'quotes\\\\or\\\\backslash.txt'}, 66 | q{'dir\\\\with some\\\\/whacks.txt'}, 67 | ), 68 | ), 69 | 'manifest quotes files with spaces' 70 | ); 71 | 72 | done_testing; 73 | -------------------------------------------------------------------------------- /t/plugins/metanoindex.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More; 5 | use Test::Deep; 6 | use Test::DZil; 7 | 8 | my %TEST_ATTR = ( 9 | files => { 10 | values => [ qw(My/Module.pm My/Module2.pm) ], 11 | aliases => [ qw(files) ], 12 | }, 13 | directories => { 14 | values => [ qw(My/Private My/Private2) ], 15 | aliases => [ qw(dir directory folder) ], 16 | }, 17 | packages => { 18 | values => [ qw(My::Module::Stuff My::Module::Things) ], 19 | aliases => [ qw(class module package) ], 20 | }, 21 | namespaces => { 22 | values => [ qw(My::Module::Stuff My::Module::Things)], 23 | aliases => [ qw(namespace) ], 24 | }, 25 | ); 26 | 27 | 28 | my $tzil = Builder->from_config( 29 | { dist_root => 'corpus/dist/DZT' }, 30 | { 31 | add_files => { 32 | 'source/dist.ini' => simple_ini( 33 | [ 34 | MetaNoIndex => { 35 | file => 'file-1.txt', 36 | files => 'file-2.txt', 37 | 38 | dir => 'dir-1', 39 | directory => 'dir-2', 40 | directories => 'dir-3', 41 | folder => 'dir-4', 42 | 43 | package => 'Package::1', 44 | packages => 'Package::2', 45 | class => 'Class::1', 46 | module => 'Module::1', 47 | 48 | namespace => 'Namespace::1', 49 | namespaces => 'Namespaces::1', 50 | }, 51 | ], 52 | ), 53 | }, 54 | }, 55 | ); 56 | 57 | $tzil->build; 58 | 59 | cmp_deeply( 60 | $tzil->distmeta, 61 | superhashof({ no_index => { 62 | file => bag(qw(file-1.txt file-2.txt)), 63 | directory => bag(qw(dir-1 dir-2 dir-3 dir-4)), 64 | package => bag(qw(Package::1 Package::2 Class::1 Module::1)), 65 | namespace => bag(qw(Namespace::1 Namespaces::1)), 66 | }}), 67 | "we generated the no_index entry we expected", 68 | ); 69 | 70 | done_testing; 71 | -------------------------------------------------------------------------------- /t/plugins/misctests.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | use Test::Deep; 5 | 6 | use autodie; 7 | use Test::DZil; 8 | 9 | my $tzil = Builder->from_config( 10 | { dist_root => 'corpus/dist/DZT' }, 11 | { 12 | add_files => { 13 | 'source/dist.ini' => simple_ini( 14 | qw(GatherDir MetaTests PodSyntaxTests PodCoverageTests) 15 | ), 16 | }, 17 | }, 18 | ); 19 | 20 | $tzil->build; 21 | 22 | my $meta_test = $tzil->slurp_file('build/xt/author/distmeta.t'); 23 | like($meta_test, qr{meta_yaml_ok}, "we have a distmeta file that tests it"); 24 | 25 | my $pod_test = $tzil->slurp_file('build/xt/author/pod-syntax.t'); 26 | like($pod_test, qr{all_pod_files_ok}, "we have a pod-syntax test"); 27 | 28 | my $pod_c_test = $tzil->slurp_file('build/xt/author/pod-coverage.t'); 29 | like($pod_c_test, qr{all_pod_coverage_ok}, "we have a pod-coverage test"); 30 | 31 | cmp_deeply( 32 | $tzil->distmeta, 33 | superhashof( 34 | { 35 | prereqs => 36 | { 37 | develop => 38 | { 39 | requires => 40 | { 41 | # PodSyntaxTests 42 | 'Test::Pod' => '1.41', 43 | # PodCoverageTests 44 | 'Test::Pod::Coverage' => '1.08', 45 | 'Pod::Coverage::TrustPod' => 0, 46 | # MetaTests 47 | 'Test::CPAN::Meta' => 0, 48 | }, 49 | }, 50 | }, 51 | } 52 | ), 53 | 'develop prereqs' 54 | ); 55 | 56 | done_testing; 57 | -------------------------------------------------------------------------------- /t/plugins/munger-that-prunes.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | 5 | use lib 't/lib'; 6 | 7 | use Test::DZil; 8 | use YAML::Tiny; 9 | 10 | # In the future, pruning during munging may become impossible by design. Until 11 | # that time, it should not cause weird-o action at a distance. -- rjbs, 12 | # 2016-01-31 13 | 14 | { 15 | my $tzil = Builder->from_config( 16 | { dist_root => 'corpus/dist/DZT' }, 17 | { 18 | add_files => { 19 | 'source/Build.pod' => "This file is cruft.\n", 20 | 'source/Build2.pod' => "This other file is cruft.\n", 21 | 'source/Build3.pod' => "This third file is cruft.\n", 22 | 'source/dist.ini' => simple_ini( 23 | 'GatherDir', 24 | 'MungerThatPrunesPodFiles', 25 | ), 26 | }, 27 | }, 28 | ); 29 | 30 | $tzil->build; 31 | 32 | my @files = map {; $_->name } @{ $tzil->files }; 33 | is_filelist( 34 | [ @files ], 35 | [ qw(lib/DZT/Sample.pm t/basic.t dist.ini) ], 36 | 'munge_file that call prunes does not mangle $self->zilla->files', 37 | ); 38 | } 39 | 40 | done_testing; 41 | -------------------------------------------------------------------------------- /t/plugins/podsyntaxtests.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | use Test::Deep; 5 | 6 | use Test::DZil; 7 | 8 | { 9 | my $tzil = Builder->from_config( 10 | { dist_root => 'corpus/dist/DZT' }, 11 | { 12 | add_files => { 13 | 'source/dist.ini' => simple_ini( 14 | [ GatherDir => ], 15 | [ PodSyntaxTests => ], 16 | ), 17 | }, 18 | }, 19 | ); 20 | 21 | $tzil->build; 22 | 23 | cmp_deeply( 24 | $tzil->distmeta, 25 | superhashof( 26 | { 27 | prereqs => 28 | { 29 | develop => { requires => { 'Test::Pod' => '1.41' } }, 30 | }, 31 | } 32 | ), 33 | 'PodSyntaxTests develop prereqs' 34 | ); 35 | 36 | like( 37 | $tzil->slurp_file('build/xt/author/pod-syntax.t'), 38 | qr/\Quse Test::Pod 1.41/, 39 | 'xt/release/pod-syntax.t content' 40 | ); 41 | } 42 | 43 | done_testing; 44 | -------------------------------------------------------------------------------- /t/plugins/podversion.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | 5 | use autodie; 6 | use Test::DZil; 7 | 8 | my $with_place_for_pod = ' 9 | 10 | package DZT::WPFP; 11 | 12 | =head1 NAME 13 | 14 | DZT::WPFP - with place for pod! 15 | 16 | =cut 17 | 18 | sub foo { } 19 | 20 | 1; 21 | '; 22 | 23 | my $with_version = ' 24 | 25 | package DZT::WVer; 26 | 27 | =head1 NAME 28 | 29 | DZT::WVer - version in pod! 30 | 31 | =head1 VERSION 32 | 33 | version 1.234 34 | 35 | =cut 36 | 37 | sub foo { } 38 | 39 | 1; 40 | '; 41 | 42 | my $with_multi_line_abstract = ' 43 | 44 | package DZT::MLA; 45 | 46 | =head1 NAME 47 | 48 | DZT::MLA - This abstract spans 49 | multiple lines. 50 | 51 | =cut 52 | 53 | sub foo { } 54 | 55 | 1; 56 | '; 57 | 58 | my $script = ' 59 | #!/usr/bin/perl 60 | 61 | =head1 NAME 62 | 63 | script.pl - a podded script! 64 | 65 | =cut 66 | 67 | print "hello world\n"; 68 | '; 69 | 70 | my $tzil = Builder->from_config( 71 | { dist_root => 'corpus/dist/DZT' }, 72 | { 73 | add_files => { 74 | 'source/lib/DZT/WPFP.pm' => $with_place_for_pod, 75 | 'source/lib/DZT/WVer.pm' => $with_version, 76 | 'source/lib/DZT/MLA.pm' => $with_multi_line_abstract, 77 | 'source/bin/script.pl' => $script, 78 | 'source/dist.ini' => simple_ini('GatherDir', 'PodVersion', 'ExecDir'), 79 | }, 80 | }, 81 | ); 82 | 83 | $tzil->build; 84 | 85 | my $want = <<'END_POD'; 86 | =head1 VERSION 87 | 88 | version 0.001 89 | 90 | =cut 91 | END_POD 92 | 93 | my $want_mla = <<'END_POD'; 94 | =head1 NAME 95 | 96 | DZT::MLA - This abstract spans 97 | multiple lines. 98 | 99 | =head1 VERSION 100 | 101 | version 0.001 102 | 103 | =cut 104 | END_POD 105 | 106 | my $dzt_sample = $tzil->slurp_file('build/lib/DZT/Sample.pm'); 107 | ok( 108 | index($dzt_sample, $want) == -1, 109 | "we didn't add version pod to Sample; it has no NAME", 110 | ); 111 | 112 | my $dzt_wpfp = $tzil->slurp_file('build/lib/DZT/WPFP.pm'); 113 | ok( 114 | index($dzt_wpfp, $want) > 0, 115 | "we did add version pod to WPFP", 116 | ); 117 | 118 | my $dzt_wver = $tzil->slurp_file('build/lib/DZT/WVer.pm'); 119 | ok( 120 | index($dzt_wver, $want) == -1, 121 | "we didn't add version pod to WVer; it has one already", 122 | ); 123 | 124 | my $dzt_mla = $tzil->slurp_file('build/lib/DZT/MLA.pm'); 125 | ok( 126 | index($dzt_mla, $want_mla) > 0, 127 | "we properly skipped over multi-line abstract", 128 | ); 129 | 130 | my $dzt_script = $tzil->slurp_file('build/bin/script.pl'); 131 | ok( 132 | index($dzt_script, $want) > 0, 133 | "we did add version pod to script", 134 | ); 135 | 136 | done_testing; 137 | 138 | -------------------------------------------------------------------------------- /t/plugins/readme.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | use utf8; 5 | 6 | use autodie; 7 | use Test::DZil; 8 | 9 | my $tzil = Builder->from_config( 10 | { dist_root => 'corpus/dist/DZT' }, 11 | { 12 | add_files => { 13 | 'source/dist.ini' => simple_ini('Readme'), 14 | }, 15 | }, 16 | ); 17 | 18 | $tzil->build; 19 | 20 | my $contents = $tzil->slurp_file('build/README'); 21 | 22 | like( 23 | $contents, 24 | qr{This software is copyright .c. [0-9]+ by E\. Xavier Ample}i, 25 | "copyright appears in README file", 26 | ); 27 | 28 | like( 29 | $contents, 30 | qr{same terms as (the )?perl.*itself}i, 31 | "'same terms as perl'-ish text appears in README", 32 | ); 33 | 34 | my $name = $tzil->name; 35 | like( 36 | $contents, 37 | qr{\Q$name\E}, 38 | "dist name appears in README", 39 | ); 40 | 41 | { 42 | my $tzil = Builder->from_config( 43 | { dist_root => 'corpus/dist/DZ-NonAscii' }, 44 | ); 45 | 46 | $tzil->build; 47 | 48 | my $contents = $tzil->slurp_file('build/README'); 49 | 50 | like( 51 | $contents, 52 | qr{ภูมิพลอดุลยเดช}, 53 | "HRH unmangled in README", 54 | ); 55 | } 56 | 57 | done_testing; 58 | 59 | -------------------------------------------------------------------------------- /t/plugins/testrelease.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | use Test::Fatal; 5 | 6 | use Test::DZil; 7 | use File::Temp qw( tempdir ); 8 | 9 | sub new_tzil { 10 | #my $tmpdir = tdir(); 11 | my $tzil = Builder->from_config( 12 | { dist_root => 'corpus/dist/DZT', }, 13 | { 14 | add_files => { 'source/dist.ini' => simple_ini(qw(GatherDir MakeMaker TestRelease FakeRelease)), }, 15 | }, 16 | ); 17 | } 18 | 19 | sub release_happened { 20 | scalar grep( {/Fake release happening/i} @{ shift->log_messages } ),; 21 | } 22 | 23 | { 24 | my $tzil = new_tzil; 25 | is( exception { $tzil->build }, undef, "No failures occured building the release with TestRelease", ); 26 | 27 | is( exception { $tzil->release }, undef, "No failures occured in testing the release with TestRelease", ); 28 | 29 | note explain { root => ''. $tzil->root }; 30 | ok( release_happened($tzil), "Release happened" ); 31 | } 32 | 33 | done_testing; 34 | -------------------------------------------------------------------------------- /t/tester-demo.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More 0.88; 4 | 5 | use Dist::Zilla::App::Tester; 6 | use Test::DZil; 7 | 8 | ## SIMPLE TEST WITH DZIL::APP TESTER 9 | 10 | $ENV{DZIL_GLOBAL_CONFIG_ROOT} = 't'; 11 | 12 | my $result = test_dzil('corpus/dist/DZ1', [ qw(build) ]); 13 | 14 | is($result->error, undef, 'No errors'); 15 | is($result->exit_code, 0, "dzil would have exited 0"); 16 | 17 | ok( 18 | (grep { $_ eq '[DZ] writing archive to DZ1-0.001.tar.gz' } 19 | @{ $result->log_messages }), 20 | "we logged the archive-creation", 21 | ); 22 | 23 | ## SIMPLE TEST WITH DZIL TESTER 24 | require Dist::Zilla::Tester; 25 | my $tester = Dist::Zilla::Tester->from_config( 26 | { dist_root => 'corpus/dist/DZT' }, 27 | { 28 | add_files => { 'source/dist.ini' => simple_ini('@Classic') }, 29 | } 30 | ); 31 | 32 | $tester->build; 33 | 34 | ok( 35 | (grep { $_->{message} =~ m<^\[DZ\]\s> } @{ $tester->chrome->logger->events }), 36 | "we have at least some expected log content", 37 | ); 38 | 39 | use YAML::Tiny; 40 | my $yaml = YAML::Tiny->read($tester->built_in->child('META.yml')); 41 | my $meta = $yaml->[0]; 42 | 43 | like($meta->{generated_by}, qr{Dist::Zilla}, "powered by... ROBOT DINOSAUR"); 44 | 45 | done_testing; 46 | -------------------------------------------------------------------------------- /t/tester-local-plugins.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More 0.88; 5 | use Dist::Zilla::Tester; 6 | use Test::DZil; 7 | use Test::Fatal; 8 | 9 | my $tzil; 10 | is( 11 | exception { 12 | $tzil = Builder->from_config( 13 | { dist_root => 'does-not-exist' }, 14 | { 15 | add_files => { 16 | 'source/dist.ini' => simple_ini( 17 | [ GatherDir => ], 18 | [ MetaJSON => ], 19 | [ '=inc::MyMetadata' ], 20 | ), 21 | 'source/inc/MyMetadata.pm' => <chrome->logger->set_debug(1); 33 | $tzil->build; 34 | }, 35 | undef, 36 | q{config does not blow up with "Required plugin inc::MyMetadata isn't installed."}, 37 | ); 38 | 39 | done_testing; 40 | -------------------------------------------------------------------------------- /t/tester-sort.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Test::More 0.88; 5 | use Test::DZil; 6 | 7 | my @pass_one = split /\n/, simple_ini(); 8 | my @pass_two = split /\n/, simple_ini(); 9 | 10 | is_deeply(\@pass_one, \@pass_two, "Multiple calls to simple_ini are in the same order"); 11 | 12 | done_testing; 13 | -------------------------------------------------------------------------------- /t/tester.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Archive::Tar; 5 | use Test::More 0.88; 6 | use Test::DZil; 7 | 8 | my $tzil = Builder->from_config( 9 | { dist_root => 'corpus/dist/DZT' }, 10 | { add_files => { 11 | 'source/zero' => '', 12 | 'source/dist.ini' => simple_ini({ 13 | name => 'DZT', 14 | }, 'GatherDir', 'MakeMaker', 'FakeRelease') 15 | }, 16 | }, 17 | ); 18 | 19 | $tzil->release; 20 | 21 | is($tzil->VERSION, Dist::Zilla->VERSION, "zilla tester VERSION"); 22 | 23 | my $basename = $tzil->dist_basename; 24 | my $tarball = $tzil->archive_filename; 25 | 26 | $tarball = $tzil->built_in->parent->child('source')->child($tarball); 27 | $tarball = Archive::Tar->new($tarball->stringify); 28 | 29 | my $makefile_pl = File::Spec::Unix->catfile($basename, 'Makefile.PL'); 30 | 31 | ok( 32 | $tarball->contains_file( $makefile_pl ), 33 | "Makefile.PL is located at the root of a Test-built archive", 34 | ); 35 | 36 | my ($file) = $tarball->get_files( $makefile_pl ); 37 | 38 | like($file->get_content, qr{ExtUtils}, "the file contains the real content"); 39 | 40 | my $zero_byte = File::Spec::Unix->catfile($basename, 'zero'); 41 | 42 | my ($zero_byte_file) = $tarball->get_files( $zero_byte ); 43 | 44 | is($zero_byte_file->get_content, "", "zero byte file is empty"); 45 | 46 | my $tzil2 = Builder->from_config( 47 | { dist_root => 'corpus/dist/DZT' }, 48 | { add_files => { 49 | 'source/zero' => '', 50 | 'source/dist.ini' => simple_ini({ 51 | name => 'DZT', 52 | }, 'GatherDir', 'MakeMaker', 'FakeRelease') 53 | }, 54 | }, 55 | ); 56 | 57 | $tzil2->test; 58 | ok((grep { /all's well/ } @{ $tzil2->log_messages }), 59 | "tester can run the test method"); 60 | 61 | done_testing; 62 | -------------------------------------------------------------------------------- /t/util.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use Test::More; 4 | 5 | use Dist::Zilla::Util; 6 | 7 | sub abstract_from_string { 8 | my ($str) = @_; 9 | my $e = Dist::Zilla::Util::PEA->_new; 10 | $e->parse_string_document($str); 11 | return $e->{abstract}; 12 | } 13 | 14 | { 15 | my $pod = <<'EOP'; 16 | =head1 NAME 17 | 18 | Term::ReadLine - Perl interface to various C packages. 19 | If no real package is found, substitutes stubs instead of basic functions. 20 | 21 | 22 | =head1 SYNOPSIS 23 | 24 | =cut 25 | 26 | # ABSTRACT: Decoy 27 | 28 | EOP 29 | 30 | is abstract_from_string($pod), 'Perl interface to various C packages. If no real package is found, substitutes stubs instead of basic functions.'; 31 | } 32 | 33 | { 34 | my $pod = <<'EOP'; 35 | =head1 NAME 36 | 37 | Search::Dict, look - search for key in dictionary file 38 | 39 | =head1 SYNOPSIS 40 | EOP 41 | 42 | is abstract_from_string($pod), 'search for key in dictionary file'; 43 | } 44 | 45 | { 46 | my $pod = <<'EOP'; 47 | # ABSTRACT: Do stuff 48 | 49 | =head1 NAME 50 | 51 | Search::Dict - decoy 52 | 53 | =head1 SYNOPSIS 54 | EOP 55 | 56 | is abstract_from_string($pod), 'Do stuff'; 57 | } 58 | 59 | 60 | { 61 | my $pod = <<'EOP'; 62 | =head1 NAME 63 | 64 | retropan - Makes a historic minicpan E<9203> E<#9203> E E E E E 65 | 66 | =head1 SYNOPSIS 67 | EOP 68 | 69 | is abstract_from_string($pod), "Makes a historic minicpan \x{23f3} E<#9203> \x{ff} > < | /"; 70 | } 71 | 72 | { 73 | my $pod = qq{ 74 | =head1 NAME 75 | 76 | pound - latin1 \xa3 77 | 78 | =head1 SYNOPSIS 79 | }; 80 | 81 | is abstract_from_string($pod), "latin1 \xa3"; 82 | } 83 | 84 | { 85 | my $pod = qq{ 86 | =encoding utf8 87 | 88 | =head1 NAME 89 | 90 | pound - utf8 \xc2\xa3 91 | 92 | =head1 SYNOPSIS 93 | }; 94 | 95 | is abstract_from_string($pod), "utf8 \xa3"; 96 | } 97 | 98 | 99 | done_testing; 100 | -------------------------------------------------------------------------------- /todo/CHECKLIST-testing.mkdn: -------------------------------------------------------------------------------- 1 | # METHODS OF Dist::Zilla - these are actually really important (and hard?) 2 | 3 | * find_files 4 | * build, build_in 5 | * ensure_built_in 6 | * build_archive 7 | * test 8 | * release 9 | * install 10 | * clean 11 | 12 | # COMMANDS IN Dist::Zilla::App - should stop being interesting as overhauled 13 | 14 | * Dist::Zilla::App::Command 15 | * Dist::Zilla::App::Command::build 16 | * Dist::Zilla::App::Command::clean 17 | * Dist::Zilla::App::Command::install 18 | * Dist::Zilla::App::Command::new 19 | * Dist::Zilla::App::Command::release 20 | * Dist::Zilla::App::Command::run 21 | * Dist::Zilla::App::Command::smoke 22 | * Dist::Zilla::App::Command::test 23 | 24 | # CONFIG STUFF - don't bother until assembly overhaul happens 25 | 26 | Dist::Zilla::Config 27 | Dist::Zilla::Config::Finder 28 | Dist::Zilla::Config::Perl 29 | 30 | # FILE CLASSES - probably tested sufficiently by testing plugins 31 | 32 | Dist::Zilla::File::FromCode 33 | Dist::Zilla::File::InMemory 34 | Dist::Zilla::File::OnDisk 35 | 36 | # PLUGINS 37 | 38 | * Dist::Zilla::Plugin::BumpVersion - not worth testing, doomed to be replaced 39 | 40 | * Dist::Zilla::Plugin::InlineFiles - exercised by other plugins 41 | * Dist::Zilla::Plugin::UploadToCPAN - difficult to test 42 | 43 | # PREREQ HANDLING 44 | Dist::Zilla::Prereqs 45 | 46 | # MISC 47 | Dist::Zilla::Tester 48 | Dist::Zilla::Types 49 | Dist::Zilla::Util 50 | Dist::Zilla::Util::MVPAssembler 51 | -------------------------------------------------------------------------------- /todo/command-plugins.mkdn: -------------------------------------------------------------------------------- 1 | 2 | # COMMAND PLUGIN PROTOCOL 3 | 4 | Right now, we just load all the available plugins via App::Cmd. This is 5 | probably going to be a pain, in the future. There should be a way to mitigate 6 | an overabundance of command plugins. One option is that only the "core" ones 7 | are loaded unless you have ~/.dzil/config.ini with: 8 | 9 | [!newcommand] 10 | 11 | -------------------------------------------------------------------------------- /todo/config-arg-prefix.mkdn: -------------------------------------------------------------------------------- 1 | 2 | # CONFIG ARG PREFIX RESERVATIONS 3 | 4 | 1. All config arg names that start with [a-z] are reserved for the plugin. 5 | 6 | 2. All config arg names that start with - are reserved for the plugin. 7 | 8 | 3. All config arg names that start with : are reserved for Dist::Zilla. 9 | 10 | 4. All config arg names that start with = are prohibited and are used internall 11 | for things like plugin_name (?) 12 | 13 | This will let us say: 14 | 15 | [Plugin] 16 | :version = 1.23 17 | 18 | ...which will then assert: Plugin->VERSION(1.23) 19 | 20 | The first two rules are already more or less in place for things like the 21 | Prereq plugin. It might be cool to make it easy for plugin authors to get at 22 | the two sets of args (-x and x) in their BUILDARGS or something. Possibly a 23 | Plugin-role-provided method to partition the args. 24 | 25 | We should also try to set aside the :-args as early as possible, so they're 26 | never available during plugin init without really digging. This would be 27 | similar to the way in which -args are not provided to generators in 28 | Sub::Exporter. 29 | 30 | ## TODO 31 | 32 | Think about applying the same rules to plugin names. For example, in the 33 | future virtual plugins could be created with names like :Blorgle that do... 34 | stuff. 35 | 36 | -------------------------------------------------------------------------------- /todo/delay-core-attrs.mkdn: -------------------------------------------------------------------------------- 1 | 2 | # DELAY CORE ATTRIBUTE INIT 3 | 4 | We might want something like $zilla->name to come from some plugin that 5 | converts from main_module, or yadda yadda. This will allow 6 | register-on-the-fly of plugins because we can construct the Zilla before we 7 | know all its required attribute values. 8 | 9 | We'll probably mark those values as LazyRequired and SetOnce. 10 | 11 | ## ATTRIBUTES TO FIX, IN ORDER: 12 | 13 | * main_module, name -- interdependent 14 | 15 | * abstract 16 | 17 | * version - it's unique and should be simplified 18 | * copyright_{holder,year} - should come from a plugin somehow, too 19 | * license 20 | * authors 21 | 22 | * root? 23 | -------------------------------------------------------------------------------- /todo/external-core-attr.mkdn: -------------------------------------------------------------------------------- 1 | 2 | # EXTERNALIZE CORE ATTRIBUTES 3 | 4 | Right now you can't initialize a Zilla without a few attributes like name, 5 | author, etc. These should be autodetectable, meaning they should be able to 6 | wait until plugin initialization is complete -- or at least underway. (...but 7 | probably until it's complete. It should be possible, for example, to defer 8 | decision on name and version until FileGather-ing is done.) 9 | 10 | ## STRATEGY? 11 | 12 | I think what I want is some simple attribute traits: 13 | 14 | has name => ( 15 | ... 16 | traits => [ qw(WORM Demanded) ], 17 | ); 18 | 19 | WORM is what it sounds like. Once set, the value cannot be changed. The 20 | writer throws if the predicate returns true. 21 | 22 | Demanded means that the accessor is fatal if the predicate is false. 23 | 24 | Together, it means you *must initialize* the value before reading it, and you 25 | *must not* try to change it once initialized. 26 | -------------------------------------------------------------------------------- /todo/version-from-prev.mkdn: -------------------------------------------------------------------------------- 1 | 2 | # NEXT VERSION FROM PREVIOUS VERSION 3 | 4 | Sort of like BumpVersion, but with pluggable version-finding and -bumping. 5 | 6 | Ævar wrote something like this, and it should be cored after being rewritten to 7 | use plugin-by-name finding and some other future dzilisms. 8 | -------------------------------------------------------------------------------- /todo/vfs-for-files.mkdn: -------------------------------------------------------------------------------- 1 | 2 | # VIRTUAL FILESYSTEM TO REPLACE "FILES" ARRAY 3 | 4 | Right now, files are simple objects stored in an array. This is nice and 5 | simple, but also a bit of a mess. It allows duplicate filenames forces us to 6 | use regex to find files in a given directory, and so on. Instead, we should 7 | use Path::Resolver (or something) to build a simple virtual filesystem. 8 | 9 | Then we could have filename changes detect conflicts immediately, we could have 10 | $file->replace_with( $other_file ), and other nice improvements. 11 | -------------------------------------------------------------------------------- /todo/xs-improvement.mkdn: -------------------------------------------------------------------------------- 1 | 2 | # XS AUTHORING 3 | 4 | First order of business: ask the XS authors what would help beyond the 5 | now-released `dzil run`. 6 | --------------------------------------------------------------------------------