diff options
Diffstat (limited to 'dev-ruby/sassc-rails')
4 files changed, 215 insertions, 0 deletions
diff --git a/dev-ruby/sassc-rails/Manifest b/dev-ruby/sassc-rails/Manifest index 03e3c1e93703..4150241780a7 100644 --- a/dev-ruby/sassc-rails/Manifest +++ b/dev-ruby/sassc-rails/Manifest @@ -1,3 +1,6 @@ +AUX sassc-rails-2.1.2-test-directories.patch 2849 BLAKE2B 9c054cbff7c0c3355333e3a1846d2a2ea3fa31a7721dea697628f2242c4b3be9d4b199c3f5ed7c2712ed7764b450a543c4bff919d648d7a4648c62ae8f2d5e99 SHA512 5c7e7e285189db56fbe8693c161080d9acf5ca3b075eed8946bdf3b1fa6c0afdea5abf1520e926ca9eda27a9563356ee76645e8e5fb24fbcec594d2101158677 +AUX sassc-rails-2.1.2-test-isolation.patch 4755 BLAKE2B 4f1abb47ebc46fad927d5cea9d3c90f2caf6ad4e265534b9e62f2d203809b21cac53dc37e1eddaeaee96414b3d933a4fda44174f34e5a81cde2a5e07342dd74e SHA512 dddb76598f41ccdaa684e9449ea21c1fb613c99097b18f06f2719515c9005b17235ddae4ca06342d9c53741d4fd9ef93df693f3686af69a1cc872649d07352d9 DIST sassc-rails-2.1.2.gem 33280 BLAKE2B 1ecd048a879ea9ba08390ed81c679a3a4461f3937d1b0ce5ee001810067286f386ea885787984ffa417d2af191f178563e892ea24f1b466b6538c815fadbd9e3 SHA512 d250f22a3f2c4afb56a22f4533194d80b8a301730e5e4b49f9613e489f7158e7bd9c02cff8e1ec8ce727ede25f1c03a2613a664291967b5e97e210f7890d0bc8 EBUILD sassc-rails-2.1.2-r2.ebuild 954 BLAKE2B b6cf69a9fc91057163615ecbf3787098dd146f737fc70dbf2754be359b2d7784ca139fee69f788a12bd38b6333bd6dd5037c3799d417422abc22a6b3fa7af846 SHA512 9fc3df4994c0127f16cfccc8a048cb654118fb165d593baf04d409238d0123d3cc0c9c02d3187adcb8b8ad64b8c0306f6aa4fea51a993860807de33238d14b5f +EBUILD sassc-rails-2.1.2-r3.ebuild 1270 BLAKE2B 35a78e6b5e44c7be77fb3485fa7113737eb59c7e66c8221a8a6f3ec84bf3b7a018bc0999fedd16f4d9ae5820ae32d5ec17de1896f422b56c6aa6bade07a3166e SHA512 472b3cd093729b56e227e219045ef2bbb07cba879eac1e7b67d1861538eb1acec1a2440c37b371f19a6a2824fb750e20c6f9ae2ddc1912d2b7a86fa41118bf53 MISC metadata.xml 343 BLAKE2B 6319dd108c825d78ce2b27bfcc376edcc437b9710eaa62371617ce5bcfdb673e948c81ffe1d48a8b5d85fccaf26b450b063b5366a8f9f5d12a0d6e1798418aad SHA512 2f57cba2c2b633b7794296478ff1a8cff92033fc30169917ee85aa7388bdc267191699307bbaf5096f249f0cf806a20fc763e21346330309693c221489db8f20 diff --git a/dev-ruby/sassc-rails/files/sassc-rails-2.1.2-test-directories.patch b/dev-ruby/sassc-rails/files/sassc-rails-2.1.2-test-directories.patch new file mode 100644 index 000000000000..dd4ae709084c --- /dev/null +++ b/dev-ruby/sassc-rails/files/sassc-rails-2.1.2-test-directories.patch @@ -0,0 +1,73 @@ +From 9b653021e7a5a192758968a81b0dc81c68f298d0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com> +Date: Mon, 27 Feb 2023 16:38:38 +0100 +Subject: [PATCH] Run test cases in separate test directories + +This is in preparation to be able to run the tests in isolation, because +recent versions of Rails does not allow multiple to calls to +`initialize!`. +--- + test/sassc_rails_test.rb | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/test/sassc_rails_test.rb b/test/sassc_rails_test.rb +index a15110d..f8c36e4 100644 +--- a/test/sassc_rails_test.rb ++++ b/test/sassc_rails_test.rb +@@ -4,14 +4,18 @@ + + class SassRailsTest < MiniTest::Test + attr_reader :app ++ attr_reader :test_dir + + def setup + Rails.application = nil + ++ @test_dir = Dir.mktmpdir("sassc-rails") ++ FileUtils.cp_r File.join(File.dirname(__FILE__), "dummy"), test_dir ++ + @app = Class.new(Rails::Application) + @app.config.active_support.deprecation = :log + @app.config.eager_load = false +- @app.config.root = File.join(File.dirname(__FILE__), "dummy") ++ @app.config.root = File.join(test_dir, "dummy") + @app.config.log_level = :debug + + # reset config back to default +@@ -30,8 +34,7 @@ def setup + end + + def teardown +- directory = "#{Rails.root}/tmp" +- FileUtils.remove_dir(directory) if File.directory?(directory) ++ FileUtils.remove_dir(test_dir) if File.directory?(test_dir) + end + + def render_asset(asset) +@@ -169,7 +172,7 @@ def test_line_comments_active_in_dev + + css_output = render_asset("css_scss_handler.css") + assert_match %r{/* line 1}, css_output +- assert_match %r{.+test/dummy/app/assets/stylesheets/css_scss_handler.css.scss}, css_output ++ assert_match %r{.+#{test_dir}/dummy/app/assets/stylesheets/css_scss_handler.css.scss}, css_output + end + + def test_context_is_being_passed_to_erb_render +@@ -287,7 +290,7 @@ def test_globbed_imports_work_when_globbed_file_is_changed + begin + initialize! + +- new_file = File.join(File.dirname(__FILE__), 'dummy', 'app', 'assets', 'stylesheets', 'globbed', 'new_glob.scss') ++ new_file = File.join(test_dir, 'dummy', 'app', 'assets', 'stylesheets', 'globbed', 'new_glob.scss') + + File.open(new_file, 'w') do |file| + file.puts '.new-file-test { color: #000; }' +@@ -314,7 +317,7 @@ def test_globbed_imports_work_when_globbed_file_is_added + + css_output = render_asset("glob_test.css") + refute_match /changed-file-test/, css_output +- new_file = File.join(File.dirname(__FILE__), 'dummy', 'app', 'assets', 'stylesheets', 'globbed', 'new_glob.scss') ++ new_file = File.join(test_dir, 'dummy', 'app', 'assets', 'stylesheets', 'globbed', 'new_glob.scss') + + File.open(new_file, 'w') do |file| + file.puts '.changed-file-test { color: #000; }' diff --git a/dev-ruby/sassc-rails/files/sassc-rails-2.1.2-test-isolation.patch b/dev-ruby/sassc-rails/files/sassc-rails-2.1.2-test-isolation.patch new file mode 100644 index 000000000000..afd2274fe0a0 --- /dev/null +++ b/dev-ruby/sassc-rails/files/sassc-rails-2.1.2-test-isolation.patch @@ -0,0 +1,90 @@ +From d2f47f3f7d6ea382a45b87042dfebde7dfe57b9a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com> +Date: Mon, 27 Feb 2023 16:43:07 +0100 +Subject: [PATCH] Run the test cases in isolation + +This is to prevent test errors in recent versions of Rails such as: + +~~~ +SassRailsTest#test_setup_works: +FrozenError: can't modify frozen Array: [] + railties (7.0.4.2) lib/rails/engine.rb:574:in `unshift' + railties (7.0.4.2) lib/rails/engine.rb:574:in `block in <class:Engine>' + railties (7.0.4.2) lib/rails/initializable.rb:32:in `instance_exec' + railties (7.0.4.2) lib/rails/initializable.rb:32:in `run' + railties (7.0.4.2) lib/rails/initializable.rb:61:in `block in run_initializers' + usr/share/ruby/tsort.rb:228:in `block in tsort_each' + usr/share/ruby/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' + usr/share/ruby/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from' + usr/share/ruby/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from' + usr/share/ruby/tsort.rb:431:in `each_strongly_connected_component_from' + usr/share/ruby/tsort.rb:421:in `block in each_strongly_connected_component_from' + railties (7.0.4.2) lib/rails/initializable.rb:50:in `each' + railties (7.0.4.2) lib/rails/initializable.rb:50:in `tsort_each_child' + usr/share/ruby/tsort.rb:415:in `call' + usr/share/ruby/tsort.rb:415:in `each_strongly_connected_component_from' + usr/share/ruby/tsort.rb:421:in `block in each_strongly_connected_component_from' + railties (7.0.4.2) lib/rails/initializable.rb:50:in `each' + railties (7.0.4.2) lib/rails/initializable.rb:50:in `tsort_each_child' + usr/share/ruby/tsort.rb:415:in `call' + usr/share/ruby/tsort.rb:415:in `each_strongly_connected_component_from' + usr/share/ruby/tsort.rb:349:in `block in each_strongly_connected_component' + usr/share/ruby/tsort.rb:347:in `each' + usr/share/ruby/tsort.rb:347:in `call' + usr/share/ruby/tsort.rb:347:in `each_strongly_connected_component' + usr/share/ruby/tsort.rb:226:in `tsort_each' + usr/share/ruby/tsort.rb:205:in `tsort_each' + railties (7.0.4.2) lib/rails/initializable.rb:60:in `run_initializers' + railties (7.0.4.2) lib/rails/application.rb:372:in `initialize!' + railties (7.0.4.2) lib/rails/railtie.rb:226:in `public_send' + railties (7.0.4.2) lib/rails/railtie.rb:226:in `method_missing' + builddir/build/BUILD/sassc-rails-2.1.2/usr/share/gems/gems/sassc-rails-2.1.2/test/sassc_rails_test.rb:48:in `initialize_dev!' + builddir/build/BUILD/sassc-rails-2.1.2/usr/share/gems/gems/sassc-rails-2.1.2/test/sassc_rails_test.rb:57:in `test_setup_works' + minitest (5.17.0) lib/minitest/test.rb:102:in `block (3 levels) in run' + minitest (5.17.0) lib/minitest/test.rb:199:in `capture_exceptions' + minitest (5.17.0) lib/minitest/test.rb:97:in `block (2 levels) in run' + minitest (5.17.0) lib/minitest.rb:296:in `time_it' + minitest (5.17.0) lib/minitest/test.rb:96:in `block in run' + minitest (5.17.0) lib/minitest.rb:391:in `on_signal' + minitest (5.17.0) lib/minitest/test.rb:247:in `with_info_handler' + minitest (5.17.0) lib/minitest/test.rb:95:in `run' + minitest (5.17.0) lib/minitest.rb:1051:in `run_one_method' + minitest (5.17.0) lib/minitest.rb:365:in `run_one_method' + minitest (5.17.0) lib/minitest.rb:352:in `block (2 levels) in run' + minitest (5.17.0) lib/minitest.rb:351:in `each' + minitest (5.17.0) lib/minitest.rb:351:in `block in run' + minitest (5.17.0) lib/minitest.rb:391:in `on_signal' + minitest (5.17.0) lib/minitest.rb:378:in `with_info_handler' + minitest (5.17.0) lib/minitest.rb:350:in `run' + minitest (5.17.0) lib/minitest.rb:182:in `block in __run' + minitest (5.17.0) lib/minitest.rb:182:in `map' + minitest (5.17.0) lib/minitest.rb:182:in `__run' + minitest (5.17.0) lib/minitest.rb:159:in `run' + minitest (5.17.0) lib/minitest.rb:83:in `block in autorun' +rails test /builddir/build/BUILD/sassc-rails-2.1.2/usr/share/gems/gems/sassc-rails-2.1.2/test/sassc_rails_test.rb:56 +~~~ + +This is caused by multiple calls to `initialize!` method and very likely +due to this commit in Rails: + +https://github.com/rails/rails/commit/fe4377098b3800c3998f0583549a414b99b72b19 +--- + test/sassc_rails_test.rb | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/test/sassc_rails_test.rb b/test/sassc_rails_test.rb +index f8c36e4..36686cb 100644 +--- a/test/sassc_rails_test.rb ++++ b/test/sassc_rails_test.rb +@@ -1,8 +1,11 @@ + # frozen_string_literal: true + + require "test_helper" ++require 'active_support/testing/isolation' + + class SassRailsTest < MiniTest::Test ++ include ActiveSupport::Testing::Isolation ++ + attr_reader :app + attr_reader :test_dir + diff --git a/dev-ruby/sassc-rails/sassc-rails-2.1.2-r3.ebuild b/dev-ruby/sassc-rails/sassc-rails-2.1.2-r3.ebuild new file mode 100644 index 000000000000..ace5a004939f --- /dev/null +++ b/dev-ruby/sassc-rails/sassc-rails-2.1.2-r3.ebuild @@ -0,0 +1,49 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +USE_RUBY="ruby27 ruby30 ruby31" + +RUBY_FAKEGEM_TASK_DOC="" +RUBY_FAKEGEM_EXTRADOC="README.md" + +RUBY_FAKEGEM_GEMSPEC="${PN}.gemspec" + +inherit ruby-fakegem + +DESCRIPTION="Integrate SassC-Ruby with Rails" +HOMEPAGE="https://github.com/sass/sassc-rails" + +LICENSE="MIT" +SLOT="$(ver_cut 1)" +KEYWORDS="~amd64" + +IUSE="" + +PATCHES=( "${FILESDIR}/${P}-test-directories.patch" "${FILESDIR}/${P}-test-isolation.patch" ) + +ruby_add_rdepend " + >=dev-ruby/sassc-2.0 + dev-ruby/tilt:* + || ( dev-ruby/railties:7.0 dev-ruby/railties:6.0 dev-ruby/railties:6.1 ) + >=dev-ruby/sprockets-3.0:* + dev-ruby/sprockets-rails:* +" + +ruby_add_bdepend " + test? ( dev-ruby/bundler dev-ruby/mocha )" + +all_ruby_prepare() { + sed -e '/rake/ s/,.*$//' \ + -e '/pry/ s:^:#:' \ + -e 's/git ls-files -z/find * -print0/' \ + -i ${RUBY_FAKEGEM_GEMSPEC} || die + sed -i -e '/pry/ s:^:#:' test/test_helper.rb || die + sed -e '/test_line_comments_active_in_dev/askip "Fails for unknown reason"' \ + -e '/test_globbed_imports_work_when_globbed_file_is_added/askip "Fails intermittently, similar to test above"' \ + -i test/sassc_rails_test.rb || die +} + +each_ruby_test() { + ${RUBY} -S bundle exec rake test || die +} |