# Generated from sysexits-1.2.0.gem by gem2rpm -*- rpm-spec -*-
%global gem_name sysexits
Name: rubygem-%{gem_name}
Version: 1.2.0
Release: 1%{?dist}
Summary: Have you ever wanted to call exit()
with an error condition, but weren't sure what exit status to use? No? Maybe it's just me, then
License: BSD
URL: https://bitbucket.org/ged/sysexits
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby >= 1.8.7
# BuildRequires: rubygem(hoe-mercurial) >= 1.4.0
# BuildRequires: rubygem(hoe-mercurial) < 1.5
# BuildRequires: rubygem(hoe-highline) >= 0.1.0
# BuildRequires: rubygem(hoe-highline) < 0.2
# BuildRequires: rubygem(rspec) >= 2.11
# BuildRequires: rubygem(rspec) < 3
# BuildRequires: rubygem(simplecov) >= 0.6
# BuildRequires: rubygem(simplecov) < 1
# BuildRequires: rubygem(hoe) >= 3.9
# BuildRequires: rubygem(hoe) < 4
BuildArch: noarch
%description
Have you ever wanted to call exit()
with an error condition, but
weren't sure what exit status to use? No? Maybe it's just me, then.
Anyway, I was reading manpages late one evening before retiring to bed in my
palatial estate in rural Oregon, and I stumbled across
sysexits(3)
. Much to my chagrin, I couldn't find a +sysexits+ for
Ruby! Well, for the other 2 people that actually care about
style(9)
as it applies to Ruby code, now there is one!
Sysexits is a *completely* *awesome* collection of human-readable constants
for
the standard (BSDish) exit codes, used as arguments to +exit+ to
indicate a specific error condition to the parent process.
It's so fantastically fabulous that you'll want to fork it right away to avoid
being thought of as that guy that's still using Webrick for his blog. I mean,
exit(1)
is so passé! This is like the 14-point font of Systems
Programming.
Like the C header file from which this was derived (I mean forked, naturally),
error numbers begin at Sysexits::EX__BASE
(which is way more cool
than plain old +64+) to reduce the possibility of clashing with other exit
statuses that other programs may already return.
The codes are available in two forms: as constants which can be imported into
your own namespace via include Sysexits
, or as
Sysexits::STATUS_CODES
, a Hash keyed by Symbols derived from the
constant names.
Allow me to demonstrate. First, the old way:
exit( 69 )
Whaaa...? Is that a euphemism? What's going on? See how unattractive and...
well, 1970 that is? We're not changing vaccuum tubes here, people, we're
building a totally-awesome future in the Cloud™!
include Sysexits
exit EX_UNAVAILABLE
Okay, at least this is readable to people who have used fork()
more than twice, but you could do so much better!
include Sysexits
exit :unavailable
Holy Toledo! It's like we're writing Ruby, but our own made-up dialect in
which variable++ is possible! Well, okay, it's not quite that cool. But it
does look more Rubyish. And no monkeys were patched in the filming of this
episode! All the simpletons still exiting with icky _numbers_ can still
continue blithely along, none the wiser.
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description doc
Documentation for %{name}.
%prep
%setup -q -n %{gem_name}-%{version}
%build
# Create the gem as gem install only works on a gem file
gem build ../%{gem_name}-%{version}.gemspec
# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
%gem_install
%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
%check
pushd .%{gem_instdir}
# rspec spec
popd
%files
%dir %{gem_instdir}
%exclude %{gem_instdir}/.gemtest
%license %{gem_instdir}/LICENSE
%{gem_instdir}/Manifest.txt
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}
%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/ChangeLog
%doc %{gem_instdir}/History.rdoc
%doc %{gem_instdir}/README.rdoc
%{gem_instdir}/Rakefile
%{gem_instdir}/spec
%changelog
* Thu Sep 16 2021 mockbuilder - 1.2.0-1
- Initial package