line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Command::generate::js_url_for; |
2
|
1
|
|
|
1
|
|
581
|
use Mojo::Base 'Mojolicious::Command'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
3
|
1
|
|
|
1
|
|
104
|
use Mojo::Home; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.17'; |
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 \$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
|
2
|
|
|
2
|
0
|
4638
|
my ( $self, $filename ) = @_; |
21
|
2
|
100
|
|
|
|
8
|
die $self->usage unless $filename; |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
3
|
$self->app->plugin('Mojolicious::Plugin::JSUrlFor'); |
24
|
1
|
|
|
|
|
89
|
my $js = $self->app->_js_url_for_code_only; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
12
|
$self->write_rel_file( $filename, $js ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |