Blob Blame History Raw
%global gem_name gherkin
%global rubyabi 1.9.1

Summary: Fast Gherkin lexer/parser
Name: rubygem-%{gem_name}
Version: 2.9.3
Release: 2%{?dist}
Group: Development/Languages
License: MIT
URL: http://github.com/aslakhellesoy/gherkin
Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem

# generated by running:
# ruby -rfileutils -e 'Dir.glob("gherkin-2.9.3/ext/gherkin_lexer_*/").each { |d| Dir.glob("#{d}*.c"){ |f| FileUtils.cp(f,  d + f.split("/").last + ".orig" ) }}'
# find ./gherkin-2.9.3/ext/ -name *.c -exec sed -i 's/#line.*//g' {} \; 
# ruby -e 'Dir.glob("gherkin-2.9.3/ext/*/*.c").each { |f| puts `diff -sup #{f}.orig #{f}` }'
Patch1: gherkin-%{version}-remove-hash-line.patch

Requires: ruby(abi) = %{rubyabi}
Requires: ruby(rubygems)
Requires: rubygem(json)
BuildRequires: rubygems-devel
BuildRequires: ruby-devel
BuildRequires: rubygem(cucumber)
BuildRequires: rubygem(rspec)
Provides: rubygem(%{gem_name}) = %{version}

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

%description doc
Documentation for %{name}


%description
A fast Gherkin lexer/parser based on the Ragel State Machine Compiler.


%prep
mkdir -p .%{gem_dir}
gem install --local --install-dir .%{gem_dir} \
            --force -V --rdoc %{SOURCE0}

pushd .%{gem_instdir}
%patch1 -p1
popd

%build
pushd .%{gem_instdir}
pushd ext
for lexer_dir in */ ; do
    pushd $lexer_dir
    CONFIGURE_ARGS="--with-cflags='%{optflags}'" ruby extconf.rb
    make clean && make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
    make install RUBYARCHDIR="../../lib"
    popd
done
popd

%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
        %{buildroot}%{gem_dir}/

mkdir -p %{buildroot}%{gem_extdir}/lib
# the .so files go in the extdir, so remove them from lib
find %{buildroot}%{gem_instdir}/lib -iname '*.so' -exec rm -f {} \;
find %{buildroot}%{gem_instdir}/ext -iname '*.so' -exec mv {} %{buildroot}%{gem_extdir}/lib \;

# clean out any gitignore
find %{buildroot} -iname '.gitignore' -exec rm -f {} \;

%check
pushd .%{gem_instdir}
# use this gherkin, not the system one
export GEM_HOME="../../"
# kill bundler for features and specs
sed -i '7,8d' features/support/env.rb
sed -i '7,8d' spec/spec_helper.rb
# link the cucumber here for two features
ln -s %{gem_dir}/gems/cucumber-`cucumber --version`/ ../cucumber
# run cucumber features
cucumber
# run specs
# 6 examples fail because of bug in rspec 2.8 - should work ok when updated to rspec 2.9
rspec spec | grep '270 examples, 6 failures, 3 pending'
popd

%files
%defattr(-, root, root, -)
%dir %{gem_instdir}
%exclude %{gem_instdir}/.*
%{gem_extdir}
%{gem_libdir}
%{gem_instdir}/js
%{gem_instdir}/ragel
%{gem_instdir}/build_native_gems.sh
%doc %{gem_instdir}/features
%doc %{gem_instdir}/spec
%doc %{gem_instdir}/LICENSE
%doc %{gem_instdir}/cucumber.yml
%doc %{gem_instdir}/Gemfile
%{gem_instdir}/%{gem_name}.gemspec
%{gem_cache}
%{gem_spec}

%files doc
%defattr(-, root, root, -)
%{gem_instdir}/History.md
%{gem_instdir}/README.md
%{gem_instdir}/Rakefile
%{gem_instdir}/examples
%{gem_instdir}/ext
%{gem_instdir}/tasks
%{gem_docdir}

%changelog
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.9.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Thu Mar 29 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 2.9.3-1
- Update to 2.9.3
- Introduced %%check section

* Mon Jan 23 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 2.4.5-4
- Removed *.so files from %%{gem_libdir}.

* Mon Jan 23 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 2.4.5-3
- Rebuilt for Ruby 1.9.3.
- Significantly simplified build process.

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Jul 12 2011 Mo Morsi <mmorsi@redhat.com> - 2.4.5-1
- Update to latest upstream release

* Tue Jun 08 2011 Chris Lalancette <clalance@redhat.com> - 2.3.3-3
- Significantly revamped spec to conform more to fedora standards
- Fix build on Rawhide

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.3.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Fri Feb 04 2011 Michal Fojtik <mfojtik@redhat.com> - 2.3.3-1
- Version bump

* Fri Sep 24 2010 Michal Fojtik <mfojtik@redhat.com> - 2.2.4-3
- Replaced ~> with >= in JSON version so now it can be used
  with latest json as well

* Fri Sep 24 2010 Michal Fojtik <mfojtik@redhat.com> - 2.2.4-2
- Fixed JSON dependency version

* Fri Sep 24 2010 Michal Fojtik <mfojtik@redhat.com> - 2.2.4-1
- Version bump

* Wed Sep 08 2010 Michal Fojtik <mfojtik@redhat.com> - 2.2.0-1
- Version bump

* Wed Jul 20 2010 Michal Fojtik <mfojtik@redhat.com> - 2.1.5-3
- Fixed rspec and trollop versions in gemspec files

* Wed Jul 20 2010 Michal Fojtik <mfojtik@redhat.com> - 2.1.5-2
- Added -doc subpackage
- Fixed debugging symbols issue (Thanks mtasaka)
- Fixed path for pushd in install section
- Fixed trollop version in gemspec
- Removed '#line foo' from C files

* Wed Jul 19 2010 Michal Fojtik <mfojtik@redhat.com> - 2.1.5-1
- Updated to latest version
- Fixed compiler flags
- Fixed directory ownership
- Removed unwanted versioning files
- Placed .so files on right place

* Wed Jul 14 2010 Michal Fojtik <mfojtik@redhat.com> - 2.1.3-1
- Initial package