Jifty/Plugin/Config.pm untested

filter: Statementstmt 0.0% 0 / 18 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 25 CC 2 SCAR 12.8
CC
2
Cov
0%
init
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.6
1 use strict;
2 use warnings;
3  
4 package Jifty::Plugin::Config;
5 use base qw/Jifty::Plugin Class::Data::Inheritable/;
6 __PACKAGE__->mk_classdata( after_restart_url => '/' );
7 __PACKAGE__->mk_classdata( wait_seconds => 5 );
8 __PACKAGE__->mk_classdata( nav_menu => 1);
9 __PACKAGE__->mk_classdata( config_url => '/__jifty/config' );
10 __PACKAGE__->mk_classdata( restart_url => '/__jifty/config/restart.html' );
11  
12 =head2 NAME
13  
14 Jifty::Plugin::Config - Add configuration editor
15  
16 =head1 SYNOPSIS
17  
18 # In your jifty config.yml under the framework section:
19  
20 Plugins:
21 - Config:
22 after_restart_url: '/'
23 wait_seconds: 5
24 config_url: '/__jifty/config'
25 restart_url: '/__jifty/config/restart.html'
26 nav_menu: 1
27  
28 =head2 DESCRIPTION
29  
30 This plugin lets you update etc/config.yml in web page.
31  
32 =head1 METHODS
33  
34 =head2 init
35  
36 set after_restart_url, wait_seconds and config_url,
37 default is '/', 5 and '/__jifty/config', respectively
38 after_restart_url is the url where we will redirect to after restart
39 wait_seconds are the seconds that we wait for before redirecting
40 config_url is the url where we will update the config
41 restart_url is the url where we actually do the restart, with a wait page
42 setting nav_menu to 0 will stop this plugin from adding anything to your application's navigation menu
43  
44  
45 =cut
46  
47 sub init {
48 my $self = shift;
49 my %opt = @_;
50 for ( qw/after_restart_url restart_url config_url wait_seconds nav_menu/ ) {
51 __PACKAGE__->$_( $opt{$_} ) if defined $opt{$_};
52 }
53 }
54  
55 1;
56