blib/lib/Mojolicious/Command/generate/bootstrap.pm

filter: Statementstmt 66.6% 16 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 70.0% 21 / 30 CC 1 SCAR 1.8
CC
1
Cov
67%
run
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
↑ Summary
1 package Mojolicious::Command::generate::bootstrap;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Mojo::Base "Mojolicious::Command";
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Mojo::Util "b64_decode";
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $VERSION = "0.04";
10 1 has "description" => "Deploy Twitter Bootstrap library into your Mojolicous-App.\n";
11 1 has "usage" => "usage: $0 generate bootstrap\n";
12  
13 =head1 NAME
14  
15 Mojolicious::Command::generate::bootstrap - Include Twitters Bootstrap
16  
17 =head1 SYNOPSIS
18  
19 # Run within an existing Mojolicious App
20 mojo genereate bootstrap
21  
22 Will automagically unload following files:
23  
24 $APPHOME/public/css/bootstrap.min.css
25 $APPHOME/public/js/bootstrap.min.js
26 $APPHOME/public/img/glyphicons-halflings.png
27 $APPHOME/public/img/glyphicons-halflings-white.png
28 $APPHOME/templates/layouts/bootstrap.html.ep
29  
30 So you only have to include those into your Templates/Layouts or use the enhanced default layout "bootstrap.html.ep".
31  
32 Currently bundled with this Module is Version 2.3.0 of the Twitter Bootstrap Library.
33  
34 =head1 INSTALL
35  
36 Just like any other ordinary perl module:
37  
38 perl Makefile.pl
39 make
40 make test
41 make install
42  
43 =head1 SUPPORT
44  
45 Report Bugs and Problems to cpan@sveneppler.de
46  
47 =head1 LICENSE AND COPYRIGHT
48  
49 Bootstrap Library Copyright 2013 by Twitter under the Apache License 2.0 (http://twitter.github.com/bootstrap/)
50  
51 Mojolicious::Command::generate::bootstrap Copyright 2013 by Sven Eppler (cpan@sveneppler.de)
52  
53 This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
54  
55 See http://dev.perl.org/licenses/ for more information.
56  
57 =head1 CHANGES
58  
59 =over
60  
61 =item *
62 0.03 - 01.03.2013: Missing Escapes when generating the bootstrap.html.ep layout file
63  
64 =item *
65 0.02 - 28.02.2013: Included an enhanced default layout, idea by Tetsuya Tatsumi
66  
67 =item *
68 0.01 - 19.02.2013: Initial CPAN Version
69  
70 =back
71  
72 =cut
73  
74 0 ▶sub run {
Subroutine run: not called CC=1 SCAR=6.9
Pod documented
75 0 my ($self, $class) = @_;
76  
77 0 $self->render_to_rel_file("bootstrap.min.js", "public/js/bootstrap.min.js");
78 0 $self->render_to_rel_file("bootstrap.min.css", "public/css/bootstrap.min.css");
79  
80 0 my $glyph = $self->render_data("glyphicons-halflings.png");
81 0 $self->write_rel_file("public/img/glyphicons-halflings.png", b64_decode($glyph));
82
83 0 my $glyph_white = $self->render_data("glyphicons-halflings-white.png");
84 0 $self->write_rel_file("public/img/glyphicons-halflings-white.png", b64_decode($glyph_white));
85  
86 0 $self->render_to_rel_file("bootstrap.html.ep", "templates/layouts/bootstrap.html.ep");
87 }
88  
89  
90 1 1;
91  
92 __DATA__
↑ Summary