From 2957c1fb52216a43e9b6fc94d4fd7d02cf6738d8 Mon Sep 17 00:00:00 2001 From: Ken Dreyer Date: Sat, 11 Apr 2015 10:11:30 -0600 Subject: Run tests in %check --- .gitignore | 1 + rubygem-pathspec-generate-tarball.sh | 27 +++++++++++++++++++++++++++ rubygem-pathspec.spec | 21 ++++++++++++++++++++- sources | 1 + 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100755 rubygem-pathspec-generate-tarball.sh diff --git a/.gitignore b/.gitignore index 98c7eaa..d534d68 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /1210826-rubygem-pathspec/ /pathspec-0.0.2.gem +/pathspec-ruby-0.0.2-tests.tar.xz diff --git a/rubygem-pathspec-generate-tarball.sh b/rubygem-pathspec-generate-tarball.sh new file mode 100755 index 0000000..91f0811 --- /dev/null +++ b/rubygem-pathspec-generate-tarball.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set -e + +VERSION=0.0.2 + +GITHUBURL=https://github.com/highb/pathspec-ruby/archive/${VERSION}.zip + + +# download zipball +if [[ ! -f pathspec-ruby-$VERSION.zip ]]; then + curl -o pathspec-ruby-$VERSION.zip -L $GITHUBURL +fi + +# extract zipball +[[ -d pathspec-ruby-$VERSION ]] && rm -r pathspec-ruby-$VERSION +unzip pathspec-ruby-$VERSION.zip + +pushd pathspec-ruby-$VERSION + # repack + tar -cJvf pathspec-ruby-$VERSION-tests.tar.xz spec + mv pathspec-ruby-$VERSION-tests.tar.xz .. +popd + +# Clean up +rm pathspec-ruby-$VERSION.zip +rm -r pathspec-ruby-$VERSION diff --git a/rubygem-pathspec.spec b/rubygem-pathspec.spec index 5919a04..82ca5d4 100644 --- a/rubygem-pathspec.spec +++ b/rubygem-pathspec.spec @@ -8,9 +8,13 @@ Summary: Use to match path patterns such as gitignore License: ASL 2.0 URL: https://rubygems.org/gems/%{gem_name} Source0: https://rubygems.org/downloads/%{gem_name}-%{version}.gem +Source1: rubygem-pathspec-generate-tarball.sh +Source2: pathspec-ruby-%{version}-tests.tar.xz BuildArch: noarch BuildRequires: rubygems-devel +BuildRequires: rubygem(rspec) +BuildRequires: rubygem(fakefs) %description Use to match path patterns such as gitignore. @@ -28,9 +32,18 @@ Documentation for %{name}. %prep gem unpack %{SOURCE0} -%setup -q -D -T -n %{gem_name}-%{version} +%setup -q -D -T -n %{gem_name}-%{version} -a 2 gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec +%if 0%{fedora} < 22 + # Fedora 21 has Rspec 2.x, and Fedora 22 has Rspec 3.x. + # Switch to the older Rspec functions. + for f in $(find spec -type f); do + sed -i $f \ + -e "s/is_expected\.to/should/g" \ + -e "s/is_expected\.not_to/should_not/g" + done +%endif %build gem build %{gem_name}.gemspec @@ -41,6 +54,12 @@ gem build %{gem_name}.gemspec mkdir -p %{buildroot}%{gem_dir} cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}/ +%check +cp -pr spec .%{gem_instdir} +pushd .%{gem_instdir} + rspec -Ilib spec + rm -r spec/ +popd %files %license LICENSE diff --git a/sources b/sources index 9398fbe..2fc33df 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ 1ee6858ce390195ae44b3ee4751a731d pathspec-0.0.2.gem +87b911718ad413c7f4cfbcc25717a635 pathspec-ruby-0.0.2-tests.tar.xz -- cgit