railsui_icon 1.0.3 → 1.0.4

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: d45845912b9f9db2bd1ce2c19f8953fb20ed205b9156af38036c208710c1b7bc
4
- data.tar.gz: 45dd58a2aeaa6ddcb07371f41d28e71a2edbec951197cb1c0d526789a0677d02
3
+ metadata.gz: f2b20a83d52f2e74a09b0cb4adea7b985e58a245838416527db32698446dce8b
4
+ data.tar.gz: dcbd25c4c0cb05a1adb68ca4f1da4cf6cb96c77393e741e702fbbf805258b825
5
5
  SHA512:
6
- metadata.gz: ff42b7699dbc33087a3cdd3fcc4b14b9ba35b81f10308f611f430271232b1ae6ad36e6557752dfd8d9ea35bd009b8de25ded5395f3d76386931b935aa7467d31
7
- data.tar.gz: 1fba9f974a50d891eab7953a6d27adfde80549fca92607f3def566646606046610cc4a86e5ae98dbf564e80d79f4f0a85ebd91d4879d10629f7f0d37df2705a5
6
+ metadata.gz: cf94910fd60faa96cad929156fd4176c5d48936be7e713eac65262d8260937446d1b6ec58f4af462263bd798969930696c3ce19ed5b603c60506865ef7133969
7
+ data.tar.gz: e1dd62964ec1ec79bf5cfbbac56e94d96dacfaae9d0aa3021a34cf8503456a8c23d1862653519a3d043748da593d221e019de0eed8e32130e36ad5fb5506cace
@@ -15,6 +15,7 @@ module RailsuiIcon
15
15
 
16
16
  def render
17
17
  if custom_path
18
+ puts "🔥🔥🔥🔥🔥#{custom_path}"
18
19
  render_custom_path(custom_path)
19
20
  else
20
21
  render_standard_icon
@@ -41,21 +42,23 @@ module RailsuiIcon
41
42
  end
42
43
 
43
44
  def render_custom_path(custom_path)
44
- # Check the engine's asset path first
45
- engine_asset_path = Railsui::Engine.root.join("app/assets/images/#{custom_path}")
46
-
47
- # Check the main app's asset path
48
- app_asset_path = Rails.root.join("app/assets/images/#{custom_path}")
49
-
50
- # Determine which path exists
51
- asset_path = if File.exist?(engine_asset_path)
52
- engine_asset_path
53
- elsif File.exist?(app_asset_path)
54
- app_asset_path
55
- else
56
- Rails.logger.error "Asset not found: #{engine_asset_path} and #{app_asset_path}"
57
- return warning
58
- end
45
+ return warning if custom_path.blank?
46
+
47
+ if defined?(Railsui::Engine) && Railsui::Engine.root.present?
48
+ engine_asset_path = Railsui::Engine.root.join("app/assets/images#{custom_path}")
49
+
50
+ if File.exist?(engine_asset_path)
51
+ asset_path = engine_asset_path
52
+ end
53
+ end
54
+
55
+ app_asset_path = Rails.root.join("app/assets/images#{custom_path}")
56
+
57
+ if File.exist?(app_asset_path)
58
+ asset_path = app_asset_path
59
+ end
60
+
61
+ raise ArgumentError, "Asset path cannot be nil" if asset_path.nil?
59
62
 
60
63
  svg_content = File.read(asset_path)
61
64
  doc = Nokogiri::HTML::DocumentFragment.parse(svg_content)
@@ -1,3 +1,3 @@
1
1
  module RailsuiIcon
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railsui_icon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Leverenz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-15 00:00:00.000000000 Z
11
+ date: 2024-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails