[rubygem-joiner] initial import (RHBZ #1117025)

Ken Dreyer ktdreyer at fedoraproject.org
Tue Oct 21 16:51:58 UTC 2014


commit dc2e08b0bad67439cae23629a9321e741de02007
Author: Ken Dreyer <ktdreyer at ktdreyer.com>
Date:   Tue Oct 21 10:51:29 2014 -0600

    initial import (RHBZ #1117025)

 .gitignore                |    1 +
 rubygem-joiner-libs.patch |   29 ++++++++++++
 rubygem-joiner.spec       |  105 +++++++++++++++++++++++++++++++++++++++++++++
 sources                   |    1 +
 4 files changed, 136 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..94be453 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/joiner-0.3.3.gem
diff --git a/rubygem-joiner-libs.patch b/rubygem-joiner-libs.patch
new file mode 100644
index 0000000..f5b68d8
--- /dev/null
+++ b/rubygem-joiner-libs.patch
@@ -0,0 +1,29 @@
+From ecccd10d0cbd68654dcd2995f427e674e09b2af1 Mon Sep 17 00:00:00 2001
+From: Ken Dreyer <ktdreyer at ktdreyer.com>
+Date: Fri, 10 Oct 2014 16:12:43 -0600
+Subject: [PATCH] explicitly load activerecord/activesupport
+
+When used in conjunction with Bundler, ActiveRecord will already be
+available in the environment, and joiner can access the ActiveRecord and
+ActiveSupport objects.
+
+When used completely outside Bundler, ActiveRecord and ActiveSupport are
+not yet loaded, so joiner cannot be used.
+---
+ lib/joiner/joins.rb | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/lib/joiner/joins.rb b/lib/joiner/joins.rb
+index 1a325b4..d736a55 100644
+--- a/lib/joiner/joins.rb
++++ b/lib/joiner/joins.rb
+@@ -1,3 +1,6 @@
++require 'active_record'
++require 'active_support/ordered_hash'
++
+ class Joiner::Joins
+   JoinDependency = ::ActiveRecord::Associations::JoinDependency
+ 
+-- 
+1.9.3
+
diff --git a/rubygem-joiner.spec b/rubygem-joiner.spec
new file mode 100644
index 0000000..a6c9302
--- /dev/null
+++ b/rubygem-joiner.spec
@@ -0,0 +1,105 @@
+%global gem_name joiner
+
+Name: rubygem-%{gem_name}
+Version: 0.3.3
+Release: 1%{?dist}
+Summary: Builds ActiveRecord joins from association paths
+Group: Development/Languages
+License: MIT
+URL: https://github.com/pat/joiner
+Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
+Patch0: rubygem-joiner-libs.patch
+%if 0%{?fc19} || 0%{?fc20} || 0%{?el7}
+Requires: ruby(release)
+Requires: ruby(rubygems)
+Requires: rubygem(activerecord) >= 4.1.0
+%endif
+BuildRequires: ruby(release)
+BuildRequires: rubygems-devel
+BuildRequires: rubygem(rails)
+BuildRequires: rubygem(rspec)
+BuildRequires: rubygem(rspec-rails)
+BuildRequires: rubygem(sqlite3)
+# combustion is yet in Fedora. Review request at
+# https://bugzilla.redhat.com/1117022
+#BuildRequires: rubygem(combustion)
+BuildArch: noarch
+%if 0%{?fc19} || 0%{?fc20} || 0%{?el7}
+Provides: rubygem(%{gem_name}) = %{version}
+%endif
+
+%description
+Builds ActiveRecord outer joins from association paths and provides references
+to table aliases.
+
+
+%package doc
+Summary: Documentation for %{name}
+Group: Documentation
+Requires: %{name} = %{version}-%{release}
+BuildArch: noarch
+
+%description doc
+Documentation for %{name}
+
+%prep
+gem unpack %{SOURCE0}
+
+%setup -q -D -T -n  %{gem_name}-%{version}
+
+gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
+
+for f in .gitignore Gemfile Rakefile; do
+  rm $f
+  sed -i "s|\"$f\",||g" %{gem_name}.gemspec
+done
+
+# Remove dependency on bundler.
+sed -i "/bundle/Id" spec/spec_helper.rb
+
+# Explicitly load ActiveSupport / ActiveRecord. This is so that the gem can be
+# used outside of Bundler.
+%patch0 -p1
+
+%build
+# Create the gem as gem install only works on a gem file
+gem build %{gem_name}.gemspec
+
+%gem_install
+
+# remove unnecessary gemspec
+rm .%{gem_instdir}/%{gem_name}.gemspec
+
+%install
+mkdir -p %{buildroot}%{gem_dir}
+cp -pa .%{gem_dir}/* \
+        %{buildroot}%{gem_dir}/
+
+%check
+pushd .%{gem_instdir}
+  # rubygem-combustion is not yet in Fedora, so the test suite fails.
+  # combustion review request at https://bugzilla.redhat.com/1117022
+  rspec -Ilib spec || :
+popd
+
+
+%files
+%{!?_licensedir:%global license %%doc}
+%dir %{gem_instdir}
+%license %{gem_instdir}/LICENSE.txt
+%doc %{gem_instdir}/README.md
+%{gem_libdir}
+%exclude %{gem_cache}
+%{gem_spec}
+
+%files doc
+%doc %{gem_docdir}
+%exclude %{gem_instdir}/spec
+
+%changelog
+* Fri Oct 10 2014 Ken Dreyer <ktdreyer at ktdreyer.com> - 0.3.3-1
+- Update to joiner 0.3.3 (RHBZ #1117025)
+- Use %%license macro (RHBZ #1117025)
+
+* Wed May 07 2014 Ken Dreyer <ktdreyer at ktdreyer.com> - 0.3.0-1
+- Initial package
diff --git a/sources b/sources
index e69de29..f42009c 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+2851a3b844318b2eeb4411f2603c0549  joiner-0.3.3.gem


More information about the scm-commits mailing list