Created
March 17, 2012 17:07
-
-
Save kraih/2062679 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Mojolicious::Command::files; | |
use Mojo::Base 'Mojo::Command'; | |
use Mojo::Home; | |
has description => "List templates and static files.\n"; | |
has usage => "usage: $0 files\n"; | |
sub run { | |
my $self = shift; | |
# Find all DATA files | |
my $app = $self->app; | |
my $renderer = $app->renderer; | |
my $static = $app->static; | |
my @classes = @{$renderer->classes}, @{$static->classes}; | |
for my $class (keys %{{map { $_ => 1 } @classes}}) { | |
my @files = sort keys %{$self->get_all_data($class) || {}}; | |
say join("\n", "$class:", @files) if @files; | |
} | |
# Find all real files | |
my @paths = @{$renderer->paths}, @{$static->paths}; | |
for my $path (keys %{{map { $_ => 1 } @paths}}) { | |
my @files = sort @{Mojo::Home->new($path)->list_files}; | |
say join("\n", "$path:", @files) if @files; | |
} | |
} | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment