Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

support and encourage camel case plugin names everywhere

  • Loading branch information...
commit 84d75f3ce45aa8af11632325dac33dfb8137df47 1 parent 8811d15
@kraih authored
Showing with 91 additions and 95 deletions.
  1. +8 −8 lib/Mojolicious.pm
  2. +1 −1  lib/Mojolicious/Command/Generate/App.pm
  3. +1 −1  lib/Mojolicious/Command/Generate/LiteApp.pm
  4. +1 −1  lib/Mojolicious/Command/Generate/Makefile.pm
  5. +3 −7 lib/Mojolicious/Command/Generate/Plugin.pm
  6. +1 −1  lib/Mojolicious/Guides/Cookbook.pod
  7. +3 −3 lib/Mojolicious/Guides/Rendering.pod
  8. +3 −3 lib/Mojolicious/Guides/Routing.pod
  9. +1 −1  lib/Mojolicious/Lite.pm
  10. +2 −2 lib/Mojolicious/Plugin/CallbackCondition.pm
  11. +3 −3 lib/Mojolicious/Plugin/Charset.pm
  12. +8 −8 lib/Mojolicious/Plugin/Config.pm
  13. +2 −2 lib/Mojolicious/Plugin/DefaultHelpers.pm
  14. +9 −9 lib/Mojolicious/Plugin/EpRenderer.pm
  15. +3 −3 lib/Mojolicious/Plugin/EplRenderer.pm
  16. +2 −2 lib/Mojolicious/Plugin/HeaderCondition.pm
  17. +5 −5 lib/Mojolicious/Plugin/I18n.pm
  18. +4 −4 lib/Mojolicious/Plugin/JsonConfig.pm
  19. +6 −6 lib/Mojolicious/Plugin/Mount.pm
  20. +9 −9 lib/Mojolicious/Plugin/PodRenderer.pm
  21. +5 −5 lib/Mojolicious/Plugin/PoweredBy.pm
  22. +2 −2 lib/Mojolicious/Plugin/RequestTimer.pm
  23. +2 −2 lib/Mojolicious/Plugin/TagHelpers.pm
  24. +1 −1  t/mojolicious/external/myapp.pl
  25. +1 −1  t/mojolicious/json_config_mode_lite_app.t
  26. +1 −1  t/mojolicious/pod_renderer_lite_app.t
  27. +4 −4 t/mojolicious/twinkle_lite_app.t
