Bootstrap.pm untested

filter: Statementstmt 0.0% 0 / 46 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 52 CC 1 SCAR 6.9
CC
1
Cov
0%
mk_compclass
2.0
mk_templates
2.0
BEGIN
2.0
CRAP 2.0
1 package Catalyst::Helper::View::TT::Bootstrap;
2  
3 use strict;
4 use Path::Class;
5  
6 our $VERSION = '0.01';
7  
8 sub mk_compclass {
9 my ( $self, $helper, @args ) = @_;
10 my $file = $helper->{file};
11 $helper->render_file( 'compclass', $file );
12 $self->mk_templates( $helper, @args );
13 }
14  
15 sub mk_templates {
16 my ( $self, $helper ) = @_;
17  
18 # Build directory structure
19 # /{base}/root
20 my $root = dir( $helper->{base}, 'root' );
21 $helper->mk_dir($root);
22  
23 # /{base}/root/static ./css ./css/images ./scripts ./images
24 my $static = dir( $root, 'static' );
25 $helper->mk_dir($static);
26 my $css = dir( $static, 'css' );
27 $helper->mk_dir($css);
28 $helper->mk_dir( dir( $css, 'images' ) );
29 $helper->mk_dir( dir( $static, 'images') );
30 $helper->mk_dir( dir( $static, 'scripts') );
31  
32 # /{base}/root/site
33 my $site = dir( $root, 'site' );
34 $helper->mk_dir($site);
35  
36 # /{base}/root/site/shared
37 my $shared = dir( $site, 'shared' );
38 $helper->mk_dir($shared);
39  
40 # /{base}/root/site/layout
41 my $layout = dir( $site, 'layout' );
42 $helper->mk_dir($layout);
43  
44 # /{base}/root/site/header, navigation, and footer
45 my $header = dir( $site, 'header' );
46 $helper->mk_dir($header);
47 my $nav = dir( $site, 'nav' );
48 $helper->mk_dir($nav);
49 my $footer = dir( $site, 'footer' );
50 $helper->mk_dir($footer);
51  
52 # Render files
53 # /{base}/root/static/css files
54 $helper->render_file( "screen_css", file( $css, 'screen.css' ) );
55 $helper->render_file( "nav_default_css", file( $css, 'nav_default.css' ) );
56  
57 # /{base}/root/site files
58 $helper->render_file( "site_wrapper", file( $site, 'wrapper.tt' ) );
59 $helper->render_file( "site_html", file( $site, 'html.tt' ) );
60  
61 # /{base}/root/site/shared files
62 $helper->render_file( "shared_base", file( $shared, 'base.tt' ) );
63  
64 # /{base}/root/site/layout files
65 $helper->render_file( "layout_default", file( $layout, 'default.tt' ) );
66 $helper->render_file( "layout_2columns", file( $layout, '2columns.tt' ) );
67 $helper->render_file( "layout_2col_top", file( $layout, '2col_top.tt' ) );
68 $helper->render_file( "layout_2col_bottom", file( $layout, '2col_bottom.tt' ) );
69  
70 # /{base}/root/site/header, navigation, and footer files
71 $helper->render_file( "header_default", file( $header, 'default.tt' ) );
72 $helper->render_file( "nav_default", file( $nav, 'default.tt' ) );
73 $helper->render_file( "footer_default", file( $footer, 'default.tt' ) );
74 }
75  
76 =head1 NAME
77  
78 Catalyst::Helper::View::TT::Bootstrap - Helper for TT view. Creates the View/TT.pm and a template directory structure under MyApp/root containing templates, macros, and a base stylesheet to facilitate getting to the meat of building your app's pages sooner than later.
79  
80 =head1 SYNOPSIS
81  
82 # use the helper to create the view module and templates
83  
84 $ script/myapp_create.pl view TT TT::Bootstrap
85  
86 # add something like the following to the page templates for your application
87 [%
88 page.layout = '2columns'; # use a 2 column layout
89 page.header = 'my_custom'; # will load root/site/header/my_custom.tt
90 page.footer = 'none'; # don't display a footer
91  
92 # adds these <link rel="stylsheet"...> tags to the <head>
93 page.head.stylesheets.push('foo.css','bar.css');
94  
95 # adds these <script> tags to the <head>
96 page.head.scripts.push('foo.js','bar.js');
97  
98 # adds these <script> tags to the bottom of the <body> -- usually preferable
99 page.body.scripts.push('baz.js','poop.js');
100  
101 # adds these classes to the <body> tag
102 page.body.classes.push('foo','bar');
103 %]
104 ...your content here...
105  
106 =head1 DESCRIPTION
107  
108 This helper module creates a TT View module. It also creates a set of
109 templates, macros, and a stylesheet to let you focus on the content of
110 your apps pages sooner.
111  
112 The View/TT.pm module created is configured to work within the generated
113 template structure.
114  
115 See L<Catalyst::Helper::View::TT::Bootstrap::Manual> for more details on
116 available variables and macros, and how to work with the layouts.
117  
118 =head2 METHODS
119  
120 =head3 mk_compclass
121  
122 Generates the component class.
123  
124 =head3 mk_templates
125  
126 Generates the templates.
127  
128 =cut
129  
130 =head1 SEE ALSO
131  
132 L<Catalyst>, L<Catalyst::View::TT>, L<Catalyst::Helper>,
133 L<Catalyst::Helper::View::TT>
134  
135 =head1 AUTHOR
136  
137 Lucas Smith <lsmith@lucas.e.smith@gmail.com>
138  
139 =head1 LICENSE
140  
141 This library is free software . You can redistribute it and/or modify
142 it under the same terms as perl itself.
143  
144 =cut
145  
146 1;
147  
148 __DATA__