rubygem-railties/rubygem-railties.spec
2023-09-11 11:35:28 +08:00

239 lines
8.6 KiB
RPMSpec

%global gem_name railties
%bcond_with bootstrap
%bcond_with webpacker
Name: rubygem-%{gem_name}
Version: 7.0.7
Release: 2
Summary: Tools for creating, working with, and running Rails applications
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 archive -v -o railties-7.0.7-tests.txz v7.0.7 test/
Source1: %{gem_name}-%{version}-tests.txz
# The tools are needed for the test suite, are however unpackaged in gem file.
# You may check it out like so
# git clone http://github.com/rails/rails.git --no-checkout
# cd rails && git archive -v -o rails-7.0.7-tools.txz v7.0.7 tools/
Source2: rails-%{version}-tools.txz
# Fixes for Minitest 5.16+
# https://github.com/rails/rails/pull/45380
Patch1: rubygem-railties-7.0.2.3-Remove-the-multi-call-form-of-assert_called_with.patch
Patch2: CVE-2023-38037.patch
Recommends: ruby(irb)
Suggests: %{_bindir}/sqlite3
BuildRequires: ruby(release) rubygems-devel ruby >= 2.2.2 rubygem(did_you_mean)
%if %{without bootstrap}
BuildRequires: rubygem(actionmailer) = %{version} rubygem(actionpack) = %{version}
BuildRequires: rubygem(activerecord) = %{version} rubygem(activesupport) = %{version}
BuildRequires: rubygem(activestorage) = %{version} rubygem(bundler) rubygem(method_source)
BuildRequires: rubygem(rake) >= 0.8.7 rubygem(rack-cache) rubygem(sqlite3) rubygem(puma)
BuildRequires: rubygem(bootsnap) rubygem(capybara) sqlite rubygem(sprockets-rails)
BuildRequires: rubygem(thor) >= 0.18.1 rubygem(turbolinks) git
BuildRequires: rubygem(jquery-rails) rubygem(uglifier) rubygem(rails) nodejs
BuildRequires: rubygem(actioncable) = %{version} ruby(irb) rubygem(importmap-rails)
%if %{with webpacker}
BuildRequires: %{_bindir}/webpacker
%endif
%endif
BuildArch: noarch
%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 %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description doc
Documentation for %{name}.
%prep
%setup -q -n %{gem_name}-%{version} -b1 -b2
%patch2 -p2
pushd %{_builddir}
%patch1 -p2
popd
%build
gem build ../%{gem_name}-%{version}.gemspec
%gem_install
%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
%if %{without bootstrap}
%check
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/activestorage-%{version}/ .%{gem_dir}/gems/activestorage
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 %{gem_dir}/gems/actioncable-%{version}/ .%{gem_dir}/gems/actioncable
ln -s ${PWD}%{gem_instdir} .%{gem_dir}/gems/railties
mkdir -p .%{gem_dir}/gems/tmp/templates/app_template
pushd .%{gem_dir}/gems/railties
ln -s %{_builddir}/tools ..
mv %{_builddir}/test .
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 "activestorage"' >> ../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 "turbolinks"' >> ../Gemfile
echo 'gem "sprockets-rails"' >> ../Gemfile
echo 'gem "puma"' >> ../Gemfile
echo 'gem "bootsnap"' >> ../Gemfile
echo 'gem "capybara"' >> ../Gemfile
echo 'gem "irb"' >> ../Gemfile
echo 'gem "importmap-rails"' >> ../Gemfile
echo 'gem "jquery-rails"' >> ../Gemfile
echo 'gem "rails"' >> ../Gemfile
echo 'gem "uglifier", require: false' >> ../Gemfile
sed -i '/def test_system_tests_are_run_through_rake_test_when_given_in_TEST$/,/^ end$/ s/^/#/' \
test/application/test_runner_test.rb
sed -i '/def test_reset_sessions_before_rollback_on_system_tests$/,/^ end$/ s/^/#/' \
test/application/test_runner_test.rb
sed -i '/test "database middleware doesn.t initialize when activerecord is not in frameworks" do$/,/^ end$/ s/^/#/' \
test/application/initializers/frameworks_test.rb
mv test/application/rake/dbs_test.rb{,.disable}
sed -i '/test "i18n files have lower priority than application ones" do$/,/^ end$/ s/^/#/' \
test/railties/engine_test.rb
sed -i -e '/require..minitest.retry./ s/^/#/' \
test/isolation/abstract_unit.rb
export RUBYOPT="-I${PWD}/../railties/lib"
export PATH="${PWD}/../railties/exe:$PATH"
export BUNDLE_GEMFILE=${PWD}/../Gemfile
# Uses Bundler.require(...)
mv test/generators/test_runner_in_engine_test.rb{,.disable}
mv test/generators/plugin_generator_test.rb{,.disable}
# yarn requires network access
sed -i -e '/^\s*sh .yarn/ s/^/#/g' \
test/isolation/abstract_unit.rb
%if %{without webpacker}
sed -i -e '/^\s*sh .bin.rails webpacker/ s/^/#/g' \
test/isolation/abstract_unit.rb
mv -v test/app_loader_test.rb{,.disable}
mv -v test/engine/test_test.rb{,.disable}
mv -v test/secrets_test.rb{,.disable}
for tname in \
railtie \
engine \
mounted_engine \
;do
mv -v test/railties/${tname}_test.rb{,.disable}
done
for tname in \
credentials \
encrypted \
initializers \
notes \
routes \
secrets \
server \
;do
mv -v test/commands/${tname}_test.rb{,.disable}
done
rm -rf test/application/
sed -i -e '/^\s*def test_scaffold_tests_pass_by_default_inside_mountable_engine/ a \ skip' \
-e '/^\s*def test_scaffold_tests_pass_by_default_inside_namespaced_mountable_engine/ a \ skip' \
-e '/^\s*def test_scaffold_tests_pass_by_default_inside_full_engine/ a \ skip' \
-e '/^\s*def test_scaffold_tests_pass_by_default_inside_api_full_engine/ a \ skip' \
-e '/^\s*def test_scaffold_tests_pass_by_default_inside_api_mountable_engine/ a \ skip' \
test/generators/scaffold_generator_test.rb
%endif
# Tests does not seem to work with importmap-rails now
# Error: Don't know how to build task 'turbo:install'
mv test/generators/app_generator_test.rb{,.disable}
sed -i -e '/^\s*test "outputs errors inline" do/ a \ skip' \
-e '/^\s*test "outputs colored failed results" do/ a \ skip' \
test/test_unit/reporter_test.rb
sed -i -e '/^\s*test "outputs colored failed results" do/ a \ skip' \
-e '/^\s*test "outputs errors inline" do/ a \ skip' \
test/test_unit/reporter_test.rb
sed -i '/^\s*def test_template_is_executed_when_supplied_an_https_path/ a \ skip' \
test/generators/shared_generator_tests.rb
# Disable malfunctioning test
sed -i '/^\s*def test_create_migrations/ a \ skip' \
test/generators/action_mailbox_install_generator_test.rb
git config --global init.defaultBranch master
find test -type f -name '*_test.rb' -print0 | \
sort -z | \
xargs -0 -n1 -i sh -c "echo '* Test file: {}'; ruby -Itest -- '{}' || exit 255"
popd
%endif
%files
%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
* Mon Sep 11 2023 wangkai <13474090681@163.com> - 7.0.7-2
- Fix CVE-2023-38037
* Thu Aug 17 2023 Ge Wang <wang__ge@126.com> - 7.0.7-1
- Upgrade to version 7.0.7
* Thu Jan 19 2023 wangkai <wangkai385@h-partners.com> - 7.0.4-1
- Upgrade to version 7.0.4
* Fri Mar 04 2022 jiangxinyu <jiangxinyu@kylinos.cn> - 6.1.4.1-1
- update to 6.1.4.1
* Tue Apr 6 2021 lingsheng <lingsheng@huawei.com> - 5.2.4.4-4
- Add requires ruby-devel sqlite-devel
* Tue Apr 6 2021 lingsheng <lingsheng@huawei.com> - 5.2.4.4-3
- Add requires rubygem(bundler)
* Mon Feb 8 2021 sunguoshuai <sunguoshuai@huawei.com> - 5.2.4.4-1
- Upgrade to 5.2.4.4
* Sat Sep 5 2020 liyanan <liyanan32@huawei.com> - 5.2.3-2
- fix build fail
* Tue Aug 18 2020 huangyangke <huangyangke@huawei.com> - 5.2.3-1
- package init