Dist::Zilla

59
Dist::Zilla raaaaaaaaar!

description

Dist::Zilla is a tool for writing less crap and more code when building CPAN distributions.

Transcript of Dist::Zilla

Page 1: Dist::Zilla

Dist::Zillaraaaaaaaaar!

Page 2: Dist::Zilla

you @ cpan . org

This talk is about your life as a CPAN author.

Page 3: Dist::Zilla

CPAN == Dists

The CPAN is just a bunch of dists (distributions).

Page 4: Dist::Zilla

YourApp-1.0.tar.gz isa Dist

and a distribution is just an archive file

Page 5: Dist::Zilla

dists contain files

Page 6: Dist::Zilla

~/code/YourApp$ find ../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

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

Page 7: Dist::Zilla

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

Page 8: Dist::Zilla

Module::Starter

Page 9: Dist::Zilla

Module::StarterSUCKS!

Page 10: Dist::Zilla

only gets you to a starting point

Page 11: Dist::Zilla

can’t rebuild from templates post facto

Page 12: Dist::Zilla

can’t add files to your dist

Page 13: Dist::Zilla

no good for files that need to be rebuilt a lot

Page 14: Dist::Zilla

Module::Install

Page 15: Dist::Zilla

generates some files when running ‘make’

Page 16: Dist::Zilla

Makefile.PL

takes the usually short Makefile.PL

Page 17: Dist::Zilla

Makefile.PL

makes it slightly smaller

Page 18: Dist::Zilla

Module::Install

Page 19: Dist::Zilla

Module::InstallSUCKS!

Page 20: Dist::Zilla

relies on ExtUtils::MakeMaker

Page 21: Dist::Zilla

relies on ExtUtils::MakeMakerSUCKS

!

Page 22: Dist::Zilla

puts insane complexity on user’s computer

Page 23: Dist::Zilla

bundles scary, versioned code in the dist

Page 24: Dist::Zilla

when bugs are fixed, everybody re-releases

Page 25: Dist::Zilla

...to review...

Page 26: Dist::Zilla

writing code == fun

Page 27: Dist::Zilla

writing =head1 LICENSE

NOT FUN

Page 28: Dist::Zilla

Dist::Zillaraaaaaaaaar!

Page 29: Dist::Zilla

~/code/YourApp$ find ../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

So, back to this list of files....

Page 30: Dist::Zilla

~/code/YourApp$ find .

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

Let’s get rid of all the crap

Page 31: Dist::Zilla

~/code/YourApp$ find .

dist.conf

./lib/YourApp.pm

./lib/YourApp/Reticulator.pm

./lib/YourApp/Util/mtfnpy.pm

./lib/YourApp/Xyzzy.pm

./t/unit-tests.t

and replace it with a little config for Dist::Zilla

Page 32: Dist::Zilla

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.

method that_method { ... }

=head1 AUTHOR

Margo Yapp <[email protected]>

=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;

Here’s a .pm file

Page 33: Dist::Zilla

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.

method that_method { ... }

=head1 AUTHOR

Margo Yapp <[email protected]>

=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;

The =name section is annoying.

Page 34: Dist::Zilla

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.

method that_method { ... }

=head1 AUTHOR

Margo Yapp <[email protected]>

=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;

We’ll replace it with a comment.

Page 35: Dist::Zilla

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.

method that_method { ... }

=head1 AUTHOR

Margo Yapp <[email protected]>

=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;

The =version section is redundant.

Page 36: Dist::Zilla

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.

method that_method { ... }

=head1 AUTHOR

Margo Yapp <[email protected]>

=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;

Drop it.

Page 37: Dist::Zilla

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.

method that_method { ... }

=head1 AUTHOR

Margo Yapp <[email protected]>

=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;

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

Page 38: Dist::Zilla

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.

method that_method { ... }

=head1 AUTHOR

Margo Yapp <[email protected]>

=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;

our overarching METHOD section is dumb

Page 39: Dist::Zilla

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 AUTHOR

Margo Yapp <[email protected]>

=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;

let’s just use =method for them all

Page 40: Dist::Zilla

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 AUTHOR

Margo Yapp <[email protected]>

=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;

Repeating the author everywhere is annoying, too.

Page 41: Dist::Zilla

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;

Drop it, use author info found in DZ config.

Page 42: Dist::Zilla

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;

The license is gigantic! Ugh!

Page 43: Dist::Zilla

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 { ... }

1;

Drop it.

Page 44: Dist::Zilla

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 { ... }

1;

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

Page 45: Dist::Zilla

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 { ... }

1;

And is about half Perl.

Page 46: Dist::Zilla

the CLI interface

Page 47: Dist::Zilla

dzil new

the CLI interface

Page 48: Dist::Zilla

dzil new

dzil test

the CLI interface

Page 49: Dist::Zilla

dzil new

dzil test

dzil build

the CLI interface

Page 50: Dist::Zilla

dzil new

dzil test

dzil build

dzil release

the CLI interface

Page 51: Dist::Zilla

CPAN::Uploader

Pod::Weaver

Pod::Eventual

Software::License

String::RewritePrefix

Config::INI::MVP::Reader

Mixin::Linewise

Data::Section

spin-off modules

String::Flogger Pod::Elemental

lots of spin-off modules

Page 52: Dist::Zilla

lots of prereqs

Page 53: Dist::Zilla

...but that’s okay...

Page 54: Dist::Zilla

dzil replaces “make dist”

Page 55: Dist::Zilla

...and the dist is boring

Page 56: Dist::Zilla

plain old Makefile.PL(or Build.PL)

Page 57: Dist::Zilla

users don’t notice that you used Dist::Zilla

Page 58: Dist::Zilla

they just notice how productive you are

Page 59: Dist::Zilla

Dist::Zillaraaaaaaaaar!