1package Minilla::CLI::Build; 2use strict; 3use warnings; 4use utf8; 5 6use File::Path qw(rmtree mkpath); 7use File::Spec; 8 9use Minilla::Project; 10use Minilla::WorkDir; 11use Minilla::Logger; 12use Minilla::Util qw(parse_options); 13 14sub run { 15 my ($class, @args) = @_; 16 17 my $test = 1; 18 parse_options( 19 \@args, 20 'test!' => \$test, 21 ); 22 23 my $project = Minilla::Project->new(); 24 $project->regenerate_files(); 25 unless ($project->validate()) { 26 return; 27 } 28 29 my $dst = File::Spec->rel2abs(sprintf("%s-%s", $project->dist_name, $project->version)); 30 31 # generate project directory 32 infof("Create %s\n", $dst); 33 rmtree($dst); 34 mkpath($dst); 35 my $work_dir = Minilla::WorkDir->new(project => $project, dir => $dst, cleanup => 0); 36 $work_dir->build(); 37} 38 391; 40__END__ 41 42=head1 NAME 43 44Minilla::CLI::Build - Build dist directory 45 46=head1 SYNOPSIS 47 48 % minil build 49 50=head1 DESCRIPTION 51 52TBD 53