cocoapods-bb-PodAssistant 0.3.10.1 → 0.3.11.0
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/cocoapods-bb-PodAssistant/config/data_config.rb +46 -4
- data/lib/cocoapods-bb-PodAssistant/config/json_parser.rb +53 -0
- data/lib/cocoapods-bb-PodAssistant/config/source_manager.rb +16 -0
- data/lib/cocoapods-bb-PodAssistant/gem_version.rb +1 -1
- data/lib/cocoapods-bb-PodAssistant/helpers/pod_module_helper.rb +17 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c64174155b43b25df889bb156ee02467411ce11c89cf2ddb2e9471f8aa675fe2
|
4
|
+
data.tar.gz: fcd75f2accb25d16a75ed2ea6d91fbbc2683632a528048b3a73c1aec8e94cb39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d15a10db7b21dae333ff26d0358633ab7bf92032c44188857d9c4db6adc358602fc5a32a82a5158809f3033ee2a75c8a0c3356de28f1e1666f77eac747e14fa
|
7
|
+
data.tar.gz: 7be09e5bf0ad8a9a2489699a4c3be1c1009aaf0bf807fa30acc67f07e0b2fc4105ea2b3b03cac5e76e7caf3cc8b65ceca77d0a26a28499f04d322c599fc07a07
|
@@ -1,19 +1,61 @@
|
|
1
|
+
require 'cocoapods-bb-PodAssistant/config/json_parser'
|
2
|
+
|
1
3
|
module BB
|
2
4
|
class DataConfig
|
3
5
|
def self.config
|
4
6
|
@config ||= DataConfig.new
|
5
7
|
end
|
6
8
|
|
9
|
+
def initialize()
|
10
|
+
file_path = customConfigPath
|
11
|
+
if file_exists?(customConfigPath)
|
12
|
+
puts "开始解析打包机自定义配置 json:#{file_path}".yellow
|
13
|
+
json_parser = BB::JsonParser.new(file_path)
|
14
|
+
@json_data = json_parser.get_json_data
|
15
|
+
puts "json数据:#{@json_data}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
#与打包机约定自定义配置文件
|
20
|
+
def customConfigPath
|
21
|
+
return "#{Dir.pwd}/bbCustomConfig.json" # 存放工程目录下
|
22
|
+
end
|
23
|
+
|
24
|
+
# 提供给业务方的获取 JSON 数据方法
|
25
|
+
def get_custom_json_data
|
26
|
+
return {} unless @json_data
|
27
|
+
@json_data
|
28
|
+
end
|
29
|
+
|
30
|
+
# 检查文件是否存在
|
31
|
+
def file_exists?(file_path)
|
32
|
+
File.exist?(file_path)
|
33
|
+
end
|
34
|
+
|
7
35
|
# 需要过滤忽略组件
|
8
36
|
def ignore_dependencies_pod_names
|
9
|
-
puts "<===获取业务方配置过滤组件数据:#{@ignore_pods_list}".yellow
|
37
|
+
puts "<===获取业务方配置过滤组件数据:#{@ignore_pods_list} 打包机自定义配置数据:#{@json_data}".yellow
|
10
38
|
return @ignore_pods_list
|
11
39
|
end
|
12
|
-
|
40
|
+
|
13
41
|
# 配置过滤忽略组件
|
14
42
|
def set_ignore_dependencies_pod_names(pods=[])
|
15
|
-
|
16
|
-
|
43
|
+
@ignore_pods_list = pods
|
44
|
+
# puts "==>业务方配置需要过滤组件数据:#{pods} cls:#{pods.class}".yellow
|
45
|
+
# json_data = get_custom_json_data
|
46
|
+
# if json_data.nil? || json_data.empty?
|
47
|
+
# @ignore_pods_list = pods
|
48
|
+
# else
|
49
|
+
# whitelist_pods=[]
|
50
|
+
# pods.each do |pod_name|
|
51
|
+
# data = json_data[pod_name]
|
52
|
+
# if data.nil? || data.empty?
|
53
|
+
# whitelist_pods.push(pod_name)
|
54
|
+
# end
|
55
|
+
# end
|
56
|
+
# puts "==>修正后需要过滤组件数据:#{whitelist_pods} cls:#{whitelist_pods.class}".green
|
57
|
+
# @ignore_pods_list = whitelist_pods
|
58
|
+
# end
|
17
59
|
end
|
18
60
|
end
|
19
61
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module BB
|
4
|
+
class JsonParser
|
5
|
+
attr_reader :json_data
|
6
|
+
|
7
|
+
# 初始化,读取并解析 JSON 文件
|
8
|
+
def initialize(file_path)
|
9
|
+
@file_path = file_path
|
10
|
+
@json_data = read_json
|
11
|
+
end
|
12
|
+
|
13
|
+
# 读取并解析 JSON 文件
|
14
|
+
def read_json
|
15
|
+
begin
|
16
|
+
file_content = File.read(@file_path)
|
17
|
+
JSON.parse(file_content)
|
18
|
+
rescue Errno::ENOENT
|
19
|
+
puts "错误:找不到文件 #{@file_path}"
|
20
|
+
nil
|
21
|
+
rescue JSON::ParserError
|
22
|
+
puts "错误:JSON 解析失败,请检查文件格式"
|
23
|
+
nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# 遍历 JSON 并返回 key-value 结构
|
28
|
+
def traverse_json(data = @json_data, prefix = "", result = {})
|
29
|
+
return result unless data
|
30
|
+
|
31
|
+
case data
|
32
|
+
when Hash
|
33
|
+
data.each do |key, value|
|
34
|
+
traverse_json(value, "#{prefix}#{key}.", result)
|
35
|
+
end
|
36
|
+
when Array
|
37
|
+
data.each_with_index do |value, index|
|
38
|
+
traverse_json(value, "#{prefix}[#{index}].", result)
|
39
|
+
end
|
40
|
+
else
|
41
|
+
result[prefix.chomp('.')] = data
|
42
|
+
end
|
43
|
+
|
44
|
+
result
|
45
|
+
end
|
46
|
+
|
47
|
+
# 提供给业务方的获取 JSON 数据方法
|
48
|
+
def get_json_data
|
49
|
+
return {} unless @json_data
|
50
|
+
traverse_json
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -576,6 +576,22 @@ module BB
|
|
576
576
|
return (has_include_subspec(podName) && podName.include?("#{podCoreName}/"))
|
577
577
|
end
|
578
578
|
|
579
|
+
# 更新自定义pod组件数据
|
580
|
+
def update_custom_podmodules(json_data)
|
581
|
+
if json_data.nil? || json_data.empty?
|
582
|
+
puts ""
|
583
|
+
else
|
584
|
+
puts "动态更新本地组件:#{json_data}".yellow
|
585
|
+
if json_data.is_a?(Hash)
|
586
|
+
local_stable_data = fetch_local_stable_datas # 本地stable配置
|
587
|
+
json_data.each do |key, value|
|
588
|
+
local_stable_data[key] = value
|
589
|
+
end
|
590
|
+
puts "[PodAssistant] 更新本地stable数据".yellow
|
591
|
+
update_localstable_datas(local_stable_data)
|
592
|
+
end
|
593
|
+
end
|
594
|
+
end
|
579
595
|
# 更新单个pod组件
|
580
596
|
def update_podmodules(pod_lists)
|
581
597
|
local_stable_data = fetch_local_stable_datas # 本地stable配置
|
@@ -24,7 +24,10 @@ module BB
|
|
24
24
|
# ignore_dependencies_pod_names 过滤组件,不受stable版本控制
|
25
25
|
def initialize(all_modules, member_modules = {}, member_configs = [], ignore_local_stable = false, skip_stable_check = false, ignore_dependencies_pod_names=[])
|
26
26
|
@source_manager = BB::SourceManager.new()
|
27
|
-
BB::DataConfig.config
|
27
|
+
config = BB::DataConfig.config
|
28
|
+
config.set_ignore_dependencies_pod_names(ignore_dependencies_pod_names)
|
29
|
+
# # 打包机支持自定义配置,解决开发环境组件动态更新问题
|
30
|
+
# @source_manager.update_custom_podmodules(config.get_custom_json_data)
|
28
31
|
#加载远程稳定仓库 和本地podfile 指定的仓库进行合并
|
29
32
|
if skip_stable_check == true
|
30
33
|
# 过滤带:remove数据
|
@@ -314,6 +317,19 @@ module BB
|
|
314
317
|
else
|
315
318
|
puts "[PodAssistant] 本地stable数据无变化<===完成".yellow
|
316
319
|
end
|
320
|
+
config = BB::DataConfig.config
|
321
|
+
json_data = config.get_custom_json_data
|
322
|
+
if json_data.nil? || json_data.empty?
|
323
|
+
puts ""
|
324
|
+
else
|
325
|
+
puts "打包后台配置更新自定义组件配置数据:#{json_data}".yellow
|
326
|
+
if json_data.is_a?(Hash)
|
327
|
+
json_data.each do |key, value|
|
328
|
+
stable_hash[key] = value
|
329
|
+
puts "=====动态更新组件-#{key}:#{value} 替换版本完成====="
|
330
|
+
end
|
331
|
+
end
|
332
|
+
end
|
317
333
|
# puts "[PodAssistant] stable_hash:#{stable_hash}".red
|
318
334
|
stable_specs = []
|
319
335
|
stable_hash.each do |name,pod|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-bb-PodAssistant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- humin
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-02-
|
10
|
+
date: 2025-02-19 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: cocoapods-core
|
@@ -169,6 +169,7 @@ files:
|
|
169
169
|
- lib/cocoapods-bb-PodAssistant/command/stable/update.rb
|
170
170
|
- lib/cocoapods-bb-PodAssistant/config/cache_path.rb
|
171
171
|
- lib/cocoapods-bb-PodAssistant/config/data_config.rb
|
172
|
+
- lib/cocoapods-bb-PodAssistant/config/json_parser.rb
|
172
173
|
- lib/cocoapods-bb-PodAssistant/config/source_manager.rb
|
173
174
|
- lib/cocoapods-bb-PodAssistant/config/stable_source.rb
|
174
175
|
- lib/cocoapods-bb-PodAssistant/config/stable_specs.rb
|