137 lines
5.1 KiB
RPMSpec
137 lines
5.1 KiB
RPMSpec
#
|
|
# spec file for package perl-Path-Dispatcher
|
|
#
|
|
# Copyright (c) 2024 SUSE LLC
|
|
#
|
|
# 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 https://bugs.opensuse.org/
|
|
#
|
|
|
|
|
|
%define cpan_name Path-Dispatcher
|
|
Name: perl-Path-Dispatcher
|
|
Version: 1.80.0
|
|
Release: 0
|
|
# 1.08 -> normalize -> 1.80.0
|
|
%define cpan_version 1.08
|
|
License: Artistic-1.0 OR GPL-1.0-or-later
|
|
Summary: Flexible and extensible dispatch
|
|
URL: https://metacpan.org/release/%{cpan_name}
|
|
Source0: https://cpan.metacpan.org/authors/id/E/ET/ETHER/%{cpan_name}-%{cpan_version}.tar.gz
|
|
Source100: README.md
|
|
BuildArch: noarch
|
|
BuildRequires: perl
|
|
BuildRequires: perl-macros
|
|
BuildRequires: perl(Module::Build)
|
|
BuildRequires: perl(Module::Build::Tiny) >= 0.034
|
|
BuildRequires: perl(Module::Metadata)
|
|
BuildRequires: perl(Moo)
|
|
BuildRequires: perl(Moo::Role)
|
|
BuildRequires: perl(MooX::TypeTiny)
|
|
BuildRequires: perl(Test::Fatal)
|
|
BuildRequires: perl(Try::Tiny)
|
|
BuildRequires: perl(Type::Tiny)
|
|
BuildRequires: perl(Type::Utils)
|
|
BuildRequires: perl(Types::Standard)
|
|
Requires: perl(Moo)
|
|
Requires: perl(Moo::Role)
|
|
Requires: perl(MooX::TypeTiny)
|
|
Requires: perl(Try::Tiny)
|
|
Requires: perl(Type::Tiny)
|
|
Requires: perl(Type::Utils)
|
|
Requires: perl(Types::Standard)
|
|
Provides: perl(Path::Dispatcher) = %{version}
|
|
Provides: perl(Path::Dispatcher::Dispatch) = %{version}
|
|
Provides: perl(Path::Dispatcher::Match) = %{version}
|
|
Provides: perl(Path::Dispatcher::Path) = %{version}
|
|
Provides: perl(Path::Dispatcher::Role::Rules) = %{version}
|
|
Provides: perl(Path::Dispatcher::Rule) = %{version}
|
|
Provides: perl(Path::Dispatcher::Rule::Alternation) = %{version}
|
|
Provides: perl(Path::Dispatcher::Rule::Always) = %{version}
|
|
Provides: perl(Path::Dispatcher::Rule::Chain) = %{version}
|
|
Provides: perl(Path::Dispatcher::Rule::CodeRef) = %{version}
|
|
Provides: perl(Path::Dispatcher::Rule::Dispatch) = %{version}
|
|
Provides: perl(Path::Dispatcher::Rule::Empty) = %{version}
|
|
Provides: perl(Path::Dispatcher::Rule::Enum) = %{version}
|
|
Provides: perl(Path::Dispatcher::Rule::Eq) = %{version}
|
|
Provides: perl(Path::Dispatcher::Rule::Intersection) = %{version}
|
|
Provides: perl(Path::Dispatcher::Rule::Metadata) = %{version}
|
|
Provides: perl(Path::Dispatcher::Rule::Regex) = %{version}
|
|
Provides: perl(Path::Dispatcher::Rule::Sequence) = %{version}
|
|
Provides: perl(Path::Dispatcher::Rule::Tokens) = %{version}
|
|
Provides: perl(Path::Dispatcher::Rule::Under) = %{version}
|
|
%undefine __perllib_provides
|
|
%{perl_requires}
|
|
|
|
%description
|
|
We really like Jifty::Dispatcher and wanted to use it for Prophet's command
|
|
line.
|
|
|
|
The basic operation is that of dispatch. Dispatch takes a path and a list
|
|
of rules, and it returns a list of matches. From there you can "run" the
|
|
rules that matched. These phases are distinct so that, if you need to, you
|
|
can inspect which rules were matched without ever running their codeblocks.
|
|
|
|
Tab completion support is also available (see in particular
|
|
Path::Dispatcher::Cookbook/How can I configure tab completion for shells?)
|
|
for the dispatchers you write.
|
|
|
|
Each rule may take a variety of different forms (which I think justifies
|
|
the "flexible" adjective in the module's description). Some of the rule
|
|
types are:
|
|
|
|
* Path::Dispatcher::Rule::Regex
|
|
|
|
Matches the path against a regular expression.
|
|
|
|
* Path::Dispatcher::Rule::Enum
|
|
|
|
Match one of a set of strings.
|
|
|
|
* Path::Dispatcher::Rule::CodeRef
|
|
|
|
Execute a coderef to determine whether the path matches the rule. So you
|
|
can do anything you like. Though writing a domain-specific rule (see below)
|
|
will enable better introspection and encoding intent.
|
|
|
|
* Path::Dispatcher::Rule::Dispatch
|
|
|
|
Use another Path::Dispatcher to match the path. This facilitates both
|
|
extending dispatchers (a bit like subclassing) and delegating to plugins.
|
|
|
|
Since Path::Dispatcher is designed with good object-oriented programming
|
|
practices, you can also write your own domain-specific rule classes (which
|
|
earns it the "extensible" adjective). For example, in Prophet, we have a
|
|
custom rule for matching, and tab completing, record IDs.
|
|
|
|
You may want to use Path::Dispatcher::Declarative which gives you some
|
|
sugar inspired by Jifty::Dispatcher.
|
|
|
|
%prep
|
|
%autosetup -n %{cpan_name}-%{cpan_version}
|
|
|
|
%build
|
|
perl Build.PL --installdirs=vendor
|
|
./Build build --flags=%{?_smp_mflags}
|
|
|
|
%check
|
|
./Build test
|
|
|
|
%install
|
|
./Build install --destdir=%{buildroot} --create_packlist=0
|
|
%perl_gen_filelist
|
|
|
|
%files -f %{name}.files
|
|
%doc Changes CONTRIBUTING README
|
|
%license LICENSE
|
|
|
|
%changelog
|