lucide-ruby 0.1.6 → 0.1.101

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: f40706628f265d6315af92115ccfa6cb3fd88819af1d8819343ef3a4c898a540
4
- data.tar.gz: 28fdcde9c4f501eb1e574ff1758107285ced8a3324579c4657884b2513a5d96f
3
+ metadata.gz: 9f493e82f1f41363ebe773c62833b3f0c66a4625902ee68f5923f1b8eec77d94
4
+ data.tar.gz: b287887eda4df66659fbb44e7730db0f8f541eb76453cc2a8cb4375c61846825
5
5
  SHA512:
6
- metadata.gz: e50440309745ff546050698d05c6ff809f5811506ef9ce271cb59a951fad1821176d06fb53b235299ab689b10d76df1efe9db25e247905144b02a57188f1be3b
7
- data.tar.gz: 8d369fa80be42a4040c96377958e4be1eab812da092b1854b39e6e958a618780af82e1d72f6275c43bb4aa3f1370c19f3af6463a7ab109025a497458062f6f8b
6
+ metadata.gz: 0df5018961748faf926aba9e70ced8dc2b0eb3986daac636e22c2378191c894db20bf201a5ef85460ea879cbaae86d505486fdcb7433527d16d2ca1d5c574c13
7
+ data.tar.gz: 9267d4ae69d71da219a61ddf3fec746f74b2b1a6e5b3fb15180ac45946c965accb56d02ae4cfc25348eb00ce0f1355e1b22ea1f25ac177fff24028ac7c18383b
@@ -29,38 +29,38 @@ namespace :lucide do
29
29
 
30
30
  Dir.mktmpdir("lucide-sync") do |tmpdir|
31
31
  zip_path = File.join(tmpdir, "lucide-icons.zip")
32
- extract_path = File.join(tmpdir, "extracted")
33
32
 
34
33
  # Download
35
34
  puts "Downloading #{download_url}..."
36
35
  download_file(download_url, zip_path)
37
36
  puts "Downloaded #{File.size(zip_path)} bytes"
38
37
 
39
- # Extract
40
- FileUtils.mkdir_p(extract_path)
41
- extract_zip(zip_path, extract_path)
42
-
43
- # Find SVG files in extracted archive
44
- svg_source = find_svg_directory(extract_path)
45
-
46
- if svg_source.nil?
47
- raise LucideRuby::SyncError, "No SVG files found in the downloaded archive"
48
- end
49
-
50
- svg_files = Dir.glob(File.join(svg_source, "*.svg"))
51
- puts "Found #{svg_files.size} icons"
52
-
53
- # Atomic replace: write to temp dir, then swap
38
+ # Extract SVGs directly from zip
54
39
  staging_path = "#{icon_path}.staging"
55
40
  backup_path = "#{icon_path}.backup"
56
41
 
57
42
  FileUtils.rm_rf(staging_path)
58
43
  FileUtils.mkdir_p(staging_path)
59
44
 
60
- svg_files.each do |svg_file|
61
- FileUtils.cp(svg_file, staging_path)
45
+ svg_count = 0
46
+ Zip::File.open(zip_path) do |zip_file|
47
+ zip_file.each do |entry|
48
+ next if entry.directory?
49
+ next unless entry.name.end_with?(".svg")
50
+
51
+ dest = File.join(staging_path, File.basename(entry.name))
52
+ File.binwrite(dest, entry.get_input_stream.read)
53
+ svg_count += 1
54
+ end
55
+ end
56
+
57
+ if svg_count == 0
58
+ FileUtils.rm_rf(staging_path)
59
+ raise LucideRuby::SyncError, "No SVG files found in the downloaded archive"
62
60
  end
63
61
 
62
+ puts "Found #{svg_count} icons"
63
+
64
64
  # Write version file
65
65
  File.write(File.join(staging_path, ".lucide-version"), version)
66
66
 
@@ -73,7 +73,7 @@ namespace :lucide do
73
73
  # Clear cache
74
74
  LucideRuby.cache.clear!
75
75
 
76
- puts "Synced #{svg_files.size} Lucide icons (#{version}) to #{icon_path}"
76
+ puts "Synced #{svg_count} Lucide icons (#{version}) to #{icon_path}"
77
77
  end
78
78
  end
79
79
 
@@ -141,33 +141,3 @@ def make_request(uri)
141
141
  http.request(request)
142
142
  end
143
143
 
144
- def extract_zip(zip_path, extract_path)
145
- real_extract_path = File.realpath(extract_path)
146
-
147
- Zip::File.open(zip_path) do |zip_file|
148
- zip_file.each do |entry|
149
- entry_path = File.join(real_extract_path, entry.name)
150
-
151
- # Prevent zip slip - expand_path normalizes ".." segments
152
- unless File.expand_path(entry_path).start_with?(real_extract_path)
153
- raise LucideRuby::SyncError, "Zip slip detected: #{entry.name}"
154
- end
155
-
156
- if entry.directory?
157
- FileUtils.mkdir_p(entry_path)
158
- else
159
- FileUtils.mkdir_p(File.dirname(entry_path))
160
- entry.extract(entry_path)
161
- end
162
- end
163
- end
164
- end
165
-
166
- def find_svg_directory(extract_path)
167
- # Look for SVGs directly or in subdirectories
168
- if Dir.glob(File.join(extract_path, "*.svg")).any?
169
- return extract_path
170
- end
171
-
172
- Dir.glob(File.join(extract_path, "**", "*.svg")).first&.then { |f| File.dirname(f) }
173
- end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucideRuby
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.101"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucide-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.101
5
5
  platform: ruby
6
6
  authors:
7
7
  - lucide-ruby contributors