include git commit hash in metadata
[p5sagit/Distar.git] / helpers / add-git-commit
CommitLineData
f45d9bde 1#!/usr/bin/env perl
2use strict;
3use warnings FATAL => 'all';
4
5use CPAN::Meta;
6use Parse::CPAN::Meta;
7
8my $file = shift || die "need a file";
9my $meta = Parse::CPAN::Meta->load_file($file);
10
11my $commit = `git rev-parse HEAD`;
12chomp $commit;
13$meta->{x_vcs_commit} = $commit;
14
15my $tag = `git describe`;
16chomp $tag;
17$meta->{x_vcs_tag} = $tag;
18
19CPAN::Meta->new($meta)->save($file, { version => ($file =~ /\.yml$/ ? 1 : 2) });