Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created August 5, 2010 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tadzik/510123 to your computer and use it in GitHub Desktop.
Save tadzik/510123 to your computer and use it in GitHub Desktop.
use v6;
sub notice (Str $what) {
say "\e[1m==> ", $what, "\e[0m";
}
sub MAIN (Str $url) {
my $res; # for various run() calls
my $workdir = '.protominus.tmpdir';
if $workdir.IO ~~ :e {
notice "Old $workdir exists, removing";
if run "rm -rf $workdir" {
die "Could not remove $workdir, please do it yourself"
}
}
$url ~~ /(<-[\/]>+).git/;
my $name = $/[0];
mkdir $workdir;
chdir $workdir;
notice "Cloning $name";
$res = run "git clone $url";
die "Failed cloning the repo!" if $res;
chdir $name;
notice 'Building';
$res = run 'which ufo';
if !$res {
run 'ufo';
} else {
die "Oh noes, no ufo!"
}
$res = run 'make';
die "Failed building the module!" if $res;
if 't'.IO ~~ :d {
notice 'Testing';
$res = run 'make test';
if $res {
die 'Testing failed, will not continue without --force'
}
}
notice 'Installing';
run 'make install';
chdir '../..';
run "rm -rf $workdir";
notice 'Cleaning up';
}
sub USAGE {
say "Usage: protominus.pl <git repo url>"
}
# vim: ft=perl6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment