File Coverage

blib/lib/Bot/Cobalt/Conf.pm
Criterion Covered Total %
statement 40 40 100.0
branch n/a
condition n/a
subroutine 17 17 100.0
pod n/a
total 57 57 100.0


line stmt bran cond sub pod time code
1             package Bot::Cobalt::Conf;
2             $Bot::Cobalt::Conf::VERSION = '0.021001';
3 4     4   39333 use strictures 2;
  4         2522  
  4         121  
4 4     4   520 use Carp;
  4         5  
  4         173  
5              
6 4     4   689 use Bot::Cobalt::Common ':types';
  4         6  
  4         20  
7              
8 4     4   1381 use Bot::Cobalt::Conf::File::Core;
  4         8  
  4         101  
9 4     4   1479 use Bot::Cobalt::Conf::File::Channels;
  4         9  
  4         90  
10 4     4   1336 use Bot::Cobalt::Conf::File::Plugins;
  4         9  
  4         96  
11              
12 4     4   17 use Path::Tiny;
  4         4  
  4         177  
13 4     4   15 use Types::Path::Tiny -types;
  4         5  
  4         16  
14              
15 4     4   2165 use Scalar::Util 'blessed';
  4         4  
  4         135  
16              
17              
18 4     4   14 use Moo;
  4         4  
  4         10  
19              
20             has etc => (
21             required => 1,
22             is => 'rw',
23             isa => Path,
24             coerce => 1,
25             );
26              
27             has debug => (
28             is => 'rw',
29             isa => Bool,
30 3     3   19851 builder => sub { 0 }
31             );
32              
33             has path_to_core_cf => (
34             lazy => 1,
35             is => 'rwp',
36             isa => Path,
37             coerce => 1,
38             builder => sub {
39 2     2   2817 path( shift->etc .'/cobalt.conf' )
40             },
41             );
42              
43             has path_to_channels_cf => (
44             lazy => 1,
45             is => 'rwp',
46             isa => Path,
47             coerce => 1,
48             builder => sub {
49 2     2   2853 path( shift->etc .'/channels.conf' )
50             },
51             );
52              
53             has path_to_plugins_cf => (
54             lazy => 1,
55             is => 'rwp',
56             isa => Path,
57             coerce => 1,
58             builder => sub {
59 2     2   1721 path( shift->etc .'/plugins.conf' )
60             },
61             );
62              
63              
64             has core => (
65             lazy => 1,
66             is => 'ro',
67             predicate => 'has_core',
68             writer => 'set_core',
69             isa => InstanceOf['Bot::Cobalt::Conf::File::Core'],
70             builder => sub {
71 2     2   1706 my ($self) = @_;
72 2         8 Bot::Cobalt::Conf::File::Core->new(
73             debug => $self->debug,
74             cfg_path => $self->path_to_core_cf,
75             )
76             },
77             );
78              
79             has channels => (
80             lazy => 1,
81             is => 'ro',
82             predicate => 'has_channels',
83             writer => 'set_channels',
84             isa => InstanceOf['Bot::Cobalt::Conf::File::Channels'],
85             builder => sub {
86 2     2   1935 my ($self) = @_;
87 2         31 Bot::Cobalt::Conf::File::Channels->new(
88             debug => $self->debug,
89             cfg_path => $self->path_to_channels_cf,
90             )
91             },
92             );
93              
94             has plugins => (
95             lazy => 1,
96             is => 'ro',
97             predicate => 'has_plugins',
98             writer => 'set_plugins',
99             isa => InstanceOf['Bot::Cobalt::Conf::File::Plugins'],
100             builder => sub {
101 2     2   1431 my ($self) = @_;
102 2         30 Bot::Cobalt::Conf::File::Plugins->new(
103             debug => $self->debug,
104             cfg_path => $self->path_to_plugins_cf,
105             etcdir => $self->etc,
106             )
107             },
108             );
109              
110              
111             1;
112             __END__