Skip to content

Commit

Permalink
Changed 'nocleanup' -> 'cleanup'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrey Ryan Thalhammer committed Oct 7, 2011
1 parent fce11c9 commit 6b7021a
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 22 deletions.
5 changes: 5 additions & 0 deletions Changes
Expand Up @@ -99,6 +99,11 @@
The 'noclobber' configuration setting has been removed, since it
was never implemented anyway.

The 'nocleanup' configuration setting has been changed to 'cleanup'
and it now defaults to 0. This is the opposite of the old behavior.
So if you want your repository to contain only the latest dists,
then set cleanup=1 in your configuration.

The --force option of the 'update' command for pinto-admin is no
longer supported. I'm thinking of changing the meaning of "force"
and might bring it back in a future release.
Expand Down
24 changes: 10 additions & 14 deletions lib/App/Pinto/Admin/Command/create.pm
Expand Up @@ -25,11 +25,11 @@ sub opt_spec {
my ($self, $app) = @_;

return (
[ 'cleanup' => 'Automatically remove distributions when they become outdated' ],
[ 'devel' => 'Include development releases in the repository index' ],
[ 'nocleanup' => 'Do not delete distributions when they become outdated' ],
[ 'noinit' => 'Do not pull/update from VCS before each operation' ],
[ 'store=s' => 'Name of class that handles storage of your repository' ],
[ 'source=s@' => 'URL of repository for foreign distributions (repeatable)' ],
[ 'source=s@' => 'URL of repository for foreign distributions (repeatable)' ],
);
}

Expand Down Expand Up @@ -94,20 +94,16 @@ Instructs L<Pinto> to include development releases in the index. A
development release is any archive that includes an underscore (_) in
the last component of the version number.
=item --nocleanup
=item --cleanup
Prevents L<Pinto> from deleting outdated distributions from your
repository when newer ones are added. Remember that outdated
distributions are NEVER listed in the index. But if you set this
option, then you'll be able to install outdated distributions using
the full distribution path, like this:
Instructs L<Pinto> to remove outdated distributions from your
repository when newer ones are added. In effect, your repository will
contain only those distributions that have the latest version of any
given package.
$> cpanm A/AU/AUTHOR/Some-Dist-2.4.tar.gz
If C<--nocleanup> is set, your repository could significantly grow in
size over time. At any time, you may run the C<clean> command to
remove outdated distributions, irrespective of the C<--nocleanup>
parameter.
If C<--cleanup> is not set, your repository could significantly grow
in size over time. But at any time, you may run the C<clean> command
to remove outdated distributions.
=item --noinit
Expand Down
2 changes: 2 additions & 0 deletions lib/Pinto.pm
Expand Up @@ -158,6 +158,8 @@ sub run_actions {
# Divert any warnings to our logger
local $SIG{__WARN__} = sub { $self->whine(@_) };

$self->add_action('Clean') if $self->config->cleanup();

$self->locker->lock();

my $r = $self->_batch->run();
Expand Down
2 changes: 1 addition & 1 deletion lib/Pinto/Action/Clean.pm
Expand Up @@ -29,7 +29,7 @@ override execute => sub {
my $archive = $dist->archive( $self->config->repos() );

$self->db->remove_distribution($dist);
$self->store->remove(file => $archive);
$self->store->remove_archive($archive);

$self->add_message( "Removed distribution $path" );
$removed++;
Expand Down
6 changes: 3 additions & 3 deletions lib/Pinto/Config.pm
Expand Up @@ -98,12 +98,12 @@ has basename => (
);


has nocleanup => (
has cleanup => (
is => 'ro',
isa => Bool,
key => 'nocleanup',
key => 'cleanup',
default => 0,
documentation => 'Do not delete distributions when they become outdated',
documentation => 'Automatically remove distributions when they become outdated',
);


Expand Down
2 changes: 1 addition & 1 deletion lib/Pinto/Schema/ResultSet/Distribution.pm
Expand Up @@ -45,7 +45,7 @@ sub outdated {

my @outdated;
while ( my $dist = $rs->next() ) {
push @outdated, $dist if none { $_->should_index() } $dist->packages();
push @outdated, $dist if none { $_->is_latest() } $dist->packages();
}

my $new_rs = $self->result_source->resultset();
Expand Down
8 changes: 5 additions & 3 deletions t/02-config.t
Expand Up @@ -3,7 +3,7 @@
use strict;
use warnings;

use Test::More (tests => 12);
use Test::More (tests => 14);
use Test::Exception;

use Path::Class;
Expand All @@ -21,8 +21,9 @@ use Pinto::Config;
repos => 'nowhere',
sources => 'http://cpan.perl.org',
store => 'Pinto::Store',
nocleanup => 0,
cleanup => 0,
noinit => 0,
devel => 0,
);

my $cfg = Pinto::Config->new(repos => 'nowhere');
Expand All @@ -35,8 +36,9 @@ use Pinto::Config;
repos => 'nowhere',
sources => 'http://cpan.pair.com http://metacpan.org',
store => 'Pinto::Store::VCS::Git',
nocleanup => 1,
cleanup => 1,
noinit => 1,
devel => 1,
);

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

0 comments on commit 6b7021a

Please sign in to comment.