rjbs/dist-zilla — pull request #132 by hartzell (2012-12-03 22:48:43+00:00)
Title: Sketch of code to maintain cpanfile in project dir via listdeps command

Hi Ricardo,

I'm generally interested in the stable CPAN/DPAN problem and hired Jeff Thalhammer to build Pinto while I was at Genentech. He presented it at a recent SF.pm meeting and Miyagawa sat in the front row comparing it to Carton, convincing me that I should go and get to know carton better.

I was noodling around with it and realized that I could have carton pull down, install and stash my dependencies using something like

carton install `dzil listdeps`

In the interested of learning more about Carton I decided that it would be more elegant if I could do

dzil listdeps | carton install

(that way I don't need to worry about the size of the command line, etc.... ).

Along the way I discovered that installing from the command line had been removed and that one now need to use a cpanfile. While I'm capable of editing the cpanfile I'd prefer to have dzil manage it for me (one less opportunity to screw things up).

I found your CPANFile plugin but it's not useful for my goal of maintaining the carton.lock file and tarball stash. In order to do what I want I need the cpanfile at the project top level.

These two commits (whoops, git is *not* easy, your YAPC talk not withstanding...) add an option to the listdeps command to write out a cpanfile in the project dir. They pull your code out of the CPANFile plugin into a Dist::Zilla::Util::CPANfile.pm, update your plugin to use the shared copy and then wire a bit of code into the listdeps command.

This lets me do installs and stash the carton.lock file and tarballs in the repos. with everything else.

I'm asking for feedback, not offering this up as a finished thought. A couple of questions:

* Are you generally open to maintaining a cpanfile at the top level?
* Would it be better done as another subcommand (dzil cpanfile --update) or is it ok in listdeps?
Can a plugin add a new command or does it need to get wired in (I'm sure I can dig in and
figure this out...)?
* How could I change my code to fit in better? More/different tests?

Once the basics are in place I'd like to look at merging an existing cpanfile with the results of a listdeps crawl (there is some merge code in CPAN::Meta::Prereqs (or somewhere around there) that would be a start.

Thanks,

g.