-
Notifications
You must be signed in to change notification settings - Fork 31
/
Push.pm
107 lines (71 loc) · 2.08 KB
/
Push.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#
# This file is part of Dist-Zilla-Plugin-Git
#
# This software is copyright (c) 2009 by Jerome Quelin.
#
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
#
use 5.008;
use strict;
use warnings;
package Dist::Zilla::Plugin::Git::Push;
{
$Dist::Zilla::Plugin::Git::Push::VERSION = '1.120970';
}
# ABSTRACT: push current branch
use Git::Wrapper;
use Moose;
use MooseX::Has::Sugar;
use MooseX::Types::Moose qw{ ArrayRef Str };
with 'Dist::Zilla::Role::AfterRelease';
with 'Dist::Zilla::Role::Git::Repo';
sub mvp_multivalue_args { qw(push_to) }
# -- attributes
has push_to => (
is => 'ro',
isa => 'ArrayRef[Str]',
lazy => 1,
default => sub { [ qw(origin) ] },
);
sub after_release {
my $self = shift;
my $git = Git::Wrapper->new( $self->repo_root );
# push everything on remote branch
for my $remote ( @{ $self->push_to } ) {
$self->log("pushing to $remote");
my @remote = split(/\s+/,$remote);
$self->log_debug($_) for $git->push( @remote );
$self->log_debug($_) for $git->push( { tags=>1 }, $remote[0] );
}
}
1;
=pod
=head1 NAME
Dist::Zilla::Plugin::Git::Push - push current branch
=head1 VERSION
version 1.120970
=head1 SYNOPSIS
In your F<dist.ini>:
[Git::Push]
push_to = origin ; this is the default
push_to = origin HEAD:refs/heads/released ; also push to released branch
=head1 DESCRIPTION
Once the release is done, this plugin will push current git branch to
remote end, with the associated tags.
The plugin accepts the following options:
=over 4
=item *
push_to - the name of the a remote to push to. The default is F<origin>.
This may be specified multiple times to push to multiple repositories.
=back
=for Pod::Coverage after_release
mvp_multivalue_args
=head1 AUTHOR
Jerome Quelin
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2009 by Jerome Quelin.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
__END__