Gentoo-Overlay-Group-INI
view release on metacpan or search on metacpan
"File::Tempdir" => 0,
"FindBin" => 0,
"Module::Build" => "0.4003",
"Test::Fatal" => 0,
"Test::More" => "0.98",
"autodie" => 0
},
"configure_requires" => {
"Module::Build" => "0.4003"
},
"dist_abstract" => "Load a list of overlays defined in a configuration file.",
"dist_author" => [
"Kent Fredric <kentnl\@cpan.org>"
],
"dist_name" => "Gentoo-Overlay-Group-INI",
"dist_version" => "0.2.2",
"license" => "perl",
"module_name" => "Gentoo::Overlay::Group::INI",
"recommends" => {},
"recursive_test_files" => 1,
"requires" => {
for testing as tests will create those paths.
0.2.0 2012-06-22T06:15:18Z
[Dependencies::Runtime]
- new : String::RewritePrefix
[Features]
- added INI->load_named( $name, $config );
- added INI->load_all_isa( $isa, $config );
- added INI->load_all_does( $role, $config );
- added Overlays->overlay_group();
[Internals]
- moved section <-> group transformer into section code.
- broke internals of ->load into ->_parse
0.1.0 2012-06-21T21:05:59Z
- First version.
.perltidyrc
Build.PL
Changes
LICENSE
MANIFEST
META.json
META.yml
README
corpus/overlay_4/fake-category-2/keepdir
corpus/overlay_4/fake-category/keepdir
corpus/overlay_4/metadata/keepdir
corpus/overlay_4/profiles/categories
corpus/overlay_4/profiles/repo_name
corpus/overlay_5/fake-category-2/keepdir
corpus/overlay_5/fake-category/keepdir
corpus/overlay_5/metadata/keepdir
corpus/overlay_5/profiles/categories
corpus/overlay_5/profiles/repo_name
dist.ini
lib/Gentoo/Overlay/Group/INI.pm
lib/Gentoo/Overlay/Group/INI/Assembler.pm
lib/Gentoo/Overlay/Group/INI/Section.pm
lib/Gentoo/Overlay/Group/INI/Section/Overlays.pm
perlcritic.rc
t/00-compile.t
t/000-report-versions-tiny.t
t/basic.t
t/multi_name.t
{
"abstract" : "Load a list of overlays defined in a configuration file.",
"author" : [
"Kent Fredric <kentnl@cpan.org>"
],
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 4.300031, CPAN::Meta::Converter version 2.120921",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
---
abstract: 'Load a list of overlays defined in a configuration file.'
author:
- 'Kent Fredric <kentnl@cpan.org>'
build_requires:
File::Find: 0
File::Temp: 0
File::Tempdir: 0
FindBin: 0
Module::Build: 0.4003
Test::Fatal: 0
Test::More: 0.98
NAME
Gentoo::Overlay::Group::INI - Load a list of overlays defined in a
configuration file.
VERSION
version 0.2.2
SYNOPSIS
Generates a "Gentoo::Overlay::Group" object using a configuration file
from your environment.
require Gentoo::Overlay::Group::INI;
CLASS METHODS
load
Returns a working Overlay::Group object.
my $group = Gentoo::Overlay::Group::INI->load();
load_named
Return an inflated arbitrary section:
# A "self-named" overlay section
my $section = Gentoo::Overlay::Group::INI->load_named('Overlay');
# A 'custom named overlay section, ie:
# [ Overlay / foo ]
my $section = Gentoo::Overlay::Group::INI->load_named('foo');
load_all_does
Return all sections in a config file that "do" the given role.
my ( @sections ) = Gentoo::Overlay::Group::INI->load_all_does('Some::Role');
load_all_isa
Return all sections in a config file that inherit the given class.
corpus/overlay_4/profiles/repo_name view on Meta::CPAN
overlay_4
corpus/overlay_5/profiles/repo_name view on Meta::CPAN
overlay_5
lib/Gentoo/Overlay/Group/INI.pm view on Meta::CPAN
use warnings;
package Gentoo::Overlay::Group::INI;
BEGIN {
$Gentoo::Overlay::Group::INI::AUTHORITY = 'cpan:KENTNL';
}
{
$Gentoo::Overlay::Group::INI::VERSION = '0.2.2';
}
# ABSTRACT: Load a list of overlays defined in a configuration file.
use Moose;
use Path::Tiny;
use File::HomeDir;
use Gentoo::Overlay::Exceptions qw( :all );
our $CFG_PATHS;
lib/Gentoo/Overlay/Group/INI.pm view on Meta::CPAN
payload => { paths => ( join q{}, map { " $_\n" } _enumerate_file_list ), }
);
}
sub load {
my ($self) = @_;
my $seq = $self->_parse();
return $seq->section_named('Overlays')->construct->overlay_group;
}
sub load_named {
my ( $self, $name, $config ) = @_;
$config //= {};
my $seq = $self->_parse();
my $section = $seq->section_named($name);
return unless defined $section;
lib/Gentoo/Overlay/Group/INI.pm view on Meta::CPAN
1;
__END__
=pod
=encoding utf-8
=head1 NAME
Gentoo::Overlay::Group::INI - Load a list of overlays defined in a configuration file.
=head1 VERSION
version 0.2.2
=head1 SYNOPSIS
Generates a L<< C<Gentoo::Overlay::B<Group>> object|Gentoo::Overlay::Group >> using a configuration file from your environment.
require Gentoo::Overlay::Group::INI;
lib/Gentoo/Overlay/Group/INI.pm view on Meta::CPAN
=head2 load
Returns a working Overlay::Group object.
my $group = Gentoo::Overlay::Group::INI->load();
=head2 load_named
Return an inflated arbitrary section:
# A "self-named" overlay section
my $section = Gentoo::Overlay::Group::INI->load_named('Overlay');
# A 'custom named overlay section, ie:
# [ Overlay / foo ]
my $section = Gentoo::Overlay::Group::INI->load_named('foo');
=head2 load_all_does
Return all sections in a config file that C<do> the given role.
my ( @sections ) = Gentoo::Overlay::Group::INI->load_all_does('Some::Role');
=head2 load_all_isa
lib/Gentoo/Overlay/Group/INI/Section/Overlays.pm view on Meta::CPAN
has '_directories' => (
init_arg => 'directory',
isa => 'ArrayRef[ Str ]',
is => 'rw',
traits => [qw( Array )],
handles => { directories => elements =>, },
);
sub overlay_group {
my ( $self, @rest ) = @_;
require Gentoo::Overlay::Group;
my $group = Gentoo::Overlay::Group->new();
for my $path ( $self->directories ) {
$group->add_overlay($path);
}
return $group;
}
__PACKAGE__->meta->make_immutable;
no Moose;
1;
__END__
lib/Gentoo/Overlay/Group/INI/Section/Overlays.pm view on Meta::CPAN
This is eventually parsed and decoded into one of these objects.
my @directories = ( $object->directories ); # ( a, b, c )
=head1 METHODS
=head2 mvp_multivalue_args
Tells Config::MVP that C<directory> can be specified multiple times.
=head2 overlay_group
Convert the data stored in this section into a Gentoo::Overlay::Group object.
$group = $section->overlay_group;
=head1 AUTHOR
Kent Fredric <kentnl@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Kent Fredric <kentnl@cpan.org>.
This is free software; you can redistribute it and/or modify it under
use warnings;
use Test::More;
use Test::Fatal;
use Path::Tiny qw( path );
use FindBin;
use autodie;
my $base = path("$FindBin::Bin/../corpus");
my @overlays = ( $base->child("overlay_4")->stringify, $base->child("overlay_5")->stringify,, );
use File::Tempdir;
my $tmpdir = File::Tempdir->new();
my $homedir = File::Tempdir->new();
my $dir = path( $tmpdir->name );
my $fh = $dir->child('config.ini')->openw;
$fh->print("[Overlays]\n");
$fh->print("directory = $_\n") for @overlays;
$fh->flush;
$fh->close;
local $ENV{GENTOO_OVERLAY_GROUP_INI_PATH} = $dir->stringify;
local $ENV{HOME} = $homedir->name;
# FILENAME: basic.t
# CREATED: 22/06/12 07:13:46 by Kent Fredric (kentnl) <kentfredric@gmail.com>
# ABSTRACT: Test basic functionality
t/multi_name.t view on Meta::CPAN
use warnings;
use Test::More;
use Test::Fatal;
use Path::Tiny qw( path );
use FindBin;
use autodie;
my $base = path("$FindBin::Bin/../corpus");
my @overlays = ( $base->child("overlay_4")->stringify, $base->child("overlay_5")->stringify,, );
use File::Tempdir;
my $tmpdir = File::Tempdir->new();
my $homedir = File::Tempdir->new();
my $dir = path( $tmpdir->name );
my $fh = $dir->child('config.ini')->openw;
$fh->print("[Overlays]\n");
$fh->print("directory = $_\n") for @overlays;
$fh->print("[Overlays / test_2 ]\n");
$fh->print("directory = $_\n") for $overlays[0];
$fh->print("[Overlays / test_3 ]\n");
$fh->print("directory = $_\n") for $overlays[1];
$fh->flush;
$fh->close;
local $ENV{GENTOO_OVERLAY_GROUP_INI_PATH} = $dir->stringify;
local $ENV{HOME} = $homedir->name;
# FILENAME: basic.t
# CREATED: 22/06/12 07:13:46 by Kent Fredric (kentnl) <kentfredric@gmail.com>
# ABSTRACT: Test basic functionality
( run in 1.667 second using v1.01-cache-2.11-cpan-49f99fa48dc )