File Coverage

blib/lib/Rails/Assets/Output.pm
Criterion Covered Total %
statement 38 38 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 44 44 100.0


line stmt bran cond sub pod time code
1             package Rails::Assets::Output {
2              
3 1     1   568   use 5.006;
  1         4  
4 1     1   4   use strict;
  1         3  
  1         16  
5 1     1   4   use warnings;
  1         2  
  1         42  
6              
7               our $VERSION = '0.02';
8 1     1   4   use Exporter qw(import);
  1         14  
  1         377  
9               our @EXPORT = qw(
10             tell_output
11             );
12              
13               sub tell_output {
14 1     1 1 1580     my $assets = shift;
15 1         3     foreach my $key (sort keys %{$assets->assets_hash()}) {
  1         6  
16 4         31       print "My $key files are:" . scalar @{$assets->assets_hash()->{$key}} . "\n";
  4         11  
17 4         59       foreach (sort { "\L$a->{name}" cmp "\L$b->{name}" } @{$assets->assets_hash()->{$key}}){
  1         7  
  4         9  
18 4         27         print "- $_->{name} ($_->{full_path})" . "\n";
19                   };
20 4         14       print "My $key references are:" . scalar @{$assets->template_hash()->{$key}} . "\n";
  4         9  
21 4         26       foreach (sort { "\L$a->{name}" cmp "\L$b->{name}" } @{$assets->template_hash()->{$key}}){
  1         5  
  4         10  
22 3         21         print "- $_->{name} ($_->{full_path})" . "\n";
23                   };
24 4         13       print "My $key .scss references are:" . scalar @{$assets->scss_hash()->{$key}} . "\n";
  4         11  
25 4         33       foreach (sort { "\L$a->{name}" cmp "\L$b->{name}" } @{$assets->scss_hash()->{$key}}){
  1         10  
  4         10  
26 2         12         print "- $_->{name} ($_->{referral})" . "\n";
27                   };
28 4         18       print "My $key .js references are:" . scalar @{$assets->map_hash()->{$key}} . "\n";
  4         10  
29 4         35       foreach (sort { "\L$a->{name}" cmp "\L$b->{name}" } @{$assets->map_hash()->{$key}}){
  1         6  
  4         9  
30 2         11         print "- $_->{name} ($_->{referral})" . "\n";
31                   };
32                 }
33               }
34              
35             }
36              
37             =head1 NAME
38            
39             Rails::Assets::Output - Output Functions for Rails::Assets
40            
41             =head1 VERSION
42            
43             Version 0.02
44            
45             =head1 SYNOPSIS
46            
47             use Rails::Assets;
48             use Rails::Assets::Output;
49            
50             my $assets = Rails::Assets->new();
51             $assets->analyse();
52             tell_output($assets);
53             ...
54            
55             =head1 EXPORT
56            
57             =head2 tell_output
58            
59             This function print the content of the analysis on STDOUT
60            
61             =head1 SUBROUTINES/METHODS
62            
63             =head1 AUTHOR
64            
65             Mauro Berlanda, C<< <kupta at cpan.org> >>
66            
67             =head1 BUGS
68            
69             Please report any bugs or feature requests to C<bug-rails-assets at rt.cpan.org>, or through
70             the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Rails-Assets>. I will be notified, and then you'll
71             automatically be notified of progress on your bug as I make changes.
72            
73             Pull Requests, Issues, Stars and Forks on the project L<github repository|https://github.com/mberlanda/rails-assets-coverage> are welcome!
74            
75             =head1 SUPPORT
76            
77             You can find documentation for this module with the perldoc command.
78            
79             perldoc Rails::Assets::Output
80            
81             You can also look for information at:
82            
83             =over 4
84            
85             =item * RT: CPAN's request tracker (report bugs here)
86            
87             L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=.>
88            
89             =item * AnnoCPAN: Annotated CPAN documentation
90            
91             L<http://annocpan.org/dist/.>
92            
93             =item * CPAN Ratings
94            
95             L<http://cpanratings.perl.org/d/.>
96            
97             =item * Search CPAN
98            
99             L<http://search.cpan.org/dist/./>
100            
101             =back
102            
103             =head1 ACKNOWLEDGEMENTS
104            
105             =head1 LICENSE AND COPYRIGHT
106            
107             Copyright 2017 Mauro Berlanda.
108            
109             This program is free software; you can redistribute it and/or modify it
110             under the terms of the the Artistic License (2.0). You may obtain a
111             copy of the full license at:
112            
113             L<http://www.perlfoundation.org/artistic_license_2_0>
114            
115             Any use, modification, and distribution of the Standard or Modified
116             Versions is governed by this Artistic License. By using, modifying or
117             distributing the Package, you accept this license. Do not use, modify,
118             or distribute the Package, if you do not accept this license.
119            
120             If your Modified Version has been derived from a Modified Version made
121             by someone other than you, you are nevertheless required to ensure that
122             your Modified Version complies with the requirements of this license.
123            
124             This license does not grant you the right to use any trademark, service
125             mark, tradename, or logo of the Copyright Holder.
126            
127             This license includes the non-exclusive, worldwide, free-of-charge
128             patent license to make, have made, use, offer to sell, sell, import and
129             otherwise transfer the Package with respect to any patent claims
130             licensable by the Copyright Holder that are necessarily infringed by the
131             Package. If you institute patent litigation (including a cross-claim or
132             counterclaim) against any party alleging that the Package constitutes
133             direct or contributory patent infringement, then this Artistic License
134             to you shall terminate on the date that such litigation is filed.
135            
136             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
137             AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
138             THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
139             PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
140             YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
141             CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
142             CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
143             EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
144            
145             =cut
146              
147             1; # End of Rails::Assets::Output
148