check_dependencies 0.1.7 → 0.1.9
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 +20 -14
- data/check_dependencies-0.1.7.gem +0 -0
- data/check_dependencies-0.1.8.gem +0 -0
- data/check_dependencies.gemspec +1 -1
- data/lib/check_dependencies.rb +20 -14
- data/note.md +43 -0
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '095dc3f59d3cdc3073916ef8d5b3853cadabf69ff27289673b9850fe2664df7d'
|
|
4
|
+
data.tar.gz: 5105743f16867dec87c914755e8ffe9bb80e580303a9dc2a6e55ec84a13b7e48
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 163ea165d4b770a4dad749437714a2b903fb74434f71e92d663996616be7d5074eb59caaf5c28c221211e95ecefcbfc2c2b8519f50a787c42fe9d0a99d124367
|
|
7
|
+
data.tar.gz: 26276355e26a180f751ecfb895e66ef7f511ce9f610daddf08ebd90645d12da728f714d720de93930a16a7a76bbd8caac28fc6da85684a319563997d2d4b31ba
|
data/bin/check_dependencies
CHANGED
|
@@ -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,38 +259,38 @@ 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
|
|
|
279
287
|
# 检查差异并决定退出状态
|
|
280
288
|
if only_in_old.empty? && only_in_new.empty?
|
|
281
|
-
puts "
|
|
282
|
-
exit 0
|
|
289
|
+
puts "No differences!"
|
|
283
290
|
else
|
|
284
|
-
puts "
|
|
291
|
+
puts "Differences exist:"
|
|
285
292
|
only_in_old.each { |dep| puts "#{red('-')} #{dep}" }
|
|
286
293
|
only_in_new.each { |dep| puts "#{green('+')} #{dep}" }
|
|
287
|
-
exit 1
|
|
288
294
|
end
|
|
289
295
|
end
|
|
290
296
|
|
|
Binary file
|
|
Binary file
|
data/check_dependencies.gemspec
CHANGED
data/lib/check_dependencies.rb
CHANGED
|
@@ -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,38 +259,38 @@ 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
|
|
|
279
287
|
# 检查差异并决定退出状态
|
|
280
288
|
if only_in_old.empty? && only_in_new.empty?
|
|
281
|
-
puts "
|
|
282
|
-
exit 0
|
|
289
|
+
puts "No differences!"
|
|
283
290
|
else
|
|
284
|
-
puts "
|
|
291
|
+
puts "Differences exist:"
|
|
285
292
|
only_in_old.each { |dep| puts "#{red('-')} #{dep}" }
|
|
286
293
|
only_in_new.each { |dep| puts "#{green('+')} #{dep}" }
|
|
287
|
-
exit 1
|
|
288
294
|
end
|
|
289
295
|
end
|
|
290
296
|
|
data/note.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# 主标题
|
|
2
|
+
|
|
3
|
+
这是一个简介段落,这里介绍文档的主要内容或目的。
|
|
4
|
+
|
|
5
|
+
## 副标题
|
|
6
|
+
|
|
7
|
+
这里是更详细的信息或部分内容的开始。
|
|
8
|
+
|
|
9
|
+
### 小标题
|
|
10
|
+
|
|
11
|
+
- **加粗文本**:强调重要性。
|
|
12
|
+
- *斜体文本*:用于强调或区别。
|
|
13
|
+
- `代码`:用于表示代码或命令。
|
|
14
|
+
|
|
15
|
+
#### 列表
|
|
16
|
+
|
|
17
|
+
- 无序列表项 1
|
|
18
|
+
- 无序列表项 2
|
|
19
|
+
- 子列表项 a
|
|
20
|
+
- 子列表项 b
|
|
21
|
+
|
|
22
|
+
1. 有序列表项 1
|
|
23
|
+
2. 有序列表项 2
|
|
24
|
+
1. 子列表项 a
|
|
25
|
+
2. 子列表项 b
|
|
26
|
+
|
|
27
|
+
#### 链接和图片
|
|
28
|
+
|
|
29
|
+
这是一个[链接示例](http://example.com)。
|
|
30
|
+
|
|
31
|
+
这是一个图片示例:
|
|
32
|
+
|
|
33
|
+
#### 引用
|
|
34
|
+
|
|
35
|
+
> 这是一段引用文本,你可以在这里引用其他人的话或者文档中的一部分内容。
|
|
36
|
+
|
|
37
|
+
#### 代码块
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
# 这是一个 Python 代码块
|
|
41
|
+
def hello_world():
|
|
42
|
+
print("Hello, Markdown!")
|
|
43
|
+
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ITxiansheng
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-04-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -57,10 +57,13 @@ files:
|
|
|
57
57
|
- bin/check_dependencies
|
|
58
58
|
- bin/console
|
|
59
59
|
- bin/setup
|
|
60
|
+
- check_dependencies-0.1.7.gem
|
|
61
|
+
- check_dependencies-0.1.8.gem
|
|
60
62
|
- check_dependencies.gemspec
|
|
61
63
|
- gem_env_install.sh
|
|
62
64
|
- lib/check_dependencies.rb
|
|
63
65
|
- lib/check_dependencies/version.rb
|
|
66
|
+
- note.md
|
|
64
67
|
- sig/check_dependencies.rbs
|
|
65
68
|
homepage: https://github.com/ITxiansheng/check_dependencies
|
|
66
69
|
licenses:
|