File Coverage

blib/lib/Mojolicious/Command/generate/bootstrap.pm
Criterion Covered Total %
statement 12 20 60.0
branch n/a
condition n/a
subroutine 4 5 80.0
pod 1 1 100.0
total 17 26 65.3


line stmt bran cond sub pod time code
1             package Mojolicious::Command::generate::bootstrap;
2              
3 1     1   32583 use strict;
  1         3  
  1         49  
4 1     1   6 use warnings;
  1         2  
  1         37  
5              
6 1     1   1311 use Mojo::Base "Mojolicious::Command";
  1         12313  
  1         7  
7 1     1   791750 use Mojo::Util "b64_decode";
  1         2  
  1         299  
8              
9             our $VERSION = "0.04";
10             has "description" => "Deploy Twitter Bootstrap library into your Mojolicous-App.\n";
11             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             sub run {
75 0     0 1   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;
91              
92             __DATA__