root/lang/perl/ShipIt-Step-CommitMessageWrap/trunk/lib/ShipIt/Step/CommitMessageWrap.pm @ 3886

Revision 3886, 1.6 kB (checked in by yappo, 7 years ago)

lang/perl/ShipIt-Step-CommitMessageWrap?: tag_version method hook point is mistaken

Line 
1package ShipIt::Step::CommitMessageWrap;
2use strict;
3use warnings;
4use base 'ShipIt::Step';
5our $VERSION = '0.02';
6
7sub init {
8    my ($self, $conf) = @_;
9
10    $self->{format} = $conf->value('commit_message.format') || '%msg';
11    $self->{format} =~ s/%/%%/g;
12    $self->{format} =~ s/%%msg/%s/g;
13}
14
15sub run {
16    my ($self, $state) = @_;
17
18    my $pkg = ref($state->vc);
19
20    my $commit      = $pkg->can('commit');
21    my $tag_version = $pkg->can('tag_version');
22    no strict 'refs';
23    *{"$pkg\::commit"} = sub {
24        use strict;
25        my $c = shift;
26        my $msg  = shift;
27        $msg = sprintf $self->{format}, $msg;
28        $commit->($c, $msg, @_);
29    };
30    *{"$pkg\::tag_version"} = sub {
31        use strict;
32        my $c = shift;
33        my $ver  = shift;
34        my $msg  = shift;
35        $msg = sprintf $self->{format}, $msg;
36        $tag_version->($c, $ver, $msg, @_);
37    };
38    use strict;
39}
40
411;
42__END__
43
44=head1 NAME
45
46ShipIt::Step::CommitMessageWrap - commit message wrapping format to shipit version control
47
48=head1 SYNOPSIS
49
50None.
51
52=head1 DESCRIPTION
53
54this module is quick hack to commit and tag_version method in ShipIt::VC module.
55commit message it makes your free wrapping format to version control.
56
57=head1 CONFIGURATION
58
59In the .shipit file:
60
61  commit_message.format = before %msg after
62
63tagging log:
64
65  before Tagging version '$ver' using shipit. after
66
67=head1 AUTHOR
68
69Kazuhiro Osawa E<lt>ko@yappo.ne.jpE<gt>
70
71=head1 SEE ALSO
72
73=head1 LICENSE
74
75This library is free software; you can redistribute it and/or modify
76it under the same terms as Perl itself.
77
78=cut
Note: See TracBrowser for help on using the browser.