Dist::Zilla - Maximum Overkill for CPAN Distributions

Post on 18-Jan-2015

1620 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

Transcript

Dist::Zillaraaaaaaaaar!

Tuesday, December 14, 2010

What is Dist::Zilla?

Tuesday, December 14, 2010

This talk is about your life as a CPAN author.

AWESOME

Tuesday, December 14, 2010

Any Questions?

Tuesday, December 14, 2010

RJBS

Tuesday, December 14, 2010

ME!!!

also awesome!

I give away almost all my useful software on CPAN

RJBS- cake and pie (and doughnuts)

Tuesday, December 14, 2010

ME!!!

also awesome!

I give away almost all my useful software on CPAN

RJBS- cake and pie (and doughnuts)

- cocktails and beer

Tuesday, December 14, 2010

ME!!!

also awesome!

I give away almost all my useful software on CPAN

RJBS- cake and pie (and doughnuts)

- cocktails and beer

- shooting zombies

Tuesday, December 14, 2010

ME!!!

also awesome!

I give away almost all my useful software on CPAN

RJBS- cake and pie (and doughnuts)

- cocktails and beer

- shooting zombies

- giving away useful software

Tuesday, December 14, 2010

ME!!!

also awesome!

I give away almost all my useful software on CPAN

CPAN!

Tuesday, December 14, 2010

CPAN is awesome, too. We all know that.

being a CPAN author is hard!let’s go gemming!

Tuesday, December 14, 2010

who here is a CPAN author?

what makes it a pain? let’s talk about it

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

Tuesday, December 14, 2010

this is all the crap in your working copy where you write this distmaking all these is a boring pain in the butt

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

Tuesday, December 14, 2010

and a bunch of semi-structured data is in Makefile.PL

ExtUtils::MakeMaker

Tuesday, December 14, 2010

WriteMakefile( NAME => ‘YourApp’, AUTHOR => ‘You <rjbs@cpan.org>’, VERSION_FROM => ‘lib/YourApp.pm’, ABSTRACT_FROM => ‘lib/YourApp.pm’, LICENSE => ‘perl’, PREREQ_PM => { ‘Lingua::EN::Inflect’ => 1.86, ‘Sub::Override’ => 0.07, ‘Test::More’ => 0, },);

Tuesday, December 14, 2010

Then you have to put a bunch more information describing your distribution into Makefile.PL, if you’re using ExtUtils::MakeMaker.

WriteMakefile( NAME => ‘YourApp’, AUTHOR => ‘You <rjbs@cpan.org>’, VERSION_FROM => ‘lib/YourApp.pm’, ABSTRACT_FROM => ‘lib/YourApp.pm’, LICENSE => ‘perl’, PREREQ_PM => { ‘Lingua::EN::Inflect’ => 1.86, ‘Sub::Override’ => 0.07, ‘Test::More’ => 0, }, (eval { ExtUtils::MakeMaker->VERSION(6.46) } ? (META_MERGE => { resources => { Repository => ‘...’ } }) : ()),);

Tuesday, December 14, 2010

If you want to add more metadata, you start having to use really gross constructions, trying to avoid backcompat issues. In part, this is because even the data only needed for installing the dist (like your respository) is present and executed on the installing user’s computer.

Module::Install

Tuesday, December 14, 2010

use inc::Module::Install;all_from(‘lib/YourApp.pm’);

requires(‘Lingua::EN::Inflect’ => 1.86);requires(‘Sub::Override’ => 0.07);requires(‘Test::More’ => 0);

repository(...);

WriteAll();

Tuesday, December 14, 2010

Module::Install lets you write this, instead. It does a lot more auto-detection by reading your Pod and trying to parse its meaning. Then it runs on the installer’s machine and uses the machinery of ExtUtils::MakeMaker to build a plain old Makefile for installation. So, it bundles itself with each dist that uses it, and it’s still beholden to the version of EUMM installed on the user’s machine. Still, it saves quite a lot of time in dealing with stupid crap in Makefile.PL.

It just means you need to write a bunch of other stuff for it to scan, like:

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

Tuesday, December 14, 2010

You need to have your author in the main module to be detected, and the license. Then, because you want to keep the data in each library, you have to keep that same data in each Perl module. Copy and paste!

Module::Starter

Tuesday, December 14, 2010

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/boilerplate.t

./t/pod-coverage.t

./t/pod.t

Tuesday, December 14, 2010

It can create all these files, Pod and all, *for* you so you don’t have to go through this drudgery. Unfortunately, some of these files include stuff that you’re going to need to customize, replace, or delete immediately upon starting the dist. So many people used Module::Starter and then left in garbage data that we added a test to help stop them from doing so...

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/boilerplate.t

./t/pod-coverage.t

./t/pod.t

Tuesday, December 14, 2010

It looks for the stock content you should get rid of. Once this test passes, you are expected to delete it. Why have that boilerplate crap at all?

Worse, what if one of your boilerplate files has a typo? Or what if you want to change your default pod-coverage setup? You need to go update every file in all of your distributions, because that file actually exists in your source repository.

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

Tuesday, December 14, 2010

Dist::Zilla tries to solve all these problems: don’t repeat yourself; don’t store what you can compute; rely on the installing user having only the bare minimum of tools needed to install, and don’t bundle more if you can help it.

It also tries hard to be easy to test, so that when you write extensions to DZ, they’re easy to write and easy to test. EUMM, M:I, and Starter are not.

I’m going to show you how to eliminate as much of this as you can so there’s less to write, less to update, less to diff, and less to think about in general.

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

Tuesday, December 14, 2010

(files we can get rid of entirely)

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./LICENSE

Tuesday, December 14, 2010

(files we can get rid of entirely)

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./LICENSE

./MANIFEST.SKIP

Tuesday, December 14, 2010

(files we can get rid of entirely)

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

Tuesday, December 14, 2010

(files we can get rid of entirely)

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

