view_primitives 0.1.1 → 0.1.2

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: 3bef69fa2796d5fec3caefbc2030477efadbe97cb28542e54b6f015edb3196de
4
- data.tar.gz: a85bd022df50687b09ad134173dd76e264c66a7b24a4df8eff09918794a209cb
3
+ metadata.gz: 8c238e3e54f7adcde5c4deac58db808e62b8602534c8f72921c2a266347dd0d9
4
+ data.tar.gz: a2d11d3988be3ebbe6926f673ea8dc6deef422409ff83fd0b2857afb2c14a47e
5
5
  SHA512:
6
- metadata.gz: 424be22b1983a620253005a43f6598043553603eb6822de5c28b8bf10a49181039c3c5165f33ced82da6266af526422824b88ae7d0f7adad1d139e0fd695cf26
7
- data.tar.gz: a3c8c3a237183d849329f998ad3c0d276fde2873db327d24d091ceeeff503518ba0ca20e3512c8683dc5ded47e13fd97066a16b62131e6923cea050f40a4e9f4
6
+ metadata.gz: a6c5cc252992ae249a0679881fa8d9eb4ddd87ebd71e9c7de7686f4e0ae56ccaf0354c53b5d9f38c7a6958e8a2cbbd35ca2ce68e69a2dff4c8f8f2a79577c107
7
+ data.tar.gz: 0d325f0d79a32e0d015e263c0cd44c8d3d32abee0744c8f5d6afeab49855018c68087ad89c3dc800216edee71438bd4dacf8ba096f78ce8d386c421f1a980dab
data/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.2] - 2026-06-04
11
+
12
+ ### Fixed
13
+
14
+ - `InstallGenerator#verify_ui_inflection` checked `"ui/button".camelize` which can never equal `"UI::ButtonComponent"`, causing the warning to fire unconditionally even when inflections were correctly configured; fixed to check `"ui/button_component".camelize`
15
+ - `InstallGenerator#inject_css_import` used `String#include?` to detect `@import "tailwindcss"` (matches with or without semicolon) but passed `after: "@import \"tailwindcss\"\n"` (no semicolon) to `inject_into_file`; the anchor mismatch left the entry point unchanged ("File unchanged!") on Tailwind CSS v4 projects that use `@import "tailwindcss";`; fixed by probing for all four variants (double/single quotes × with/without semicolon) and passing the exact matching line as the anchor
16
+
10
17
  ## [0.1.1] - 2026-06-01
11
18
 
12
19
  ### Fixed
@@ -38,6 +38,18 @@ module ViewPrimitives
38
38
  File.exist?(File.join(destination_root, dir))
39
39
  end
40
40
  end
41
+
42
+ # Returns the exact line (including newline) that inject_into_file should anchor after,
43
+ # or nil if no tailwindcss @import is present. Checks with and without semicolons so
44
+ # the after: anchor always matches what the file actually contains.
45
+ def tailwind_import_anchor(content)
46
+ [
47
+ "@import \"tailwindcss\";\n",
48
+ "@import \"tailwindcss\"\n",
49
+ "@import 'tailwindcss';\n",
50
+ "@import 'tailwindcss'\n"
51
+ ].find { |anchor| content.include?(anchor) }
52
+ end
41
53
  end
42
54
  end
43
55
  end
@@ -10,7 +10,7 @@ module ViewPrimitives
10
10
  source_root File.expand_path("templates", __dir__)
11
11
 
12
12
  def verify_ui_inflection
13
- return if "ui/button".camelize == "UI::ButtonComponent"
13
+ return if "ui/button_component".camelize == "UI::ButtonComponent"
14
14
 
15
15
  say "\n Warning: ActiveSupport inflection for `UI` is not configured.", :yellow
16
16
  say " ViewPrimitives expects `ui/button` to resolve to `UI::ButtonComponent`.", :yellow
@@ -52,10 +52,9 @@ module ViewPrimitives
52
52
 
53
53
  import_line = "@import \"#{css_import_path}\";\n"
54
54
 
55
- if entry_content.include?('@import "tailwindcss"')
56
- inject_into_file entry, import_line, after: "@import \"tailwindcss\"\n"
57
- elsif entry_content.include?("@import 'tailwindcss'")
58
- inject_into_file entry, import_line, after: "@import 'tailwindcss'\n"
55
+ anchor = tailwind_import_anchor(entry_content)
56
+ if anchor
57
+ inject_into_file entry, import_line, after: anchor
59
58
  else
60
59
  append_to_file entry, "\n#{import_line}"
61
60
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ViewPrimitives
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: view_primitives
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Poimtsev
@@ -261,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
261
  - !ruby/object:Gem::Version
262
262
  version: '0'
263
263
  requirements: []
264
- rubygems_version: 4.0.12
264
+ rubygems_version: 4.0.10
265
265
  specification_version: 4
266
266
  summary: Primitive view components and helpers for Rails applications
267
267
  test_files: []