inline_forms_installer 8.1.57 → 8.1.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d1734105bfa07ffb1a5a27e0c52fcc41ea5cbd8aac7db548ef6601493c3b492
4
- data.tar.gz: d22858fa2313b583b881fc7f7ec69b224566be4412311f9ec5f458c912b171db
3
+ metadata.gz: c9e3599f9f0622e0fe6e64acfbf1679d07f83a10d5738b555404f1b2fa4a6694
4
+ data.tar.gz: d45293d3e30a531e61c9a10db1c31981ee58868c3d6830ee8da148eaa60919f7
5
5
  SHA512:
6
- metadata.gz: 759e2f5a92aa54b3fcf125b311a55b80ba00bcc0f3247564510d04753ed091be6f5d15603fa816232dd0d8ff63df1dda501f3f8118edf86de9d7f89276a94473
7
- data.tar.gz: 937571d49fb60a4fc83db7e789bab6a971287e5f1a4e50112f25b7c793a69273c69349c22dced242d1972344b5142b5faa718da1d5731ce0c6b7e711360b3053
6
+ metadata.gz: be4bac316abc71fd2c200a10eb8d169b7aec2b3772bf44a6dfb2e35ccd1e99344f089ae790c0b6ec1a409f37ee5320ad2e1a2f9e6f3d56e682b15720b39d10fa
7
+ data.tar.gz: 321944c96eafdaa2ed8cd7b99825522c545aaa1dd26fc8b7604b00c0ca7727bbf87a557f2519b6bbf84ad2bec2915c7ac511334d618b162549c3619a6af752d1
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  module InlineFormsInstaller
4
- VERSION = "8.1.57"
4
+ VERSION = "8.1.58"
5
5
 
6
6
  # Canonical bare Ruby version (must match gemspec `required_ruby_version`).
7
7
  # Written verbatim into generated apps' `.ruby-version` for rbenv/chruby/asdf/
@@ -12,3 +12,19 @@ Rails.application.config.dartsass.builds = {
12
12
  "inline_forms_install/inline_forms_main.scss" => "inline_forms/inline_forms.css",
13
13
  "inline_forms_install/devise_main.scss" => "inline_forms/devise.css"
14
14
  }
