railsui_icon 1.0.3 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d45845912b9f9db2bd1ce2c19f8953fb20ed205b9156af38036c208710c1b7bc
4
- data.tar.gz: 45dd58a2aeaa6ddcb07371f41d28e71a2edbec951197cb1c0d526789a0677d02
3
+ metadata.gz: 1bd7919c8f13f907f53889eefdb415673f37e32efa162e1935adac97101e36fd
4
+ data.tar.gz: 3b57157b1c05982a935e0eac257418b47a64cdbccb62e531829e42d88608d5db
5
5
  SHA512:
6
- metadata.gz: ff42b7699dbc33087a3cdd3fcc4b14b9ba35b81f10308f611f430271232b1ae6ad36e6557752dfd8d9ea35bd009b8de25ded5395f3d76386931b935aa7467d31
7
- data.tar.gz: 1fba9f974a50d891eab7953a6d27adfde80549fca92607f3def566646606046610cc4a86e5ae98dbf564e80d79f4f0a85ebd91d4879d10629f7f0d37df2705a5
6
+ metadata.gz: b214074a637067755e3e7776bbb8f89a562ec1133d74460bf5ae4d0138fb67e58cc4566efe3f0f17750d422e1b4b5b15a717b2caf12ad316b825c5383d853332
7
+ data.tar.gz: e5bb3544be5dfcdd49d3219e5e22a632bbaab53a37c281a8b850fb3e783a34b77486b3807bae54813200b2359d0cdbc9582ac162c8ce4a36689a551219710f7b
@@ -41,21 +41,23 @@ module RailsuiIcon
41
41
  end
42
42
 
43
43
  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
44
+ return warning if custom_path.blank?
45
+
46
+ if defined?(Railsui::Engine) && Railsui::Engine.root.present?
47
+ engine_asset_path = Railsui::Engine.root.join("app/assets/images#{custom_path}")
48
+
49
+ if File.exist?(engine_asset_path)
50
+ asset_path = engine_asset_path
51
+ end
52
+ end
53
+
54
+ app_asset_path = Rails.root.join("app/assets/images#{custom_path}")
55
+
56
+ if File.exist?(app_asset_path)
57
+ asset_path = app_asset_path
58
+ end
59
+
60
+ raise ArgumentError, "Asset path cannot be nil" if asset_path.nil?
59
61
 
60
62
  svg_content = File.read(asset_path)
61
63
  doc = Nokogiri::HTML::DocumentFragment.parse(svg_content)
@@ -1,3 +1,3 @@
1
1
  module RailsuiIcon
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.5"
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.5
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