Newer Older
101 lines | 2.123kb
copy gitweblite soruce code
root authored on 2012-11-23
1
package Mojolicious::Command::generate::lite_app;
upgraded Mojolicious to v3.7...
Yuki Kimoto authored on 2013-01-28
2
use Mojo::Base 'Mojolicious::Command';
copy gitweblite soruce code
root authored on 2012-11-23
3

            
4
has description => "Generate Mojolicious::Lite application.\n";
5
has usage       => "usage: $0 generate lite_app [NAME]\n";
6

            
7
sub run {
8
  my ($self, $name) = @_;
9
  $name ||= 'myapp.pl';
10
  $self->render_to_rel_file('liteapp', $name);
11
  $self->chmod_file($name, 0744);
12
}
13

            
14
1;
15
__DATA__
16

            
17
@@ liteapp
18
#!/usr/bin/env perl
19
use Mojolicious::Lite;
20

            
21
# Documentation browser under "/perldoc"
22
plugin 'PODRenderer';
23

            
24
get '/' => sub {
25
  my $self = shift;
26
  $self->render('index');
27
};
28

            
29
app->start;
30
<% %>__DATA__
31

            
32
<% %>@@ index.html.ep
33
%% layout 'default';
34
%% title 'Welcome';
35
Welcome to the Mojolicious real-time web framework!
36

            
37
<% %>@@ layouts/default.html.ep
38
<!DOCTYPE html>
39
<html>
40
  <head><title><%%= title %></title></head>
41
  <body><%%= content %></body>
42
</html>
43

            
44
__END__
update Mojolicious to 4.57
Yuki Kimoto authored on 2013-12-02
45

            
46
=encoding utf8
47

            
copy gitweblite soruce code
root authored on 2012-11-23
48
=head1 NAME
49

            
50
Mojolicious::Command::generate::lite_app - Lite app generator command
51

            
52
=head1 SYNOPSIS
53

            
54
  use Mojolicious::Command::generate::lite_app;
55

            
56
  my $app = Mojolicious::Command::generate::lite_app->new;
57
  $app->run(@ARGV);
58

            
59
=head1 DESCRIPTION
60

            
61
L<Mojolicious::Command::generate::lite_app> generate fully functional
62
L<Mojolicious::Lite> applications.
63

            
upgraded Mojolicious to v3.7...
Yuki Kimoto authored on 2013-01-28
64
This is a core command, that means it is always enabled and its code a good
65
example for learning to build new commands, you're welcome to fork it.
66

            
copy gitweblite soruce code
root authored on 2012-11-23
67
=head1 ATTRIBUTES
68

            
69
L<Mojolicious::Command::generate::lite_app> inherits all attributes from
upgraded Mojolicious to v3.7...
Yuki Kimoto authored on 2013-01-28
70
L<Mojolicious::Command> and implements the following new ones.
copy gitweblite soruce code
root authored on 2012-11-23
71

            
update Mojolicious and added...
Yuki Kimoto authored on 2013-03-20
72
=head2 description
copy gitweblite soruce code
root authored on 2012-11-23
73

            
74
  my $description = $app->description;
75
  $app            = $app->description('Foo!');
76

            
77
Short description of this command, used for the command list.
78

            
update Mojolicious and added...
Yuki Kimoto authored on 2013-03-20
79
=head2 usage
copy gitweblite soruce code
root authored on 2012-11-23
80

            
81
  my $usage = $app->usage;
82
  $app      = $app->usage('Foo!');
83

            
84
Usage information for this command, used for the help screen.
85

            
86
=head1 METHODS
87

            
88
L<Mojolicious::Command::generate::lite_app> inherits all methods from
upgraded Mojolicious to v3.7...
Yuki Kimoto authored on 2013-01-28
89
L<Mojolicious::Command> and implements the following new ones.
copy gitweblite soruce code
root authored on 2012-11-23
90

            
update Mojolicious and added...
Yuki Kimoto authored on 2013-03-20
91
=head2 run
copy gitweblite soruce code
root authored on 2012-11-23
92

            
93
  $app->run(@ARGV);
94

            
95
Run this command.
96

            
97
=head1 SEE ALSO
98

            
99
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.
100

            
101
=cut