cocoapods-bb-PodAssistant 0.3.14.8 → 0.3.15.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db7710e35da66ac01ef6576481808717436a834db8b94ec3ddcbd2934d1edbd2
4
- data.tar.gz: f3848abd2fb18073298950ec83c243918eeddd910c7f4af3e02f1a6178ed5f95
3
+ metadata.gz: b4d6a536ded17c7b3899449e80bae4028f209802a8bd88a4e1b2aa1af558428f
4
+ data.tar.gz: 743d3ca02035aed8fb60e8fbfb1e552dad7e4fb0404b0bd413037776299d9b90
5
5
  SHA512:
6
- metadata.gz: 609bae8ace3a8bf8abd992e729f6bf8780f19e0afe8299da94ae7641474794841012d30d7fbdd3582ece21584ef0c857e77f89fba0b09d788b223f8f6631aec1
7
- data.tar.gz: 45dbae620e5d155b09d446393f664018ebb6fc2051882e636dac5171197f1c1d4f0f92dbdfa6c363e7f301905dfcd45fa36ed851b69d65006fba917c73a36ac2
6
+ metadata.gz: 63872fbb2c6043ce1c62126bf8be143fc957e101fbc81c3362cfd2c09ab4a05e5f0cdacf9e104907e086c61debd97de11be0cd20affd0873704aeb7efecab419
7
+ data.tar.gz: e8bf9cd6e6cee3d0c1ebed3558ba5d7a75407b837798bd65746c7db79072e4e284ffd71503e11f7be0582dc39a991ba51b8f8ebcc392cd8b62ac193492fc98c0
@@ -1,3 +1,3 @@
1
1
  module CocoapodsBbPodassistant
2
- VERSION = "0.3.14.8"
2
+ VERSION = "0.3.15.0"
3
3
  end
@@ -106,7 +106,7 @@ module BB
106
106
  # 合并stable和podfile 中的specs! ⚠️podfile 中的组件会覆盖stable 中的!
107
107
  # 比如stable 中AFNetworking 指向标签1.1,而 podfile中AFNetworking 指向develop,那么最终AFNetworking 会指向develop
108
108
  def load_stable_specs_to_podfile(podfile_specs, ignore_local_stable = false)
109
- puts "[PodAssistant] start process pod module...".yellow
109
+ puts "[PodAssistant] start process pod module..."
110
110
  local_stable_data = @source_manager.fetch_local_stable_datas # 本地stable配置
111
111
  if (local_stable_data.is_a? Hash) && !local_stable_data.empty?
112
112
  return merge_module_data(podfile_specs, local_stable_data)
@@ -231,7 +231,7 @@ module BB
231
231
  end
232
232
  if (branch && !branch.empty?) || (git && !git.empty?)
233
233
  # 项目配置指向分支数据,以本项目为主
234
- puts "[PodAssistant] #{podName} 指向分支数据 => #{podfile_pod}"
234
+ puts "[PodAssistant] #{podName} 指向分支数据 => #{podfile_pod}".yellow
235
235
  stable_hash[podCoreName] = podfile_pod
236
236
  if podName != podCoreName
237
237
  need_update_pod_data[podName] = podfile_pod
@@ -246,7 +246,7 @@ module BB
246
246
  is_fuzzy_version = version.include?('~>') ? true : false # 固定版本 pod 'A','~> x.x.x'
247
247
  is_fuzzy_versionV2 = (!is_fixed_version && !is_lessthan_version && !is_greaterthan_version && !is_fuzzy_version) ? true : false # 固定版本 pod 'A','x.x.x'
248
248
  if (is_fixed_version == true) || (is_lessthan_version == true) || (is_fuzzy_versionV2 == true)
249
- puts "[PodAssistant] ⚠️ 限制组件版本 '#{podName}', '#{version}' 以项目配置为主. (最新版本=> #{pod.send(:red)})"
249
+ puts "[PodAssistant] ⚠️ 限制组件版本 '#{podName}', '#{version}' 以项目配置为主. (最新版本=> #{pod.send(:red)})".yellow
250
250
  stable_hash[podCoreName] = version
251
251
  if podName != podCoreName
252
252
  need_update_pod_data[podName] = version
@@ -88,7 +88,7 @@ module BB
88
88
  project_dir = File.dirname(getXcodeprojPath)
89
89
  plist_path = File.expand_path(plist_rel, project_dir)
90
90
  if File.exist?(plist_path)
91
- puts "Info.plist(主Target): #{plist_path}".yellow
91
+ # puts "Info.plist(主Target): #{plist_path}".yellow
92
92
  return plist_path
93
93
  end
94
94
  end
@@ -120,7 +120,7 @@ module BB
120
120
  return info_path
121
121
  end
122
122
 
