Jifty/Plugin/Prototypism.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 29 CC 3 SCAR 19.5
CC
3
Cov
0%
init
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 7.0
1 use strict;
2 use warnings;
3  
4 package Jifty::Plugin::Prototypism;
5 use base 'Jifty::Plugin';
6  
7 =head1 NAME
8  
9 Jifty::Plugin::Prototypism - Provide Prototype and Scriptaculous js libraries
10  
11 =head1 SYNOPSIS
12  
13 # In your jifty config.yml under the framework section:
14  
15 Plugins:
16 - Prototypism
17 cdn: 'http://yourcdn.for.static.prefix/'
18  
19 =head1 DESCRIPTION
20  
21 This module provides the Prototype and Scriptaculous javascript
22 libraries to your application. Jifty used to rely on these libraries,
23 so this plugin may be automatically added to your application's
24 plugins if you upgrade from an older version of Jifty. It is safe to
25 remove if your application does not use Prototype or Scriptaculous
26 javascript code, however.
27  
28 =cut
29  
30 __PACKAGE__->mk_accessors(qw(cdn));
31  
32 =head1 METHODS
33  
34 =head2 init
35  
36 On initialization, adds Jifty compatibility methods if the
37 configuration file version is before 4.
38  
39 =cut
40  
41 sub init {
42 my $self = shift;
43 return if $self->_pre_init;
44  
45 my %opt = @_;
46 $self->cdn( $opt{ cdn } || '' );
47 my @js = qw(
48 prototype
49 scriptaculous/builder
50 scriptaculous/effects
51 scriptaculous/controls
52 );
53  
54 push @js, 'jifty_compatible' if Jifty->config->framework('ConfigFileVersion') < 4;
55 Jifty->web->add_javascript( "prototypism/$_.js" ) for @js;
56  
57 }
58  
59 1;
60