inline_forms_installer 8.1.56 → 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: 9b2831a93f9f5c8b73b05ba62ff707b93b8775979e338a51573fd58074dad7ab
4
- data.tar.gz: 131524c58a0db8a9cf28838baa2d4d7b70f5e66673e2fbf911c65a36a591801e
3
+ metadata.gz: c9e3599f9f0622e0fe6e64acfbf1679d07f83a10d5738b555404f1b2fa4a6694
4
+ data.tar.gz: d45293d3e30a531e61c9a10db1c31981ee58868c3d6830ee8da148eaa60919f7
5
5
  SHA512:
6
- metadata.gz: a90ea3700df031e6cc35b6d9511c9551676d03de5b86a8fba118e0b6ac4603f8544e6b083e70b91da0ea2975908f29f9a291dca544ffcd2a4fe00725aeae6cba
7
- data.tar.gz: b746466b0dc7eb1eb9852700af5a5ea28a4359c265d9cf81751afa54a396cb57d1d1967c4482e9704f0966baa69748c68a56dbf70850dd5935a663938a69289e
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.56"
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,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
4
+
5
+ # The sign-in page (inline_forms 8.1.57): the Devise layout declares the page
6
+ # language like the inline_forms layout, and the submit button is translated
7
+ # (it was `f.submit :login`, an untranslated "login" in every locale).
8
+ class ExampleAppDeviseSignInTest < ActionDispatch::IntegrationTest
9
+ setup do
10
+ host!("www.example.com")
11
+ @mapping = Devise.mappings.values.first
12
+ end
13
+
14
+ def sign_in_path
15
+ Rails.application.routes.url_helpers.public_send("new_#{@mapping.name}_session_path")
16
+ end
17
+
18
+ test "the sign-in page declares its language and translates the submit button" do
19
+ get sign_in_path
20
+
21
+ assert_response :success
22
+ assert_includes @response.body, %(<html lang="#{I18n.locale}">)
23
+ assert_includes @response.body, %(value="#{I18n.t('inline_forms.devise.login')}")
24
+ end
25
+
26
+ test "the submit label has an nl translation" do
27
+ assert_equal "inloggen", I18n.t("inline_forms.devise.login", locale: :nl)
28
+ end
29
+ 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
@@ -11,7 +11,7 @@ class ExampleAppTurboLayoutTest < ExampleAppIntegrationTestCase
11
11
  assert_response :success
12
12
 
13
13
  assert_match(
14
- %r{<script\s+type="module">\s*import\s+\{\s*Turbo\s*\}\s+from\s+"[^"]*turbo\.min(?:-[a-f0-9]+)?\.js"}m,
14
+ %r{<script\s+type="module"[^>]*>\s*import\s+\{\s*Turbo\s*\}\s+from\s+"[^"]*turbo\.min(?:-[a-f0-9]+)?\.js"}m,
15
15
  @response.body,
16
16
  "expected the inline_forms layout to import turbo.min.js as a module"
17
17
  )
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.56
4
+ version: 8.1.58
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
@@ -97,7 +97,9 @@ 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
102
+ - lib/installer_templates/example_app_tests/test/integration/example_app_devise_sign_in_test.rb
101
103
  - lib/installer_templates/example_app_tests/test/integration/example_app_guest_access_test.rb
102
104
  - lib/installer_templates/example_app_tests/test/integration/example_app_layout_title_test.rb
103
105
  - lib/installer_templates/example_app_tests/test/integration/example_app_owner_tabs_test.rb
@@ -106,6 +108,7 @@ files:
106
108
  - lib/installer_templates/example_app_tests/test/integration/example_app_photos_test.rb
107
109
  - lib/installer_templates/example_app_tests/test/integration/example_app_production_ssl_test.rb
108
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
109
112
  - lib/installer_templates/example_app_tests/test/integration/example_app_schema_edit_test.rb
110
113
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_choice_scale_fields_test.rb
111
114
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_date_time_fields_test.rb