automatic update OBS-URL: https://build.opensuse.org/request/show/456832 OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Shell-Config-Generate?expand=0&rev=5
124 lines
3.5 KiB
RPMSpec
124 lines
3.5 KiB
RPMSpec
#
|
|
# spec file for package perl-Shell-Config-Generate
|
|
#
|
|
# 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-Shell-Config-Generate
|
|
Version: 0.26
|
|
Release: 0
|
|
%define cpan_name Shell-Config-Generate
|
|
Summary: Portably generate config for any shell
|
|
License: Artistic-1.0 or GPL-1.0+
|
|
Group: Development/Libraries/Perl
|
|
Url: http://search.cpan.org/dist/Shell-Config-Generate/
|
|
Source0: https://cpan.metacpan.org/authors/id/P/PL/PLICEASE/%{cpan_name}-%{version}.tar.gz
|
|
Source1: cpanspec.yml
|
|
BuildArch: noarch
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
BuildRequires: perl
|
|
BuildRequires: perl-macros
|
|
BuildRequires: perl(Shell::Guess) >= 0.02
|
|
BuildRequires: perl(Test::More) >= 0.94
|
|
Requires: perl(Shell::Guess) >= 0.02
|
|
%{perl_requires}
|
|
|
|
%description
|
|
This module provides an interface for specifying shell configurations for
|
|
different shell environments without having to worry about the arcane
|
|
differences between shells such as csh, sh, cmd.exe and command.com.
|
|
|
|
It does not modify the current environment, but it can be used to create
|
|
shell configurations which do modify the environment.
|
|
|
|
This module uses Shell::Guess to represent the different types of shells
|
|
that are supported. In this way you can statically specify just one or more
|
|
shells:
|
|
|
|
#!/usr/bin/perl
|
|
use Shell::Guess;
|
|
use Shell::Config::Generate;
|
|
my $config = Shell::Config::Generate->new;
|
|
# ... config config ...
|
|
$config->generate_file(Shell::Guess->bourne_shell, 'foo.sh' );
|
|
$config->generate_file(Shell::Guess->c_shell, 'foo.csh');
|
|
$config->generate_file(Shell::Guess->cmd_shell, 'foo.cmd');
|
|
$config->generate_file(Shell::Guess->command_shell, 'foo.bat');
|
|
|
|
This will create foo.sh and foo.csh versions of the configurations, which
|
|
can be sourced like so:
|
|
|
|
#!/bin/sh
|
|
. ./foo.sh
|
|
|
|
or
|
|
|
|
#!/bin/csh
|
|
source foo.csh
|
|
|
|
It also creates '.cmd' and '.bat' files with the same configuration which
|
|
can be used in Windows. The configuration can be imported back into your
|
|
shell by simply executing these files:
|
|
|
|
C:\> foo.cmd
|
|
|
|
or
|
|
|
|
C:\> foo.bat
|
|
|
|
Alternatively you can use the shell that called your Perl script using
|
|
Shell::Guess's 'running_shell' method, and write the output to standard
|
|
out.
|
|
|
|
#!/usr/bin/perl
|
|
use Shell::Guess;
|
|
use Shell::Config::Generate;
|
|
my $config = Shell::Config::Generate->new;
|
|
# ... config config ...
|
|
print $config->generate(Shell::Guess->running_shell);
|
|
|
|
If you use this pattern, you can eval the output of your script using your
|
|
shell's back ticks to import the configuration into the shell.
|
|
|
|
#!/bin/sh
|
|
eval `script.pl`
|
|
|
|
or
|
|
|
|
#!/bin/csh
|
|
eval `script.pl`
|
|
|
|
%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 author.yml Changes example README
|
|
%license LICENSE
|
|
|
|
%changelog
|