| 1 | package Mojolicious::Command::Author::generate::callbackery_app; | ||
| 2 | |||
| 3 | use Mojo::Base 'Mojolicious::Command::Author::generate::automake_app'; | ||
| 4 | use File::Basename qw(basename dirname); | ||
| 5 | use Mojo::Util qw(class_to_file class_to_path); | ||
| 6 | use Mojo::File; | ||
| 7 | |||
| 8 | use POSIX qw(strftime); | ||
| 9 | use Cwd 'getcwd'; | ||
| 10 | use File::Spec::Functions qw(catdir catfile); | ||
| 11 | our $VERSION = '0.7.4'; | ||
| 12 | has description => 'Generate Callbackery web application with Automake'; | ||
| 13 | has usage => sub { shift->extract_usage }; | ||
| 14 | |||
| 15 | has defaultName => 'MyCallbackeryApp'; | ||
| 16 | has package => 'callbackery'; | ||
| 17 | |||
| 18 | sub file { | ||
| 19 | my $self = shift; | ||
| 20 | |||
| 21 | # Configure Main Dir | ||
| 22 | return { | ||
| 23 | 'configure.ac' => 'configure.ac', | ||
| 24 | 'bootstrap' => 'bootstrap', | ||
| 25 | 'cpanfile' => 'cpanfile', | ||
| 26 | 'VERSION' => 'VERSION', | ||
| 27 | 'README.md' => 'README.md', | ||
| 28 | 'AUTHORS' => 'AUTHORS', | ||
| 29 | '.gitignore' => '.gitignore', | ||
| 30 | '.perlcritic' => '.perlcritic', | ||
| 31 | '.github/workflows/unit-tests.yaml' => '.github/workflows/unit-tests.yaml', | ||
| 32 | 'LICENSE' => 'LICENSE', | ||
| 33 | 'COPYRIGHT' => 'COPYRIGHT', | ||
| 34 | 'CHANGES' => 'CHANGES', | ||
| 35 | 'Makefile.am' => 'Makefile.am', | ||
| 36 | 'bin/Makefile.am' => 'bin/Makefile.am', | ||
| 37 | 'thirdparty/Makefile.am' => 'thirdparty/Makefile.am', | ||
| 38 | 'etc/Makefile.am' => 'etc/Makefile.am', | ||
| 39 | 'etc/app.dist.yaml' => 'etc/'.$self->filename.'.dist.yaml', | ||
| 40 | 'bin/app.pl' => 'bin/'.$self->filename.'.pl', | ||
| 41 | 'bin/source-mode.sh' => 'bin/'.$self->filename.'-source-mode.sh', | ||
| 42 | 'lib/App.pm' => 'lib/'.$self->class_path, | ||
| 43 | 'lib/Makefile.am' => 'lib/Makefile.am', | ||
| 44 | 'lib/App/GuiPlugin/Song.pm' => 'lib/'.$self->class.'/GuiPlugin/Song.pm', | ||
| 45 | 'lib/App/GuiPlugin/SongForm.pm' => 'lib/'.$self->class.'/GuiPlugin/SongForm.pm', | ||
| 46 | 'frontend/Makefile.am' => 'frontend/Makefile.am', | ||
| 47 | 'frontend/Manifest.json' => 'frontend/Manifest.json', | ||
| 48 | 'frontend/compile.json' => 'frontend/compile.json', | ||
| 49 | 'frontend/compile.js' => 'frontend/compile.js', | ||
| 50 | 'frontend/package.json' => 'frontend/package.json', | ||
| 51 | 'frontend/source/boot/index.html' => 'frontend/source/boot/index.html', | ||
| 52 | 'frontend/source/class/app/Application.js' => 'frontend/source/class/'.$self->class_file.'/Application.js', | ||
| 53 | 'frontend/source/class/app/__init__.js' => 'frontend/source/class/'.$self->class_file.'/__init__.js', | ||
| 54 | 'frontend/source/class/app/theme/Theme.js' => 'frontend/source/class/'.$self->class_file.'/theme/Theme.js', | ||
| 55 | 't/basic.t' => 't/basic.t', | ||
| 56 | }; | ||
| 57 | } | ||
| 58 | |||
| 59 | sub finalize { | ||
| 60 | my $self = shift; | ||
| 61 | my $name = $self->filename; | ||
| 62 | $self->chmod_rel_file("$name/bin/".$name."-source-mode.sh", 0755); | ||
| 63 | $self->create_rel_dir("$name/frontend/source/resource/$name"); | ||
| 64 | $self->create_rel_dir("$name/frontend/source/translation"); | ||
| 65 | $self->SUPER::finalize($name); | ||
| 66 | } | ||
| 67 | |||
| 68 | |||
| 69 | has search_path => sub { | ||
| 70 | my $self = shift; | ||
| 71 | my $path = $self->SUPER::search_path(); | ||
| 72 | my $src = $INC{class_to_path __PACKAGE__}; | ||
| 73 | return [ dirname($src).'/'.basename($src,'.pm').'/', @$path ]; | ||
| 74 | }; | ||
| 75 | |||
| 76 | 1; | ||
| 77 | |||
| 78 | =encoding utf8 | ||
| 79 | |||
| 80 | =head1 NAME | ||
| 81 | |||
| 82 | Mojolicious::Command::Author::generate::calbackery_app - Callbackery App generator command | ||
| 83 | |||
| 84 | =head1 SYNOPSIS | ||
| 85 | |||
| 86 | Usage: mojo generate callbackery_app [OPTIONS] [NAME] | ||
| 87 | |||
| 88 | mojo generate callbackery_app | ||
| 89 | mojo generate callbackery_app [/full/path/]TestApp | ||
| 90 | |||
| 91 | Options: | ||
| 92 | -h, --help Show this summary of available options | ||
| 93 | |||
| 94 | =head1 DESCRIPTION | ||
| 95 | |||
| 96 | L<Mojolicious::Command::Authos::generate::callbackery_app> generates application directory structures for fully functional L<Callbackery> applications. | ||
| 97 | |||
| 98 | =head1 SEE ALSO | ||
| 99 | |||
| 100 | L<Callbackery>, L<https://www.gnu.org/software/automake/>. | ||
| 101 | |||
| 102 | =cut |