commit e4e6840b12dadb98a5a58e0e29062d6766a6b4a4
Author: Dominic Cleal <dcleal@redhat.com>
Date:   Tue Feb 3 18:28:25 2015 +0100

    Fix checks against scl name, optimise rhel/empty SCL conditional

diff --git a/foreman-installer/foreman-installer.spec b/foreman-installer/foreman-installer.spec
index e770558c8..12e59b68a 100644
--- a/foreman-installer/foreman-installer.spec
+++ b/foreman-installer/foreman-installer.spec
@@ -1,4 +1,4 @@
-%if "%{?scl}" == "ruby193"
+%if "%{?scl_ruby}" == "ruby193"
     %global scl_prefix %{scl}-
     %global scl_ruby /usr/bin/ruby193-ruby
 %else
@@ -28,7 +28,7 @@ Requires:   %{?scl_prefix}rubygem-kafo >= 0.6.5
 Requires:   %{?scl_prefix}rubygem-apipie-bindings >= 0.0.6
 Requires:   foreman-selinux
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires:   %{?scl_prefix_ruby}ruby(abi)
 %else
 Requires:   %{?scl_prefix_ruby}ruby(release)
diff --git a/foreman-proxy/foreman-proxy.spec b/foreman-proxy/foreman-proxy.spec
index 17770dd5f..5b29e7d7f 100644
--- a/foreman-proxy/foreman-proxy.spec
+++ b/foreman-proxy/foreman-proxy.spec
@@ -1,7 +1,7 @@
 %global homedir %{_datadir}/%{name}
 %global confdir config
 
-%if "%{?scl}" == "ruby193"
+%if "%{?scl_ruby}" == "ruby193"
     %global scl_prefix %{scl}-
     %global scl_ruby /usr/bin/ruby193-ruby
     %global scl_rake /usr/bin/ruby193-rake
@@ -37,7 +37,7 @@ BuildRequires:  /usr/bin/rename
 BuildRequires:  asciidoc
 BuildRequires:  %{?scl_prefix_ruby}rubygem(rake) >= 0.8.3
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 Requires:      %{?scl_prefix_ruby}ruby(abi)
 %else
@@ -58,7 +58,7 @@ Requires:       %{?scl_prefix}rubygem(bundler_ext)
 Requires:       sudo
 Requires:       wget
 Requires(pre):  shadow-utils
-%if 0%{?rhel} == 6
+%if 0%{?el6}
 Requires(post): chkconfig
 Requires(preun): chkconfig
 Requires(preun): initscripts
@@ -123,7 +123,7 @@ install -d -m0755 %{buildroot}%{_localstatedir}/lib/%{name}
 install -d -m0750 %{buildroot}%{_localstatedir}/log/%{name}
 install -d -m0750 %{buildroot}%{_var}/run/%{name}
 
-%if 0%{?rhel} == 6
+%if 0%{?el6}
 install -Dp -m0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
 install -Dp -m0755 %{SOURCE2} %{buildroot}%{_initrddir}/%{name}
 install -Dp -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
@@ -176,7 +176,7 @@ rm -rf %{buildroot}
 %attr(-,%{name},root) %{_datadir}/%{name}/config.ru
 %{_sbindir}/foreman-prepare-realm
 %{_mandir}/man8
-%if 0%{?rhel} == 6
+%if 0%{?el6}
 %{_initrddir}/%{name}
 %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
 %else
@@ -216,7 +216,7 @@ if [ $1 == 2 ]; then
   popd >/dev/null
 fi
 
-%if 0%{?rhel} == 6
+%if 0%{?el6}
   /sbin/chkconfig --add %{name}
   exit 0
 %else
@@ -228,7 +228,7 @@ fi
 %preun
 if [ $1 -eq 0 ] ; then
   # Package removal, not upgrade
-  %if 0%{?rhel} == 6
+  %if 0%{?el6}
     /sbin/service %{name} stop >/dev/null 2>&1
     /sbin/chkconfig --del %{name}
   %else
@@ -238,7 +238,7 @@ if [ $1 -eq 0 ] ; then
 fi
 
 %postun
