Blob Blame History Raw
%{?scl:%scl_package rubygem-%{gem_name}}
%{!?scl:%global pkg_name %{name}}

# Generated from railties-3.0.3.gem by gem2rpm -*- rpm-spec -*-
%global gem_name railties

# Circular dependency with rubygem-{rails,jquery-rails,uglifier}.
%{?_with_bootstrap: %global bootstrap 1}

# Fallback to rh-nodejs4 rh-nodejs4-scldevel is probably not available in
# the buildroot.
%{?scl:%{!?scl_nodejs:%global scl_nodejs rh-nodejs4}}
%{?scl:%{!?scl_prefix_nodejs:%global scl_prefix_nodejs %{scl_nodejs}-}}

Name: %{?scl_prefix}rubygem-%{gem_name}
Version: 5.0.1
Release: 4%{?dist}
Summary: Tools for creating, working with, and running Rails applications
Group: Development/Languages
License: MIT
URL: http://rubyonrails.org
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
# Get the test suite:
# git clone http://github.com/rails/rails.git && cd rails/railties/
# git checkout v5.0.1 && tar czvf railties-5.0.1-tests.tgz test/
Source1: railties-%{version}-tests.tgz
# Run bundler with --local. This is for Red Hat only. Not for Fedora.
# https://bugzilla.redhat.com/show_bug.cgi?id=1317078
Patch100: rubygem-railties-default-to-bundle-install-local.patch
Patch101: rubygem-railties-default-to-bundle-install-local-test.patch

# Fix: Ruby 2.4 compatibility
# https://github.com/rails/rails/pull/27412/commits/c79c40ed82186fc5000cf5beea697b286422bcdb
Patch1: rubygem-railties-5.0.1-limit-length-of-secret.patch

# Fix: Minitest 5.10 compatibility
# https://github.com/rails/rails/pull/27739
Patch2: rubygem-railties-5.0.1-Use-new-minitest-assert-false-message.patch

# Relax the Listen dependency to make the default app works out of the box.
# https://github.com/rails/rails/pull/26695
Patch3: railties-5.0.1-Allow-the-use-of-listen-3.1.x.patch

# Fix SQLite 3.16.0+ compatibility.
# https://github.com/rails/rails/pull/27734
Patch4: railties-5.0.1-update-CREATE-TABLE-statements-generated-by-sqlite3-command.patch

# dbconsole requires the executable.
Requires: sqlite
# Let's keep Requires and BuildRequires sorted alphabeticaly
Requires: %{?scl_prefix_ruby}ruby(release)
Requires: %{?scl_prefix_ruby}ruby(rubygems)
Requires: %{?scl_prefix}rubygem(actionpack) = %{version}
Requires: %{?scl_prefix}rubygem(activesupport) = %{version}
Requires: %{?scl_prefix}rubygem(method_source)
Requires: %{?scl_prefix_ruby}rubygem(rake) >= 0.8.7
Requires: %{?scl_prefix}rubygem(thor) >= 0.18.1
BuildRequires: %{?scl_prefix_ruby}ruby(release)
BuildRequires: %{?scl_prefix_ruby}ruby(rubygems)
BuildRequires: %{?scl_prefix_ruby}ruby
BuildRequires: %{?scl_prefix_ruby}rubygems-devel
BuildRequires: %{?scl_prefix}rubygem(actioncable) = %{version}
BuildRequires: %{?scl_prefix}rubygem(actionmailer) = %{version}
BuildRequires: %{?scl_prefix}rubygem(actionpack) = %{version}
BuildRequires: %{?scl_prefix}rubygem(activerecord) = %{version}
BuildRequires: %{?scl_prefix}rubygem(activesupport) = %{version}
BuildRequires: %{?scl_prefix_ruby}rubygem(bundler)
BuildRequires: %{?scl_prefix}rubygem(method_source)
BuildRequires: %{?scl_prefix_ruby}rubygem(rake)
BuildRequires: %{?scl_prefix}rubygem(rack-cache)
BuildRequires: %{?scl_prefix}rubygem(sqlite3)
BuildRequires: sqlite
BuildRequires: %{?scl_prefix}rubygem(sprockets-rails)
BuildRequires: %{?scl_prefix}rubygem(thor)
%if ! 0%{?bootstrap}
BuildRequires: %{?scl_prefix}rubygem(jquery-rails)
BuildRequires: %{?scl_prefix}rubygem(uglifier)
BuildRequires: %{?scl_prefix}rubygem(rails)
BuildRequires: %{?scl_prefix}rubygem(turbolinks)
BuildRequires: %{?scl_prefix}rubygem(turbolinks-source)
%endif
BuildRequires: %{?scl_prefix_nodejs}nodejs
BuildArch: noarch
Provides: %{?scl_prefix}rubygem(%{gem_name}) = %{version}