Tuesday, December 14, 2010

(files we can get rid of entirely)

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

Tuesday, December 14, 2010

(files we can get rid of entirely)

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

Tuesday, December 14, 2010

(files we can get rid of entirely)

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

Tuesday, December 14, 2010

(files we can get rid of entirely)

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

Tuesday, December 14, 2010

(files we can get rid of entirely)

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

Tuesday, December 14, 2010

(files we can get rid of entirely)

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

Tuesday, December 14, 2010

(files we can get rid of entirely)

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

Tuesday, December 14, 2010

(files we can get rid of entirely)

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

Tuesday, December 14, 2010

(files from which we can prune lots of non-essential content)

...and it can do more than just reduce the on-disk content...

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./Changes

Tuesday, December 14, 2010

(files from which we can prune lots of non-essential content)

...and it can do more than just reduce the on-disk content...

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./Changes

./lib/YourApp.pm

Tuesday, December 14, 2010

(files from which we can prune lots of non-essential content)

...and it can do more than just reduce the on-disk content...

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./Changes

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

Tuesday, December 14, 2010

(files from which we can prune lots of non-essential content)

...and it can do more than just reduce the on-disk content...

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./Changes

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

Tuesday, December 14, 2010

(files from which we can prune lots of non-essential content)

...and it can do more than just reduce the on-disk content...

./Changes

./LICENSE

./MANIFEST.SKIP

./Makefile.PL

./README

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

./t/pod-coverage.t

./t/pod.t

./Changes

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

Tuesday, December 14, 2010

(files from which we can prune lots of non-essential content)

...and it can do more than just reduce the on-disk content...

Tuesday, December 14, 2010

...and that’s why

- updating version numbers

Tuesday, December 14, 2010

...and that’s why

- updating version numbers

- uploading to CPAN

Tuesday, December 14, 2010

...and that’s why

- updating version numbers

- uploading to CPAN

- committing, tagging releases in Git (VCS)

Tuesday, December 14, 2010

...and that’s why

- updating version numbers

- uploading to CPAN

- committing, tagging releases in Git (VCS)

- determine prerequisites

Tuesday, December 14, 2010

...and that’s why

- updating version numbers

- uploading to CPAN

- committing, tagging releases in Git (VCS)

- determine prerequisites

- other stuff that is totally boring

Tuesday, December 14, 2010

...and that’s why

Dist::Zilla isAWESOME

Tuesday, December 14, 2010

...because it frees you up to do things that are much more interesting than distribution building, like...

Tuesday, December 14, 2010

- eating cake and pie (and donuts)

Tuesday, December 14, 2010

- eating cake and pie (and donuts)

- drinking cocktails and beer

Tuesday, December 14, 2010

- eating cake and pie (and donuts)

- drinking cocktails and beer

- shooting zombies

Tuesday, December 14, 2010

- eating cake and pie (and donuts)

- drinking cocktails and beer

- shooting zombies

- giving away useful software

Tuesday, December 14, 2010

Dist::Zilla isHUGE

Tuesday, December 14, 2010

106 prereqs

Tuesday, December 14, 2010

106 prereqs(and counting)

Tuesday, December 14, 2010

Tuesday, December 14, 2010

- Dist::Zilla only handles “make dist”

Tuesday, December 14, 2010

- Dist::Zilla only handles “make dist”

- it doesn’t handle “make install”

Tuesday, December 14, 2010

- Dist::Zilla only handles “make dist”

- it doesn’t handle “make install”

- only authors need to install the 106 prereqs

Tuesday, December 14, 2010

- Dist::Zilla only handles “make dist”

- it doesn’t handle “make install”

- only authors need to install the 106 prereqs

- your users don’t see Dist::Zilla

Tuesday, December 14, 2010

- Dist::Zilla only handles “make dist”

- it doesn’t handle “make install”

- only authors need to install the 106 prereqs

- your users don’t see Dist::Zilla

- they just see MakeMaker or Module::Build

Tuesday, December 14, 2010

Dist::Zilla is also Stupid

Tuesday, December 14, 2010

like me!

It keeps its brains in plugins.

Tuesday, December 14, 2010

Almost all of the remainder of this talk is going to be about DZ plugins, because they do all the work. DZ itself just orchestrates the interaction of plugins. When you use Dist::Zilla, you provide it with a configuration file that sets up your plugins.

dist.ini

Tuesday, December 14, 2010

It’s almost always an INI file. INI is a nice simple format, and I’m going to just assume everybody understands it. Here’s a sample dist.ini:

# How Dist::Zilla builds a dist:

prepare;gather_files;prune_files;munge_files;register_prereqs;setup_installer;write_files;finish;

name = Your-Distlicense = Perl_5copyright_holder = J. Fred Bloggs

[GatherDir]include_dotfiles = 1

[PruneCruft][MetaYAML][MakeMaker][TestRelease][ConfirmRelease]

[UploadToCPAN]user = JFBpassword = QwardRules

Tuesday, December 14, 2010

You can do lots of different things in really varied ways, and there are people who use Dist::Zilla with very different workflows to mine.

But I’m going to talk about how I use Dist::Zilla, which by grand coincidence is the one reflected in the tutorial and is probably the most common workflow.

# How Dist::Zilla builds a dist:

prepare;gather_files;prune_files;munge_files;register_prereqs;setup_installer;write_files;finish;

name = Your-Distlicense = Perl_5copyright_holder = J. Fred Bloggs

[GatherDir]include_dotfiles = 1

[PruneCruft][MetaYAML][MakeMaker][TestRelease][ConfirmRelease]

[UploadToCPAN]user = JFBpassword = QwardRules

Tuesday, December 14, 2010

the root section generally describes the dist itself, and is pretty short

# How Dist::Zilla builds a dist:

prepare;gather_files;prune_files;munge_files;register_prereqs;setup_installer;write_files;finish;