-%if 0%{?rhel} == 6
+%if 0%{?el6}
   if [ $1 -ge 1 ] ; then
     /sbin/service %{name} restart >/dev/null 2>&1
   fi
diff --git a/rubygem-algebrick/rubygem-algebrick.spec b/rubygem-algebrick/rubygem-algebrick.spec
index fad73cd1f..7679e3d26 100644
--- a/rubygem-algebrick/rubygem-algebrick.spec
+++ b/rubygem-algebrick/rubygem-algebrick.spec
@@ -15,7 +15,7 @@ Source0: http://rubygems.org/downloads/%{gem_name}-%{version}.gem
 Requires: %{?scl_prefix_ruby}ruby(rubygems)
 Requires: %{?scl_prefix_ruby}ruby
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
diff --git a/rubygem-angular-rails-templates/rubygem-angular-rails-templates.spec b/rubygem-angular-rails-templates/rubygem-angular-rails-templates.spec
index 4918c5313..8e83427cb 100644
--- a/rubygem-angular-rails-templates/rubygem-angular-rails-templates.spec
+++ b/rubygem-angular-rails-templates/rubygem-angular-rails-templates.spec
@@ -24,7 +24,7 @@ Requires:  %{?scl_prefix_ruby}ruby(rubygems)
 Requires:  %{?scl_prefix_ruby}rubygem(railties) >= 3.1
 Requires:  %{?scl_prefix_ruby}rubygem(sprockets)
 Requires:  %{?scl_prefix_ruby}rubygem(tilt)
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires:      %{?scl_prefix_ruby}ruby(abi)
 %else
 Requires:      %{?scl_prefix_ruby}ruby(release)
@@ -32,7 +32,7 @@ Requires:      %{?scl_prefix_ruby}ruby(release)
 
 BuildRequires: %{?scl_prefix_ruby}ruby(rubygems)
 BuildRequires: %{?scl_prefix_ruby}rubygems-devel
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
 BuildRequires: %{?scl_prefix_ruby}ruby(release)
diff --git a/rubygem-ansi/rubygem-ansi.spec b/rubygem-ansi/rubygem-ansi.spec
index 2297319b2..64c1e86ed 100644
--- a/rubygem-ansi/rubygem-ansi.spec
+++ b/rubygem-ansi/rubygem-ansi.spec
@@ -23,7 +23,7 @@ BuildArch: noarch
 Provides:  %{?scl_prefix}rubygem(%{gem_name}) = %{version}
 %{?scl:Obsoletes: ruby193-rubygem-%{gem_name}}
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && 0%{!?scl:1})
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires:  %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
diff --git a/rubygem-apipie-bindings/rubygem-apipie-bindings.spec b/rubygem-apipie-bindings/rubygem-apipie-bindings.spec
index 335e70768..b36f88a1d 100644
--- a/rubygem-apipie-bindings/rubygem-apipie-bindings.spec
+++ b/rubygem-apipie-bindings/rubygem-apipie-bindings.spec
@@ -19,7 +19,7 @@ Requires: %{?scl_prefix}rubygem(awesome_print)
 Requires: %{?scl_prefix}rubygem(oauth)
 Requires: %{?scl_prefix_ruby}rubygem(json) >= 1.2.1
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires:      %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}rubygems-devel
diff --git a/rubygem-apipie-params/rubygem-apipie-params.spec b/rubygem-apipie-params/rubygem-apipie-params.spec
index bd4714e42..58b9c8524 100644
--- a/rubygem-apipie-params/rubygem-apipie-params.spec
+++ b/rubygem-apipie-params/rubygem-apipie-params.spec
@@ -14,7 +14,7 @@ Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
 Requires: %{?scl_prefix_ruby}ruby(rubygems)
 Requires: %{?scl_prefix_ruby}ruby
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
diff --git a/rubygem-awesome_print/rubygem-awesome_print.spec b/rubygem-awesome_print/rubygem-awesome_print.spec
index 38fd18db7..212418f43 100644
--- a/rubygem-awesome_print/rubygem-awesome_print.spec
+++ b/rubygem-awesome_print/rubygem-awesome_print.spec
@@ -14,7 +14,7 @@ Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
 Requires: %{?scl_prefix_ruby}ruby(rubygems)
 Requires: %{?scl_prefix_ruby}ruby
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires:      %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
diff --git a/rubygem-bundler_ext/rubygem-bundler_ext.spec b/rubygem-bundler_ext/rubygem-bundler_ext.spec
index 7a420878f..3d7649a57 100644
--- a/rubygem-bundler_ext/rubygem-bundler_ext.spec
+++ b/rubygem-bundler_ext/rubygem-bundler_ext.spec
@@ -12,14 +12,14 @@ Group: Development/Languages
 License: ASL 2.0
 URL: https://github.com/aeolus-incubator/bundler_ext
 Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 %else
 Requires: %{?scl_prefix_ruby}ruby(release)
 %endif
 Requires: %{?scl_prefix_ruby}ruby(rubygems)
 Requires: %{?scl_prefix_ruby}rubygem(bundler)
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
 BuildRequires: %{?scl_prefix_ruby}ruby(release)
