Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more consistent generator commands
  • Loading branch information
kraih committed Aug 19, 2014
1 parent 4de64f7 commit 7bba516
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
3 changes: 1 addition & 2 deletions lib/Mojolicious/Command.pm
Expand Up @@ -20,8 +20,7 @@ has usage => "Usage: APPLICATION\n";
sub chmod_file {
my ($self, $path, $mod) = @_;
chmod $mod, $path or croak qq{Can't chmod file "$path": $!};
$mod = sprintf '%lo', $mod;
say " [chmod] $path $mod" unless $self->quiet;
say " [chmod] $path " . sprintf('%lo', $mod) unless $self->quiet;
return $self;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Command/generate/app.pm
Expand Up @@ -19,7 +19,7 @@ EOF
# Script
my $name = class_to_file $class;
$self->render_to_rel_file('mojo', "$name/script/$name", $class);
$self->chmod_file("$name/script/$name", 0744);
$self->chmod_rel_file("$name/script/$name", 0744);

# Application class
my $app = class_to_path $class;
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Command/generate/lite_app.pm
Expand Up @@ -8,7 +8,7 @@ sub run {
my ($self, $name) = @_;
$name ||= 'myapp.pl';
$self->render_to_rel_file('liteapp', $name);
$self->chmod_file($name, 0744);
$self->chmod_rel_file($name, 0744);
}

1;
Expand Down
5 changes: 1 addition & 4 deletions lib/Mojolicious/Commands.pm
Expand Up @@ -83,10 +83,7 @@ sub run {
return print $self->message, tablify(\@rows), $self->hint;
}

sub start_app {
my $self = shift;
return Mojo::Server->new->build_app(shift)->start(@_);
}
sub start_app { shift; Mojo::Server->new->build_app(shift)->start(@_) }

sub _command {
my ($module, $fatal) = @_;
Expand Down
11 changes: 5 additions & 6 deletions lib/Mojolicious/Plugins.pm
Expand Up @@ -7,7 +7,7 @@ has namespaces => sub { ['Mojolicious::Plugin'] };

sub emit_hook {
my $self = shift;
$_->(@_) for @{$self->subscribers(shift)};
for my $cb (@{$self->subscribers(shift)}) { $cb->(@_) }
return $self;
}

Expand All @@ -25,7 +25,7 @@ sub emit_chain {

sub emit_hook_reverse {
my $self = shift;
$_->(@_) for reverse @{$self->subscribers(shift)};
for my $cb (reverse @{$self->subscribers(shift)}) { $cb->(@_) }
return $self;
}

Expand All @@ -52,10 +52,9 @@ sub register_plugin {

sub _load {
my $module = shift;
if (my $e = Mojo::Loader->new->load($module)) {
ref $e ? die $e : return undef;
}
return $module->isa('Mojolicious::Plugin');
return $module->isa('Mojolicious::Plugin')
unless my $e = Mojo::Loader->new->load($module);
ref $e ? die $e : return undef;
}

1;
Expand Down

0 comments on commit 7bba516

Please sign in to comment.