# Explicitly require runtime subpackage, as long as older scl-utils do not generate it
%{?scl:Requires: %{?scl_prefix}runtime}

%description
Rails internals: application bootup, plugins, generators, and rake tasks.
Railties is responsible to glue all frameworks together. Overall, it:
* handles all the bootstrapping process for a Rails application;
* manages rails command line interface;
* provides Rails generators core;

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

%description doc
Documentation for %{pkg_name}.

%prep
%setup -n %{pkg_name}-%{version} -q -c -T
%{?scl:scl enable %{scl} - << \EOF}
%gem_install -n %{SOURCE0}
%{?scl:EOF}

pushd .%{gem_instdir}
%patch3 -p2

%patch100 -p2 -F 0
popd

%build

%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
        %{buildroot}%{gem_dir}/


mkdir -p %{buildroot}%{_bindir}
cp -p .%{_bindir}/* \
        %{buildroot}%{_bindir}/

find %{buildroot}%{gem_instdir}/exe -type f | xargs chmod a+x

%check
# fake RAILS_FRAMEWORK_ROOT
ln -s %{gem_dir}/specifications/rails-%{version}.gemspec .%{gem_dir}/gems/rails.gemspec
ln -s %{gem_dir}/gems/activesupport-%{version}/ .%{gem_dir}/gems/activesupport
ln -s %{gem_dir}/gems/actionmailer-%{version}/ .%{gem_dir}/gems/actionmailer
ln -s %{gem_dir}/gems/activerecord-%{version}/ .%{gem_dir}/gems/activerecord
ln -s %{gem_dir}/gems/actionview-%{version}/ .%{gem_dir}/gems/actionview
ln -s ${PWD}%{gem_instdir} .%{gem_dir}/gems/railties

pushd .%{gem_dir}/gems/railties

# Extract tests.
tar xzf %{SOURCE1}

patch -p2 < %{PATCH1}
patch -p2 < %{PATCH2}
patch -p2 < %{PATCH4}

patch -p2 -F 0 < %{PATCH101}

# Expected by InfoTest#test_rails_version
echo '%{version}' > ../RAILS_VERSION

touch ../Gemfile
echo 'gem "actioncable"' >> ../Gemfile
echo 'gem "actionmailer"' >> ../Gemfile
echo 'gem "actionpack"' >> ../Gemfile
echo 'gem "activerecord"' >> ../Gemfile
echo 'gem "activesupport"' >> ../Gemfile
echo 'gem "method_source"' >> ../Gemfile
echo 'gem "rack-test"' >> ../Gemfile
echo 'gem "rack-cache"' >> ../Gemfile
echo 'gem "rake"' >> ../Gemfile
echo 'gem "rdoc"' >> ../Gemfile
echo 'gem "sqlite3"' >> ../Gemfile
echo 'gem "thor"' >> ../Gemfile
echo 'gem "sprockets-rails"' >> ../Gemfile
%if ! 0%{?bootstrap}
echo 'gem "jquery-rails"' >> ../Gemfile
echo 'gem "rails"' >> ../Gemfile
echo 'gem "turbolinks"' >> ../Gemfile
echo 'gem "uglifier", require: false' >> ../Gemfile
%else
# Depends on jquer-rails and uglifier.
mv test/application/assets_test.rb{,.disable}
mv test/application/asset_debugging_test.rb{,.disable}

sed -i '/def test_scaffold_.*tests_pass_by_default$/,/^    end$/ s/^/#/' test/application/rake_test.rb
sed -i '/def test_rake_routes_with_rake_options$/,/^    end$/ s/^/#/' test/application/rake_test.rb
sed -i '/def test_rails_routes_displays_message_when_no_routes_are_defined$/,/^    end$/ s/^/#/' test/application/rake_test.rb
sed -i '/def test_rails_routes_calls_the_route_inspector$/,/^    end$/ s/^/#/' test/application/rake_test.rb

sed -i '/def test_generated_controller_works_with_rails_test$/,/^    end$/ s/^/#/' test/application/test_runner_test.rb
sed -i '/def test_generated_scaffold_works_with_rails_test$/,/^    end$/ s/^/#/' test/application/test_runner_test.rb

# Depends on rails.
mv test/application/bin_setup_test.rb{,.disable}

sed -i '/def test_generation_runs_bundle_install_with_full_and_mountable$/,/^  end$/ s/^/#/' test/generators/plugin_generator_test.rb
sed -i '/def test_generate_application_.*_when_does_not_exist_in_mountable_engine$/,/^  end$/ s/^/#/' test/generators/plugin_generator_test.rb

sed -i '/def test_controller_tests_pass_by_default_inside_mountable_engine$/,/^  end$/ s/^/#/' test/generators/scaffold_controller_generator_test.rb
sed -i '/def test_controller_tests_pass_by_default_inside_full_engine$/,/^  end$/ s/^/#/' test/generators/scaffold_controller_generator_test.rb

sed -i '/def test_application_new_exits_with_message_and_non_zero_code_when_generating_inside_existing_rails_directory$/,/^  end$/ s/^/#/' test/generators/app_generator_test.rb
sed -i '/def test_application_new_show_help_message_inside_existing_rails_directory$/,/^  end$/ s/^/#/' test/generators/app_generator_test.rb
%endif

# Disable unstable test.
# https://github.com/rails/rails/issues/25774
sed -i '/^  def test_sqlite3_db_without_defined_rails_root$/,/^  end$/ s/^/#/' test/commands/dbconsole_test.rb

# This works only when AR is not specified in Gemfile. Not sure how to
# workaround this.
sed -i '/test "database middleware doesn.t initialize when activerecord is not in frameworks" do$/,/^    end$/ s/^/#/' \
  test/application/initializers/frameworks_test.rb

# TODO: Mismatch in RAILS_FRAMEWORK_ROOT, not sure how to fix it.
sed -i '/test "i18n files have lower priority than application ones" do$/,/^    end$/ s/^/#/' \
  test/railties/engine_test.rb

export RUBYOPT="-I${PWD}/../railties/lib -Eutf-8"
export PATH="${PWD}/../railties/exe:$PATH"

# Needed for test/generators/test_runner_in_engine_test.rb and
# test/generators/plugin_generator_test.rb
export BUNDLE_GEMFILE=${PWD}/../Gemfile

%{?scl:scl enable %{scl} %{scl_nodejs} - << \EOF}
set -e
# Tests needs to be executed in isolation.
find test -type f -name '*_test.rb' -print0 | \
  xargs -0 -n1 -i sh -c "echo '* Test file: {}'; ruby -Itest -- '{}' || exit 255"
%{?scl:EOF}
popd

%files
# There is no %%license macro on RHEL6.
# https://bugzilla.redhat.com/show_bug.cgi?id=1386246
%{!?_licensedir:%global license %%doc}

%dir %{gem_instdir}
%{_bindir}/rails
%license %{gem_instdir}/MIT-LICENSE
%{gem_instdir}/exe
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}

%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/CHANGELOG.md
%doc %{gem_instdir}/RDOC_MAIN.rdoc
%doc %{gem_instdir}/README.rdoc

%changelog
* Wed Feb 15 2017 Jun Aruga <jaruga@redhat.com> - 5.0.1-4
- Fix typo.

* Mon Jan 23 2017 Vít Ondruch <vondruch@redhat.com> - 5.0.1-3
- Fix Listen 3.1.x compatibility.

* Wed Jan 18 2017 Jun Aruga <jaruga@redhat.com> - 5.0.1-2
- Update to Railties 5.0.1.

* Thu Apr 07 2016 Pavel Valena <pvalena@redhat.com> - 4.2.6-3
- Apply patch properly

* Thu Apr 07 2016 Pavel Valena <pvalena@redhat.com> - 4.2.6-2
- Fix: apply patch0: run bundler with --local

* Mon Apr 04 2016 Pavel Valena <pvalena@redhat.com> - 4.2.6-1
- Update to 4.2.6

* Wed Mar 30 2016 vagrant - 4.2.5.1-7
- Run bundle install with --local
  - Resolves: rhbz#1317078

* Mon Feb 29 2016 Pavel Valena <pvalena@redhat.com> - 4.2.5.1-6
- Enable tests
- Add thread_safe build dependency

* Mon Feb 29 2016 Pavel Valena <pvalena@redhat.com> - 4.2.5.1-5
- Fix rubygem-thor dependency prefix

* Wed Feb 17 2016 Pavel Valena <pvalena@redhat.com> - 4.2.5.1-4
- Update to 4.2.5.1

* Mon Jan 26 2015 Josef Stribny <jstribny@redhat.com> - 4.1.5-1
- Update to 4.1.5

* Wed Jul 23 2014 Josef Stribny <jstribny@redhat.com> - 4.0.2-3
- Patch: Run bundle install with --local when creating new app
  - Resolves: rhbz#1115079

* Wed Feb 05 2014 Josef Stribny <jstribny@redhat.com> - 4.0.2-2
- Fix license (SyntaxHighlighter is removed in 4.x.x)

* Wed Dec 04 2013 Josef Stribny <jstribny@redhat.com> - 4.0.2-1
- Update to Railties 4.0.2
  - Resolves: rhbz#1037985

* Thu Nov 21 2013 Josef Stribny <jstribny@redhat.com> - 4.0.1-1
- Update to Railties 4.0.1

* Wed Oct 16 2013 Josef Stribny <jstribny@redhat.com> - 4.0.0-2
- Convert to scl.

* Thu Aug 08 2013 Josef Stribny <jstribny@redhat.com> - 4.0.0-1
- Update to Railties 4.0.0.

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.13-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Tue Jun 11 2013 Josef Stribny <jstribny@redhat.com> - 3.2.13-1
- Fix license.

* Sat Mar 09 2013 Vít Ondruch <vondruch@redhat.com> - 3.2.12-3
- Relax RDoc dependency.

* Fri Mar 08 2013 Vít Ondruch <vondruch@redhat.com> - 3.2.12-2
- Rebuild for https://fedoraproject.org/wiki/Features/Ruby_2.0.0

* Tue Feb 12 2013 Vít Ondruch <vondruch@redhat.com> - 3.2.12-1
- Update to Railties 3.2.12.

* Wed Jan 09 2013 Vít Ondruch <vondruch@redhat.com> - 3.2.11-1
- Update to Railties 3.2.11.

* Fri Jan 04 2013 Vít Ondruch <vondruch@redhat.com> - 3.2.10-1
- Update to Railties 3.2.10.

* Mon Aug 13 2012 Vít Ondruch <vondruch@redhat.com> - 3.2.8-1
- Update to Railties 3.2.8.

* Mon Jul 30 2012 Vít Ondruch <vondruch@redhat.com> - 3.2.7-1
- Update to Railties 3.2.7.

* Mon Jul 23 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 3.2.6-1
- Update to Railties 3.2.6.
- Move some files into -doc subpackage.
- Remove the unneeded %%defattr.
- Introduce %%check section (not running tests yet, as they are part of dependency loop).

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.15-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Fri Jun 15 2012 Vít Ondruch <vondruch@redhat.com> - 3.0.15-1
- Update to Railties 3.0.15.

* Fri Jun 01 2012 Vít Ondruch <vondruch@redhat.com> - 3.0.13-1
- Update to Railties 3.0.13.

* Wed Feb 01 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 3.0.11-1
- Rebuilt for Ruby 1.9.3.
- Update to Railties 3.0.11.

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Mon Aug 22 2011 Vít Ondruch <vondruch@redhat.com> - 3.0.10-1
- Update to Railties 3.0.10

* Thu Jul 21 2011 Vít Ondruch <vondruch@redhat.com> - 3.0.9-2
- Added missing RDoc dependency.

* Thu Jul 07 2011 Vít Ondruch <vondruch@redhat.com> - 3.0.9-1
- Update to Railties 3.0.9

* Mon Jun 27 2011  <mmorsi@redhat.com> - 3.0.5-2
- include fix for BZ #715385

* Tue Mar 29 2011 Vít Ondruch <vondruch@redhat.com> - 3.0.5-1
- Updated to Railties 3.0.5

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.3-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Wed Feb 02 2011  <Minnikhanov@gmail.com> - 3.0.3-7
- Fix Comment 11 #665560. https://bugzilla.redhat.com/show_bug.cgi?id=668090#c11
- Take LICENSE file from upstream.

* Mon Jan 31 2011  <Minnikhanov@gmail.com> - 3.0.3-6
- Fix Comment 9 #665560. https://bugzilla.redhat.com/show_bug.cgi?id=668090#c9
- Temporarily test suite is blocked.

* Thu Jan 27 2011  <Minnikhanov@gmail.com> - 3.0.3-5
- Fix Comment 7 #665560. https://bugzilla.redhat.com/show_bug.cgi?id=668090#c7 

* Tue Jan 25 2011  <Minnikhanov@gmail.com> - 3.0.3-4
- Fix Comment 5 #665560. https://bugzilla.redhat.com/show_bug.cgi?id=668090#c5 

* Mon Jan 24 2011  <Minnikhanov@gmail.com> - 3.0.3-3
- Fix Comment 3 #665560. https://bugzilla.redhat.com/show_bug.cgi?id=668090#c3 

* Sun Jan 23 2011  <Minnikhanov@gmail.com> - 3.0.3-2
- Fix Comment 1 #665560. https://bugzilla.redhat.com/show_bug.cgi?id=668090#c1 

* Fri Jan 07 2011  <Minnikhanov@gmail.com> - 3.0.3-1
- Initial package