Skip to content

Commit

Permalink
improved Mojolicious::Command::generate::plugin to use better directo…
Browse files Browse the repository at this point in the history
…ry names
  • Loading branch information
kraih committed May 31, 2014
1 parent f2b6ef9 commit 5aadebb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Changes
Expand Up @@ -3,6 +3,8 @@
- Added multi-name support to cookie and signed_cookie methods in
Mojolicious::Controller.
- Added multi-name support to cookie and upload methods in Mojo::Message.
- Improved Mojolicious::Command::generate::plugin to use better directory
names.
- Fixed bug where Mojo::DOM::HTML could not handle tags with lots of
attributes.

Expand Down
7 changes: 4 additions & 3 deletions lib/Mojolicious/Command/generate/plugin.pm
Expand Up @@ -15,13 +15,14 @@ sub run {
my $class = $name =~ /^[a-z]/ ? camelize($name) : $name;
$class = "Mojolicious::Plugin::$class";
my $app = class_to_path $class;
$self->render_to_rel_file('class', "$name/lib/$app", $class, $name);
my $dir = join '-', split '::', $class;
$self->render_to_rel_file('class', "$dir/lib/$app", $class, $name);

# Test
$self->render_to_rel_file('test', "$name/t/basic.t", $name);
$self->render_to_rel_file('test', "$dir/t/basic.t", $name);

# Makefile
$self->render_to_rel_file('makefile', "$name/Makefile.PL", $class, $app);
$self->render_to_rel_file('makefile', "$dir/Makefile.PL", $class, $app);
}

1;
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Guides/Rendering.pod
Expand Up @@ -938,8 +938,8 @@ Assets such as templates and static files can be easily bundled with your
plugins, even if you plan to release them to CPAN.

$ mojo generate plugin AlertAssets
$ mkdir AlertAssets/lib/Mojolicious/Plugin/AlertAssets
$ cd AlertAssets/lib/Mojolicious/Plugin/AlertAssets
$ mkdir Mojolicious-Plugin-AlertAssets/lib/Mojolicious/Plugin/AlertAssets
$ cd Mojolicious-Plugin-AlertAssets/lib/Mojolicious/Plugin/AlertAssets
$ mkdir public
$ echo 'alert("Hello World!");' > public/alertassets.js
$ mkdir templates
Expand Down

0 comments on commit 5aadebb

Please sign in to comment.