Skip to content

Commit

Permalink
The nopinit options is back in the config.
Browse files Browse the repository at this point in the history
I've rationalized (to myself) that this is something
that you should be able to set just once on the
repository.  For example, if you create a repository
that is strictly for private use and you know that
no one else will be messing with the VCS.
  • Loading branch information
Jeffrey Ryan Thalhammer committed Aug 25, 2011
1 parent 3466c6a commit ffba137
Show file tree
Hide file tree
Showing 15 changed files with 90 additions and 22 deletions.
6 changes: 6 additions & 0 deletions Changes
@@ -1,5 +1,11 @@
{{$NEXT}}

* Interface changes

The "noinit" parameter has been removed from the repository's
configuration file and is now only available on the command
line.

0.019 2011-08-24 04:09:41 America/Los_Angeles

* Bug Fixes:
Expand Down
2 changes: 1 addition & 1 deletion dist.ini
Expand Up @@ -5,7 +5,7 @@ license = Perl_5
copyright_holder = Imaginative Software Systems
copyright_year = 2011

version = 0.019
version = 0.020

[GatherDir] ; everything under top dir
[PruneCruft] ; default stuff to skip
Expand Down
9 changes: 4 additions & 5 deletions lib/App/Pinto/Admin.pm
Expand Up @@ -16,11 +16,10 @@ use App::Cmd::Setup -app;
sub global_opt_spec {

return (

[ "repos|r=s" => "Path to your repository directory"],
[ "nocolor" => "Do not colorize diagnostic messages" ],
[ "quiet|q" => "Only report fatal errors"],
[ "verbose|v+" => "More diagnostic output (repeatable)" ],
[ 'repos|r=s' => 'Path to your repository directory' ],
[ 'nocolor' => 'Do not colorize diagnostic messages' ],
[ 'quiet|q' => 'Only report fatal errors' ],
[ 'verbose|v+' => 'More diagnostic output (repeatable)' ],
);
}

Expand Down
19 changes: 19 additions & 0 deletions lib/App/Pinto/Admin/Command.pm
Expand Up @@ -15,6 +15,25 @@ use App::Cmd::Setup -command;

#-----------------------------------------------------------------------------

sub opt_spec {
my ( $self, $app ) = @_;

return (

[ 'man' => 'Show manual for this command' ],
);
}

#-----------------------------------------------------------------------------

sub validate_args {
my ($self, $opts, $args) = @_;

die "RTFM!\n" if $opts->{man};
}

#-----------------------------------------------------------------------------

=method pinto()
Returns the Pinto object for this command. Basically an alias for
Expand Down
6 changes: 5 additions & 1 deletion lib/App/Pinto/Admin/Command/add.pm
Expand Up @@ -18,7 +18,10 @@ use base 'App::Pinto::Admin::Command';
#-----------------------------------------------------------------------------

