1package Minilla::CLI::Dist;
2use strict;
3use warnings;
4use utf8;
5
6use File::Spec::Functions qw(catfile);
7use File::Basename qw(basename);
8use File::Copy qw(copy);
9
10use Minilla::Project;
11use Minilla::Util qw(check_git parse_options);
12
13sub run {
14    my ($self, @args) = @_;
15
16    my $test = 1;
17
18    check_git;
19
20    parse_options(
21        \@args,
22        'test!' => \$test,
23    );
24
25    my $project = Minilla::Project->new();
26    unless ($project->validate()) {
27        return;
28    }
29    my $work_dir = $project->work_dir;
30    if ($test) {
31        local $ENV{RELEASE_TESTING} = 1;
32        $work_dir->dist_test();
33    }
34    my $tar = $work_dir->dist();
35    my $dst = catfile($project->dir, basename($tar));
36    copy($tar, $dst);
37}
38
391;
40__END__
41
42=head1 NAME
43
44Minilla::CLI::Dist - Make tar ball distribution
45
46=head1 SYNOPSIS
47
48    % minil dist
49
50=head1 DESCRIPTION
51
52This sub-command makes distribution tar ball.
53
54