line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Git::Demo; |
2
|
1
|
|
|
1
|
|
25082
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
13589
|
use Git::Repository; |
|
1
|
|
|
|
|
33528
|
|
|
1
|
|
|
|
|
7
|
|
5
|
1
|
|
|
1
|
|
695
|
use Git::Demo::Story; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
1163
|
use Log::Log4perl; |
|
1
|
|
|
|
|
73844
|
|
|
1
|
|
|
|
|
8
|
|
8
|
1
|
|
|
1
|
|
51
|
use File::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
12
|
|
9
|
1
|
|
|
1
|
|
1442
|
use IO::File; |
|
1
|
|
|
|
|
2410
|
|
|
1
|
|
|
|
|
156
|
|
10
|
1
|
|
|
1
|
|
5137
|
use File::Temp; |
|
1
|
|
|
|
|
17632
|
|
|
1
|
|
|
|
|
474
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Git::Demo - A way for scripting git demonstrations |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 VERSION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Version 0.02 |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 SYNOPSIS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Allows playback of a Git story (a sequence of file modifications and git actions |
28
|
|
|
|
|
|
|
by various characters) to demonstrate the capabilities of Git |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Perhaps a little code snippet. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use Git::Demo; |
33
|
|
|
|
|
|
|
... |
34
|
|
|
|
|
|
|
my $demo = Git::Demo->new( $conf ); |
35
|
|
|
|
|
|
|
$demo->play(); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 new |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub new{ |
44
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
45
|
0
|
|
|
|
|
|
my $args = shift; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
foreach( qw/story_file/ ){ |
48
|
0
|
0
|
|
|
|
|
if( ! $args->{$_} ){ |
49
|
0
|
|
|
|
|
|
die( "Cannot start without $_ being defined\n" ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
my $self = {}; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# and the optionals |
56
|
0
|
|
|
|
|
|
foreach( qw/verbose/ ){ |
57
|
0
|
|
|
|
|
|
$self->{$_} = $args->{$_}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
$self->{conf} = $args; |
61
|
0
|
|
|
|
|
|
my $logger = Log::Log4perl->get_logger( "Git::Demo::Story" ); |
62
|
0
|
|
|
|
|
|
$self->{logger} = $logger; |
63
|
|
|
|
|
|
|
|
64
|
0
|
0
|
|
|
|
|
if( $self->{verbose} ){ |
65
|
0
|
|
|
|
|
|
$self->{logger}->info( "Running in verbose mode!" ); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
$self->{dir} = File::Temp->newdir( UNLINK => 1 ); |
70
|
|
|
|
|
|
|
|
71
|
0
|
0
|
|
|
|
|
if( ! $self->{dir} ){ |
72
|
0
|
|
|
|
|
|
die( "Could not create temporary directory to work in" ); |
73
|
|
|
|
|
|
|
} |
74
|
0
|
|
|
|
|
|
$logger->info( "Working directory: $self->{dir}" ); |
75
|
0
|
|
|
|
|
|
$self->{story} = Git::Demo::Story->new( { story_file => $args->{story_file}, |
76
|
|
|
|
|
|
|
dir => $self->{dir}, |
77
|
|
|
|
|
|
|
verbose => $self->{verbose}, |
78
|
|
|
|
|
|
|
} ); |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
bless $self, $class; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
return $self; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub play{ |
86
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
87
|
0
|
0
|
|
|
|
|
if( ! $self->{story} ){ |
88
|
0
|
|
|
|
|
|
warn( "No story to play!" ); |
89
|
0
|
|
|
|
|
|
return undef; |
90
|
|
|
|
|
|
|
} |
91
|
0
|
|
|
|
|
|
$self->{story}->play(); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub story{ |
96
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
97
|
0
|
|
|
|
|
|
return $self->{story}; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub save_story{ |
101
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
102
|
0
|
0
|
|
|
|
|
if( $self->{story} ){ |
103
|
0
|
|
|
|
|
|
$self->{story}->save_story(); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub dir{ |
108
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
109
|
0
|
|
|
|
|
|
return $self->{dir}; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Robin Clarke, C<< >> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 BUGS |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
120
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
121
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 SUPPORT |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
perldoc Git::Demo |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
You can also look for information at: |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=over 4 |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item * Repository on Github |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
L |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
L |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
L |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item * CPAN Ratings |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
L |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item * Search CPAN |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
L |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=back |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
L |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Copyright 2010 Robin Clarke. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
166
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
167
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
1; # End of Git::Demo |