Skip to content

Commit

Permalink
explain how config filenames are generated
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 24, 2012
1 parent 063ec7e commit 09354d0
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 41 deletions.
6 changes: 4 additions & 2 deletions lib/Mojolicious/Plugin/Charset.pm
Expand Up @@ -31,8 +31,10 @@ Mojolicious::Plugin::Charset - Charset plugin
=head1 DESCRIPTION
L<Mojolicious::Plugin::Charset> is a plugin to easily set the default charset
and encoding on all layers of L<Mojolicious>. The code of this plugin is a
good example for learning to build new plugins, you're welcome to fork it.
and encoding on all layers of L<Mojolicious>.
The code of this plugin is a good example for learning to build new plugins,
you're welcome to fork it.
=head1 OPTIONS
Expand Down
17 changes: 11 additions & 6 deletions lib/Mojolicious/Plugin/Config.pm
Expand Up @@ -106,11 +106,16 @@ Mojolicious::Plugin::Config - Perl-ish configuration plugin
=head1 DESCRIPTION
L<Mojolicious::Plugin::Config> is a Perl-ish configuration plugin. The
application object can be accessed via C<$app> or the C<app> function. You can
extend the normal configuration file C<myapp.conf> with C<mode> specific ones
like C<myapp.$mode.conf>. The code of this plugin is a good example for
learning to build new plugins, you're welcome to fork it.
L<Mojolicious::Plugin::Config> is a Perl-ish configuration plugin.
The application object can be accessed via C<$app> or the C<app> function. You
can extend the normal configuration file C<myapp.conf> with C<mode> specific
ones like C<myapp.$mode.conf>. A default configuration filename will be
generated by decamelizing the application class with
L<Mojo::Util/"decamelize"> or from the application filename.
The code of this plugin is a good example for learning to build new plugins,
you're welcome to fork it.
=head1 OPTIONS
Expand All @@ -128,7 +133,7 @@ Default configuration, making configuration files optional.
# Mojolicious::Lite
plugin Config => {ext => 'stuff'};
File extension for generated configuration file names, defaults to C<conf>.
File extension for generated configuration filenames, defaults to C<conf>.
=head2 C<file>
Expand Down
7 changes: 4 additions & 3 deletions lib/Mojolicious/Plugin/DefaultHelpers.pm
Expand Up @@ -135,9 +135,10 @@ Mojolicious::Plugin::DefaultHelpers - Default helpers plugin
=head1 DESCRIPTION
L<Mojolicious::Plugin::DefaultHelpers> is a collection of renderer helpers for
L<Mojolicious>. This is a core plugin, that means it is always enabled and its
code a good example for learning to build new plugins, you're welcome to fork
it.
L<Mojolicious>.
This is a core plugin, that means it is always enabled and its code a good
example for learning to build new plugins, you're welcome to fork it.
=head1 HELPERS
Expand Down
7 changes: 4 additions & 3 deletions lib/Mojolicious/Plugin/EPLRenderer.pm
Expand Up @@ -93,9 +93,10 @@ Mojolicious::Plugin::EPLRenderer - Embedded Perl Lite renderer plugin
=head1 DESCRIPTION
L<Mojolicious::Plugin::EPLRenderer> is a renderer for C<epl> templates. C<epl>
templates are pretty much just raw L<Mojo::Template>. This is a core plugin,
that means it is always enabled and its code a good example for learning to
build new plugins, you're welcome to fork it.
templates are pretty much just raw L<Mojo::Template>.
This is a core plugin, that means it is always enabled and its code a good
example for learning to build new plugins, you're welcome to fork it.
=head1 METHODS
Expand Down
9 changes: 4 additions & 5 deletions lib/Mojolicious/Plugin/EPRenderer.pm
Expand Up @@ -90,15 +90,14 @@ Mojolicious::Plugin::EPRenderer - Embedded Perl renderer plugin
L<Mojolicious::Plugin::EPRenderer> is a renderer for C<ep> templates.
=head1 TEMPLATES
C<ep> or C<Embedded Perl> is a simple template format where you embed perl
code into documents. It is based on L<Mojo::Template>, but extends it with
some convenient syntax sugar designed specifically for L<Mojolicious>. It
supports L<Mojolicious> template helpers and exposes the stash directly as
Perl variables. This is a core plugin, that means it is always enabled and its
code a good example for learning to build new plugins, you're welcome to fork
it.
Perl variables.
This is a core plugin, that means it is always enabled and its code a good
example for learning to build new plugins, you're welcome to fork it.
=head1 OPTIONS
Expand Down
6 changes: 4 additions & 2 deletions lib/Mojolicious/Plugin/HeaderCondition.pm
Expand Up @@ -69,8 +69,10 @@ Mojolicious::Plugin::HeaderCondition - Header condition plugin
=head1 DESCRIPTION
L<Mojolicious::Plugin::HeaderCondition> is a routes condition for header based
routes. This is a core plugin, that means it is always enabled and its code a
good example for learning to build new plugins, you're welcome to fork it.
routes.
This is a core plugin, that means it is always enabled and its code a good
example for learning to build new plugins, you're welcome to fork it.
=head1 METHODS
Expand Down
6 changes: 4 additions & 2 deletions lib/Mojolicious/Plugin/I18N.pm
Expand Up @@ -106,8 +106,7 @@ Mojolicious::Plugin::I18N - Internationalization plugin
L<Mojolicious::Plugin::I18N> adds L<Locale::Maketext> support to
L<Mojolicious>. All you have to do besides using this plugin is to add as many
lexicon classes as you need. Languages can usually be detected automatically
from the C<Accept-Languages> request header. The code of this plugin is a good
example for learning to build new plugins, you're welcome to fork it.
from the C<Accept-Languages> request header.
This plugin can save a lot of typing, since it will generate the following
code by default.
Expand All @@ -124,6 +123,9 @@ Namespace and default language of generated code are affected by their
respective options. The default lexicon class will only be generated if it
doesn't already exist.
The code of this plugin is a good example for learning to build new plugins,
you're welcome to fork it.
=head1 OPTIONS
L<Mojolicious::Plugin::I18N> supports the following options.
Expand Down
13 changes: 9 additions & 4 deletions lib/Mojolicious/Plugin/JSONConfig.pm
Expand Up @@ -67,10 +67,15 @@ Mojolicious::Plugin::JSONConfig - JSON configuration plugin
=head1 DESCRIPTION
L<Mojolicious::Plugin::JSONConfig> is a JSON configuration plugin that
preprocesses it's input with L<Mojo::Template>. The application object can be
accessed via C<$app> or the C<app> function. You can extend the normal config
file C<myapp.json> with C<mode> specific ones like C<myapp.$mode.json>. The
code of this plugin is a good example for learning to build new plugins,
preprocesses it's input with L<Mojo::Template>.
The application object can be accessed via C<$app> or the C<app> function. You
can extend the normal config file C<myapp.json> with C<mode> specific ones
like C<myapp.$mode.json>. A default configuration filename will be generated
by decamelizing the application class with L<Mojo::Util/"decamelize"> or from
the application filename.
The code of this plugin is a good example for learning to build new plugins,
you're welcome to fork it.
=head1 OPTIONS
Expand Down
6 changes: 4 additions & 2 deletions lib/Mojolicious/Plugin/Mount.pm
Expand Up @@ -54,8 +54,10 @@ Mojolicious::Plugin::Mount - Application mount plugin
=head1 DESCRIPTION
L<Mojolicious::Plugin::Mount> is a plugin that allows you to mount whole
L<Mojolicious> applications. The code of this plugin is a good example for
learning to build new plugins, you're welcome to fork it.
L<Mojolicious> applications.
The code of this plugin is a good example for learning to build new plugins,
you're welcome to fork it.
=head1 METHODS
Expand Down
1 change: 1 addition & 0 deletions lib/Mojolicious/Plugin/PODRenderer.pm
Expand Up @@ -160,6 +160,7 @@ Mojolicious::Plugin::PODRenderer - POD renderer plugin
=head1 DESCRIPTION
L<Mojolicious::Plugin::PODRenderer> is a renderer for true Perl hackers, rawr!
The code of this plugin is a good example for learning to build new plugins,
you're welcome to fork it.
Expand Down
7 changes: 4 additions & 3 deletions lib/Mojolicious/Plugin/PoweredBy.pm
Expand Up @@ -33,9 +33,10 @@ Mojolicious::Plugin::PoweredBy - Powered by plugin
=head1 DESCRIPTION
L<Mojolicious::Plugin::PoweredBy> is a plugin that adds an C<X-Powered-By>
header which defaults to C<Mojolicious (Perl)>. This is a core plugin, that
means it is always enabled and its code a good example for learning to build
new plugins, you're welcome to fork it.
header which defaults to C<Mojolicious (Perl)>.
This is a core plugin, that means it is always enabled and its code a good
example for learning to build new plugins, you're welcome to fork it.
=head1 OPTIONS
Expand Down
7 changes: 4 additions & 3 deletions lib/Mojolicious/Plugin/RequestTimer.pm
Expand Up @@ -62,9 +62,10 @@ Mojolicious::Plugin::RequestTimer - Request timer plugin
=head1 DESCRIPTION
L<Mojolicious::Plugin::RequestTimer> is a plugin to gather and log request
timing information. This is a core plugin, that means it is always enabled and
its code a good example for learning to build new plugins, you're welcome to
fork it.
timing information.
This is a core plugin, that means it is always enabled and its code a good
example for learning to build new plugins, you're welcome to fork it.
=head1 METHODS
Expand Down
7 changes: 4 additions & 3 deletions lib/Mojolicious/Plugin/TagHelpers.pm
Expand Up @@ -301,9 +301,7 @@ Mojolicious::Plugin::TagHelpers - Tag helpers plugin
=head1 DESCRIPTION
L<Mojolicious::Plugin::TagHelpers> is a collection of HTML5 tag helpers for
L<Mojolicious>. This is a core plugin, that means it is always enabled and its
code a good example for learning how to build new plugins, you're welcome to
fork it.
L<Mojolicious>.
Most form helpers can automatically pick up previous input values and will
show them as default. You can also use
Expand All @@ -315,6 +313,9 @@ necessary attributes always be generated automatically.
<%= radio_button country => 'france' %> France
<%= radio_button country => 'uk' %> UK
This is a core plugin, that means it is always enabled and its code a good
example for learning how to build new plugins, you're welcome to fork it.
=head1 HELPERS
L<Mojolicious::Plugin::TagHelpers> implements the following helpers.
Expand Down
6 changes: 3 additions & 3 deletions t/mojo/template.t
Expand Up @@ -1039,7 +1039,7 @@ $mt = Mojo::Template->new;
$file = catfile(splitdir($FindBin::Bin), qw(lib exception.mt));
$output = $mt->render_file($file);
isa_ok $output, 'Mojo::Exception', 'right exception';
like $output->message, qr/exception\.mt line 2/, 'message contains file name';
like $output->message, qr/exception\.mt line 2/, 'message contains filename';
is $output->lines_before->[0]->[0], 1, 'right number';
is $output->lines_before->[0]->[1], 'test', 'right line';
is $output->line->[0], 2, 'right number';
Expand All @@ -1052,7 +1052,7 @@ like "$output", qr/exception\.mt line 2/, 'right result';
$mt = Mojo::Template->new;
$output = $mt->name('foo.mt')->render_file($file);
isa_ok $output, 'Mojo::Exception', 'right exception';
like $output->message, qr/foo\.mt line 2/, 'message contains file name';
like $output->message, qr/foo\.mt line 2/, 'message contains filename';
is $output->lines_before->[0]->[0], 1, 'right number';
is $output->lines_before->[0]->[1], 'test', 'right line';
is $output->line->[0], 2, 'right number';
Expand All @@ -1068,7 +1068,7 @@ my $file2 = catfile $dir, 'test1.mt';
$output = $mt->render_file_to_file($file, $file2);
ok !-e $file2, 'file has not been rendered';
isa_ok $output, 'Mojo::Exception', 'right exception';
like $output->message, qr/exception\.mt line 2/, 'message contains file name';
like $output->message, qr/exception\.mt line 2/, 'message contains filename';
is $output->lines_before->[0]->[0], 1, 'right number';
is $output->lines_before->[0]->[1], 'test', 'right line';
is $output->line->[0], 2, 'right number';
Expand Down

0 comments on commit 09354d0

Please sign in to comment.