diff --git a/rubygem-concurrent-ruby-edge/rubygem-concurrent-ruby-edge.spec b/rubygem-concurrent-ruby-edge/rubygem-concurrent-ruby-edge.spec
index 685e5e3ef..9726928b4 100644
--- a/rubygem-concurrent-ruby-edge/rubygem-concurrent-ruby-edge.spec
+++ b/rubygem-concurrent-ruby-edge/rubygem-concurrent-ruby-edge.spec
@@ -17,7 +17,7 @@ Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
 Requires: %{?scl_prefix_ruby}ruby(rubygems)
 Requires: %{?scl_prefix_ruby}ruby
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
diff --git a/rubygem-concurrent-ruby/rubygem-concurrent-ruby.spec b/rubygem-concurrent-ruby/rubygem-concurrent-ruby.spec
index 2d159e1bc..f986ec128 100644
--- a/rubygem-concurrent-ruby/rubygem-concurrent-ruby.spec
+++ b/rubygem-concurrent-ruby/rubygem-concurrent-ruby.spec
@@ -16,7 +16,7 @@ Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
 Requires: %{?scl_prefix_ruby}ruby(rubygems)
 Requires: %{?scl_prefix_ruby}ruby
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
diff --git a/rubygem-dynflow/rubygem-dynflow.spec b/rubygem-dynflow/rubygem-dynflow.spec
index fa4ebda9d..e9de583f7 100644
--- a/rubygem-dynflow/rubygem-dynflow.spec
+++ b/rubygem-dynflow/rubygem-dynflow.spec
@@ -12,7 +12,7 @@ License: MIT
 URL: https://github.com/Dynflow/dynflow
 Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
diff --git a/rubygem-fast_gettext/rubygem-fast_gettext.spec b/rubygem-fast_gettext/rubygem-fast_gettext.spec
index 5c5f71647..762c4d40c 100644
--- a/rubygem-fast_gettext/rubygem-fast_gettext.spec
+++ b/rubygem-fast_gettext/rubygem-fast_gettext.spec
@@ -15,7 +15,7 @@ License: MIT and (GPLv2+ or Ruby)
 URL: http://github.com/grosser/fast_gettext
 Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
diff --git a/rubygem-fastercsv/rubygem-fastercsv.spec b/rubygem-fastercsv/rubygem-fastercsv.spec
index 5ee0cea8e..62c051752 100644
--- a/rubygem-fastercsv/rubygem-fastercsv.spec
+++ b/rubygem-fastercsv/rubygem-fastercsv.spec
@@ -12,7 +12,7 @@ Group:		Development/Languages
 URL:		http://fastercsv.rubyforge.org/
 Source:		http://gems.rubyforge.org/gems/%{gem_name}-%{version}.gem
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires:	%{?scl_prefix_ruby}ruby(abi)
 %else
 Requires:	%{?scl_prefix_ruby}ruby(release)
