Blob Blame History Raw
# Generated from openstack-compute-1.1.5.gem by gem2rpm -*- rpm-spec -*-
%global gem_name openstack-compute
%global rubyabi 1.9.1

Summary: OpenStack Compute Ruby API
Name: rubygem-%{gem_name}
Version: 1.1.5
Release: 2%{?dist}
Group: Development/Languages
License: MIT
URL: https://launchpad.net/ruby-openstack-compute
Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
# To get tests:
# git clone https://github.com/rackspace/ruby-openstack-compute.git && cd ruby-openstack-compute
# git checkout v1.1.5
# tar -czvf openstack-compute-1.1.5-test.tgz test
Source1: %{gem_name}-%{version}-test.tgz
# Fixes the library to work properly with Ruby 1.9
# https://github.com/rackspace/ruby-openstack-compute/pull/11
Patch0: openstack-compute-fix-tests-for-ruby-1.9.patch
Requires: ruby(abi) = %{rubyabi}
Requires: ruby(rubygems) 
Requires: rubygem(json) 
BuildRequires: rubygems-devel
BuildRequires: rubygem(mocha)
BuildRequires: rubygem(minitest)
BuildRequires: rubygem(json)
BuildArch: noarch
Provides: rubygem(%{gem_name}) = %{version}

%description
Ruby Openstack Compute binding for the v1.0 OSAPI.
Currently supports both v1.0 and v2.0 (keystone) auth.

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

%description doc
Documentation for %{name}

%prep
%setup -q -c -T
mkdir -p .%{gem_dir}
gem install --local --install-dir .%{gem_dir} \
            --force %{SOURCE0}

pushd .%{gem_instdir}
%patch0 -p1
popd

%build

%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
        %{buildroot}%{gem_dir}/
# Remove the unneeded shebang.
sed -i '1d' %{buildroot}%{gem_libdir}/openstack/compute.rb

%check
pushd .%{gem_instdir}
# move tests into place, fix them so that they use minitest
tar xvzf %{SOURCE1}
sed -i "s|^gem 'test-unit'||" test/test_helper.rb
testrb test/*_test.rb
popd

%files
%dir %{gem_instdir}
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}
%doc %{gem_instdir}/COPYING
# VERSION file is needed for runtime
%{gem_instdir}/VERSION

%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/README.rdoc

%changelog
* Fri Jan 27 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 1.1.5-2
- Switched from test-unit to minitest.
- Renamed the patch not to incorporate version.
- Unpacking test suite in %%check, so that it doesn't get into the RPM.
- Removed the unneeded shebang from one file.

* Thu Jan 26 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 1.1.5-1
- Initial package