Blame SPECS/rubygem-actioncable.spec

f241b6
%{?scl:%scl_package rubygem-%{gem_name}}
f241b6
%{!?scl:%global pkg_name %{name}}
f241b6
f241b6
# Generated from actioncable-5.0.0.rc2.gem by gem2rpm -*- rpm-spec -*-
f241b6
%global gem_name actioncable
f241b6
f241b6
# Disabling JS recompilation might significantly reduce the amount of
f241b6
# build dependencies.
f241b6
%global recompile_js 1
f241b6
f241b6
# Fallback to rh-nodejs4 rh-nodejs4-scldevel is probably not available in
f241b6
# the buildroot.
f241b6
%{?scl:%{!?scl_nodejs:%global scl_nodejs rh-nodejs4}}
f241b6
%{?scl:%{!?scl_prefix_nodejs:%global scl_prefix_nodejs %{scl_nodejs}-}}
f241b6
f241b6
Name: %{?scl_prefix}rubygem-%{gem_name}
f241b6
Version: 5.0.1
f241b6
Release: 1%{?dist}
f241b6
Summary: WebSocket framework for Rails
f241b6
Group: Development/Languages
f241b6
License: MIT
f241b6
URL: http://rubyonrails.org
f241b6
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
f241b6
# git clone https://github.com/rails/rails.git && cd rails/actioncable
f241b6
# git checkout v5.0.1 && tar czvf actioncable-5.0.1-tests.tgz test/
f241b6
Source1: %{gem_name}-%{version}-tests.tgz
f241b6
# The source code of pregenerated JS files.
f241b6
# git clone https://github.com/rails/rails.git && cd rails/actioncable
f241b6
# git checkout v5.0.1 && tar czvf actioncable-5.0.1-app.tgz app/ Rakefile
f241b6
Source2: %{gem_name}-%{version}-app.tgz
f241b6
# Recompile with script extracted from
f241b6
# https://github.com/rails/rails/blob/71d406697266fc2525706361b86aeb85183fe4c7/actioncable/Rakefile
f241b6
Source3: recompile_js.rb
f241b6
Requires: %{?scl_prefix_ruby}ruby(release)
f241b6
Requires: %{?scl_prefix_ruby}ruby(rubygems)
f241b6
Requires: %{?scl_prefix}rubygem(actionpack) = %{version}
f241b6
Requires: %{?scl_prefix}rubygem(nio4r)
f241b6
Requires: %{?scl_prefix}rubygem(websocket-driver)
f241b6
BuildRequires: %{?scl_prefix_ruby}ruby(release)
f241b6
BuildRequires: %{?scl_prefix_ruby}ruby(rubygems)
f241b6
BuildRequires: %{?scl_prefix_ruby}ruby
f241b6
BuildRequires: %{?scl_prefix_ruby}rubygems-devel
f241b6
BuildRequires: %{?scl_prefix}rubygem(actionpack) = %{version}
f241b6
BuildRequires: %{?scl_prefix}rubygem(mocha)
f241b6
BuildRequires: %{?scl_prefix}rubygem(nio4r)
f241b6
BuildRequires: %{?scl_prefix}rubygem(websocket-driver)
f241b6
%if 0%{?recompile_js} > 0
f241b6
BuildRequires: %{?scl_prefix}rubygem(coffee-script)
f241b6
BuildRequires: %{?scl_prefix}rubygem(sprockets)
f241b6
BuildRequires: %{?scl_prefix_nodejs}nodejs
f241b6
%endif
f241b6
BuildArch: noarch
f241b6
Provides: %{?scl_prefix}rubygem(%{gem_name}) = %{version}
f241b6
f241b6
# Explicitly require runtime subpackage, as long as older scl-utils do not generate it
f241b6
%{?scl:Requires: %{?scl_prefix}runtime}
f241b6
f241b6
%description
f241b6
Structure many real-time application concerns into channels over a single
f241b6
WebSocket connection.
f241b6
f241b6
f241b6
%package doc
f241b6
Summary: Documentation for %{pkg_name}
f241b6
Group: Documentation
f241b6
Requires: %{?scl_prefix}%{pkg_name} = %{version}-%{release}
f241b6
BuildArch: noarch
f241b6
f241b6
%description doc
f241b6
Documentation for %{pkg_name}.
f241b6
f241b6
%prep
f241b6
%{?scl:scl enable %{scl} - << \EOF}
f241b6
set -e
f241b6
gem unpack %{SOURCE0}
f241b6
f241b6
%setup -q -D -T -n  %{gem_name}-%{version} -a 2
f241b6
f241b6
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
f241b6
%{?scl:EOF}
f241b6
f241b6
%build
f241b6
%if 0%{?recompile_js} > 0
f241b6
# Recompile the embedded JS file from CoffeeScript sources.
f241b6
#
f241b6
# This is practice suggested by packaging guidelines:
f241b6
# https://fedoraproject.org/wiki/Packaging:Guidelines#Use_of_pregenerated_code
f241b6
f241b6
cp -a %{SOURCE3} .
f241b6
f241b6
# Remove folder to ensure JS is recompiled
f241b6
rm -rf lib/assets/compiled
f241b6
%{?scl:scl enable %{scl} %{scl_nodejs} - << \EOF}
f241b6
RUBYOPT=-Ilib ruby recompile_js.rb
f241b6
%{?scl:EOF}
f241b6
%endif
f241b6
f241b6
%{?scl:scl enable %{scl} - << \EOF}
f241b6
set -e
f241b6
# Create the gem as gem install only works on a gem file
f241b6
gem build %{gem_name}.gemspec
f241b6
f241b6
# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
f241b6
# by default, so that we can move it into the buildroot in %%install
f241b6
%gem_install
f241b6
%{?scl:EOF}
f241b6
f241b6
%install
f241b6
mkdir -p %{buildroot}%{gem_dir}
f241b6
cp -a .%{gem_dir}/* \
f241b6
        %{buildroot}%{gem_dir}/
f241b6
f241b6
f241b6
%check
f241b6
pushd .%{gem_instdir}
f241b6
tar xzvf %{SOURCE1}
f241b6
f241b6
# We don't have Puma in Fedora yet.
f241b6
sed -i '/puma/ s/^/#/' test/test_helper.rb
f241b6
mv test/client_test.rb{,.disable}
f241b6
f241b6
# We don't have em-hiredis in Fedora yet.
f241b6
mv test/subscription_adapter/evented_redis_test.rb{,.disable}
f241b6
f241b6
# TODO: Needs AR together with PostgreSQL.
f241b6
mv test/subscription_adapter/postgresql_test.rb{,.disable}
f241b6
f241b6
# We don't not ship redis in the SCL.
f241b6
mv test/subscription_adapter/redis_test.rb{,.disable}
f241b6
f241b6
%{?scl:scl enable %{scl} %{scl_nodejs} - << \EOF}
f241b6
ruby -Ilib:test -e 'Dir.glob "./test/**/*_test.rb", &method(:require)'
f241b6
%{?scl:EOF}
f241b6
f241b6
# TODO: Enable the test/javascript test cases.
f241b6
popd
f241b6
f241b6
%files
f241b6
# There is no %%license macro on RHEL6.
f241b6
# https://bugzilla.redhat.com/show_bug.cgi?id=1386246
f241b6
%{!?_licensedir:%global license %%doc}
f241b6
f241b6
%dir %{gem_instdir}
f241b6
%license %{gem_instdir}/MIT-LICENSE
f241b6
%{gem_libdir}
f241b6
%exclude %{gem_cache}
f241b6
%{gem_spec}
f241b6
f241b6
%files doc
f241b6
%doc %{gem_docdir}
f241b6
%doc %{gem_instdir}/CHANGELOG.md
f241b6
%doc %{gem_instdir}/README.md
f241b6
f241b6
%changelog
f241b6
* Mon Jan 16 2017 Jun Aruga <jaruga@redhat.com> - 5.0.1-1
f241b6
- Update to Action Cable 5.0.1.
f241b6
- Use recompile script from previous Action Cable version
f241b6
f241b6
* Tue Aug 16 2016 Pavel Valena <pvalena@redhat.com> - 5.0.0.1-1
f241b6
- Update to Actioncable 5.0.0.1
f241b6
f241b6
* Thu Jun 30 2016 Vít Ondruch <vondruch@redhat.com> - 5.0.0-1
f241b6
- Initial package