Source

schemingmind_tuning / install_extension.pl

Full commit
#!/usr/bin/perl -w
# -*- coding: utf-8 -*-

# Wrzuca po prostu najnowszą wersję. Nadawanie numerka wersji
# itp jest w build_extension.

use strict;
use FindBin;
use File::Spec::Functions;

chdir $FindBin::Bin or die "chdir: $!\n";

my @newest = (0,0,0);
open(F, "hg tags|");
while(<F>) {
    if(/^(\d+)\.(\d+)\.(\d+)\b/) {
        if( $1 > $newest[0]
              || ($1 == $newest[0]
                    && ($2 > $newest[1]
                          || ($2 == $newest[1] && $3 > $newest[2])))) {
            @newest = ($1, $2, $3);
        }
    }
}
close(F);
my $version = join('.', @newest);

my $XPI_NAME = "smtuning-$version.xpi";
my $RDF_NAME = "update-$version.rdf";
my $EXT_DIR = "$FindBin::Bin/smtuning";
my $XPI_FILE = catfile($FindBin::Bin, $XPI_NAME);
my $RDF_FILE = catfile($FindBin::Bin, $RDF_NAME);

unless (-f $XPI_FILE) {
    die "$XPI_FILE not found. Not built?\n";
}
unless (-f $RDF_FILE) {
    die "$RDF_FILE not found. Not built?\n";
}

print "Installing $version\n";

system("scp $XPI_FILE $RDF_FILE linode.mekk.waw.pl:");
system("ssh linode.mekk.waw.pl 'mv $XPI_NAME $RDF_NAME www_download/smtuning/; cd www_download/smtuning/; ln -sf $XPI_NAME smtuning.xpi; ln -sf $RDF_NAME update.rdf'");
system("hg push bitbucket");