name = Your-Distlicense = Perl_5copyright_holder = J. Fred Bloggs

[GatherDir]include_dotfiles = 1

[PruneCruft][MetaYAML][MakeMaker][TestRelease][ConfirmRelease]

[UploadToCPAN]user = JFBpassword = QwardRules

Tuesday, December 14, 2010

here’s a section that defined a plugin, with one option set

# How Dist::Zilla builds a dist:

prepare;gather_files;prune_files;munge_files;register_prereqs;setup_installer;write_files;finish;

name = Your-Distlicense = Perl_5copyright_holder = J. Fred Bloggs

[GatherDir]include_dotfiles = 1

[PruneCruft][MetaYAML][MakeMaker][TestRelease][ConfirmRelease]

[UploadToCPAN]user = JFBpassword = QwardRules

Tuesday, December 14, 2010

and this line sets up a plugin with no args -- the next line is just another plugin

name = Dist-Zillaauthor = Ricardo SIGNES <rjbs@cpan.org>license = Perl_5copyright_holder = Ricardo SIGNES

[@Basic][AutoPrereq][AutoVersion][PkgVersion][MetaConfig][MetaJSON][NextRelease][PodSyntaxTests][Repository][PodWeaver][@Git]

Tuesday, December 14, 2010

RJBS: THESE THREE SLIDES ARE A SPEED RUN; detailed version to follow immediately

name = Dist-Zillaauthor = Ricardo SIGNES <rjbs@cpan.org>license = Perl_5copyright_holder = Ricardo SIGNES

[@Basic][AutoPrereq][AutoVersion][PkgVersion][MetaConfig][MetaJSON][NextRelease][PodSyntaxTests][Repository][PodWeaver][@Git]

Tuesday, December 14, 2010

@Basic means a bundle, and that bundle expands to this:

[GatherDir][PruneCruft][ManifestSkip][MetaYAML][License][Readme][ExtraTests][ExecDir][ShareDir][MakeMaker][Manifest][TestRelease][ConfirmRelease][UploadToCPAN]

Tuesday, December 14, 2010

name = Dist-Zillaauthor = Ricardo SIGNES <rjbs@cpan.org>license = Perl_5copyright_holder = Ricardo SIGNES

[@Basic][AutoPrereq][AutoVersion][PkgVersion][MetaConfig][MetaJSON][NextRelease][PodSyntaxTests][Repository][PodWeaver][@Git]

Tuesday, December 14, 2010

Too much!

Tuesday, December 14, 2010

Tuesday, December 14, 2010

test is just build then “make test”install is just build then “cpan .”release is just build, then cpan-upload (mostly)

dzil build

Tuesday, December 14, 2010

test is just build then “make test”install is just build then “cpan .”release is just build, then cpan-upload (mostly)

dzil build

dzil test

Tuesday, December 14, 2010

test is just build then “make test”install is just build then “cpan .”release is just build, then cpan-upload (mostly)

dzil build

dzil test

dzil install

Tuesday, December 14, 2010

test is just build then “make test”install is just build then “cpan .”release is just build, then cpan-upload (mostly)

dzil build

dzil test

dzil install

dzil release

Tuesday, December 14, 2010

test is just build then “make test”install is just build then “cpan .”release is just build, then cpan-upload (mostly)

How Dist::Zilla Builds

Tuesday, December 14, 2010

this is, obviously, a simplification -- but not as great a simplification as you might think

to make any of these lines do anything useful, you need plugins; plugins contribute to these activities

sub build {

How Dist::Zilla Builds

Tuesday, December 14, 2010

this is, obviously, a simplification -- but not as great a simplification as you might think

to make any of these lines do anything useful, you need plugins; plugins contribute to these activities

sub build { my ($self) = @_;

How Dist::Zilla Builds

Tuesday, December 14, 2010

this is, obviously, a simplification -- but not as great a simplification as you might think

to make any of these lines do anything useful, you need plugins; plugins contribute to these activities

sub build { my ($self) = @_;

my @files = $self->gather_files;

How Dist::Zilla Builds

Tuesday, December 14, 2010

this is, obviously, a simplification -- but not as great a simplification as you might think

to make any of these lines do anything useful, you need plugins; plugins contribute to these activities

sub build { my ($self) = @_;

my @files = $self->gather_files;

$self->munge_files( @files );

How Dist::Zilla Builds

Tuesday, December 14, 2010

this is, obviously, a simplification -- but not as great a simplification as you might think

to make any of these lines do anything useful, you need plugins; plugins contribute to these activities

sub build { my ($self) = @_;

my @files = $self->gather_files;

$self->munge_files( @files );

$self->collect_metadata;

How Dist::Zilla Builds

Tuesday, December 14, 2010

this is, obviously, a simplification -- but not as great a simplification as you might think

to make any of these lines do anything useful, you need plugins; plugins contribute to these activities

sub build { my ($self) = @_;

my @files = $self->gather_files;

$self->munge_files( @files );

$self->collect_metadata;

$self->write_out( @files );

How Dist::Zilla Builds

Tuesday, December 14, 2010

this is, obviously, a simplification -- but not as great a simplification as you might think

to make any of these lines do anything useful, you need plugins; plugins contribute to these activities

sub build { my ($self) = @_;

my @files = $self->gather_files;

$self->munge_files( @files );

$self->collect_metadata;

$self->write_out( @files );}

How Dist::Zilla Builds

Tuesday, December 14, 2010

this is, obviously, a simplification -- but not as great a simplification as you might think

to make any of these lines do anything useful, you need plugins; plugins contribute to these activities

How do you pick plugins?

Tuesday, December 14, 2010

There is no default config.

Tuesday, December 14, 2010

@Basic

Tuesday, December 14, 2010

...but don’t just rush to use @Basic without understanding it. You should understand what DZ is doing so that you can understand what goes wrong, if anything goes wrong -- and something will go wrong.

There is *no* default configuration for Dist::Zilla. The @Basic bundle exists as a useful starting point, but I doubt anybody would use only @Basic. There’s just too much that you can gain by adding on top of it.

[GatherDir][PruneCruft][Manifest][ManifestSkip][MakeMaker][License][Readme][MetaYAML][ExtraTests][ExecDir][ShareDir][TestRelease][ConfirmRelease][UploadToCPAN]

The Basics

Tuesday, December 14, 2010

@Basic’s goal is to do all the stuff almost everyone wants, and to let you delete files you don’t need, but @Basic will *not* touch any of your files on disk.

[GatherDir][PruneCruft][Manifest][ManifestSkip][MakeMaker][License][Readme][MetaYAML][ExtraTests][ExecDir][ShareDir][TestRelease][ConfirmRelease][UploadToCPAN]

MANIFEST

The Basics

Tuesday, December 14, 2010

@Basic’s goal is to do all the stuff almost everyone wants, and to let you delete files you don’t need, but @Basic will *not* touch any of your files on disk.

[GatherDir][PruneCruft][Manifest][ManifestSkip][MakeMaker][License][Readme][MetaYAML][ExtraTests][ExecDir][ShareDir][TestRelease][ConfirmRelease][UploadToCPAN]

MANIFESTMakefile.PL

The Basics

Tuesday, December 14, 2010

@Basic’s goal is to do all the stuff almost everyone wants, and to let you delete files you don’t need, but @Basic will *not* touch any of your files on disk.

[GatherDir][PruneCruft][Manifest][ManifestSkip][MakeMaker][License][Readme][MetaYAML][ExtraTests][ExecDir][ShareDir][TestRelease][ConfirmRelease][UploadToCPAN]

MANIFESTMakefile.PL

LICENSE

The Basics

Tuesday, December 14, 2010

@Basic’s goal is to do all the stuff almost everyone wants, and to let you delete files you don’t need, but @Basic will *not* touch any of your files on disk.

[GatherDir][PruneCruft][Manifest][ManifestSkip][MakeMaker][License][Readme][MetaYAML][ExtraTests][ExecDir][ShareDir][TestRelease][ConfirmRelease][UploadToCPAN]

MANIFESTMakefile.PL

LICENSEREADME

The Basics

Tuesday, December 14, 2010

@Basic’s goal is to do all the stuff almost everyone wants, and to let you delete files you don’t need, but @Basic will *not* touch any of your files on disk.

[GatherDir][PruneCruft][Manifest][ManifestSkip][MakeMaker][License][Readme][MetaYAML][ExtraTests][ExecDir][ShareDir][TestRelease][ConfirmRelease][UploadToCPAN]

MANIFESTMakefile.PL

LICENSEREADME

META.yml

The Basics

Tuesday, December 14, 2010

@Basic’s goal is to do all the stuff almost everyone wants, and to let you delete files you don’t need, but @Basic will *not* touch any of your files on disk.

Cruft Minimizers

Tuesday, December 14, 2010

[PkgVersion]

Cruft Minimizers

Tuesday, December 14, 2010

[PkgVersion][PodSyntaxTests]

Cruft Minimizers

Tuesday, December 14, 2010

[PkgVersion][PodSyntaxTests][PodCoverageTests]

Cruft Minimizers

Tuesday, December 14, 2010

[PkgVersion][PodSyntaxTests][PodCoverageTests][AutoPrereq]

Cruft Minimizers

Tuesday, December 14, 2010

[PkgVersion][PodSyntaxTests][PodCoverageTests][AutoPrereq][AutoVersion]

Cruft Minimizers

Tuesday, December 14, 2010

[PkgVersion][PodSyntaxTests][PodCoverageTests][AutoPrereq][AutoVersion][NextRelease]

Cruft Minimizers

Tuesday, December 14, 2010

[@Git]

[@Subversion]

[@Mercurial]

[@SVK]

Version Control

Tuesday, December 14, 2010

this is a place where it *might* be reasonable to use a bundle when you start

Pod::Weaver

Tuesday, December 14, 2010

package YourApp;

=head1 NAME

YourApp - my awesome app

=head1 VERSION

version 1.001

=cut

our $VERSION = 0.001;

=head1 DESCRIPTION

This app is awesome.

=head1 METHODS

=head2 this_method

This method does stuff.

=cut

method this_method { ... }

=head2 that_method

Also stuff.

=cut

method that_method { ... }

=head1 AUTHOR

Margo Yapp <myapp@example.com>

=head1 LICENSE

Copyright (C) 2008, Margo Yapp.

This is distributed under the terms of the accidental death and dismemberment license and if you redistribuet this document youwill be “accidentally” deathed or dismembered. You have been told.

=cut

1;

Tuesday, December 14, 2010

Here’s a .pm file

package YourApp;

=head1 NAME

YourApp - my awesome app

=head1 VERSION

version 1.001

=cut

our $VERSION = 0.001;

=head1 DESCRIPTION

This app is awesome.

=head1 METHODS

=head2 this_method

This method does stuff.

=cut

method this_method { ... }

=head2 that_method

Also stuff.

=cut

method that_method { ... }

=head1 AUTHOR

Margo Yapp <myapp@example.com>

=head1 LICENSE

Copyright (C) 2008, Margo Yapp.

This is distributed under the terms of the accidental death and dismemberment license and if you redistribuet this document youwill be “accidentally” deathed or dismembered. You have been told.

=cut

1;

Tuesday, December 14, 2010

Here’s a .pm file

package YourApp;

=head1 NAME

YourApp - my awesome app

=head1 VERSION

version 1.001

=cut

our $VERSION = 0.001;

=head1 DESCRIPTION

This app is awesome.

=head1 METHODS

=head2 this_method

This method does stuff.

=cut

method this_method { ... }

=head2 that_method

Also stuff.

=cut

method that_method { ... }

=head1 AUTHOR

Margo Yapp <myapp@example.com>

=head1 LICENSE

Copyright (C) 2008, Margo Yapp.

This is distributed under the terms of the accidental death and dismemberment license and if you redistribuet this document youwill be “accidentally” deathed or dismembered. You have been told.

=cut

1;

Tuesday, December 14, 2010

The =name section is annoying.

package YourApp;# ABSTRACT: my awesome app

=head1 VERSION

version 1.001

=cut

our $VERSION = 0.001;

=head1 DESCRIPTION

This app is awesome.

=head1 METHODS

=head2 this_method

This method does stuff.

=cut

method this_method { ... }

=head2 that_method

Also stuff.

=cut

method that_method { ... }

=head1 AUTHOR

Margo Yapp <myapp@example.com>

=head1 LICENSE

Copyright (C) 2008, Margo Yapp.

This is distributed under the terms of the accidental death and dismemberment license and if you redistribuet this document youwill be “accidentally” deathed or dismembered. You have been told.

=cut

1;

Tuesday, December 14, 2010

We’ll replace it with a comment.

package YourApp;# ABSTRACT: my awesome app

=head1 VERSION

version 1.001

=cut

our $VERSION = 0.001;

=head1 DESCRIPTION

This app is awesome.

=head1 METHODS

=head2 this_method

This method does stuff.

=cut

method this_method { ... }

=head2 that_method

Also stuff.

=cut

method that_method { ... }

=head1 AUTHOR

Margo Yapp <myapp@example.com>

=head1 LICENSE

Copyright (C) 2008, Margo Yapp.

This is distributed under the terms of the accidental death and dismemberment license and if you redistribuet this document youwill be “accidentally” deathed or dismembered. You have been told.

=cut

1;

Tuesday, December 14, 2010

The =version section is redundant.

package YourApp;# ABSTRACT: my awesome app

our $VERSION = 0.001;

=head1 DESCRIPTION

This app is awesome.

=head1 METHODS

=head2 this_method

This method does stuff.

=cut

method this_method { ... }

=head2 that_method

Also stuff.

=cut

method that_method { ... }

=head1 AUTHOR

Margo Yapp <myapp@example.com>

=head1 LICENSE

Copyright (C) 2008, Margo Yapp.

This is distributed under the terms of the accidental death and dismemberment license and if you redistribuet this document youwill be “accidentally” deathed or dismembered. You have been told.

=cut

1;

Tuesday, December 14, 2010

Drop it.

package YourApp;# ABSTRACT: my awesome app

our $VERSION = 0.001;

=head1 DESCRIPTION

This app is awesome.

=head1 METHODS

=head2 this_method

This method does stuff.

=cut

method this_method { ... }

=head2 that_method

Also stuff.

=cut

method that_method { ... }

=head1 AUTHOR

Margo Yapp <myapp@example.com>

=head1 LICENSE

Copyright (C) 2008, Margo Yapp.

This is distributed under the terms of the accidental death and dismemberment license and if you redistribuet this document youwill be “accidentally” deathed or dismembered. You have been told.

=cut

1;

Tuesday, December 14, 2010

Even the $VERSION is redundant, since we want it constant across the dist.

package YourApp;# ABSTRACT: my awesome app

=head1 DESCRIPTION

This app is awesome.

=head1 METHODS

=head2 this_method

This method does stuff.

=cut

method this_method { ... }

=head2 that_method

Also stuff.

=cut

method that_method { ... }

=head1 AUTHOR

Margo Yapp <myapp@example.com>

=head1 LICENSE

Copyright (C) 2008, Margo Yapp.

This is distributed under the terms of the accidental death and dismemberment license and if you redistribuet this document youwill be “accidentally” deathed or dismembered. You have been told.

=cut

1;

Tuesday, December 14, 2010

our overarching METHOD section is dumb

package YourApp;# ABSTRACT: my awesome app

=head1 DESCRIPTION

This app is awesome.

=method this_method

This method does stuff.

=cut

method this_method { ... }

=method that_method

Also stuff.

=cut

method that_method { ... }

=head1 AUTHOR

Margo Yapp <myapp@example.com>

=head1 LICENSE

Copyright (C) 2008, Margo Yapp.

This is distributed under the terms of the accidental death and dismemberment license and if you redistribuet this document youwill be “accidentally” deathed or dismembered. You have been told.

=cut

1;

Tuesday, December 14, 2010

let’s just use =method for them all

package YourApp;# ABSTRACT: my awesome app

=head1 DESCRIPTION

This app is awesome.

=method this_method

This method does stuff.

=cut

method this_method { ... }

=method that_method

Also stuff.

=cut

method that_method { ... }

=head1 AUTHOR

Margo Yapp <myapp@example.com>

=head1 LICENSE

Copyright (C) 2008, Margo Yapp.

This is distributed under the terms of the accidental death and dismemberment license and if you redistribuet this document youwill be “accidentally” deathed or dismembered. You have been told.

=cut

1;

Tuesday, December 14, 2010

Repeating the author everywhere is annoying, too.

package YourApp;# ABSTRACT: my awesome app

=head1 DESCRIPTION

This app is awesome.

=method this_method

This method does stuff.

=cut

method this_method { ... }

=method that_method

Also stuff.

=cut

method that_method { ... }

=head1 LICENSE

Copyright (C) 2008, Margo Yapp.

This is distributed under the terms of the accidental death and dismemberment license and if you redistribuet this document youwill be “accidentally” deathed or dismembered. You have been told.

=cut

1;

Tuesday, December 14, 2010

Drop it, use author info found in DZ config.

package YourApp;# ABSTRACT: my awesome app

=head1 DESCRIPTION

This app is awesome.

=method this_method

This method does stuff.

=cut

method this_method { ... }

=method that_method

Also stuff.

method that_method { ... }

=head1 LICENSE

Copyright (C) 2008, Margo Yapp.

This is distributed under the terms of the accidental death and dismemberment license and if you redistribuet this document youwill be “accidentally” deathed or dismembered. You have been told.

=cut

1;

Tuesday, December 14, 2010

The license is gigantic! Ugh!

package YourApp;# ABSTRACT: my awesome app

=head1 DESCRIPTION

This app is awesome.

=method this_method

This method does stuff.

=cut

method this_method { ... }

=method that_method

Also stuff.

=cut

method that_method { ... }

=cut1;

Tuesday, December 14, 2010

Drop it.

package YourApp;# ABSTRACT: my awesome app

=head1 DESCRIPTION

This app is awesome.

=method this_method

This method does stuff.

=cut

method this_method { ... }

=method that_method

Also stuff.

=cut

method that_method { ... }

1;

Tuesday, December 14, 2010

Now our file is simple, just the unique docs and code it needs. It fits on one legible slide!

package YourApp;# ABSTRACT: my awesome app

=head1 DESCRIPTION

This app is awesome.

=method this_method

This method does stuff.

=cut

method this_method { ... }

=method that_method

Also stuff.

=cut

method that_method { ... }

1;

Tuesday, December 14, 2010

And is about half Perl.

and you get all of that stuff autogenerated by adding this to your dist.ini

[PodWeaver]

Tuesday, December 14, 2010

Converting Your Dist

Tuesday, December 14, 2010

Converting Your Dist

- create dist.ini

Tuesday, December 14, 2010

Converting Your Dist

- create dist.ini

- remove a bunch of files

Tuesday, December 14, 2010

Converting Your Dist

- create dist.ini

- remove a bunch of files

- delete a bunch of stuff from leftover files

Tuesday, December 14, 2010

Converting Your Dist

- create dist.ini

- remove a bunch of files

- delete a bunch of stuff from leftover files

- and Dist::Zooky, too

Tuesday, December 14, 2010

Questions so far?

Tuesday, December 14, 2010

Creating New Dists

Tuesday, December 14, 2010

dzil builddzil testdzil installdzil release

Tuesday, December 14, 2010

so, we already talked about these commands, which all operate on an existing distribution directory to build a fleshed-out CPAN distribution. to mint a brand-new dist, we use...

dzil builddzil testdzil installdzil release

dzil new

Tuesday, December 14, 2010

dzil new!

the big difference is that the first set of commands work on an existing dist, so there’s a dist.ini

we don’t have a dist.ini yet, because there’s no dist dir yet. we need a...

profile.ini

Tuesday, December 14, 2010

this file sets up the plugins that you’ll use to mint a new dist

(don’t worry, if you don’t make one, there *is* default behavior -- but it’s so incredibly simple that you probably don’t want it)

Tuesday, December 14, 2010

to understand how this works, we need to look at how minting works

[GatherDir::Template]

Tuesday, December 14, 2010

to understand how this works, we need to look at how minting works

[GatherDir::Template]root = files

Tuesday, December 14, 2010

to understand how this works, we need to look at how minting works

[GatherDir::Template]root = files

[DistINI]

Tuesday, December 14, 2010

to understand how this works, we need to look at how minting works

[GatherDir::Template]root = files

[DistINI]

[Git::Init]

Tuesday, December 14, 2010

to understand how this works, we need to look at how minting works

How Dist::Zilla Mints

Tuesday, December 14, 2010

sub mint {

How Dist::Zilla Mints

Tuesday, December 14, 2010

sub mint { my ($self) = @_;

How Dist::Zilla Mints

Tuesday, December 14, 2010

sub mint { my ($self) = @_;

my @files = $self->gather_files;

How Dist::Zilla Mints

Tuesday, December 14, 2010

sub mint { my ($self) = @_;

my @files = $self->gather_files;

$self->munge_files( @files );

How Dist::Zilla Mints

Tuesday, December 14, 2010

sub mint { my ($self) = @_;

my @files = $self->gather_files;

$self->munge_files( @files );

$self->make_module( $module );

How Dist::Zilla Mints

Tuesday, December 14, 2010

sub mint { my ($self) = @_;

my @files = $self->gather_files;

$self->munge_files( @files );

$self->make_module( $module );

$self->write_out( @files );

How Dist::Zilla Mints

Tuesday, December 14, 2010

sub mint { my ($self) = @_;

my @files = $self->gather_files;

$self->munge_files( @files );

$self->make_module( $module );

$self->write_out( @files );}

How Dist::Zilla Mints

Tuesday, December 14, 2010

Tuesday, December 14, 2010

see how there’s no root section? We *could* add one, but it would probably be the same across multiple profiles we set up, so we can put this stuff in another location:

[GatherDir::Template]

Tuesday, December 14, 2010

see how there’s no root section? We *could* add one, but it would probably be the same across multiple profiles we set up, so we can put this stuff in another location:

[GatherDir::Template]root = files

Tuesday, December 14, 2010

see how there’s no root section? We *could* add one, but it would probably be the same across multiple profiles we set up, so we can put this stuff in another location:

[GatherDir::Template]root = files

[DistINI]

Tuesday, December 14, 2010

see how there’s no root section? We *could* add one, but it would probably be the same across multiple profiles we set up, so we can put this stuff in another location:

[GatherDir::Template]root = files

[DistINI]

[Git::Init]

Tuesday, December 14, 2010

see how there’s no root section? We *could* add one, but it would probably be the same across multiple profiles we set up, so we can put this stuff in another location:

config.ini

Tuesday, December 14, 2010

global (per-user) configuration

~/.dzil/config.ini

Tuesday, December 14, 2010

[%User]name = Ricardo Signesemail = rjbs@example.org

[%Rights]license_class = Perl_5copyright_holder = Ricardo Signes

[%PAUSE]username = RJBSpassword = PeasAreDelicious

Tuesday, December 14, 2010

these aren’t plugins; global configuration is loaded before we have a Dist::Zilla object to plug into

instead, these are stashes; basically, hunks of data for plugins to look up; they can be shared, generic, referenced by name, etc etc etc

here we see our default author, our default license/legal info, and default PAUSE upload credentials

dzil setup

Tuesday, December 14, 2010

Minting a New Dist

- create config.ini (in ~/.dzil)

- maybe configure or install a profile

- run dzil new

Tuesday, December 14, 2010

Questions so far?

Tuesday, December 14, 2010

Writing Plugins!

Tuesday, December 14, 2010

Writing Plugins is Easy!

Tuesday, December 14, 2010

Writing Plugins is Easy!(and awesome)

Tuesday, December 14, 2010

sub build { my ($self) = @_;

my @files = $self->gather_files;

$self->munge_files( @files );

$self->collect_metadata;

$self->write_out( @files );}

How Dist::Zilla Builds

Tuesday, December 14, 2010

This is what I showed, earlier, as a simplified example of how Dist::Zilla builds stuff. To understand how plugins work, we need to de-simplify a little.

$self->munge_files( @files );

How Dist::Zilla Builds

Tuesday, December 14, 2010

Take this line... what happens is a bit more like this:

my @mungers = grep { $_->does(‘FileMunger’) } $self->plugins;

for my $plugin (@mungers) { $plugin->munge_files( @files );}

How Dist::Zilla Builds

Tuesday, December 14, 2010

we call a method on a bunch of delegates, where the delegates are all of the (undifferentiated) plugins that perform a given rol

package Some::Class;use Moose;with ‘Some::Role’;

$obj->does( $role )

Tuesday, December 14, 2010

LEARN MOOSE

Roles to Make Plugins Go

Tuesday, December 14, 2010

BeforeBuild

Roles to Make Plugins Go

Tuesday, December 14, 2010

BeforeBuildFileGatherer

Roles to Make Plugins Go

Tuesday, December 14, 2010

BeforeBuildFileGathererFilePruner

Roles to Make Plugins Go

Tuesday, December 14, 2010

BeforeBuildFileGathererFilePrunerFileMunger

Roles to Make Plugins Go

Tuesday, December 14, 2010

BeforeBuildFileGathererFilePrunerFileMungerPrereqSource

Roles to Make Plugins Go

Tuesday, December 14, 2010

BeforeBuildFileGathererFilePrunerFileMungerPrereqSourceMetaProvider

Roles to Make Plugins Go

Tuesday, December 14, 2010

BeforeBuildFileGathererFilePrunerFileMungerPrereqSourceMetaProviderAfterBuild

Roles to Make Plugins Go

Tuesday, December 14, 2010

BeforeBuildFileGathererFilePrunerFileMungerPrereqSourceMetaProviderAfterBuild

BeforeArchive

Roles to Make Plugins Go

Tuesday, December 14, 2010

BeforeBuildFileGathererFilePrunerFileMungerPrereqSourceMetaProviderAfterBuild

BeforeArchiveBeforeRelease

Roles to Make Plugins Go

Tuesday, December 14, 2010

BeforeBuildFileGathererFilePrunerFileMungerPrereqSourceMetaProviderAfterBuild

BeforeArchiveBeforeReleaseReleaser

Roles to Make Plugins Go

Tuesday, December 14, 2010

BeforeBuildFileGathererFilePrunerFileMungerPrereqSourceMetaProviderAfterBuild

BeforeArchiveBeforeReleaseReleaserAfterRelease

Roles to Make Plugins Go

Tuesday, December 14, 2010

Let’s write a plugin!

Tuesday, December 14, 2010

BuiltOn

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::BuiltOn;

BuiltOn

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::BuiltOn;use Moose;

BuiltOn

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::BuiltOn;use Moose;with ‘Dist::Zilla::Role::FileGatherer’;

BuiltOn

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::BuiltOn;use Moose;with ‘Dist::Zilla::Role::FileGatherer’;

sub gather_files {

BuiltOn

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::BuiltOn;use Moose;with ‘Dist::Zilla::Role::FileGatherer’;

sub gather_files { my ($self) = @_;

BuiltOn

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::BuiltOn;use Moose;with ‘Dist::Zilla::Role::FileGatherer’;

sub gather_files { my ($self) = @_; my $file = Dist::Zilla::File::InMemory->new({

BuiltOn

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::BuiltOn;use Moose;with ‘Dist::Zilla::Role::FileGatherer’;

sub gather_files { my ($self) = @_; my $file = Dist::Zilla::File::InMemory->new({ name => ‘built-on.txt’,

BuiltOn

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::BuiltOn;use Moose;with ‘Dist::Zilla::Role::FileGatherer’;

sub gather_files { my ($self) = @_; my $file = Dist::Zilla::File::InMemory->new({ name => ‘built-on.txt’, content => scalar `uname -a`,

BuiltOn

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::BuiltOn;use Moose;with ‘Dist::Zilla::Role::FileGatherer’;

sub gather_files { my ($self) = @_; my $file = Dist::Zilla::File::InMemory->new({ name => ‘built-on.txt’, content => scalar `uname -a`, });

BuiltOn

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::BuiltOn;use Moose;with ‘Dist::Zilla::Role::FileGatherer’;

sub gather_files { my ($self) = @_; my $file = Dist::Zilla::File::InMemory->new({ name => ‘built-on.txt’, content => scalar `uname -a`, });

$self->add_file( $file );

BuiltOn

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::BuiltOn;use Moose;with ‘Dist::Zilla::Role::FileGatherer’;

sub gather_files { my ($self) = @_; my $file = Dist::Zilla::File::InMemory->new({ name => ‘built-on.txt’, content => scalar `uname -a`, });

$self->add_file( $file );}

BuiltOn

Tuesday, December 14, 2010

[BuiltOn]

BuiltOn

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::BuiltOn;use Moose;with ‘Dist::Zilla::Role::FileGatherer’;

has filename => ( is => ‘ro’, default => ‘built-on.txt’,);

sub gather_files { my ($self) = @_; my $file = Dist::Zilla::File::InMemory->new({ name => $self->filename, content => scalar `uname -a`, });

$self->add_file( $file );}

Tuesday, December 14, 2010

[BuiltOn]filename = build-host.txt

BuiltOn

Tuesday, December 14, 2010

[BuiltOn]

BuiltOn

Tuesday, December 14, 2010

Let’s write a another!

Tuesday, December 14, 2010

(this will talk about plugin ordering)

AddShebangs

Tuesday, December 14, 2010

...and then just one more...

package Dist::Zilla::Plugin::AddShebangs;

AddShebangs

Tuesday, December 14, 2010

...and then just one more...

package Dist::Zilla::Plugin::AddShebangs;use Moose;

AddShebangs

Tuesday, December 14, 2010

...and then just one more...

package Dist::Zilla::Plugin::AddShebangs;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

AddShebangs

Tuesday, December 14, 2010

...and then just one more...

package Dist::Zilla::Plugin::AddShebangs;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

sub munge_file {

AddShebangs

Tuesday, December 14, 2010

...and then just one more...

package Dist::Zilla::Plugin::AddShebangs;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

sub munge_file { my ($self, $file) = @_;

AddShebangs

Tuesday, December 14, 2010

...and then just one more...

package Dist::Zilla::Plugin::AddShebangs;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

sub munge_file { my ($self, $file) = @_; next unless $file->name =~ /\.pl$/;

AddShebangs

Tuesday, December 14, 2010

...and then just one more...

package Dist::Zilla::Plugin::AddShebangs;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

sub munge_file { my ($self, $file) = @_; next unless $file->name =~ /\.pl$/;

my $content = “#!$^X\n”

AddShebangs

Tuesday, December 14, 2010

...and then just one more...

package Dist::Zilla::Plugin::AddShebangs;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

sub munge_file { my ($self, $file) = @_; next unless $file->name =~ /\.pl$/;

my $content = “#!$^X\n” . $file->content;

AddShebangs

Tuesday, December 14, 2010

...and then just one more...

package Dist::Zilla::Plugin::AddShebangs;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

sub munge_file { my ($self, $file) = @_; next unless $file->name =~ /\.pl$/;

my $content = “#!$^X\n” . $file->content;

$file->content( $content );

AddShebangs

Tuesday, December 14, 2010

...and then just one more...

package Dist::Zilla::Plugin::AddShebangs;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

sub munge_file { my ($self, $file) = @_; next unless $file->name =~ /\.pl$/;

my $content = “#!$^X\n” . $file->content;

$file->content( $content );}

AddShebangs

Tuesday, December 14, 2010

...and then just one more...

AddBlame

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::AddBlame;

AddBlame

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::AddBlame;use Moose;

AddBlame

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::AddBlame;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

AddBlame

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::AddBlame;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

sub munge_file {

AddBlame

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::AddBlame;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

sub munge_file { my ($self, $file) = @_;

AddBlame

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::AddBlame;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

sub munge_file { my ($self, $file) = @_; next unless $file->name =~ /\.p[lm]$/;

AddBlame

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::AddBlame;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

sub munge_file { my ($self, $file) = @_; next unless $file->name =~ /\.p[lm]$/;

my $content = “# BUILD BY $ENV{USER}\n”

AddBlame

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::AddBlame;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

sub munge_file { my ($self, $file) = @_; next unless $file->name =~ /\.p[lm]$/;

my $content = “# BUILD BY $ENV{USER}\n” . $file->content;

AddBlame

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::AddBlame;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

sub munge_file { my ($self, $file) = @_; next unless $file->name =~ /\.p[lm]$/;

my $content = “# BUILD BY $ENV{USER}\n” . $file->content;

$file->content( $content );

AddBlame

Tuesday, December 14, 2010

package Dist::Zilla::Plugin::AddBlame;use Moose;with ‘Dist::Zilla::Role::FileMunger’;

sub munge_file { my ($self, $file) = @_; next unless $file->name =~ /\.p[lm]$/;

my $content = “# BUILD BY $ENV{USER}\n” . $file->content;

$file->content( $content );}

AddBlame

Tuesday, December 14, 2010

[GatherDir][PruneCruft]

Tuesday, December 14, 2010

[GatherDir][PruneCruft][AddShebangs][AddBlame]

Tuesday, December 14, 2010

this is actually a problem

[GatherDir][PruneCruft][AddShebangs][AddBlame]

print “Hello.\n”;

Tuesday, December 14, 2010

If we start with this extremely powerful library file...

[GatherDir][PruneCruft][AddShebangs][AddBlame]

#!/usr/bin/perlprint “Hello.\n”;

Tuesday, December 14, 2010

The shebang gets added, just like we wanted.

[GatherDir][PruneCruft][AddShebangs][AddBlame]

# built by rjbs#!/usr/bin/perlprint “Hello.\n”;

Tuesday, December 14, 2010

then the comment -- meaning the shebang is no good, because it doesn’t start the file

[GatherDir][PruneCruft][AddBlame][AddShebangs]

#!/usr/bin/perl# built by rjbsprint “Hello.\n”;

Tuesday, December 14, 2010

then the comment -- meaning the shebang is no good, because it doesn’t start the file

In Conclusion...

Tuesday, December 14, 2010

Dist::Zilla is..?

Tuesday, December 14, 2010

Dist::Zilla is:

- judges will accept:

- awesome

- huge

- stupid

Tuesday, December 14, 2010

We are Friendly

- irc.perl.org #distzilla

- http://dzil.org/

- mailing list

- http://rt.cpan.org/

Tuesday, December 14, 2010

we will try to answer your questions

Any Questions?

Tuesday, December 14, 2010

Thank you!raaaaaaaaar!

Tuesday, December 14, 2010

top related