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 +4 -4
- data/lib/lucide_ruby/tasks/lucide.rake +19 -49
- data/lib/lucide_ruby/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f493e82f1f41363ebe773c62833b3f0c66a4625902ee68f5923f1b8eec77d94
|
|
4
|
+
data.tar.gz: b287887eda4df66659fbb44e7730db0f8f541eb76453cc2a8cb4375c61846825
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
61
|
-
|
|
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 #{
|
|
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
|
data/lib/lucide_ruby/version.rb
CHANGED