View
16 lib/Mojolicious.pm
@@ -92,14 +92,14 @@ sub new {
if -w $home->rel_file('log');
# Load default plugins
- $self->plugin('callback_condition');
- $self->plugin('header_condition');
- $self->plugin('default_helpers');
- $self->plugin('tag_helpers');
- $self->plugin('epl_renderer');
- $self->plugin('ep_renderer');
- $self->plugin('request_timer');
- $self->plugin('powered_by');
+ $self->plugin('CallbackCondition');
+ $self->plugin('HeaderCondition');
+ $self->plugin('DefaultHelpers');
+ $self->plugin('TagHelpers');
+ $self->plugin('EplRenderer');
+ $self->plugin('EpRenderer');
+ $self->plugin('RequestTimer');
+ $self->plugin('PoweredBy');
# Reduced log output outside of development mode
$self->log->level('info') unless $mode eq 'development';
View
2  lib/Mojolicious/Command/Generate/App.pm
@@ -90,7 +90,7 @@ sub startup {
my $self = shift;
# Documentation browser under "/perldoc" (this plugin requires Perl 5.10)
- $self->plugin('pod_renderer');
+ $self->plugin('PodRenderer');
# Routes
my $r = $self->routes;
View
2  lib/Mojolicious/Command/Generate/LiteApp.pm
@@ -29,7 +29,7 @@ __DATA__
use Mojolicious::Lite;
# Documentation browser under "/perldoc" (this plugin requires Perl 5.10)
-plugin 'pod_renderer';
+plugin 'PodRenderer';
get '/welcome' => sub {
my $self = shift;
View
2  lib/Mojolicious/Command/Generate/Makefile.pm
@@ -36,7 +36,7 @@ WriteMakefile(
VERSION_FROM => 'lib/<%= $path %>',
AUTHOR => 'A Good Programmer <nospam@cpan.org>',
EXE_FILES => ['script/<%= $name %>'],
- PREREQ_PM => {'Mojolicious' => '1.78'},
+ PREREQ_PM => {'Mojolicious' => '1.79'},
test => {TESTS => 't/*.t'}
);
View
10 lib/Mojolicious/Command/Generate/Plugin.pm
@@ -17,15 +17,11 @@ EOF
# So I had to hit her with this purse I found."
sub run {
my ($self, $name) = @_;
- $name ||= 'my_plugin';
-
- # Prevent bad plugins
- die qq/Your plugin name has to be snake case, like "my_plugin".\n/
- unless $name =~ /^[a-z_]+$/;
+ $name ||= 'MyPlugin';
# Class
my $class = $name;
- camelize $class;
+ camelize $class if $name =~ /^[a-z]/;
$class = "Mojolicious::Plugin::$class";
my $app = $self->class_to_path($class);
$self->render_to_rel_file('class', "$name/lib/$app", $class, $name);
@@ -120,7 +116,7 @@ WriteMakefile(
NAME => '<%= $class %>',
VERSION_FROM => 'lib/<%= $path %>',
AUTHOR => 'A Good Programmer <nospam@cpan.org>',
- PREREQ_PM => {'Mojolicious' => '1.78'},
+ PREREQ_PM => {'Mojolicious' => '1.79'},
test => {TESTS => 't/*.t'}
);
View
2  lib/Mojolicious/Guides/Cookbook.pod
@@ -551,7 +551,7 @@ get automatically installed with the modules.
# Switch to installable "templates" directory
$self->renderer->root($self->home->rel_dir('templates'));
- $self->plugin('pod_renderer');
+ $self->plugin('PodRenderer');
my $r = $self->routes;
$r->route('/welcome')->to('example#welcome');
View
6 lib/Mojolicious/Guides/Rendering.pod
@@ -581,7 +581,7 @@ The C<register> method will be called when you load the plugin.
use Mojolicious::Lite;
- plugin 'debug_helper';
+ plugin 'DebugHelper';
get '/' => sub {
my $self = shift;
@@ -594,7 +594,7 @@ The C<register> method will be called when you load the plugin.
A skeleton for a full C<CPAN> compatible plugin distribution can be
automatically generated.
- $ mojo generate plugin debug_helper
+ $ mojo generate plugin DebugHelper
And if you have a C<PAUSE> account (which can be requested at
L<http://pause.perl.org>), you are only a few commands away from relasing it
@@ -713,7 +713,7 @@ plugin with a custom configuration.
use Mojolicious::Lite;
- plugin ep_renderer => {
+ plugin EpRenderer => {
name => 'mustache',
template => {
tag_start => '{{',
View
6 lib/Mojolicious/Guides/Routing.pod
@@ -639,7 +639,7 @@ applications.
my $self = shift;
# Plugin
- $self->plugin('werewolf_condition');
+ $self->plugin('WerewolfCondition');
# Routes
my $r = $self->routes;
@@ -699,7 +699,7 @@ self-contained applications under a prefix.
use Mojolicious::Lite;
# Whole application mounted under "/prefix"
- plugin mount => {'/prefix' => '/home/sri/myapp.pl'};
+ plugin Mount => {'/prefix' => '/home/sri/myapp.pl'};
# Normal route
get '/' => sub { shift->render_text('Hello World!') };
@@ -743,7 +743,7 @@ Now just load the plugin and you're done.
my $self = shift;
# Plugin
- $self->plugin('my_embedded_app');
+ $self->plugin('MyEmbeddedApp');
}
1;
View
2  lib/Mojolicious/Lite.pm
@@ -853,7 +853,7 @@ Note that this function is EXPERIMENTAL and might change without warning!
=head2 C<plugin>
- plugin 'something';
+ plugin 'SomeThing';
Alias for L<Mojolicious/"plugin">.
View
4 lib/Mojolicious/Plugin/CallbackCondition.pm
@@ -27,14 +27,14 @@ Mojolicious::Plugin::CallbackCondition - Callback Condition Plugin
=head1 SYNOPSIS
# Mojolicious
- $self->plugin('callback_condition');
+ $self->plugin('CallbackCondition');
$self->routes->route('/:controller/:action')->over(cb => sub {
my ($r, $c, $captures) = @_;
...
});
# Mojolicious::Lite
- plugin 'callback_condition';
+ plugin 'CallbackCondition';
get '/' => (cb => sub {
my ($r, $c, $captures) = @_;
...
View
6 lib/Mojolicious/Plugin/Charset.pm
@@ -38,10 +38,10 @@ Mojolicious::Plugin::Charset - Charset Plugin
=head1 SYNOPSIS
# Mojolicious
- $self->plugin(charset => {charset => 'Shift_JIS'});
+ $self->plugin(Charset => {charset => 'Shift_JIS'});
# Mojolicious::Lite
- plugin charset => {charset => 'Shift_JIS'};
+ plugin Charset => {charset => 'Shift_JIS'};
=head1 DESCRIPTION
@@ -53,7 +53,7 @@ and encoding on all layers of L<Mojolicious>.
=head2 C<charset>
# Mojolicious::Lite
- plugin charset => {charset => 'Shift_JIS'};
+ plugin Charset => {charset => 'Shift_JIS'};
Application charset.
View
16 lib/Mojolicious/Plugin/Config.pm
@@ -114,16 +114,16 @@ Mojolicious::Plugin::Config - Perlish Configuration Plugin
};
# Mojolicious
- my $config = $self->plugin('config');
+ my $config = $self->plugin('Config');
# Mojolicious::Lite
- my $config = plugin 'config';
+ my $config = plugin 'Config';
# Reads myapp.conf by default and puts the parsed version into the stash
my $config = $self->stash('config');
# Everything can be customized with options
- my $config = plugin config => {
+ my $config = plugin Config => {
file => '/etc/myapp.stuff',
stash_key => 'conf'
};
@@ -140,22 +140,22 @@ ones like C<myapp.$mode.conf>.
=head2 C<default>
# Mojolicious::Lite
- plugin config => {default => {foo => 'bar'}};
+ plugin Config => {default => {foo => 'bar'}};
Default configuration.
=head2 C<ext>
# Mojolicious::Lite
- plugin config => {ext => 'stuff'};
+ plugin Config => {ext => 'stuff'};
File extension of config file, defaults to C<conf>.
=head2 C<file>
# Mojolicious::Lite
- plugin config => {file => 'myapp.conf'};
- plugin config => {file => '/etc/foo.stuff'};
+ plugin Config => {file => 'myapp.conf'};
+ plugin Config => {file => '/etc/foo.stuff'};
Configuration file, defaults to the value of the C<MOJO_CONFIG> environment
variable or C<myapp.conf> in the application home directory.
@@ -163,7 +163,7 @@ variable or C<myapp.conf> in the application home directory.
=head2 C<stash_key>
# Mojolicious::Lite
- plugin config => {stash_key => 'conf'};
+ plugin Config => {stash_key => 'conf'};
Configuration stash key.
View
4 lib/Mojolicious/Plugin/DefaultHelpers.pm
@@ -111,10 +111,10 @@ Mojolicious::Plugin::DefaultHelpers - Default Helpers Plugin
=head1 SYNOPSIS
# Mojolicious
- $self->plugin('default_helpers');
+ $self->plugin('DefaultHelpers');
# Mojolicious::Lite
- plugin 'default_helpers';
+ plugin 'DefaultHelpers';
=head1 DESCRIPTION
View
18 lib/Mojolicious/Plugin/EpRenderer.pm
@@ -88,19 +88,19 @@ __END__
=head1 NAME
-Mojolicious::Plugin::EpRenderer - EP Renderer Plugin
+Mojolicious::Plugin::EpRenderer - Embedded Perl Renderer Plugin
=head1 SYNOPSIS
# Mojolicious
- $self->plugin('ep_renderer');
- $self->plugin(ep_renderer => {name => 'foo'});
- $self->plugin(ep_renderer => {template => {line_start => '.'}});
+ $self->plugin('EpRenderer');
+ $self->plugin(EpRenderer => {name => 'foo'});
+ $self->plugin(EpRenderer => {template => {line_start => '.'}});
# Mojolicious::Lite
- plugin 'ep_renderer';
- plugin ep_renderer => {name => 'foo'};
- plugin ep_renderer => {template => {line_start => '.'}};
+ plugin 'EpRenderer';
+ plugin EpRenderer => {name => 'foo'};
+ plugin EpRenderer => {template => {line_start => '.'}};
=head1 DESCRIPTION
@@ -122,14 +122,14 @@ example for learning to build new plugins.
=head2 C<name>
# Mojolicious::Lite
- plugin ep_renderer => {name => 'foo'};
+ plugin EpRenderer => {name => 'foo'};
Handler name.
=head2 C<template>
# Mojolicious::Lite
- plugin ep_renderer => {template => {line_start => '.'}};
+ plugin EpRenderer => {template => {line_start => '.'}};
Template options.
View
6 lib/Mojolicious/Plugin/EplRenderer.pm
@@ -88,15 +88,15 @@ __END__
=head1 NAME
-Mojolicious::Plugin::EplRenderer - EPL Renderer Plugin
+Mojolicious::Plugin::EplRenderer - Embedded Perl Lite Renderer Plugin
=head1 SYNOPSIS
# Mojolicious
- $self->plugin('epl_renderer');
+ $self->plugin('EplRenderer');
# Mojolicious::Lite
- plugin 'epl_renderer';
+ plugin 'EplRenderer';
=head1 DESCRIPTION
View
4 lib/Mojolicious/Plugin/HeaderCondition.pm
@@ -45,12 +45,12 @@ Mojolicious::Plugin::HeaderCondition - Header Condition Plugin
=head1 SYNOPSIS
# Mojolicious
- $self->plugin('header_condition');
+ $self->plugin('HeaderCondition');
$self->routes->route('/:controller/:action')
->over(headers => {Referer => qr/example\.com/});
# Mojolicious::Lite
- plugin 'header_condition';
+ plugin 'HeaderCondition';
get '/' => (headers => {Referer => qr/example\.com/}) => sub {...};
# All headers need to match
View
10 lib/Mojolicious/Plugin/I18n.pm
@@ -85,12 +85,12 @@ Mojolicious::Plugin::I18n - Intenationalization Plugin
=head1 SYNOPSIS
# Mojolicious
- $self->plugin('i18n');
+ $self->plugin('I18n');
% languages 'de';
<%=l 'hello' %>
# Mojolicious::Lite
- plugin 'i18n' => {namespace => 'MyApp::I18N'};
+ plugin I18n => {namespace => 'MyApp::I18N'};
<%=l 'hello' %>
# Lexicon
@@ -113,7 +113,7 @@ request header.
This plugin can save a lot of typing, since it will generate the following
code by default.
- # $self->plugin('i18n');
+ # $self->plugin('I18n');
package MyApp::I18N;
use base 'Locale::Maketext';
package MyApp::I18N::en;
@@ -130,14 +130,14 @@ The default lexicon class will only be generated if it doesn't already exist.
=head2 C<default>
# Mojolicious::Lite
- plugin i18n => {default => 'en'};
+ plugin I18n => {default => 'en'};
Default language, defaults to C<en>.
=head2 C<namespace>
# Mojolicious::Lite
- plugin i18n => {namespace => 'MyApp::I18N'};
+ plugin I18n => {namespace => 'MyApp::I18N'};
Lexicon namespace, defaults to the application class followed by C<::I18N>.
View
8 lib/Mojolicious/Plugin/JsonConfig.pm
@@ -68,16 +68,16 @@ Mojolicious::Plugin::JsonConfig - JSON Configuration Plugin
}
# Mojolicious
- my $config = $self->plugin('json_config');
+ my $config = $self->plugin('JsonConfig');
# Mojolicious::Lite
- my $config = plugin 'json_config';
+ my $config = plugin 'JsonConfig';
# Reads myapp.json by default and puts the parsed version into the stash
my $config = $self->stash('config');
# Everything can be customized with options
- my $config = plugin json_config => {
+ my $config = plugin JsonConfig => {
file => '/etc/myapp.conf',
stash_key => 'conf'
};
@@ -98,7 +98,7 @@ L<Mojolicious::Plugin::Config> and the following new ones.
=head2 C<template>
# Mojolicious::Lite
- plugin json_config => {template => {line_start => '.'}};
+ plugin JsonConfig => {template => {line_start => '.'}};
Template options.
View
12 lib/Mojolicious/Plugin/Mount.pm
@@ -37,23 +37,23 @@ Mojolicious::Plugin::Mount - Application Mount Plugin
=head1 SYNOPSIS
# Mojolicious
- $self->plugin(mount => {'/prefix' => '/home/sri/myapp.pl'});
+ $self->plugin(Mount => {'/prefix' => '/home/sri/myapp.pl'});
# Mojolicious::Lite
- plugin mount => {'/prefix' => '/home/sri/myapp.pl'};
+ plugin Mount => {'/prefix' => '/home/sri/myapp.pl'};
# Adjust the generated route
- my $example = plugin mount => {'/example' => '/home/sri/example.pl'};
+ my $example = plugin Mount => {'/example' => '/home/sri/example.pl'};
$example->to(message => 'It works great!');
# Mount application with host
- plugin mount => {'mojolicio.us' => '/home/sri/myapp.pl'};
+ plugin Mount => {'mojolicio.us' => '/home/sri/myapp.pl'};
# Host and path
- plugin mount => {'mojolicio.us/myapp' => '/home/sri/myapp.pl'};
+ plugin Mount => {'mojolicio.us/myapp' => '/home/sri/myapp.pl'};
# Or even hosts with wildcard subdomains
- plugin mount => {'*.mojolicio.us/myapp' => '/home/sri/myapp.pl'};
+ plugin Mount => {'*.mojolicio.us/myapp' => '/home/sri/myapp.pl'};
=head1 DESCRIPTION
View
18 lib/Mojolicious/Plugin/PodRenderer.pm
@@ -178,16 +178,16 @@ Mojolicious::Plugin::PodRenderer - POD Renderer Plugin
=head1 SYNOPSIS
# Mojolicious
- $self->plugin('pod_renderer');
- $self->plugin(pod_renderer => {name => 'foo'});
- $self->plugin(pod_renderer => {preprocess => 'epl'});
+ $self->plugin('PodRenderer');
+ $self->plugin(PodRenderer => {name => 'foo'});
+ $self->plugin(PodRenderer => {preprocess => 'epl'});
$self->render('some_template', handler => 'pod');
<%= pod_to_html "=head1 TEST\n\nC<123>" %>
# Mojolicious::Lite
- plugin 'pod_renderer';
- plugin pod_renderer => {name => 'foo'};
- plugin pod_renderer => {preprocess => 'epl'};
+ plugin 'PodRenderer';
+ plugin PodRenderer => {name => 'foo'};
+ plugin PodRenderer => {preprocess => 'epl'};
$self->render('some_template', handler => 'pod');
<%= pod_to_html "=head1 TEST\n\nC<123>" %>
@@ -201,14 +201,14 @@ rawr!
=head2 C<name>
# Mojolicious::Lite
- plugin pod_renderer => {name => 'foo'};
+ plugin PodRenderer => {name => 'foo'};
Handler name.
=head2 C<no_perldoc>
# Mojolicious::Lite
- plugin pod_renderer => {no_perldoc => 1};
+ plugin PodRenderer => {no_perldoc => 1};
Disable perldoc browser.
Note that this option is EXPERIMENTAL and might change without warning!
@@ -216,7 +216,7 @@ Note that this option is EXPERIMENTAL and might change without warning!
=head2 C<preprocess>
# Mojolicious::Lite
- plugin pod_renderer => {preprocess => 'epl'};
+ plugin PodRenderer => {preprocess => 'epl'};
Handler name of preprocessor.
View
10 lib/Mojolicious/Plugin/PoweredBy.pm
@@ -27,12 +27,12 @@ Mojolicious::Plugin::PoweredBy - Powered By Plugin
=head1 SYNOPSIS
# Mojolicious
- $self->plugin('powered_by');
- $self->plugin(powered_by => (name => 'MyApp 1.0'));
+ $self->plugin('PoweredBy');
+ $self->plugin(PoweredBy => (name => 'MyApp 1.0'));
# Mojolicious::Lite
- plugin 'powered_by';
- plugin powered_by => (name => 'MyApp 1.0');
+ plugin 'PoweredBy';
+ plugin PoweredBy => (name => 'MyApp 1.0');
=head1 DESCRIPTION
@@ -45,7 +45,7 @@ example for learning to build new plugins.
=head2 C<powered_by>
- plugin powered_by => (name => 'MyApp 1.0');
+ plugin PoweredBy => (name => 'MyApp 1.0');
Value for C<X-Powered-By> header.
View
4 lib/Mojolicious/Plugin/RequestTimer.pm
@@ -55,10 +55,10 @@ Mojolicious::Plugin::RequestTimer - Request Timer Plugin
=head1 SYNOPSIS
# Mojolicious
- $self->plugin('request_timer');
+ $self->plugin('RequestTimer');
# Mojolicious::Lite
- plugin 'request_timer';
+ plugin 'RequestTimer';
=head1 DESCRIPTION
View
4 lib/Mojolicious/Plugin/TagHelpers.pm
@@ -342,10 +342,10 @@ Mojolicious::Plugin::TagHelpers - Tag Helpers Plugin
=head1 SYNOPSIS
# Mojolicious
- $self->plugin('tag_helpers');
+ $self->plugin('TagHelpers');
# Mojolicious::Lite
- plugin 'tag_helpers';
+ plugin 'TagHelpers';
=head1 DESCRIPTION
View
2  t/mojolicious/external/myapp.pl
@@ -7,7 +7,7 @@
use Mojolicious::Lite;
# Load plugin
-plugin 'config';
+plugin 'Config';
# GET /
get '/' => 'index';
View
2  t/mojolicious/json_config_mode_lite_app.t
@@ -19,7 +19,7 @@ use Mojolicious::Lite;
use Test::Mojo;
# Load plugin
-plugin 'json_config';
+plugin 'JsonConfig';
# GET /
get '/' => 'index';
View
2  t/mojolicious/pod_renderer_lite_app.t
@@ -19,7 +19,7 @@ use Mojolicious::Lite;
use Test::Mojo;
# POD renderer plugin
-plugin 'pod_renderer';
+plugin 'PodRenderer';
# GET /
get '/' => sub {
View
8 t/mojolicious/twinkle_lite_app.t
@@ -31,10 +31,10 @@ my $twinkle = {
};
# Plugins
-plugin ep_renderer => {name => 'twinkle', template => $twinkle};
-plugin 'pod_renderer';
-plugin pod_renderer => {name => 'teapod', preprocess => 'twinkle'};
-my $config = plugin json_config =>
+plugin EpRenderer => {name => 'twinkle', template => $twinkle};
+plugin 'PodRenderer';
+plugin PodRenderer => {name => 'teapod', preprocess => 'twinkle'};
+my $config = plugin JsonConfig =>
{default => {foo => 'bar'}, ext => 'conf', template => $twinkle};
is $config->{foo}, 'bar', 'right value';
is $config->{test}, 23, 'right value';
Please sign in to comment.
Something went wrong with that request. Please try again.