Skip to content

Commit

Permalink
generate 06perms.txt.gz
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Jan 31, 2013
1 parent f23938b commit 839e844
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@
Revision history for CPAN-Faker

{{$NEXT}}
06perms.txt.gz is now generated

0.007 2011-04-18 14:30:02 Europe/Amsterdam
require Module::Faker 0.008 for .dist files
Expand Down
27 changes: 22 additions & 5 deletions lib/CPAN/Faker.pm
Expand Up @@ -11,6 +11,7 @@ use File::Find ();
use File::Next ();
use File::Path ();
use File::Spec ();
use IO::Compress::Gzip qw(gzip $GzipError);
use Module::Faker::Dist 0.008; # from .dist files
use Sort::Versions qw(versioncmp);
use Text::Template;
Expand Down Expand Up @@ -56,7 +57,6 @@ Other files that are not currently created, but may be in the future are:
./indices/find-ls.gz
./indices/ls-lR.gz
./modules/06perms.txt.gz
./modules/by-category/...
./modules/by-module/...
Expand Down Expand Up @@ -172,6 +172,7 @@ sub make_cpan {
$self->write_author_index;
$self->write_modlist_index;
$self->write_perms_index;
$self->write_perms_gz_index;
}

=head2 add_dist
Expand Down Expand Up @@ -327,11 +328,13 @@ sub _maybe_index {
=method write_perms_index
=method write_perms_gz_index
All these are automatically called by C<make_cpan>; you probably do not need to
call them yourself.
Write C<01mailrc.txt.gz>, C<02packages.details.txt.gz>, C<03modlist.data.gz>,
and C<06perms.txt> respectively.
C<06perms.txt>, and C<06perms.txt.gz> respectively.
=cut

Expand Down Expand Up @@ -404,15 +407,20 @@ sub write_modlist_index {
$gz->gzclose and die "error closing $index_filename";
}

sub write_perms_index {
sub _perms_index_filename {
my ($self) = @_;

my $index_dir = File::Spec->catdir($self->dest, 'modules');

my $index_filename = File::Spec->catfile(
return File::Spec->catfile(
$index_dir,
'06perms.txt',
);
}

sub write_perms_index {
my ($self) = @_;

my $index_filename = $self->_perms_index_filename;

my $template = $self->section_data('packages');

Expand Down Expand Up @@ -442,6 +450,15 @@ sub write_perms_index {
close $fh or die "error closing $index_filename after writing: $!";
}

sub write_perms_gz_index {
my ($self) = @_;

my $index_filename = $self->_perms_index_filename;
my $index_gz_fname = "$index_filename.gz";
gzip($index_filename, $index_gz_fname)
or confess "gzip failed: $GzipError"
}

sub _02pkg_front_matter {
my ($self, $arg) = @_;

Expand Down

0 comments on commit 839e844

Please sign in to comment.