diff --git a/rubygem-foreman_api/rubygem-foreman_api.spec b/rubygem-foreman_api/rubygem-foreman_api.spec
index d368cfde0..e9e8b5071 100644
--- a/rubygem-foreman_api/rubygem-foreman_api.spec
+++ b/rubygem-foreman_api/rubygem-foreman_api.spec
@@ -11,7 +11,7 @@ Group: Development/Languages
 License: MIT
 URL: http://github.com/theforeman/foreman_api
 Source0:  http://rubygems.org/downloads/%{gem_name}-%{version}.gem
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 %else
 Requires: %{?scl_prefix_ruby}ruby(release)
@@ -20,7 +20,7 @@ Requires: %{?scl_prefix_ruby}ruby(rubygems)
 Requires: %{?scl_prefix_ruby}rubygem(json)
 Requires: %{?scl_prefix}rubygem(rest-client) >= 1.6.1
 Requires: %{?scl_prefix}rubygem(oauth)
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
 BuildRequires: %{?scl_prefix_ruby}ruby(release)
diff --git a/rubygem-hashie/rubygem-hashie.spec b/rubygem-hashie/rubygem-hashie.spec
index 3893a2504..db58d80d0 100644
--- a/rubygem-hashie/rubygem-hashie.spec
+++ b/rubygem-hashie/rubygem-hashie.spec
@@ -25,7 +25,7 @@ BuildArch: noarch
 Provides:  %{?scl_prefix}rubygem(%{gem_name}) = %{version}
 %{?scl:Obsoletes: ruby193-rubygem-%{gem_name}}
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && 0%{!?scl:1})
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires:  %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
diff --git a/rubygem-highline/highline.spec b/rubygem-highline/highline.spec
index ff05fac6e..47c9ef934 100644
--- a/rubygem-highline/highline.spec
+++ b/rubygem-highline/highline.spec
@@ -28,7 +28,7 @@ BuildArch: noarch
 Provides:  %{?scl_prefix}rubygem(%{gem_name}) = %{version}
 %{?scl:Obsoletes: ruby193-rubygem-%{gem_name}}
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires:  %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
diff --git a/rubygem-little-plugger/rubygem-little-plugger.spec b/rubygem-little-plugger/rubygem-little-plugger.spec
index 614ce9ff6..4d5f366d1 100644
--- a/rubygem-little-plugger/rubygem-little-plugger.spec
+++ b/rubygem-little-plugger/rubygem-little-plugger.spec
@@ -13,7 +13,7 @@ URL: http://rubygems.org/gems/little-plugger
 Source0: http://gems.rubyforge.org/gems/%{gem_name}-%{version}.gem
 Requires: %{?scl_prefix_ruby}ruby(rubygems)
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 %else
 Requires: %{?scl_prefix_ruby}ruby(release)
diff --git a/rubygem-locale/rubygem-locale.spec b/rubygem-locale/rubygem-locale.spec
index e03f2b6a4..0239307ef 100644
--- a/rubygem-locale/rubygem-locale.spec
+++ b/rubygem-locale/rubygem-locale.spec
@@ -18,7 +18,7 @@ Source0: http://rubygems.org/downloads/%{gem_name}-%{version}.gem
 
 BuildArch:	noarch
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 %else
 Requires: %{?scl_prefix_ruby}ruby(release)
