File Coverage

lib/Mojolicious/Command/generate/js_url_for_angular.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 15 15 100.0


line stmt bran cond sub pod time code
1             package Mojolicious::Command::generate::js_url_for_angular;
2 1     1   3467 use Mojo::Base 'Mojolicious::Command';
  1         1  
  1         5  
3 1     1   114 use Mojo::Home;
  1         1  
  1         137  
4              
5             our $VERSION = '0.18';
6              
7             has description => <<'EOF';
8             Generate "url_for" function for javasctipt (perldoc Mojolicious::Plugin::JSUrlFor)
9             EOF
10              
11             has usage => <<"EOF";
12             usage: $0 generate js_url_for_angular > \$file
13              
14             \$file - file for saving javascript code
15             For example, you can save it to public/static/url_for.js
16              
17             EOF
18              
19             sub run {
20 1     1 1 33 my ( $self, $filename ) = @_;
21 1         4 binmode(STDOUT, ":utf8");
22             #~ die $self->usage unless $filename;
23              
24 1         4 $self->app->plugin('Mojolicious::Plugin::JSUrlFor::Angular');
25             #~ $self->app->startup();
26 1         26 my $js = $self->app->_js_url_for_code_only;
27 1         35 say $js;
28              
29             #~ $self->write_rel_file( $filename, $js );
30             }
31              
32             1;