Shipwright::Script::Maintain - Maintain a shipyard


Shipwright documentation Contained in the Shipwright distribution.

Index


Code Index:

NAME

Top

Shipwright::Script::Maintain - Maintain a shipyard

SYNOPSIS

Top

 maintain --update-order

OPTIONS

Top

 --update-order               : update the build order
 --update-refs                : update refs count
                                times a source shows in all the require.yml
 --graph-deps                 : output a graph of all the dependencies in your vessel
                                suitable for rendering by dot (http://graphviz.org) 
 --for-dists                  : limit the sources
 --skip-requires              : skip requires when finding deps
 --skip-recommends            : skip recommends when finding deps
 --skip-build-requires        : skip build requires when finding deps
 --skip-test-requires         : skip requires when finding deps

GLOBAL OPTIONS

Top

 -r [--repository] REPOSITORY   : specify the repository uri of our shipyard
 -l [--log-level] LOGLEVEL      : specify the log level
                                  (info, debug, warn, error, or fatal)
 --log-file FILENAME            : specify the log file

AUTHORS

Top

sunnavy <sunnavy@bestpractical.com>

LICENCE AND COPYRIGHT

Top


Shipwright documentation Contained in the Shipwright distribution.

package Shipwright::Script::Maintain;

use strict;
use warnings;
use Shipwright::Util;

use base qw/App::CLI::Command Shipwright::Base Shipwright::Script/;
__PACKAGE__->mk_accessors(
    qw/update_order update_refs graph_deps skip_recommends 
      skip_build_requires skip_requires skip_test_requires for_dists/
);

use Shipwright;

sub options {
    (
        'graph-deps'          => 'graph_deps',
        'update-order'        => 'update_order',
        'update-refs'         => 'update_refs',
        'skip-recommends'     => 'skip_recommends',
        'skip-requires'       => 'skip_requires',
        'skip-build-requires' => 'skip_build_requires',
        'skip-test-requires'  => 'skip_test_requires',
        'for-dists=s'         => 'for_dists',
    );
}

sub run {
    my $self = shift;

    my $shipwright = Shipwright->new( repository => $self->repository, );

    if ( $self->update_order ) {
        $shipwright->backend->update_order(
            for_dists => [ split /,\s*/, $self->for_dists || '' ],
            map { $_ => $self->$_ }
              qw/skip_requires skip_recommends skip_build_requires
              skip_test_requires/,
        );
        $self->log->fatal( 'successfully updated order' );
    } 
    if ($self->graph_deps)  {
        my $out = $shipwright->backend->graph_deps(
            for_dists => [ split /,\s*/, $self->for_dists || '' ],
            map { $_ => $self->$_ }
              qw/skip_requires skip_recommends skip_build_requires/,
        );
        $self->log->fatal( $out );
    }

    if ( $self->update_refs ) {
        $shipwright->backend->update_refs;
        $self->log->fatal( 'successfully updated refs' );
    }
}

1;

__END__