rubygem-yard/rubygem-yard.spec
2020-08-20 16:33:19 +08:00

77 lines
2.4 KiB
RPMSpec

%global gem_name yard
Name: rubygem-%{gem_name}
Version: 0.9.12
Release: 1
Summary: Documentation tool for consistent and usable documentation in Ruby
License: MIT and (BSD or Ruby)
URL: http://yardoc.org
Source0: https://rubygems.org/gems/yard-%{version}.gem
BuildRequires: ruby(release) rubygems-devel ruby rubygem(RedCloth) rubygem(bundler)
BuildRequires: rubygem(rspec) rubygem(redcarpet) rubygem(rack)
BuildArch: noarch
%description
YARD is a documentation generation tool for the Ruby programming language.
It enables the user to generate consistent, usable documentation that can be
exported to a number of formats very easily, and also supports extending for
custom Ruby constructs such as custom class level definitions.
%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
gem build ../%{gem_name}-%{version}.gemspec
%gem_install
%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} -type f | xargs chmod a-x
find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x
%check
pushd .%{gem_instdir}
sed -i '/bundler\/setup/ s/^/#/' spec/spec_helper.rb
sed -i '/allow(File)\.to receive(:exist?).with(\/\\\.yardopts$\/)/ i\ allow(File).to receive(:exist?).and_return(true)' spec/cli/server_spec.rb
sed -i '/expect(File)\.to receive(:file?).with(%r{\/\\\.yard\/yri_cache$})\.and_return(false)/ i\ allow(File).to receive(:file?).and_return(false)' spec/cli/yri_spec.rb
rspec -rspec_helper spec
popd
%files
%dir %{gem_instdir}
%{_bindir}/yard
%{_bindir}/yardoc
%{_bindir}/yri
%exclude %{gem_instdir}/.yardopts
%license %{gem_instdir}/LEGAL
%license %{gem_instdir}/LICENSE
%{gem_instdir}/bin
%{gem_libdir}
%{gem_instdir}/templates
%exclude %{gem_cache}
%{gem_spec}
%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/CHANGELOG.md
%doc %{gem_instdir}/README.md
%{gem_instdir}/Rakefile
%{gem_instdir}/benchmarks
%doc %{gem_instdir}/docs
%{gem_instdir}/spec
%{gem_instdir}/%{gem_name}.gemspec
%changelog
* Sat Aug 8 2020 yanan li <liyanan032@huawei.com> - 0.9.12-1
- Package init