dd28575
%global gem_name scoped_search
dd28575
%if 0%{?rhel} == 6
dd28575
%global gem_dir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
dd28575
%global gem_docdir %{gem_dir}/doc/%{gem_name}-%{version}
dd28575
%global gem_cache %{gem_dir}/cache/%{gem_name}-%{version}.gem
dd28575
%global gem_spec %{gem_dir}/specifications/%{gem_name}-%{version}.gemspec
dd28575
%global gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}
dd28575
%endif
dd28575
dd28575
Summary: Easily search your ActiveRecord models
dd28575
Name: rubygem-%{gem_name}
dd28575
dd28575
Version: 2.4.0
dd28575
Release: 5%{?dist}
dd28575
Group: Development/Languages
dd28575
License: MIT
dd28575
URL: http://github.com/wvanbergen/scoped_search/wiki
dd28575
Source0: https://rubygems.org/downloads/%{gem_name}-%{version}.gem
dd28575
Requires: rubygems
dd28575
Requires: rubygem-activerecord >= 2.1.0
dd28575
BuildRequires: ruby 
dd28575
BuildRequires: rubygems
dd28575
%if 0%{?rhel} == 6 || 0%{?fedora} < 17
dd28575
Requires: ruby(abi) = 1.8
dd28575
%else
dd28575
Requires: ruby(abi) = 1.9.1
dd28575
%endif
dd28575
%if 0%{?fedora}
dd28575
BuildRequires: rubygems-devel
dd28575
%endif
dd28575
BuildArch: noarch
dd28575
Provides: rubygem(scoped_search) = %{version}
dd28575
dd28575
# for check section
dd28575
%if 0%{?fedora} > 17
dd28575
BuildRequires: rubygem(rspec)
dd28575
BuildRequires: rubygem(activerecord)
dd28575
BuildRequires: rubygem(sqlite3)
dd28575
%endif
dd28575
dd28575
%description
dd28575
Scoped search makes it easy to search your ActiveRecord-based models. It will
dd28575
create a named scope :search_for that can be called with a query string. It
dd28575
will build an SQL query using the provided query string and a definition that
dd28575
specifies on what fields to search. Because the functionality is built on
dd28575
named_scope, the result of the search_for call can be used like any other
dd28575
named_scope, so it can be chained with another scope or combined with
dd28575
will_paginate. Because it uses standard SQL, it does not require any setup,
dd28575
indexers or daemons. This makes scoped_search suitable to quickly add basic
dd28575
search functionality to your application with little hassle. On the other hand,
dd28575
it may not be the best choice if it is going to be used on very large data sets
dd28575
or by a large user base.
dd28575
dd28575
%package doc
dd28575
BuildArch:  noarch
dd28575
Requires:   %{name} = %{version}-%{release}
dd28575
Summary:    Documentation for rubygem-%{gem_name}
dd28575
dd28575
%description doc
dd28575
This package contains documentation for rubygem-%{gem_name}.
dd28575
dd28575
dd28575
%prep
dd28575
gem unpack %{SOURCE0}
dd28575
%setup -q -D -T -n  %{gem_name}-%{version}
dd28575
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
dd28575
dd28575
%build
dd28575
mkdir -p .%{gem_dir}
dd28575
dd28575
# Create the gem as gem install only works on a gem file
dd28575
gem build %{gem_name}.gemspec
dd28575
dd28575
gem install -V \
dd28575
        --local \
dd28575
        --install-dir ./%{gem_dir} \
dd28575
        --force \
dd28575
        --rdoc \
dd28575
        %{gem_name}-%{version}.gem
