| Module-Release-Git documentation | Contained in the Module-Release-Git distribution. |
Module::Release::Git - Use Git with Module::Release
The release script automatically loads this module if it sees a
.git directory. The module exports check_vcs, vcs_tag, and
make_vcs_tag.
Module::Release::Git subclasses Module::Release, and provides
its own implementations of the check_vcs() and vcs_tag() methods
that are suitable for use with a Git repository.
These methods are automatically exported in to the callers namespace using Exporter.
This module depends on the external git binary (so far).
Check the state of the Git repository.
Tag the release in local Git.
By default, examines the name of the remote file
(i.e. Foo-Bar-0.04.tar.gz) and constructs a tag string like
RELEASE_0_04 from it. Override this method if you want to use a
different tagging scheme, or don't even call it.
This module is in Github:
git://github.com/briandfoy/module--release--git.git
brian d foy, <bdfoy@cpan.org>
Copyright (c) 2007-2009, brian d foy, All Rights Reserved.
You may redistribute this under the same terms as Perl itself.
| Module-Release-Git documentation | Contained in the Module-Release-Git distribution. |
package Module::Release::Git; use strict; use warnings; use base qw(Exporter); our @EXPORT = qw(check_vcs vcs_tag make_vcs_tag); use vars qw($VERSION); $VERSION = '0.14';
sub check_vcs { my $self = shift; $self->_print( "Checking state of Git... " ); my $git_status = $self->run('git status 2>&1'); no warnings 'uninitialized'; my( $branch ) = $git_status =~ /^# On branch (\w+)/; my $up_to_date = $git_status =~ /^nothing to commit \(working directory clean\)/m; $self->_die( "\nERROR: Git is not up-to-date: Can't release files\n\n$git_status\n" ) unless $up_to_date; $self->_print( "Git up-to-date on branch $branch\n" ); return 1; }
sub vcs_tag { my( $self, $tag ) = @_; $tag ||= $self->make_vcs_tag; $self->_print( "Tagging release with $tag\n" ); return 0 unless defined $tag; $self->run( "git tag $tag" ); return 1; }
sub make_vcs_tag { no warnings 'uninitialized'; my( $major, $minor ) = $_[0]->remote_file =~ /(\d+) \. (\d+(?:_\d+)?) (?: \.tar\.gz | \.tgz | \.zip )? $/xg; $_[0]->_warn( "Could not parse remote [$_[0]->{remote_file}] to get major and minor versions" ) unless defined $major; return "RELEASE_${major}_${minor}"; }
1;