diff --git a/rubygem-logging/rubygem-logging.spec b/rubygem-logging/rubygem-logging.spec
index 1c2077afd..e92264193 100644
--- a/rubygem-logging/rubygem-logging.spec
+++ b/rubygem-logging/rubygem-logging.spec
@@ -14,7 +14,7 @@ Source0: http://gems.rubyforge.org/gems/%{gem_name}-%{version}.gem
 BuildRoot: %{_tmppath}/%{pkg_name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: %{?scl_prefix_ruby}ruby(rubygems)
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 %else
 Requires: %{?scl_prefix_ruby}ruby(release)
diff --git a/rubygem-multi_json/rubygem-multi_json.spec b/rubygem-multi_json/rubygem-multi_json.spec
index ccbdd228e..2f85e7282 100644
--- a/rubygem-multi_json/rubygem-multi_json.spec
+++ b/rubygem-multi_json/rubygem-multi_json.spec
@@ -11,7 +11,7 @@ License: MIT
 URL: http://github.com/intridea/multi_json
 Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
diff --git a/rubygem-netrc/rubygem-netrc.spec b/rubygem-netrc/rubygem-netrc.spec
index f690c2047..f5955bf08 100644
--- a/rubygem-netrc/rubygem-netrc.spec
+++ b/rubygem-netrc/rubygem-netrc.spec
@@ -12,7 +12,7 @@ Group: Development/Languages
 License: MIT
 URL: https://github.com/geemus/netrc
 Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
diff --git a/rubygem-oauth/rubygem-oauth.spec b/rubygem-oauth/rubygem-oauth.spec
index f8576e4b4..968d7bfd0 100644
--- a/rubygem-oauth/rubygem-oauth.spec
+++ b/rubygem-oauth/rubygem-oauth.spec
@@ -12,7 +12,7 @@ License: MIT
 URL: http://rubydoc.info/gems/oauth
 Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
 Requires: %{?scl_prefix_ruby}rubygems
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 %else
 Requires: %{?scl_prefix_ruby}ruby(release)
diff --git a/rubygem-passenger/rubygem-passenger.spec b/rubygem-passenger/rubygem-passenger.spec
index c0f36e284..5e1291ec5 100644
--- a/rubygem-passenger/rubygem-passenger.spec
+++ b/rubygem-passenger/rubygem-passenger.spec
@@ -90,7 +90,7 @@ Requires: %{?scl_prefix_ruby}rubygems
 #Requires: %{?scl_prefix}rubygem(daemon_controller) >= 1.0.0
 Requires: %{?scl_prefix_ruby}rubygem(rack)
 Requires: %{?scl_prefix_ruby}rubygem(rake)
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && 0%{!?scl:1})
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 %else
 Requires: %{?scl_prefix_ruby}ruby(release)
@@ -257,22 +257,19 @@ CFLAGS="${CFLAGS:-%optflags} -fno-strict-aliasing" ; export CFLAGS ;
 CXXFLAGS="${CXXFLAGS:-%optflags} -fno-strict-aliasing" ; export CXXFLAGS ;
 FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ;
 
-%if 0%{?scl:1}
-. /opt/rh/%scl/enable
-%endif
-
+%{?scl:scl enable %{scl} - << \EOF}
 rake package:gem SKIP_SIGNING=1
+%{?scl:EOF}
+%{?scl:scl enable %{scl} - << \EOF}
 rake apache2
+%{?scl:EOF}
 #rake nginx
 
 %install
 # export USE_VENDORED_LIBEV=false
 
-%if 0%{?scl:1}
-. /opt/rh/%scl/enable
-%endif
-
 # Install the gem.
+%{?scl:scl enable %{scl} - << \EOF}
 gem install -V \
             --local \
             --install-dir %{buildroot}%{gem_dir} \
@@ -280,6 +277,7 @@ gem install -V \
             --force \
             --rdoc \
             pkg/%{gem_name}-%{version}.gem
+%{?scl:EOF}
 
 # Install locations.ini
 install -pm 0644 %{SOURCE11} %{buildroot}%{gem_instdir}/lib/phusion_passenger/
@@ -361,10 +359,6 @@ sed -i '/Gem::Specification.new/ a s.extensions = ["workaround"]' \
     %{buildroot}%{gem_spec}
 
 %check
-%if 0%{?scl:1}
-. /opt/rh/%scl/enable
-%endif
-
 # export USE_VENDORED_LIBEV=false
 # Run the tests, capture the output, but don't fail the build if the tests fail
 #
@@ -381,7 +375,9 @@ sed -i \
 %{__cp} test/config.json.example test/config.json
 
 %if %{enable_check}
+%{?scl:scl enable %{scl} - << \EOF}
 rake test --trace ||:
+%{?scl:EOF}
 %endif
 
 %files
