Perl::Dist::WiX::Role::GitPlugin - Role for plugins that build from git checkouts.


Perl-Dist-WiX documentation Contained in the Perl-Dist-WiX distribution.

Index


Code Index:

NAME

Top

Perl::Dist::WiX::Role::GitPlugin - Role for plugins that build from git checkouts.

VERSION

Top

This document describes Perl::Dist::WiX::Role::GitPlugin version 1.500.

SYNOPSIS

Top

	# Since this is a role, it is composed into classes that use it.

DESCRIPTION

Top

Perl::Dist::WiX::Role::GitPlugin is a role that provides an attribute that is common to all plugins that build Perl from git checkouts.

METHODS

Top

git_describe

The git_describe method returns the output of git describe on the directory pointed to by git_checkout().

It is only executed once, and then the value is stored.

SUPPORT

Top

Bugs should be reported via the CPAN bug tracker at

http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Perl-Dist-WiX

For other issues, contact the author.

AUTHOR

Top

Curtis Jewell <csjewell@cpan.org>

SEE ALSO

Top

Perl::Dist::WiX, Perl::Dist::WiX::BuildPerl::PluginInterface (Perl::Dist::WiX::BuildPerl::PluginInterface)

COPYRIGHT AND LICENSE

Top


Perl-Dist-WiX documentation Contained in the Perl-Dist-WiX distribution.
package Perl::Dist::WiX::Role::GitPlugin;

use 5.010;
use Moose::Role;
use English qw( -no_match_vars );

our $VERSION = '1.500';
$VERSION =~ s/_//sm;

has 'git_describe' => (
	is       => 'ro',
	lazy     => 1,
	builder  => '_build_git_describe',
	init_arg => undef,
);

sub _build_git_describe {
	my $self     = shift;
	my $checkout = $self->git_checkout();
	my $location = $self->git_location();
	if ( not -f $location ) {
		PDWiX::File->throw(
			message => 'Could not find git',
			file    => $location
		);
	}
	$location = Win32::GetShortPathName($location);
	if ( not defined $location ) {
		PDWiX->throw( 'Could not convert the location of git.exe'
			  . ' to a path with short names' );
	}

	## no critic(ProhibitBacktickOperators)
	$self->trace_line( 2,
		"Finding current commit using $location describe\n" );
	my $describe =
qx{cmd.exe /d /e:on /c "pushd $checkout && $location describe && popd"};

	if ($CHILD_ERROR) {
		PDWiX->throw("'git describe' returned an error: $CHILD_ERROR");
	}

	$describe =~ s/v5[.]/5./ms;
	$describe =~ s/\n//ms;

	return $describe;
} ## end sub _build_git_describe


no Moose::Role;

1;

__END__