142 lines
4.2 KiB
RPMSpec
142 lines
4.2 KiB
RPMSpec
![]() |
#
|
||
|
# spec file for package perl-MooX-ConfigFromFile
|
||
|
#
|
||
|
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||
|
#
|
||
|
# All modifications and additions to the file contributed by third parties
|
||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||
|
# upon. The license for this file, and modifications and additions to the
|
||
|
# file, is the same license as for the pristine package itself (unless the
|
||
|
# license for the pristine package is not an Open Source License, in which
|
||
|
# case the license is the MIT License). An "Open Source License" is a
|
||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||
|
# published by the Open Source Initiative.
|
||
|
|
||
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||
|
#
|
||
|
|
||
|
|
||
|
Name: perl-MooX-ConfigFromFile
|
||
|
Version: 0.008
|
||
|
Release: 0
|
||
|
%define cpan_name MooX-ConfigFromFile
|
||
|
Summary: Moo eXtension for initializing objects from config file
|
||
|
License: Artistic-1.0 or GPL-1.0+
|
||
|
Group: Development/Libraries/Perl
|
||
|
Url: http://search.cpan.org/dist/MooX-ConfigFromFile/
|
||
|
Source0: https://cpan.metacpan.org/authors/id/R/RE/REHSACK/%{cpan_name}-%{version}.tar.gz
|
||
|
BuildArch: noarch
|
||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||
|
BuildRequires: perl
|
||
|
BuildRequires: perl-macros
|
||
|
BuildRequires: perl(Config::Any)
|
||
|
BuildRequires: perl(File::Find::Rule) >= 0.30
|
||
|
BuildRequires: perl(Hash::Merge)
|
||
|
BuildRequires: perl(JSON)
|
||
|
BuildRequires: perl(Moo) >= 1.003
|
||
|
BuildRequires: perl(MooX::File::ConfigDir) >= 0.002
|
||
|
BuildRequires: perl(Test::More) >= 0.9
|
||
|
Requires: perl(Config::Any)
|
||
|
Requires: perl(File::Find::Rule) >= 0.30
|
||
|
Requires: perl(Moo) >= 1.003
|
||
|
Requires: perl(MooX::File::ConfigDir) >= 0.002
|
||
|
%{perl_requires}
|
||
|
|
||
|
%description
|
||
|
This module is intended to easy load initialization values for attributes
|
||
|
on object construction from an appropriate config file. The building is
|
||
|
done in MooX::ConfigFromFile::Role - using MooX::ConfigFromFile ensures the
|
||
|
role is applied.
|
||
|
|
||
|
For easier usage, with 0.004, several options can be passed via _use_
|
||
|
resulting in default initializers for appropriate role attributes:
|
||
|
|
||
|
* 'config_prefix'
|
||
|
|
||
|
Default for MooX::ConfigFromFile::Role/config_prefix.
|
||
|
|
||
|
* 'config_prefixes'
|
||
|
|
||
|
Default for MooX::ConfigFromFile::Role/config_prefixes. Ensure when use
|
||
|
this flag together with MooX::Cmd to load 'MooX::ConfigFromFile' before
|
||
|
'MooX::Cmd'.
|
||
|
|
||
|
* 'config_prefix_map_separator'
|
||
|
|
||
|
Default for MooX::ConfigFromFile::Role/config_prefix_map_separator.
|
||
|
|
||
|
package Foo;
|
||
|
|
||
|
# apply role MooX::ConfigFromFile::Role and override default for
|
||
|
# attribute config_prefix_map_separator
|
||
|
use MooX::ConfigFromFile config_prefix_map_separator => "~";
|
||
|
|
||
|
...
|
||
|
|
||
|
* 'config_extensions'
|
||
|
|
||
|
Default for MooX::ConfigFromFile::Role/config_extensions.
|
||
|
|
||
|
* 'config_dirs'
|
||
|
|
||
|
Default for MooX::ConfigFromFile::Role/config_dirs. Same warning regarding
|
||
|
modifying this attribute applies here: Possible, but use with caution!
|
||
|
|
||
|
package Foo;
|
||
|
|
||
|
use MooX::ConfigFromFile config_dirs => [qw(/opt/foo/etc /home/alfred/area/foo/etc)];
|
||
|
|
||
|
...
|
||
|
|
||
|
* 'config_files'
|
||
|
|
||
|
Default for MooX::ConfigFromFile::Role/config_files.
|
||
|
|
||
|
Reasonable when you want exactly one config file in development mode. For
|
||
|
production code it is highly recommended to override the builder.
|
||
|
|
||
|
* 'config_singleton'
|
||
|
|
||
|
Flag adding a wrapper around the _builder_ of
|
||
|
MooX::ConfigFromFile::Role/loaded_config to ensure a config is loaded only
|
||
|
once per class. The _per class_ restriction results from applicable
|
||
|
modifiers per class (and singletons are per class).
|
||
|
|
||
|
* 'config_identifier'
|
||
|
|
||
|
Default for MooX::File::ConfigDir/config_identifier.
|
||
|
|
||
|
package Foo;
|
||
|
|
||
|
# apply role MooX::ConfigFromFile::Role and override default for
|
||
|
# attribute config_identifier - means to look e.g. in /etc/foo/
|
||
|
use MooX::ConfigFromFile config_identifier => "foo";
|
||
|
|
||
|
...
|
||
|
|
||
|
* 'config_hashmergeloaded'
|
||
|
|
||
|
Consumes role MooX::ConfigFromFile::Role::HashMergeLoaded directly after
|
||
|
MooX::ConfigFromFile::Role has been consumed.
|
||
|
|
||
|
%prep
|
||
|
%setup -q -n %{cpan_name}-%{version}
|
||
|
|
||
|
%build
|
||
|
%{__perl} Makefile.PL INSTALLDIRS=vendor
|
||
|
%{__make} %{?_smp_mflags}
|
||
|
|
||
|
%check
|
||
|
%{__make} test
|
||
|
|
||
|
%install
|
||
|
%perl_make_install
|
||
|
%perl_process_packlist
|
||
|
%perl_gen_filelist
|
||
|
|
||
|
%files -f %{name}.files
|
||
|
%defattr(-,root,root,755)
|
||
|
%doc Changes README.md
|
||
|
|
||
|
%changelog
|