check_dependencies 0.1.6 → 0.1.8
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/bin/check_dependencies +19 -11
- data/check_dependencies-0.1.7.gem +0 -0
- data/check_dependencies.gemspec +1 -1
- data/lib/check_dependencies.rb +19 -11
- metadata +2 -3
- data/check_dependencies-0.1.3.gem +0 -0
- data/check_dependencies-0.1.4.gem +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1fb8b26b9005629605058ec5c8bab1abafd474107992ebd5cfdca9e5e1f3a624
|
|
4
|
+
data.tar.gz: 6ed9df32bf09af0007ca87663e8caa8b6698079873d8a9cc925ca9b62fa60543
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e64aa448f87110dd4d5508a60d3dc9273c23fd5b2caa86abc43f4c2d93156169588f7b8aab8d28380f599fde7c1cfed6ce17311c061b5dad6074af2b6b72c1ce
|
|
7
|
+
data.tar.gz: 1050e3d07adde27b8b7018210ed14ac8d294b00f45b4349f4eba4634f0e9af1af4a4eac084dfb355c46b413180433e7aab7570a7e71642a19043153f33c686f4
|
data/bin/check_dependencies
CHANGED
|
@@ -18,7 +18,7 @@ end
|
|
|
18
18
|
# Define and parse options based on the command
|
|
19
19
|
options = {}
|
|
20
20
|
global_options = OptionParser.new do |opts|
|
|
21
|
-
opts.banner = "Usage:
|
|
21
|
+
opts.banner = "Usage: check_dependencies [command] [options]"
|
|
22
22
|
opts.separator ""
|
|
23
23
|
opts.separator "Commands:"
|
|
24
24
|
opts.separator " gen_pod: Generate podfile entries for new dependencies"
|
|
@@ -244,7 +244,13 @@ def red(text); colorize(text, 31); end
|
|
|
244
244
|
def green(text); colorize(text, 32); end
|
|
245
245
|
|
|
246
246
|
def read_json_array_from_file_as_set(file_path)
|
|
247
|
-
#
|
|
247
|
+
# 检查 file_path 是否为 nil 或不是字符串
|
|
248
|
+
unless file_path.is_a?(String)
|
|
249
|
+
# 可以在这里抛出异常或返回一个空的 Set
|
|
250
|
+
raise ArgumentError, "file_path must be a String" unless file_path.is_a?(String)
|
|
251
|
+
return Set.new
|
|
252
|
+
end
|
|
253
|
+
|
|
248
254
|
if File.exist?(file_path)
|
|
249
255
|
# 读取文件内容
|
|
250
256
|
file_content = File.read(file_path)
|
|
@@ -253,26 +259,28 @@ def read_json_array_from_file_as_set(file_path)
|
|
|
253
259
|
# 将数组转换为 Set 并返回
|
|
254
260
|
return json_array.to_set
|
|
255
261
|
else
|
|
256
|
-
|
|
257
|
-
|
|
262
|
+
# 文件不存在时,也可以选择抛出异常或返回一个空的 Set
|
|
263
|
+
puts "File not found: #{file_path}" # 或者使用 raise "File not found: #{file_path}"
|
|
264
|
+
return Set.new
|
|
258
265
|
end
|
|
259
|
-
rescue JSON::ParserError => e
|
|
260
|
-
puts "Error parsing JSON from #{file_path}: #{e.message}"
|
|
261
|
-
exit
|
|
262
266
|
end
|
|
263
267
|
|
|
264
268
|
def compare_podfile_locks(old_lock_path, new_lock_path, config_path = nil)
|
|
265
|
-
config_set = read_json_array_from_file_as_set(config_path)
|
|
266
269
|
|
|
267
270
|
old_pods = read_local_podfile_lock(old_lock_path)
|
|
268
271
|
new_pods = read_local_podfile_lock(new_lock_path)
|
|
269
272
|
|
|
270
273
|
old_unique_deps = find_shortest_paths(extract_unique_dependencies(old_pods)).to_set
|
|
271
274
|
new_unique_deps = find_shortest_paths(extract_unique_dependencies(new_pods)).to_set
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
+
|
|
276
|
+
unless config_path.nil?
|
|
277
|
+
config_set = read_json_array_from_file_as_set(config_path)
|
|
278
|
+
if !config_set.empty?
|
|
279
|
+
old_unique_deps = old_unique_deps.select { |dep| config_set.include?(dep.split('/').first) }
|
|
280
|
+
new_unique_deps = new_unique_deps.select { |dep| config_set.include?(dep.split('/').first) }
|
|
281
|
+
end
|
|
275
282
|
end
|
|
283
|
+
|
|
276
284
|
only_in_old = old_unique_deps - new_unique_deps
|
|
277
285
|
only_in_new = new_unique_deps - old_unique_deps
|
|
278
286
|
|
|
Binary file
|
data/check_dependencies.gemspec
CHANGED
data/lib/check_dependencies.rb
CHANGED
|
@@ -18,7 +18,7 @@ end
|
|
|
18
18
|
# Define and parse options based on the command
|
|
19
19
|
options = {}
|
|
20
20
|
global_options = OptionParser.new do |opts|
|
|
21
|
-
opts.banner = "Usage:
|
|
21
|
+
opts.banner = "Usage: check_dependencies [command] [options]"
|
|
22
22
|
opts.separator ""
|
|
23
23
|
opts.separator "Commands:"
|
|
24
24
|
opts.separator " gen_pod: Generate podfile entries for new dependencies"
|
|
@@ -244,7 +244,13 @@ def red(text); colorize(text, 31); end
|
|
|
244
244
|
def green(text); colorize(text, 32); end
|
|
245
245
|
|
|
246
246
|
def read_json_array_from_file_as_set(file_path)
|
|
247
|
-
#
|
|
247
|
+
# 检查 file_path 是否为 nil 或不是字符串
|
|
248
|
+
unless file_path.is_a?(String)
|
|
249
|
+
# 可以在这里抛出异常或返回一个空的 Set
|
|
250
|
+
raise ArgumentError, "file_path must be a String" unless file_path.is_a?(String)
|
|
251
|
+
return Set.new
|
|
252
|
+
end
|
|
253
|
+
|
|
248
254
|
if File.exist?(file_path)
|
|
249
255
|
# 读取文件内容
|
|
250
256
|
file_content = File.read(file_path)
|
|
@@ -253,26 +259,28 @@ def read_json_array_from_file_as_set(file_path)
|
|
|
253
259
|
# 将数组转换为 Set 并返回
|
|
254
260
|
return json_array.to_set
|
|
255
261
|
else
|
|
256
|
-
|
|
257
|
-
|
|
262
|
+
# 文件不存在时,也可以选择抛出异常或返回一个空的 Set
|
|
263
|
+
puts "File not found: #{file_path}" # 或者使用 raise "File not found: #{file_path}"
|
|
264
|
+
return Set.new
|
|
258
265
|
end
|
|
259
|
-
rescue JSON::ParserError => e
|
|
260
|
-
puts "Error parsing JSON from #{file_path}: #{e.message}"
|
|
261
|
-
exit
|
|
262
266
|
end
|
|
263
267
|
|
|
264
268
|
def compare_podfile_locks(old_lock_path, new_lock_path, config_path = nil)
|
|
265
|
-
config_set = read_json_array_from_file_as_set(config_path)
|
|
266
269
|
|
|
267
270
|
old_pods = read_local_podfile_lock(old_lock_path)
|
|
268
271
|
new_pods = read_local_podfile_lock(new_lock_path)
|
|
269
272
|
|
|
270
273
|
old_unique_deps = find_shortest_paths(extract_unique_dependencies(old_pods)).to_set
|
|
271
274
|
new_unique_deps = find_shortest_paths(extract_unique_dependencies(new_pods)).to_set
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
+
|
|
276
|
+
unless config_path.nil?
|
|
277
|
+
config_set = read_json_array_from_file_as_set(config_path)
|
|
278
|
+
if !config_set.empty?
|
|
279
|
+
old_unique_deps = old_unique_deps.select { |dep| config_set.include?(dep.split('/').first) }
|
|
280
|
+
new_unique_deps = new_unique_deps.select { |dep| config_set.include?(dep.split('/').first) }
|
|
281
|
+
end
|
|
275
282
|
end
|
|
283
|
+
|
|
276
284
|
only_in_old = old_unique_deps - new_unique_deps
|
|
277
285
|
only_in_new = new_unique_deps - old_unique_deps
|
|
278
286
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: check_dependencies
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ITxiansheng
|
|
@@ -57,8 +57,7 @@ files:
|
|
|
57
57
|
- bin/check_dependencies
|
|
58
58
|
- bin/console
|
|
59
59
|
- bin/setup
|
|
60
|
-
- check_dependencies-0.1.
|
|
61
|
-
- check_dependencies-0.1.4.gem
|
|
60
|
+
- check_dependencies-0.1.7.gem
|
|
62
61
|
- check_dependencies.gemspec
|
|
63
62
|
- gem_env_install.sh
|
|
64
63
|
- lib/check_dependencies.rb
|
|
Binary file
|
|
Binary file
|