sub opt_spec {
return (
my ($self, $app) = @_;

return ( $self->SUPER::opt_spec(),

[ 'author=s' => 'Your (alphanumeric) author ID' ],
[ 'message=s' => 'Prepend a message to the VCS log' ],
[ 'nocommit' => 'Do not commit changes to VCS' ],
Expand All @@ -39,6 +42,7 @@ sub execute {
$self->pinto->new_action_batch( %{$opts} );
$self->pinto->add_action('Add', %{$opts}, dist => $_) for @args;
my $result = $self->pinto->run_actions();

return $result->is_success() ? 0 : 1;
}

Expand Down
9 changes: 8 additions & 1 deletion lib/App/Pinto/Admin/Command/clean.pm
Expand Up @@ -18,7 +18,10 @@ use base 'App::Pinto::Admin::Command';
#------------------------------------------------------------------------------

sub opt_spec {
return (
my ($self, $app) = @_;

return ( $self->SUPER::opt_spec(),

[ 'noinit' => 'Do not pull/update from VCS' ],
);
}
Expand All @@ -27,7 +30,11 @@ sub opt_spec {

sub validate_args {
my ($self, $opts, $args) = @_;

$self->SUPER::validate_args($opts, $args);

$self->usage_error('Arguments are not allowed') if @{ $args };

return 1;
}

Expand Down
4 changes: 4 additions & 0 deletions lib/App/Pinto/Admin/Command/create.pm
Expand Up @@ -19,7 +19,11 @@ use base 'App::Pinto::Admin::Command';

sub validate_args {
my ($self, $opts, $args) = @_;

$self->SUPER::validate_args($opts, $args);

$self->usage_error('Arguments are not allowed') if @{ $args };

return 1;
}

Expand Down
6 changes: 5 additions & 1 deletion lib/App/Pinto/Admin/Command/list.pm
Expand Up @@ -25,8 +25,10 @@ Readonly my $DEFAULT_LIST_TYPE => 'all';
#------------------------------------------------------------------------------

sub opt_spec {
my ($self, $app) = @_;

return ( $self->SUPER::opt_spec(),

return (
[ 'noinit' => 'Do not pull/update from VCS' ],
[ 'type=s' => "One of: ( $LIST_TYPES_STRING )" ],
);
Expand All @@ -37,6 +39,8 @@ sub opt_spec {
sub validate_args {
my ($self, $opts, $args) = @_;

$self->SUPER::validate_args($opts, $args);

$self->usage_error('Arguments are not allowed') if @{ $args };

$opts->{type} ||= $DEFAULT_LIST_TYPE;
Expand Down
9 changes: 8 additions & 1 deletion lib/App/Pinto/Admin/Command/mirror.pm
Expand Up @@ -16,7 +16,10 @@ use base 'App::Pinto::Admin::Command';
#------------------------------------------------------------------------------

sub opt_spec {
return (
my ($self, $app) = @_;

return ( $self->SUPER::opt_spec(),

[ 'force' => 'Force action, even if indexes appear unchanged' ],
[ 'message=s' => 'Prepend a message to the VCS log' ],
[ 'nocommit' => 'Do not commit changes to VCS' ],
Expand All @@ -30,7 +33,11 @@ sub opt_spec {

sub validate_args {
my ($self, $opts, $args) = @_;

$self->SUPER::validate_args($opts, $args);

$self->usage_error('Arguments are not allowed') if @{ $args };

return 1;
}

Expand Down
6 changes: 5 additions & 1 deletion lib/App/Pinto/Admin/Command/rebuild.pm
Expand Up @@ -16,8 +16,10 @@ use base 'App::Pinto::Admin::Command';
#------------------------------------------------------------------------------

sub opt_spec {
my ($self, $app) = @_;

return ( $self->SUPER::opt_spec(),

return (
[ 'noinit' => 'Do not pull/update from VCS' ],
);
}
Expand All @@ -27,6 +29,8 @@ sub opt_spec {
sub validate_args {
my ($self, $opts, $args) = @_;

$self->SUPER::validate_args($opts, $args);

$self->usage_error('Arguments are not allowed') if @{ $args };

return 1;
Expand Down
5 changes: 4 additions & 1 deletion lib/App/Pinto/Admin/Command/remove.pm
Expand Up @@ -18,7 +18,10 @@ use base 'App::Pinto::Admin::Command';
#------------------------------------------------------------------------------

sub opt_spec {
return (
my ($self, $app) = @_;

return ( $self->SUPER::opt_spec(),

[ 'author=s' => 'Your (alphanumeric) author ID' ],
[ 'message=s' => 'Prepend a message to the VCS log' ],
[ 'nocommit' => 'Do not commit changes to VCS' ],
Expand Down
10 changes: 8 additions & 2 deletions lib/App/Pinto/Admin/Command/verify.pm
Expand Up @@ -16,15 +16,21 @@ use base 'App::Pinto::Admin::Command';
#-----------------------------------------------------------------------------

sub opt_spec {
return (
my ($self, $app) = @_;

return ( $self->SUPER::opt_spec(),

[ 'noinit' => 'Do not pull/update from VCS' ],
);
}

#-----------------------------------------------------------------------------

sub validate_args {
my ($self, $opt, $args) = @_;
my ($self, $opts, $args) = @_;

$self->SUPER::validate_args($opts, $args);

$self->usage_error("Arguments are not allowed") if @{ $args };
return 1;
}
Expand Down
8 changes: 1 addition & 7 deletions lib/Pinto/ActionBatch.pm
Expand Up @@ -55,12 +55,6 @@ has message => (
default => '',
);

has noinit => (
is => 'ro',
isa => Bool,
default => 0,
);

has nocommit => (
is => 'ro',
isa => Bool,
Expand Down Expand Up @@ -146,7 +140,7 @@ sub run {
sub _run_actions {
my ($self) = @_;

$self->store->initialize() unless $self->noinit();
$self->store->initialize() unless $self->config->noinit();

while ( my $action = $self->dequeue() ) {
$self->_run_one_action($action);
Expand Down
9 changes: 9 additions & 0 deletions lib/Pinto/Config.pm
Expand Up @@ -54,6 +54,15 @@ has noclobber => (
);


has noinit => (
is => 'ro',
isa => Bool,
key => 'noinit',
default => 0,
documentation => 'If true, then Pinto will not pull/update from VCS before each operation',
);


has store => (
is => 'ro',
isa => Str,
Expand Down
4 changes: 3 additions & 1 deletion t/03-config.t
Expand Up @@ -3,7 +3,7 @@
use strict;
use warnings;

use Test::More (tests => 9);
use Test::More (tests => 11);
use Test::Exception;

use Path::Class;
Expand All @@ -21,6 +21,7 @@ use Pinto::Config;
source => 'http://cpan.perl.org',
store => 'Pinto::Store',
nocleanup => 0,
noinit => 0,
);

my $cfg = Pinto::Config->new(repos => 'nowhere');
Expand All @@ -34,6 +35,7 @@ use Pinto::Config;
source => 'http://cpan.pair.com',
store => 'Pinto::Store::VCS::Git',
nocleanup => 1,
noinit => 1,
);

$cfg = Pinto::Config->new(%custom_cases);
Expand Down

0 comments on commit ffba137

Please sign in to comment.