15
+
16
+ # SELF-IMPORT GUARD: put the inline_forms gem's stylesheet dir FIRST on the
17
+ # Sass load path. Dartsass::Runner assembles
18
+ # dartsass <build_options> --load-path app/assets/stylesheets
19
+ # --load-path <each config.assets.paths entry> <in:out ...>
20
+ # and Dart Sass takes the first load path that has a match. app/assets/builds
21
+ # is on config.assets.paths BEFORE the gem, and a plain .css file is importable
22
+ # by Sass, so `@use "inline_forms/inline_forms"` (and ".../devise") in the
23
+ # inline_forms_install/*_main.scss entries would resolve to the PREVIOUS OUTPUT
24
+ # app/assets/builds/inline_forms/{inline_forms,devise}.css instead of the gem's
25
+ # .scss: from the second build on, each build re-imports its own stale result
26
+ # and gem stylesheet changes never reach the app. build_options precede the
27
+ # load paths in the command, so this --load-path wins. Single token on
28
+ # purpose: the runner splits every build_options entry on whitespace.
29
+ Rails.application.config.dartsass.build_options <<
30
+ "--load-path=#{InlineForms::Engine.root.join('app/assets/stylesheets')}"
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
4
+ require "dartsass/runner"
5
+ require "sass-embedded"
6
+
7
+ # config/initializers/inline_forms_dartsass_builds.rb puts the gem's
8
+ # stylesheet dir first on the Sass load path. Without it,
9
+ # app/assets/builds (ahead of the gem in config.assets.paths) shadows the
10
+ # gem's .scss: `@use "inline_forms/inline_forms"` in the
11
+ # inline_forms_install/*_main.scss entries re-imports the app's previous
12
+ # compiled CSS, and gem stylesheet changes never reach the app after its
13
+ # first build. test_helper runs dartsass:build, so by now builds/ already held
14
+ # a previous build when this run's one ran.
15
+ class ExampleAppDartsassBuildTest < ActiveSupport::TestCase
16
+ test "the gem stylesheet dir is the first Sass load path" do
17
+ command = Dartsass::Runner.dartsass_compile_command
18
+ first_load_path = command.index { |arg| arg == "--load-path" || arg.start_with?("--load-path=") }
19
+
20
+ assert_equal "--load-path=#{gem_stylesheets}", command[first_load_path]
21
+ end
22
+
23
+ %w[inline_forms devise].each do |entry|
24
+ test "builds/inline_forms/#{entry}.css is compiled from the gem's #{entry}.scss" do
25
+ built = Rails.root.join("app/assets/builds/inline_forms/#{entry}.css")
26
+ assert built.file?, "#{built} missing; dartsass:build did not run"
27
+
28
+ expected = Sass.compile(File.join(gem_stylesheets, "inline_forms", "#{entry}.scss"),
29
+ load_paths: load_paths, style: :compressed,
30
+ logger: Sass::Logger.silent).css
31
+ assert_equal expected.strip, built.read.strip,
32
+ "#{entry}.css differs from a direct compile of the gem's #{entry}.scss " \
33
+ "(re-imported a stale app/assets/builds/inline_forms/#{entry}.css?)"
34
+ end
35
+ end
36
+
37
+ private
38
+
39
+ def gem_stylesheets
40
+ InlineForms::Engine.root.join("app/assets/stylesheets").to_s
41
+ end
42
+
43
+ # The gem's stylesheets, then the app's asset paths without app/assets/builds.
44
+ def load_paths
45
+ [ gem_stylesheets ] + Rails.application.config.assets.paths.map(&:to_s)
46
+ .reject { |path| path.end_with?("app/assets/builds") }
47
+ end
48
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
4
+ require "sass-embedded"
5
+
6
+ # Sass @import is removed in Dart Sass 3. Since 8.1.58 the gem's entry points
7
+ # load foundation_and_overrides with @use; the only gem @imports left are the
8
+ # three in foundation_and_overrides.scss that wait for the Foundation decision
9
+ # (see the module-system note in inline_forms/inline_forms.scss). Compiles
10
+ # both entry points from the installed gem, with every deprecation reported
11
+ # (verbose), and fails if the gem gains an @import or an entry point compiles
12
+ # with more [import] warnings than 8.1.58 had.
13
+ class ExampleAppSassDeprecationsTest < ActiveSupport::TestCase
14
+ GEM_IMPORTS_LEFT = [
15
+ "foundation_and_overrides.scss 'settings/settings'",
16
+ "foundation_and_overrides.scss 'foundation'",
17
+ "foundation_and_overrides.scss 'theme'"
18
+ ].freeze
19
+ # 8.1.58 with foundation-rails 6.9.0.0: the three above + 114 inside Foundation.
20
+ MAX_IMPORT_WARNINGS = 117
21
+
22
+ %w[inline_forms devise].each do |entry|
23
+ test "#{entry}.scss compiles without new @import deprecations" do
24
+ imports = import_deprecations(entry)
25
+
26
+ gem_imports = imports.select { |span| span.url.start_with?(gem_stylesheets_url) }
27
+ .map { |span| "#{File.basename(span.url)} #{span.text}" }
28
+ assert_empty gem_imports - GEM_IMPORTS_LEFT,
29
+ "#{entry}.scss: new @import in the gem; load it with @use"
30
+ assert_operator imports.size, :<=, MAX_IMPORT_WARNINGS,
31
+ "#{entry}.scss: more [import] deprecations than 8.1.58"
32
+ end
33
+ end
34
+
35
+ private
36
+
37
+ def gem_stylesheets
38
+ InlineForms::Engine.root.join("app/assets/stylesheets").to_s
39
+ end
40
+
41
+ def gem_stylesheets_url
42
+ "file://#{gem_stylesheets}/"
43
+ end
44
+
45
+ # The gem's stylesheets first, then the app's asset paths without
46
+ # app/assets/builds (its compiled inline_forms/*.css would shadow the .scss).
47
+ def load_paths
48
+ [ gem_stylesheets ] + Rails.application.config.assets.paths.map(&:to_s)
49
+ .reject { |path| path.end_with?("app/assets/builds") }
50
+ end
51
+
52
+ def import_deprecations(entry)
53
+ spans = []
54
+ logger = {
55
+ warn: lambda do |_message, context|
56
+ spans << context.span if context.deprecation && context.deprecation_type == "import"
57
+ end
58
+ }
59
+ Sass.compile(File.join(gem_stylesheets, "inline_forms", "#{entry}.scss"),
60
+ load_paths: load_paths, style: :compressed, verbose: true, logger: logger)
61
+ spans
62
+ end
63
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms_installer
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.57
4
+ version: 8.1.58
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
@@ -97,6 +97,7 @@ files:
97
97
  - lib/installer_templates/example_app_tests/test/integration/example_app_apartment_top_level_new_test.rb
98
98
  - lib/installer_templates/example_app_tests/test/integration/example_app_apartment_top_level_pagination_test.rb
99
99
  - lib/installer_templates/example_app_tests/test/integration/example_app_apartment_versions_turbo_test.rb
100
+ - lib/installer_templates/example_app_tests/test/integration/example_app_dartsass_build_test.rb
100
101
  - lib/installer_templates/example_app_tests/test/integration/example_app_devise_passwords_test.rb
101
102
  - lib/installer_templates/example_app_tests/test/integration/example_app_devise_sign_in_test.rb
102
103
  - lib/installer_templates/example_app_tests/test/integration/example_app_guest_access_test.rb
@@ -107,6 +108,7 @@ files:
107
108
  - lib/installer_templates/example_app_tests/test/integration/example_app_photos_test.rb
108
109
  - lib/installer_templates/example_app_tests/test/integration/example_app_production_ssl_test.rb
109
110
  - lib/installer_templates/example_app_tests/test/integration/example_app_routing_test.rb
111
+ - lib/installer_templates/example_app_tests/test/integration/example_app_sass_deprecations_test.rb
110
112
  - lib/installer_templates/example_app_tests/test/integration/example_app_schema_edit_test.rb
111
113
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_choice_scale_fields_test.rb
112
114
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_date_time_fields_test.rb