diff --git a/rubygem-powerbar/rubygem-powerbar.spec b/rubygem-powerbar/rubygem-powerbar.spec
index c36f4e4fb..67fcc0203 100644
--- a/rubygem-powerbar/rubygem-powerbar.spec
+++ b/rubygem-powerbar/rubygem-powerbar.spec
@@ -29,7 +29,7 @@ Requires:  %{?scl_prefix}rubygem(ansi) >= 1.4.0
 Requires:  %{?scl_prefix}rubygem(ansi) <  1.5.0
 Requires:  %{?scl_prefix}rubygem(hashie) >= 1.1.0
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && 0%{!?scl:1})
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires:  %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
@@ -68,7 +68,7 @@ gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
 gem build %{gem_name}.gemspec
 %{?scl:"}
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && 0%{!?scl:1})
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 mkdir -p .%{_bindir}
 mkdir -p .%{gem_dir}
 %{?scl:scl enable %{scl} "}
diff --git a/rubygem-rest-client/rest-client.spec b/rubygem-rest-client/rest-client.spec
index f1a3d8e9b..c79925805 100644
--- a/rubygem-rest-client/rest-client.spec
+++ b/rubygem-rest-client/rest-client.spec
@@ -13,7 +13,7 @@ URL: http://github.com/archiloque/rest-client
 Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
 BuildRoot: %{_tmppath}/%{pkg_name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: %{?scl_prefix_ruby}rubygems
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 %else
 Requires: %{?scl_prefix_ruby}ruby(release)
diff --git a/rubygem-sequel/rubygem-sequel.spec b/rubygem-sequel/rubygem-sequel.spec
index 6e369626e..c9b540cdf 100644
--- a/rubygem-sequel/rubygem-sequel.spec
+++ b/rubygem-sequel/rubygem-sequel.spec
@@ -15,7 +15,7 @@ BuildRoot: %{_tmppath}/%{pkg_name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: %{?scl_prefix_ruby}ruby(rubygems)
 Requires: %{?scl_prefix_ruby}ruby
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
diff --git a/rubygem-sprockets/rubygem-sprockets.spec b/rubygem-sprockets/rubygem-sprockets.spec
index 38c948c45..95d17db07 100644
--- a/rubygem-sprockets/rubygem-sprockets.spec
+++ b/rubygem-sprockets/rubygem-sprockets.spec
@@ -36,7 +36,7 @@ Requires: %{?scl_prefix_ruby}rubygem(rack) < 2
 Requires: %{?scl_prefix_ruby}rubygem(tilt) => 1.1
 Requires: %{?scl_prefix_ruby}rubygem(tilt) < 2
 Conflicts: %{?scl_prefix_ruby}rubygem(tilt) = 1.3.0
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires: %{?scl_prefix_ruby}ruby(abi)
 %else
 Requires: %{?scl_prefix_ruby}ruby(release)
@@ -61,7 +61,7 @@ BuildRequires: %{?scl_prefix_ruby}rubygem(therubyracer)
 BuildRequires: %{?scl_prefix_ruby}rubygem(tilt) => 1.1
 BuildRequires: %{?scl_prefix_ruby}rubygem(tilt) < 2
 BuildConflicts: %{?scl_prefix_ruby}rubygem(tilt) = 1.3.0
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && "%{?scl}" == "")
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
 BuildRequires: %{?scl_prefix_ruby}ruby(release)
diff --git a/rubygem-wicked/rubygem-wicked.spec b/rubygem-wicked/rubygem-wicked.spec
index f64c926b0..5b36522a8 100644
--- a/rubygem-wicked/rubygem-wicked.spec
+++ b/rubygem-wicked/rubygem-wicked.spec
@@ -23,7 +23,7 @@ BuildArch: noarch
 Provides:  %{?scl_prefix}rubygem(%{gem_name}) = %{version}
 %{?scl:Obsoletes: ruby193-rubygem-%{gem_name}}
 
-%if "%{?scl}" == "ruby193" || (0%{?rhel} == 6 && 0%{!?scl:1})
+%if "%{?scl_ruby}" == "ruby193" || (0%{?el6} && 0%{!?scl:1})
 Requires:  %{?scl_prefix_ruby}ruby(abi)
 BuildRequires: %{?scl_prefix_ruby}ruby(abi)
 %else