dd28575
dd28575
%install
dd28575
mkdir -p %{buildroot}%{gem_dir}
dd28575
cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}/
dd28575
rm -rf %{buildroot}%{gem_dir}/gems/%{gem_name}-%{version}/{.yardoc,.gitignore,.infinity_test,.travis.yml}
dd28575
mv %{buildroot}%{gem_instdir}/{LICENSE,README.rdoc} ./
dd28575
dd28575
# https://github.com/wvanbergen/scoped_search/issues/26
dd28575
chmod a-x %{buildroot}%{gem_instdir}/lib/scoped_search.rb
dd28575
dd28575
rm %{buildroot}%{gem_cache}
dd28575
dd28575
%check
dd28575
pushd .%{gem_instdir}
dd28575
# Get rid of Bundler, not needed on Fedora.
dd28575
sed -i "/require 'bundler\/setup'/ d" spec/spec_helper.rb
dd28575
# sqlite3-ruby and sqlite3 are identical rubygems, where the former is
dd28575
# older name for the gem. Would be nice if upstream support both
dd28575
# reincarnations.
dd28575
# do not test on postgresql and ruby
dd28575
sed '5,15d' -i spec/database.ruby.yml
dd28575
#test does not work right now
dd28575
#https://github.com/wvanbergen/scoped_search/issues/34
dd28575
#or more precisly works only on F18+
dd28575
%if 0%{?fedora} > 17
dd28575
rspec spec
dd28575
%endif
dd28575
popd
dd28575
dd28575
%files
dd28575
%doc LICENSE
dd28575
%dir %{gem_instdir}
dd28575
%{gem_instdir}/lib
dd28575
%{gem_instdir}/init.rb
dd28575
%{gem_instdir}/tasks
dd28575
%{gem_spec}
dd28575
dd28575
%files doc
dd28575
%doc %{gem_docdir}
dd28575
%doc README.rdoc
dd28575
%{gem_instdir}/Rakefile
dd28575
%{gem_instdir}/Gemfile*
dd28575
%{gem_instdir}/spec
dd28575
%{gem_instdir}/%{gem_name}.gemspec
dd28575
dd28575
%changelog
dd28575
* Mon Dec 03 2012 Miroslav Suchý <msuchy@redhat.com> 2.4.0-5
dd28575
- run test only on F18+ (msuchy@redhat.com)
dd28575
- enable tests (msuchy@redhat.com)
dd28575
dd28575
* Tue Oct 30 2012 Miroslav Suchý <msuchy@redhat.com> 2.4.0-4
dd28575
- do not run test on rhel6 at all due missing rspec (msuchy@redhat.com)
dd28575
dd28575
* Tue Oct 30 2012 Miroslav Suchý <msuchy@redhat.com> 2.4.0-3
dd28575
- remove .travis.yml, add Gemfile.activerecord* (msuchy@redhat.com)
dd28575
dd28575
* Mon Oct 29 2012 Miroslav Suchý <msuchy@redhat.com> 2.4.0-2
dd28575
- do not run test, because it is not working (msuchy@redhat.com)
dd28575
- disable testing on other backend but sqllite (msuchy@redhat.com)
dd28575
- update to recent scoped_search-2.4.0.gem (msuchy@redhat.com)
dd28575
dd28575
* Tue Oct 16 2012 Miroslav Suchý <msuchy@redhat.com> 2.4.0-1
dd28575
- update to recent scoped_search-2.4.0.gem (msuchy@redhat.com)
dd28575
dd28575
* Wed Aug 15 2012 Miroslav Suchý <msuchy@redhat.com> 2.3.7-10
dd28575
- 847504 - move gemspec to -doc subpackage (msuchy@redhat.com)
dd28575
dd28575
* Wed Aug 15 2012 Miroslav Suchý <msuchy@redhat.com> 2.3.7-9
dd28575
- test suite is failing on F17 a lot - disable for now (msuchy@redhat.com)
dd28575
- 847504 - use test suite (msuchy@redhat.com)
dd28575
- 847504 - remove dot files in %%install section (msuchy@redhat.com)
dd28575
- 847504 - use macro in SOURCE0 (msuchy@redhat.com)
dd28575
dd28575
* Tue Aug 14 2012 Miroslav Suchý <msuchy@redhat.com> 2.3.7-8
dd28575
- 847504 - put in front of chmod link to github issue (msuchy@redhat.com)
dd28575
- 847504 - fix typo in summary (msuchy@redhat.com)
dd28575
dd28575
* Tue Aug 14 2012 Miroslav Suchý <msuchy@redhat.com> 2.3.7-7
dd28575
- 847504 - remove cached gem (msuchy@redhat.com)
dd28575
- 847504 - correctly use dist tag (msuchy@redhat.com)
dd28575
- 847504 - rewrap description (msuchy@redhat.com)
dd28575
dd28575
* Sun Aug 12 2012 Miroslav Suchý <msuchy@redhat.com> 2.3.7-6
dd28575
- fix spelling error (msuchy@redhat.com)
dd28575
- module scoped_search.rb should not be executable (msuchy@redhat.com)
dd28575
dd28575
* Sun Aug 12 2012 Miroslav Suchý <msuchy@redhat.com> 2.3.7-5
dd28575
- buildroot is not needed (msuchy@redhat.com)
dd28575
- change Group to valid item (msuchy@redhat.com)
dd28575
dd28575
* Fri Aug 10 2012 Miroslav Suchý <msuchy@redhat.com> 2.3.7-4
dd28575
- there is no need to require rubygems in some version (msuchy@redhat.com)
dd28575
dd28575
* Fri Aug 10 2012 Miroslav Suchý <msuchy@redhat.com> 2.3.7-3
dd28575
- there is no need to require rubygems in some version (msuchy@redhat.com)
dd28575
dd28575
* Thu Aug 09 2012 Miroslav Suchý <msuchy@redhat.com> 2.3.7-2
dd28575
- fix filelist (msuchy@redhat.com)
dd28575
- create doc subpackage (msuchy@redhat.com)
dd28575
- fix requirements (msuchy@redhat.com)
dd28575
dd28575
* Thu Aug 09 2012 Miroslav Suchý <msuchy@redhat.com> 2.3.7-1
dd28575
- edit rubygem-scoped_search.spec according guidelines (msuchy@redhat.com)
dd28575
- import rubygem-scoped_search.spec from foreman-rpms (msuchy@redhat.com)
dd28575