| 1 | package Mojolicious::Command::Author::generate::dockerfile; | ||||||||||
| 2 | 1 | ▶ | use Mojo::Base 'Mojolicious::Command'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 1 | ▶ | use Mojo::File qw(path); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | has description => 'Generate "Dockerfile"'; | |||||||||
| 7 | 1 | ▶ | has usage => sub { shift->extract_usage }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | sub run { | ||||||||
|
Subroutine
run: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 10 | 1 | my $self = shift; | |||||||||
| 11 | 1 | my $name = $self->app->moniker; | |||||||||
| 12 | 1 | ▶ | my $exe = $ENV{MOJO_EXE} ? path($ENV{MOJO_EXE})->to_rel($self->app->home)->to_string : "script/$name"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | 1 | $self->render_to_rel_file('dockerfile', 'Dockerfile', {name => $name, cmd => "./$exe prefork"}); | |||||||||
| 14 | } | ||||||||||
| 15 | |||||||||||
| 16 | 1 | 1; | |||||||||
| 17 | |||||||||||
| 18 | =encoding utf8 | ||||||||||
| 19 | |||||||||||
| 20 | =head1 NAME | ||||||||||
| 21 | |||||||||||
| 22 | Mojolicious::Command::Author::generate::dockerfile - Dockerfile generator command | ||||||||||
| 23 | |||||||||||
| 24 | =head1 SYNOPSIS | ||||||||||
| 25 | |||||||||||
| 26 | Usage: APPLICATION generate dockerfile [OPTIONS] | ||||||||||
| 27 | |||||||||||
| 28 | ./myapp.pl generate dockerfile | ||||||||||
| 29 | ./script/my_app generate dockerfile | ||||||||||
| 30 | |||||||||||
| 31 | Options: | ||||||||||
| 32 | -h, --help Show this summary of available options | ||||||||||
| 33 | |||||||||||
| 34 | =head1 DESCRIPTION | ||||||||||
| 35 | |||||||||||
| 36 | L<Mojolicious::Command::Author::generate::dockerfile> generates C<Dockerfile> for applications. | ||||||||||
| 37 | |||||||||||
| 38 | This is a core command, that means it is always enabled and its code a good example for learning to build new commands, | ||||||||||
| 39 | you're welcome to fork it. | ||||||||||
| 40 | |||||||||||
| 41 | See L<Mojolicious::Commands/"COMMANDS"> for a list of commands that are available by default. | ||||||||||
| 42 | |||||||||||
| 43 | =head1 ATTRIBUTES | ||||||||||
| 44 | |||||||||||
| 45 | L<Mojolicious::Command::Author::generate::dockerfile> inherits all attributes from L<Mojolicious::Command> and | ||||||||||
| 46 | implements the following new ones. | ||||||||||
| 47 | |||||||||||
| 48 | =head2 description | ||||||||||
| 49 | |||||||||||
| 50 | my $description = $dockerfile->description; | ||||||||||
| 51 | $dockerfile = $dockerfile->description('Foo'); | ||||||||||
| 52 | |||||||||||
| 53 | Short description of this command, used for the command list. | ||||||||||
| 54 | |||||||||||
| 55 | =head2 usage | ||||||||||
| 56 | |||||||||||
| 57 | my $usage = $dockerfile->usage; | ||||||||||
| 58 | $dockerfile = $dockerfile->usage('Foo'); | ||||||||||
| 59 | |||||||||||
| 60 | Usage information for this command, used for the help screen. | ||||||||||
| 61 | |||||||||||
| 62 | =head1 METHODS | ||||||||||
| 63 | |||||||||||
| 64 | L<Mojolicious::Command::Author::generate::dockerfile> inherits all methods from L<Mojolicious::Command> and implements | ||||||||||
| 65 | the following new ones. | ||||||||||
| 66 | |||||||||||
| 67 | =head2 run | ||||||||||
| 68 | |||||||||||
| 69 | $dockerfile->run(@ARGV); | ||||||||||
| 70 | |||||||||||
| 71 | Run this command. | ||||||||||
| 72 | |||||||||||
| 73 | =head1 SEE ALSO | ||||||||||
| 74 | |||||||||||
| 75 | L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>. | ||||||||||
| 76 | |||||||||||
| 77 | =cut | ||||||||||
| 78 | |||||||||||
| 79 | __DATA__ | ||||||||||