# Generated from baf-0.15.1.gem by gem2rpm -*- rpm-spec -*-
%global gem_name baf

Name: rubygem-%{gem_name}
Version: 0.15.1
Release: 1%{?dist}
Summary: Toolkit for testing and writing CLI programs
License: BSD-3-Clause
URL: https://rubygems.org/gems/baf
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby
# BuildRequires: rubygem(cucumber) >= 3.2
# BuildRequires: rubygem(cucumber) < 4
# BuildRequires: rubygem(rspec) >= 3.11
# BuildRequires: rubygem(rspec) < 4
BuildArch: noarch

%description
== Baf
baf helps writing an user acceptance test suite with a dedicated library
and cucumber steps. It can run and wait for programs in a modified
environment, verify the exit status, the output streams and other side
effects. It also supports interactive programs and writing to their
standard input.
Then, it provides a DSL to write the CLI:
require 'baf/cli'
module MyProgram
class CLI < Baf::CLI
def setup
flag_version '0.1.2'.freeze
option :c, :config, 'config', 'specify config file' do |path|
@config_path = path
end
end
def run
usage! unless arguments.any?
puts 'arguments: %s' % arguments
puts 'config: %s' % @config_path if @config_path
end
end
end
MyProgram::CLI.run ARGV
Which behaves this way:
% ./my_program
Usage: my_program [options]
options:
-c, --config config              specify config file
-h, --help                       print this message
-V, --version                    print version
zsh: exit 64    ./my_program
% ./my_program --wrong-arg
Usage: my_program [options]
options:
-c, --config config              specify config file
-h, --help                       print this message
-V, --version                    print version
zsh: exit 64    ./my_program --wrong-arg
% ./my_program foo
arguments ["foo"]
% ./my_program -c some_file foo
arguments ["foo"]
config path some_file.


%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}
# cucumber
# rspec spec
popd

%files
%dir %{gem_instdir}
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}

%files doc
%doc %{gem_docdir}


%changelog
* Wed Jul 06 2022 mockbuilder - 0.15.1-1
- Initial package