1package Minilla::CLI::Release; 2use strict; 3use warnings; 4use utf8; 5use ExtUtils::MakeMaker qw(prompt); 6 7use Minilla::Util qw(edit_file require_optional parse_options); 8use Minilla::WorkDir; 9use Minilla::Logger; 10use Minilla::Project; 11 12sub run { 13 my ($self, @args) = @_; 14 15 my $opts = { 16 test => 1, 17 trial => 0, 18 dry_run => 0, 19 }; 20 parse_options( 21 \@args, 22 'test!' => \$opts->{test}, 23 'trial!' => \$opts->{trial}, 24 'dry-run!' => \$opts->{dry_run}, 25 'pause-config=s' => \$opts->{pause_config}, 26 ); 27 28 my $project = Minilla::Project->new(); 29 unless ($project->validate()) { 30 return; 31 } 32 33 my @steps = qw( 34 CheckUntrackedFiles 35 CheckOrigin 36 BumpVersion 37 CheckChanges 38 RegenerateFiles 39 RunHooks 40 DistTest 41 MakeDist 42 43 UploadToCPAN 44 45 RewriteChanges 46 Commit 47 Tag 48 ); 49 my @klasses; 50 # Load all step classes. 51 for (@steps) { 52 my $klass = "Minilla::Release::$_"; 53 if (eval "require ${klass}; 1") { 54 push @klasses, $klass; 55 $klass->init() if $klass->can('init'); 56 } else { 57 errorf("Error while loading %s: %s\n", $_, $@); 58 } 59 } 60 # And run all steps. 61 for my $klass (@klasses) { 62 $klass->run($project, $opts); 63 } 64} 65 661; 67__END__ 68 69=head1 NAME 70 71Minilla::CLI::Release - Release the module to CPAN! 72 73=head1 SYNOPSIS 74 75 % minil release 76 77 --no-test Do not run test scripts 78 --trial Trial release 79 --dry-run Dry run mode 80 --pause-config Path to a CPAN::Uploader configuration file 81 82=head1 DESCRIPTION 83 84This sub-command release the module to CPAN. 85 86=head1 ENVIRONMENT VARIABLES 87 88=over 4 89 90=item FAKE_RELEASE 91 92 > FAKE_RELEASE=1 minil release 93 94If this is your first conversion to Minilla and want to make sure you're not going to mess CPAN with a bad archive when something goes wrong, you can run the release command with FAKE_RELEASE environment variable. This will run all the other release process, except the UploadToCPAN step. 95 96Note, this runs C<< git tag >> and C<< git push >>. 97 98=back 99