Gentoo-Overlay-Group-INI
view release on metacpan or search on metacpan
121314151617181920212223242526272829303132
"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"
=> {
495051525354555657585960616263646566
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.
12345678910111213141516171819202122232425262728.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
123456789101112{
"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"
: {
123456789101112---
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
123456789101112NAME
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.
4243444546474849505152535455565758596061626364CLASS 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
1overlay_4
corpus/overlay_5/profiles/repo_name view on Meta::CPAN
1overlay_5
lib/Gentoo/Overlay/Group/INI.pm view on Meta::CPAN
23456789101112131415161718192021use
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;
our
$CFG_PATHS
;
lib/Gentoo/Overlay/Group/INI.pm view on Meta::CPAN
676869707172737475767778798081828384858687
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
1571581591601611621631641651661671681691701711721731741751761771;
__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
208209210211212213214215216217218219220221222223224225226227228229230=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
2122232425262728293031323334353637383940414243444546has
'_directories'
=> (
init_arg
=>
'directory'
,
isa
=>
'ArrayRef[ Str ]'
,
is
=>
'rw'
,
traits
=> [
qw( Array )
],
handles
=> {
directories
=>
elements
=>, },
);
sub
overlay_group {
my
(
$self
,
@rest
) =
@_
;
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
67686970717273747576777879808182838485868788899091This 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
234567891011121314151617181920212223242526272829303132use
warnings;
use
Test::More;
use
Test::Fatal;
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
->
(
"[Overlays]\n"
);
$fh
->
(
"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
23456789101112131415161718192021222324252627282930313233343536use
warnings;
use
Test::More;
use
Test::Fatal;
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
->
(
"[Overlays]\n"
);
$fh
->
(
"directory = $_\n"
)
for
@overlays
;
$fh
->
(
"[Overlays / test_2 ]\n"
);
$fh
->
(
"directory = $_\n"
)
for
$overlays
[0];
$fh
->
(
"[Overlays / test_3 ]\n"
);
$fh
->
(
"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 0.600 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )