#!/usr/bin/perl
#
#

use strict;

use Getopt::Std;
use File::Basename;

use lib '/app/tools/distribution/lib';
use Distribution::Test::Command::Staging;

my %opt;
usage() unless ( getopts( 'a:j:s:gt:r:hbdxvf', \%opt ) );

usage() if ( $opt{h} );

my $matcher = new Distribution::Test::Command::Staging(
    album_id        => $opt{a},
    force           => $opt{f},
    test_conf_dir   => $opt{j},
    test_output_dir => $opt{t},
    service_id      => $opt{s},
    report_email    => $opt{r},
    no_clean        => $opt{x},
    build_conf      => $opt{b},
    verbose         => $opt{v},
    debug           => $opt{d}
);

$matcher->run();

sub usage {
    my $prog = basename $0;

    print <<EofUSAGE;

usage: $prog [-j test_conf_dir] [-s service_id] [-r report_email_address] [-x error_email_address] [-a album_id] [-h] [-d]
            -a - album_id
            -j - override test configuration directory
            -t - override test output directory
            -s - Only run for specified service id
            -r - Send summary report to this email
            -x - Don't clean the build directory after a successful test
            -b - Build the test configuration and templates (no tests are run)
            -f - Force test build
            -d - display debug information to STDERR
            -v - display verbose debug information to STDERR
            -h - display this screen
EofUSAGE

    exit 1;
}
