%global gem_name launchy
Name:                rubygem-%{gem_name}
Version:             2.4.3
Release:             1
Summary:             Helper class for cross-platform launching of applications
License:             ISC
URL:                 http://github.com/copiousfreetime/launchy
Source0:             https://rubygems.org/gems/%{gem_name}-%{version}.gem
BuildRequires:       ruby(release) rubygems-devel ruby rubygem(minitest) >= 5.0 rubygem(addressable)
BuildArch:           noarch
%description
Launchy is helper class for launching cross-platform applications in a fire
and forget manner. There are application concepts (browser, email client, etc)
that are common across all platforms, and they may be launched differently on
each platform. Launchy is here to make a common approach to launching external
application from within ruby programs.

%package doc
Summary:             Documentation for %{name}
Requires:            %{name} = %{version}-%{release}
BuildArch:           noarch

%description doc
Documentation for %{name}.

%prep
%setup -q -c -T
%gem_install -n %{SOURCE0}

%build

%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
        %{buildroot}%{gem_dir}/
mkdir -p %{buildroot}%{_bindir}
cp -a .%{_bindir}/* \
        %{buildroot}%{_bindir}/
find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x

%check
pushd .%{gem_instdir}
sed -i '/[cC]ov/ s/^/#/' spec/spec_helper.rb
sed -i '/prints the command on stdout when using --dry-run/ a \   skip' spec/cli_spec.rb
sed -i '/asssumes we open a local file if we have an exception if we have an invalid scheme and a valid path/ a \    skip' spec/launchy_spec.rb
sed -i '/when host_os is ...host_os.. the appropriate .app_list. method is called/ a \      skip' spec/applications/browser_spec.rb
sed -i '/the BROWSER environment variable overrides any host defaults on/ a \      skip' spec/applications/browser_spec.rb
ruby -Ilib:spec -e 'Dir.glob "./spec/**/*_spec.rb", &method(:require)'
popd

%files
%dir %{gem_instdir}
%{_bindir}/launchy
%license %{gem_instdir}/LICENSE
%{gem_instdir}/bin
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}

%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/CONTRIBUTING.md
%doc %{gem_instdir}/HISTORY.md
%doc %{gem_instdir}/Manifest.txt
%doc %{gem_instdir}/README.md
%{gem_instdir}/Rakefile
%{gem_instdir}/spec
%{gem_instdir}/tasks

%changelog
* Wed Aug 19 2020 tuShenmei <tushenmei@huawei.com> - 2.4.3-1
- package init