Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Tomcat42
perl-Shell-Config-Generate
perl-Shell-Config-Generate.spec
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File perl-Shell-Config-Generate.spec of Package perl-Shell-Config-Generate
# # spec file for package perl-Shell-Config-Generate # # Copyright (c) 2020 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 https://bugs.opensuse.org/ # Name: perl-Shell-Config-Generate Version: 0.34 Release: 0 %define cpan_name Shell-Config-Generate Summary: Portably generate config for any shell License: Artistic-1.0 OR GPL-1.0-or-later Group: Development/Libraries/Perl Url: https://metacpan.org/release/%{cpan_name} 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(Test2::API) >= 1.302015 BuildRequires: perl(Test2::Mock) >= 0.000060 BuildRequires: perl(Test2::V0) >= 0.000060 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} find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -name "configure" -print0 | xargs -0 chmod 644 %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
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor