Gentoo-Overlay-Group-INI

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  "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" => {

Changes  view on Meta::CPAN

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
   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.

MANIFEST  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
.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

META.json  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
{
   "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" : {

META.yml  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
---
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

README  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
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;

README  view on Meta::CPAN

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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

1
overlay_4

corpus/overlay_5/profiles/repo_name  view on Meta::CPAN

1
overlay_5

lib/Gentoo/Overlay/Group/INI.pm  view on Meta::CPAN

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
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;
 
 
 
our $CFG_PATHS;

lib/Gentoo/Overlay/Group/INI.pm  view on Meta::CPAN

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
    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

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
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

208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
=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

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
has '_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

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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

t/basic.t  view on Meta::CPAN

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 
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,, );
 
 
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

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
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,, );
 
 
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 0.600 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )