Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 87 lines (69 sloc) 1.88 KB
#!/usr/bin/perl
use strict;
use warnings;
use File::Copy;
use File::Path;
use Template;
use YAML 'LoadFile';
use constant TT => "$ENV{HOME}/git/release";
my $USER = 'mag-sol@mag-sol.com';
my $DIR = 'subdomains/code';
my %build = (
build => {
start => './Build.PL',
cover => './Build testcover',
dist => './Build dist',
},
make => {
start => './Makefile.PL',
cover => 'HARNESS_PERL_SWITCHES=-MDevel::Cover make test',
dist => 'make dist',
}
);
my $metafile;
foreach (qw[MYMETA.yml META.yml]) {
if (-f $_ and ! -z $_) {
$metafile = $_;
}
}
die "Can't find MYMETA.yml or META.yml\n" unless -f $metafile;
my $meta = LoadFile($metafile);
my $build;
if (-f 'Build.PL') {
$build = $build{build};
} else {
$build = $build{make};
}
system "perl $build->{start}";
system 'cover -delete';
system $build->{cover};
system 'cover -report html_basic';
system $build->{dist};
rmtree($meta->{name}) if -d $meta->{name};
mkdir "$meta->{name}";
mkdir "$meta->{name}/cover";
foreach (<cover_db/*.html>, <cover_db/*.css>) {
s|^cover_db/||;
copy "cover_db/$_", "$meta->{name}/cover/$_";
}
move "$meta->{name}/cover/coverage.html", "$meta->{name}/cover/index.html";
my $ver = "$meta->{name}-$meta->{version}";
#system("cpanspec -b -f $ver.tar.gz");
#my $rpm = glob("noarch/perl-$meta->{name}-$meta->{version}-*.rpm");
#my $srcrpm = glob("perl-$meta->{name}-$meta->{version}-*.src.rpm");
my $t = Template->new({INCLUDE_PATH => TT});
$t->process('index.tt', { metafile => $metafile },
"$meta->{name}/index.html")
or die $t->error;
copy "$ver.tar.gz", $meta->{name};
#if ($rpm) {
# copy $rpm, $meta->{name};
# $rpm =~ s|^noarch/||;
#}
#copy $srcrpm, $meta->{name} if $srcrpm;
chdir "$meta->{name}";
system "zcat $ver.tar.gz | tar xvf -";
move $ver, 'dist';
chdir '..';
system "ssh $USER rm -rf $DIR/$meta->{name}";
system "scp -r ./$meta->{name} $USER:$DIR/";