123
- puts "无法找到工程Info.plist配置文件,工程目录:#{getProjectPath} @hm确认".red
123
+ # puts "无法找到工程Info.plist配置文件,工程目录:#{getProjectPath} @hm确认".red
124
124
  return nil
125
125
  end
126
126
  # 获取info配置key对应的值
@@ -81,6 +81,75 @@ module BB
81
81
  # 获取时间差
82
82
  time = $podEndTime - $podStartTime
83
83
  puts "[PodAssistant] pod操作总耗时【#{time.to_s.send(:red)}秒】start:#{$podStartTime} end:#{$podEndTime}".green
84
+ # # podfile配置插件进行关键字扫描,参照
85
+ # plugin 'cocoapods-bb-PodAssistant',
86
+ # :scan_enable => true, # 是否需要开启,建议不用每次扫描,需要打开
87
+ # :scan_scope => 'all', # all / source / pod,对应全部/源码/Pods库
88
+ # :scan_keywords => ['SimulateIDFA', 'OpenUDID'], # 扫描关键字
89
+ # :scan_ignore => ['MGTVSDK'] # 过滤关键字
90
+ # 关键字扫描
91
+ podfile = if installer.respond_to?(:podfile)
92
+ installer.podfile
93
+ elsif installer.respond_to?(:installer) && installer.installer.respond_to?(:podfile)
94
+ installer.installer.podfile
95
+ else
96
+ Pod::Config.instance.podfile
97
+ end
98
+ plugins = podfile&.plugins || {}
99
+ config = (plugins['cocoapods-bb-PodAssistant'] || {}).transform_keys(&:to_sym)
100
+ scan_enable = config[:scan_enable] || false # 是否开启扫描
101
+ scan_scope = config[:scan_scope] || 'source' # all / source / pod
102
+ keywords = config[:scan_keywords] || ["SimulateIDFA", "OpenUDID"] # 扫描关键字
103
+ ignore_list = config[:scan_ignore] || [""] # 忽略列表
104
+ scan_enable ||= ENV['POD_SCAN_ENABLE'] == '1' # 支持环境配置 ENV['POD_SCAN_ENABLE'] = '1'
105
+ # puts "scan_enable:#{scan_enable}"
106
+ # puts "scan_scope:#{scan_scope}"
107
+ # puts "keywords:#{keywords}"
108
+ # puts "ignore_list:#{ignore_list}"
109
+ if scan_enable
110
+ puts "config:#{plugins}"
111
+ puts "[PodAssistant] 开始关键字扫描...".yellow
112
+ project_root = Dir.pwd
113
+ pods_path = installer.sandbox_root.to_s
114
+ scan_keys = keywords.map { |k| Regexp.escape(k) }.join('|')
115
+ ignore_list = (ignore_list || []).reject(&:empty?)
116
+ case scan_scope
117
+ when 'all'
118
+ puts "开始扫描全部内容"
119
+ search_path = project_root
120
+ include_ext = ""
121
+ when 'source'
122
+ puts "开始扫描源码内容"
123
+ search_path = project_root
124
+ include_ext = "--include=*.{h,m,mm,swift,cpp,c}"
125
+ when 'pod'
126
+ puts "开始扫描Pods内容"
127
+ search_path = pods_path
128
+ include_ext = "--include=*.{h,m,mm,swift,cpp,c}"
129
+ else
130
+ search_path = project_root
131
+ end
132
+ grep_cmd = %Q(grep -lr -E "#{scan_keys}" #{search_path} #{include_ext})
133
+ puts "扫描指令 % #{grep_cmd}".yellow
134
+ result = `#{grep_cmd}`
135
+ if result && !result.strip.empty?
136
+ puts "ignore_list:#{ignore_list}".yellow
137
+ filtered = result.lines.reject do |line|
138
+ ignore_list.any? { |i| line.include?(i) }
139
+ end
140
+ if filtered.any?
141
+ puts "[PodAssistant][ ⚠️ 风险] 检测到敏感字段:".red
142
+ puts "#{filtered}".yellow
143
+ abort("[PodAssistant] 检测到违规关键字,请处理后再提交".red)
144
+ else
145
+ puts "[PodAssistant] 未检测到敏感字段".green
146
+ end
147
+ else
148
+ puts "[PodAssistant] 未检测到敏感字段".green
149
+ end
150
+ else
151
+ puts "[PodAssistant] 关键字扫描未开启".yellow
152
+ end
84
153
  rescue => exception
85
154
  # 如果没有下载则#{Dir.home}/.AllPodsTimeAndSize.csv文件不会生成,产生异常
86
155
  puts "[PodAssistant] post_install error(已捕获): #{exception}".red
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-bb-PodAssistant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.14.8
4
+ version: 0.3.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - humin