File Coverage

blib/lib/Statocles/App/Static.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Statocles::App::Static;
2             our $VERSION = '0.085';
3             # ABSTRACT: (DEPRECATED) Manage static files like CSS, JS, images, and other untemplated content
4              
5 1     1   2337 use Statocles::Base 'Class';
  1         27  
  1         9  
6 1     1   6379 use Statocles::Page::File;
  1         3  
  1         30  
7 1     1   5 use Statocles::Util qw( derp );
  1         2  
  1         294  
8             with 'Statocles::App';
9              
10             #pod =attr store
11             #pod
12             #pod The L<store|Statocles::Store> containing this app's files. Required.
13             #pod
14             #pod =cut
15              
16             has store => (
17             is => 'ro',
18             isa => Store,
19             required => 1,
20             coerce => Store->coercion,
21             );
22              
23             #pod =method pages
24             #pod
25             #pod my @pages = $app->pages;
26             #pod
27             #pod Get the L<page objects|Statocles::Page> for this app.
28             #pod
29             #pod =cut
30              
31             sub pages {
32             my ( $self ) = @_;
33              
34             derp qq{Statocles::App::Static has been replaced by Statocles::App::Basic and will be removed in 2.0. Change the app class to "Statocles::App::Basic" to silence this message.};
35              
36             my @pages;
37             my $iter = $self->store->find_files( include_documents => 1 );
38             FILE: while ( my $path = $iter->() ) {
39             # Check for hidden files and folders
40             next if $path->basename =~ /^[.]/;
41             my $parent = $path->parent;
42             while ( !$parent->is_rootdir ) {
43             next FILE if $parent->basename =~ /^[.]/;
44             $parent = $parent->parent;
45             }
46              
47             push @pages, Statocles::Page::File->new(
48             path => $path,
49             file_path => $self->store->path->child( $path ),
50             );
51             }
52              
53             return @pages;
54             }
55              
56             1;
57              
58             __END__
59              
60             =pod
61              
62             =encoding UTF-8
63              
64             =head1 NAME
65              
66             Statocles::App::Static - (DEPRECATED) Manage static files like CSS, JS, images, and other untemplated content
67              
68             =head1 VERSION
69              
70             version 0.085
71              
72             =head1 DESCRIPTION
73              
74             B<NOTE:> This application's functionality has been added to
75             L<Statocles::App::Basic>. You can use the Basic app to replace this app. This
76             class will be removed with v2.0. See L<Statocles::Help::Upgrading>.
77              
78             This L<Statocles::App|Statocles::App> manages static content with no processing,
79             perfect for images, stylesheets, scripts, or already-built HTML.
80              
81             =head1 ATTRIBUTES
82              
83             =head2 store
84              
85             The L<store|Statocles::Store> containing this app's files. Required.
86              
87             =head1 METHODS
88              
89             =head2 pages
90              
91             my @pages = $app->pages;
92              
93             Get the L<page objects|Statocles::Page> for this app.
94              
95             =head1 AUTHOR
96              
97             Doug Bell <preaction@cpan.org>
98              
99             =head1 COPYRIGHT AND LICENSE
100              
101             This software is copyright (c) 2016 by Doug Bell.
102              
103             This is free software; you can redistribute it and/or modify it under
104             the same terms as the Perl 5 programming language system itself.
105              
106             =cut