blib/lib/FindApp/Git.pm untested

filter: Statementstmt 0.0% 0 / 54 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 85 CC 4 SCAR 12.3
CC
4
Cov
0%
export_root_to_env
6.0
shell_settings
6.0
export_git_dir
6.0
CRAP 3.4
1 package FindApp::Git;
2  
3 use v5.10;
4 use strict;
5 use warnings;
6 use mro "c3";
7  
8 use parent qw(FindApp);
9 use FindApp::Vars qw(:all);
10 use FindApp::Utils qw(:all);
11 use namespace::clean;
12  
13 sub init { &ENTER_TRACE;
14 my($self) = @_;
15 $self->next::method;
16 debug "adding .git/ dir";
17 $self->add_rootdir_wanted(".git/");
18 $self->export_git_dir(0);
19 }
20  
21 sub copy { &ENTER_TRACE;
22 my($to, $from) = @_;
23 $to->next::method($from);
24 $from->can($_) && $to->$_($from->$_) for "export_git_dir";
25 return $to;
26 }
27  
28 # This overrides the FindApp::Object::Behavior method,
29 # *not* the FindApp::Object::State::Group method.
30 # We're a FindApp object, not a group object.
31 sub export_root_to_env { &ENTER_TRACE;
32 my $self = &myself;
33 $self->next::method(@_);
34 if ($Root && $self->export_git_dir) {
35 $GIT_DIR = $Root;
36 $self->rootdir->bump_exports;
37 }
38 }
39  
40 sub shell_settings { &ENTER_TRACE;
41 my $self = &myself;
42 my $settings = $self->SUPER::shell_settings(@_);
43 $settings .= $self->show_shell_var(GIT_DIR => $Root) if $self->export_git_dir;
44 return $settings;
45 }
46  
47 ####################################
48 # Now our own methods.
49 ####################################
50  
51 use pluskeys qw{
52 UNSAFE_EXPORT
53 };
54  
55 sub export_git_dir { &ENTER_TRACE;
56 my $self = &myself;
57 $self->{+UNSAFE_EXPORT} = !!shift if @_;
58 return $self->{+UNSAFE_EXPORT};
59 }
60  
61 __PACKAGE__->renew;
62  
63 1;
64  
65 =encoding utf8
66  
67 =head1 NAME
68  
69 FindApp::Git - FIXME
70  
71 =head1 SYNOPSIS
72  
73 use FindApp::Git;
74  
75 =head1 DESCRIPTION
76  
77 =head2 Pluskey Attributes
78  
79 These are always private; use the methods insteads.
80  
81 =over
82  
83 =item UNSAFE_EXPORT
84  
85 =back
86  
87 =head2 Public Methods
88  
89 =over
90  
91 =item copy
92  
93 =item export_git_dir
94  
95 =item export_root_to_env
96  
97 =item init
98  
99 =item shell_settings
100  
101 =back
102  
103 =head2 Exports
104  
105 =over
106  
107 =item FIXME
108  
109 =back
110  
111 =head1 EXAMPLES
112  
113 =head1 ENVIRONMENT
114  
115 =head1 SEE ALSO
116  
117 =over
118  
119 =item L<FindApp>
120  
121 =back
122  
123 =head1 CAVEATS AND PROVISOS
124  
125 =head1 BUGS AND LIMITATIONS
126  
127 =head1 HISTORY
128  
129 =head1 AUTHOR
130  
131 Tom Christiansen << <tchrist@perl.com> >>
132  
133 =head1 LICENCE AND COPYRIGHT
134  
135 Copyright (c) 2016, Tom Christiansen C<< <tchrist@perl.com> >>.
136 All Rights Reserved.
137  
138 This module is free software; you can redistribute it and/or
139 modify it under the same terms as Perl itself. See L<perlartistic>.
140  
141 =cut
142