cocoapods-bb-PodAssistant 0.1.5.1 → 0.1.7
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/command/stable/init.rb +37 -0
- data/lib/cocoapods-bb-PodAssistant/command/stable/install.rb +38 -0
- data/lib/cocoapods-bb-PodAssistant/command/stable/sync.rb +57 -0
- data/lib/cocoapods-bb-PodAssistant/command/stable/update.rb +50 -0
- data/lib/cocoapods-bb-PodAssistant/command/stable.rb +51 -0
- data/lib/cocoapods-bb-PodAssistant/command.rb +6 -7
- data/lib/cocoapods-bb-PodAssistant/config/source_manager.rb +26 -32
- data/lib/cocoapods-bb-PodAssistant/gem_version.rb +1 -1
- data/lib/cocoapods-bb-PodAssistant/helpers/git_cmd_helper.rb +5 -1
- data/lib/cocoapods-bb-PodAssistant/helpers/pod_module_helper.rb +103 -41
- data/lib/cocoapods-bb-PodAssistant/helpers/stable_env_helper.rb +59 -16
- data/lib/cocoapods-bb-PodAssistant/podfile.rb +16 -4
- data/lib/cocoapods-bb-PodAssistant/source_provider_hook.rb +5 -1
- metadata +12 -9
- data/lib/cocoapods-bb-PodAssistant/command/PodAssistant.rb +0 -44
- data/lib/cocoapods-bb-PodAssistant/command/stable/stable.rb +0 -168
- /data/lib/cocoapods-bb-PodAssistant/{command → babybus}/linkline/target-linkline.rb +0 -0
- /data/lib/cocoapods-bb-PodAssistant/{command → babybus}/linkline/targetValidator-linkline.rb +0 -0
- /data/lib/cocoapods-bb-PodAssistant/{command → babybus}/linkline/targetdefinition-linkline.rb +0 -0
- /data/lib/cocoapods-bb-PodAssistant/{command → babybus}/stable/podfile-linkline.rb +0 -0
- /data/lib/cocoapods-bb-PodAssistant/command/{linkline/linkline.rb → linkline.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a9981c561f8eb760349f20d77d0afd544602a810472cb9f8ecd02d6e2779664
|
4
|
+
data.tar.gz: da2528d18dfe9a93eafd8c18de120ba5212663c845bce0473f3c5fbbb056a8ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8adc406969d02c2cb60393ff1afbba8a3e909acee63b85643183e72e58e3f087b156022037059a90a2ebe348c1ec832720ff7d5b66a637c42cc64ab0ff9925e8
|
7
|
+
data.tar.gz: a02261b3e1006d4d8164646843bc02414442ede74086dc763b66a41fe560610730797fc167f1662e4229f96d84cb867ab664c6f209fe5160108b06b63d56eea8
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'cocoapods-bb-PodAssistant/config/source_manager'
|
2
|
+
require 'cocoapods-bb-PodAssistant/helpers/stable_env_helper'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
class Stable < Command
|
7
|
+
class Init < Stable
|
8
|
+
|
9
|
+
self.summary = '[初始化项目yml配置] Generate a Stable yml config file from a Podfile.lock'
|
10
|
+
|
11
|
+
self.description = <<-DESC
|
12
|
+
通过项目`Podfile.lock`文件,生成`stable_specs_lock.yml`配置文件
|
13
|
+
DESC
|
14
|
+
|
15
|
+
def initialize(argv)
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
# verify_podfile_exists!
|
21
|
+
env = BB::StableEnv.new()
|
22
|
+
if env.verify_stable_env_exists == true
|
23
|
+
env.system_clone_stable_git # 自动拉取远端git仓库数据
|
24
|
+
source_manager = BB::SourceManager.new()
|
25
|
+
puts "[PodAssistant] 开始配置生成当前项目yml文件".yellow
|
26
|
+
# 生成本地yml配置
|
27
|
+
source_manager.generate_localStable
|
28
|
+
puts "[PodAssistant] `pod stable init` complete!".green
|
29
|
+
else
|
30
|
+
puts "[PodAssistant] ❌工程没有配置stable环境".red
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'cocoapods-bb-PodAssistant/config/source_manager'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Stable < Command
|
6
|
+
class Install < Stable
|
7
|
+
self.summary = '[命令同执行`pod install操作`] Install project dependencies according to versions from a Podfile.lock'
|
8
|
+
|
9
|
+
self.description = <<-DESC
|
10
|
+
Downloads all dependencies defined in `Podfile` and creates an Xcode
|
11
|
+
Pods library project in `./Pods`.
|
12
|
+
|
13
|
+
The Xcode project file should be specified in your `Podfile` like this:
|
14
|
+
|
15
|
+
project 'path/to/XcodeProject.xcodeproj'
|
16
|
+
|
17
|
+
If no project is specified, then a search for an Xcode project will
|
18
|
+
be made. If more than one Xcode project is found, the command will
|
19
|
+
raise an error.
|
20
|
+
|
21
|
+
This will configure the project to reference the Pods static library,
|
22
|
+
add a build configuration file, and add a post build script to copy
|
23
|
+
Pod resources.
|
24
|
+
|
25
|
+
This may return one of several error codes if it encounters problems.
|
26
|
+
* `1` Generic error code
|
27
|
+
* `31` Spec not found (i.e out-of-date source repos, mistyped Pod name etc...)
|
28
|
+
DESC
|
29
|
+
|
30
|
+
def run
|
31
|
+
puts "[PodAssistant] 开始执行 $ pod stable install".yellow
|
32
|
+
system "pod install"
|
33
|
+
puts "[PodAssistant] `pod stable install` complete!".green
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'cocoapods-bb-PodAssistant/config/source_manager'
|
2
|
+
require 'cocoapods-bb-PodAssistant/helpers/git_cmd_helper'
|
3
|
+
require 'cocoapods-bb-PodAssistant/helpers/stable_env_helper'
|
4
|
+
require 'cocoapods'
|
5
|
+
|
6
|
+
module Pod
|
7
|
+
class Command
|
8
|
+
class Stable < Command
|
9
|
+
class Sync < Stable
|
10
|
+
require 'fileutils'
|
11
|
+
require 'cocoapods/executable.rb'
|
12
|
+
extend Executable
|
13
|
+
executable :git
|
14
|
+
|
15
|
+
self.summary = '[同步远端yml配置] sync a Stable yml config file'
|
16
|
+
|
17
|
+
self.description = <<-DESC
|
18
|
+
同步远端stable yml配置文件,并对本地文件进行合并操作
|
19
|
+
DESC
|
20
|
+
|
21
|
+
def initialize(argv)
|
22
|
+
super
|
23
|
+
end
|
24
|
+
|
25
|
+
def run
|
26
|
+
puts "开始合并远端stable yml数据".yellow
|
27
|
+
# 数据合并
|
28
|
+
source_manager = BB::SourceManager.new()
|
29
|
+
fetch_stale_git
|
30
|
+
source_manager.merge_stable_data
|
31
|
+
puts "[PodAssistant] `pod stable sync` complete! Please execute the [pod install/ pod update] command".green
|
32
|
+
end
|
33
|
+
|
34
|
+
# 拉取stable仓库代码 ruby脚本内部调用
|
35
|
+
def clone_stable_git
|
36
|
+
cache = BB::Cache.new()
|
37
|
+
cachePath = cache.cachePath
|
38
|
+
configGitPath(cachePath)
|
39
|
+
unless Dir.exist?(File.join(cachePath))
|
40
|
+
clonePath = File.dirname(cachePath)
|
41
|
+
FileUtils.mkdir_p clonePath
|
42
|
+
git_clone(@stable_source,clonePath)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def fetch_stale_git
|
47
|
+
clone_stable_git
|
48
|
+
# git操作
|
49
|
+
git_reset
|
50
|
+
git_fetch
|
51
|
+
git_checkout_and_pull(@stable_source, @stable_branch, @stable_tag)
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'cocoapods-bb-PodAssistant/config/source_manager'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Stable < Command
|
6
|
+
class Update < Stable
|
7
|
+
self.summary = '[命令同执行`pod update操作`] Update outdated project dependencies and create new ' \
|
8
|
+
'Podfile.lock'
|
9
|
+
|
10
|
+
self.description = <<-DESC
|
11
|
+
Updates the Pods identified by the specified `POD_NAMES`, which is a
|
12
|
+
space-delimited list of pod names. If no `POD_NAMES` are specified, it
|
13
|
+
updates all the Pods, ignoring the contents of the Podfile.lock. This
|
14
|
+
command is reserved for the update of dependencies; pod install should
|
15
|
+
be used to install changes to the Podfile.
|
16
|
+
DESC
|
17
|
+
|
18
|
+
self.arguments = [
|
19
|
+
CLAide::Argument.new('POD_NAMES', false, true),
|
20
|
+
]
|
21
|
+
|
22
|
+
def self.options
|
23
|
+
[
|
24
|
+
# ['--business-spec=specName', '业务线公共stable spec名称'],
|
25
|
+
].concat(super)
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(argv)
|
29
|
+
@pods = argv.arguments!
|
30
|
+
super
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def run
|
35
|
+
puts "[PodAssistant] 开始执行 $ pod stable update".yellow
|
36
|
+
# verify_podfile_exists! # 系统提供api验证podfile是否ok
|
37
|
+
if @pods.any?
|
38
|
+
pods_str = @pods.join(" ")
|
39
|
+
system "pod update #{pods_str}"
|
40
|
+
else
|
41
|
+
system "pod update"
|
42
|
+
end
|
43
|
+
source_manager = BB::SourceManager.new()
|
44
|
+
source_manager.update_local_stable_from_podmodules(@pods)
|
45
|
+
puts "[PodAssistant] `pod stable update` complete!".green
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'cocoapods-bb-PodAssistant/config/source_manager'
|
2
|
+
require 'cocoapods-bb-PodAssistant/config/cache_path'
|
3
|
+
require 'cocoapods-bb-PodAssistant/helpers'
|
4
|
+
|
5
|
+
require 'cocoapods-bb-PodAssistant/command/stable/init'
|
6
|
+
require 'cocoapods-bb-PodAssistant/command/stable/install'
|
7
|
+
require 'cocoapods-bb-PodAssistant/command/stable/update'
|
8
|
+
require 'cocoapods-bb-PodAssistant/command/stable/sync'
|
9
|
+
|
10
|
+
module Pod
|
11
|
+
|
12
|
+
# class StableOptions
|
13
|
+
# # define business specs,defalut is stable_specs
|
14
|
+
# option :business_specs, "stable_specs"
|
15
|
+
|
16
|
+
# # define custom lockSpecs tag
|
17
|
+
# option :tag, ""
|
18
|
+
|
19
|
+
# # define custom lockSpecs branch
|
20
|
+
# option :branch, ""
|
21
|
+
# end
|
22
|
+
|
23
|
+
class Command
|
24
|
+
class Stable < Command
|
25
|
+
self.abstract_command = true
|
26
|
+
|
27
|
+
self.summary = '拉取稳定Podfile.lock配置'
|
28
|
+
self.description = <<-DESC
|
29
|
+
拉取稳定lock配置插件。利用版本比对进行更新配置实现对组件版本控制管理。
|
30
|
+
DESC
|
31
|
+
|
32
|
+
self.default_subcommand = 'init'
|
33
|
+
|
34
|
+
#-----------------------------------------------------------------------#
|
35
|
+
|
36
|
+
extend Executable
|
37
|
+
executable :git
|
38
|
+
|
39
|
+
def validate!
|
40
|
+
super
|
41
|
+
banner! if @help
|
42
|
+
end
|
43
|
+
|
44
|
+
def run
|
45
|
+
puts "[PodAssistant] `pod stable` 帮助文档请查看�".yellow
|
46
|
+
# banner!
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,9 +1,8 @@
|
|
1
|
-
require 'cocoapods-bb-PodAssistant/command/PodAssistant'
|
2
1
|
#stable
|
3
|
-
require 'cocoapods-bb-PodAssistant/command/stable
|
4
|
-
require 'cocoapods-bb-PodAssistant/
|
2
|
+
require 'cocoapods-bb-PodAssistant/command/stable'
|
3
|
+
require 'cocoapods-bb-PodAssistant/babybus/stable/podfile-linkline'
|
5
4
|
#linkline
|
6
|
-
require 'cocoapods-bb-PodAssistant/command/linkline
|
7
|
-
require 'cocoapods-bb-PodAssistant/
|
8
|
-
require 'cocoapods-bb-PodAssistant/
|
9
|
-
require 'cocoapods-bb-PodAssistant/
|
5
|
+
require 'cocoapods-bb-PodAssistant/command/linkline'
|
6
|
+
require 'cocoapods-bb-PodAssistant/babybus/linkline/target-linkline'
|
7
|
+
require 'cocoapods-bb-PodAssistant/babybus/linkline/targetdefinition-linkline'
|
8
|
+
require 'cocoapods-bb-PodAssistant/babybus/linkline/targetValidator-linkline'
|
@@ -2,12 +2,14 @@ require 'cocoapods-bb-PodAssistant/helpers'
|
|
2
2
|
require 'cocoapods-bb-PodAssistant/config/stable_specs'
|
3
3
|
require 'cocoapods-bb-PodAssistant/helpers/stable_manager_helper'
|
4
4
|
require 'cocoapods-core'
|
5
|
+
require 'cocoapods-bb-PodAssistant/helpers/stable_env_helper'
|
5
6
|
|
6
7
|
# 数据源管理
|
7
8
|
module BB
|
8
9
|
class SourceManager
|
9
|
-
def initialize(
|
10
|
-
|
10
|
+
def initialize()
|
11
|
+
env = BB::StableEnv.new()
|
12
|
+
@businessSpecName = env.business_stable
|
11
13
|
@stableMgr = BB::StableManager.new()
|
12
14
|
end
|
13
15
|
|
@@ -29,7 +31,12 @@ module BB
|
|
29
31
|
# 产品线本地lock数据
|
30
32
|
def fetch_local_stable_datas
|
31
33
|
localSpec = BB::StableSpecs.new()
|
32
|
-
|
34
|
+
yml = local_stable_yaml
|
35
|
+
if !File.file?(yml)
|
36
|
+
puts "yml配置文件不存在,执行自动初始化项目yml配置文件".green
|
37
|
+
generate_localStable
|
38
|
+
end
|
39
|
+
return localSpec.readData(yml)
|
33
40
|
end
|
34
41
|
|
35
42
|
# 远端公共lock数据
|
@@ -231,51 +238,38 @@ module BB
|
|
231
238
|
return lockfile
|
232
239
|
end
|
233
240
|
|
241
|
+
# 生成项目stable配置文件
|
242
|
+
# 策略:根据podfile.lock dependencies依赖记录pod core标签/分支数据,不存储subspec数据
|
234
243
|
def generate_localStable
|
235
244
|
lockfile = podfile_lock
|
236
245
|
local_specs = {}
|
237
|
-
# step.1 获取分支指向信息
|
238
246
|
dependencies = lockfile.dependencies
|
239
247
|
dependencies.each do | dependency |
|
248
|
+
pod_name = dependency.name
|
249
|
+
if has_include_subspec(pod_name)
|
250
|
+
podCoreName = subspec_podname(pod_name)
|
251
|
+
else
|
252
|
+
podCoreName = pod_name
|
253
|
+
end
|
240
254
|
if dependency.external_source.is_a? Hash
|
241
|
-
|
255
|
+
# 指向分支
|
242
256
|
external_source = dependency.external_source
|
243
|
-
podCoreName = subspec_podname(name)
|
244
257
|
# checkout_options = lockfile.checkout_options_for_pod_named(podCoreName)
|
245
258
|
# if checkout_options.is_a? Hash
|
246
259
|
# commit = checkout_options[:commit]
|
247
260
|
# external_source[:commit] = commit
|
248
261
|
# puts "name:#{podCoreName} checkout_options:#{checkout_options} commit:#{commit}"
|
249
262
|
# end
|
250
|
-
if podCoreName
|
251
|
-
# local_specs.delete(podCoreName)
|
263
|
+
if !local_specs.has_key?(podCoreName)
|
252
264
|
local_specs[podCoreName] = external_source
|
253
|
-
|
254
|
-
local_specs[name] = external_source
|
255
|
-
Pod::UI.puts "[分支] #{name} => (#{external_source})"
|
256
|
-
end
|
257
|
-
else
|
258
|
-
local_specs[name] = external_source
|
259
|
-
Pod::UI.puts "[分支] #{name} => (#{external_source})"
|
260
|
-
end
|
261
|
-
end
|
262
|
-
end
|
263
|
-
# step.2 获取pods标签信息,如果存在分支优先使用分支信息
|
264
|
-
lockfile.pod_names.each do |pod_name|
|
265
|
-
version = lockfile.version(pod_name)
|
266
|
-
podCoreName = subspec_podname(pod_name)
|
267
|
-
if local_specs.has_key?(podCoreName)
|
268
|
-
if podCoreName != pod_name
|
269
|
-
if (!has_include_core_subspec(pod_name)) # 过滤core数据
|
270
|
-
# Pod::UI.puts "step.2 #{pod_name} => (#{local_specs[podCoreName]})"
|
271
|
-
local_specs[pod_name] = local_specs[podCoreName]
|
272
|
-
end
|
265
|
+
# puts "[分支] #{podCoreName} => (#{external_source})".yellow
|
273
266
|
end
|
274
267
|
else
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
268
|
+
# 指向标签版本
|
269
|
+
version = lockfile.version(pod_name).to_s
|
270
|
+
if !version.empty? && !local_specs.has_key?(podCoreName)
|
271
|
+
local_specs[podCoreName] = version
|
272
|
+
# puts "[标签] #{podCoreName} => (#{version})".yellow
|
279
273
|
end
|
280
274
|
end
|
281
275
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# cache stable
|
2
|
+
require 'cocoapods'
|
2
3
|
|
3
4
|
######################################## Git Command ########################################
|
4
5
|
def configGitPath(gitPath)
|
@@ -66,7 +67,10 @@ def git_branch_exists?(branch)
|
|
66
67
|
end
|
67
68
|
|
68
69
|
def git_clone(source, path)
|
69
|
-
puts "git clone source:#{source} path:#{path}"
|
70
|
+
puts "git clone source:#{source} path:#{path}".yellow
|
71
|
+
if !File.directory?(path)
|
72
|
+
Dir.mkdir(path)
|
73
|
+
end
|
70
74
|
UI.section("Cloning `#{source}` into `#{path}`.") do
|
71
75
|
Dir.chdir(path) { git! ['clone', source] } #origin git command
|
72
76
|
end
|
@@ -14,7 +14,14 @@ module BB
|
|
14
14
|
@@member_configs = [
|
15
15
|
]
|
16
16
|
|
17
|
-
|
17
|
+
# pod组件合并
|
18
|
+
# 参数说明
|
19
|
+
# all_modules 业务使用组件
|
20
|
+
# member_modules 项目成员模块,一般用于切本地开发使用
|
21
|
+
# member_configs 项目成员工程配置
|
22
|
+
# ignore_local_stable 是否忽略本地stable配置,true 适合pod子组件
|
23
|
+
# skip_stable_check 是否跳过stable检测,true 采用标准pod合并操作
|
24
|
+
def initialize(all_modules, member_modules = {}, member_configs = [], ignore_local_stable = false, skip_stable_check = false)
|
18
25
|
@source_manager = BB::SourceManager.new()
|
19
26
|
#加载远程稳定仓库 和本地podfile 指定的仓库进行合并
|
20
27
|
if skip_stable_check == true
|
@@ -24,7 +31,6 @@ module BB
|
|
24
31
|
end
|
25
32
|
@@member_modules = member_modules
|
26
33
|
@@member_configs = member_configs
|
27
|
-
# puts "member_modules:#{member_modules}"
|
28
34
|
end
|
29
35
|
|
30
36
|
def current_member
|
@@ -142,39 +148,101 @@ module BB
|
|
142
148
|
}
|
143
149
|
return podfile_hash
|
144
150
|
end
|
151
|
+
# 合并组建数据
|
152
|
+
# 策略:本地stable作为基础数据,遍历podfile组件进行替换,变化以本地为主,标签以stable为主
|
145
153
|
def merge_module_data(podfile_specs, local_stable_data)
|
146
154
|
# puts "podfile_specs: #{podfile_specs}".green
|
147
155
|
podfile_hash = convert_podfile_specs_data(podfile_specs)
|
148
156
|
# puts "podfile_hash: #{podfile_hash}".red
|
149
157
|
# puts "local_stable_data: #{local_stable_data}".red
|
150
158
|
need_update_pod_data={}
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
#
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
159
|
+
stable_hash = local_stable_data
|
160
|
+
podfile_hash.each do |podName,podfile_pod|
|
161
|
+
podCoreName = @source_manager.subspec_podname(podName)
|
162
|
+
if (podName == podCoreName) || @source_manager.has_pod_subspec(podName, podCoreName)
|
163
|
+
pod = stable_hash[podCoreName]
|
164
|
+
if pod.nil? # stbale没有受版本控制
|
165
|
+
need_update_pod_data[podName] = podfile_pod
|
166
|
+
else
|
167
|
+
# if podCoreName == 'BBGameModule'
|
168
|
+
# puts "[stable]podCoreName:#{podCoreName}(#{pod}) VS [podfile] podName:#{podName}(#{podfile_pod})".green
|
169
|
+
# end
|
170
|
+
if pod == podfile_pod
|
171
|
+
if podName != podCoreName
|
172
|
+
need_update_pod_data[podName] = podfile_pod
|
173
|
+
end
|
174
|
+
else
|
175
|
+
branch = podfile_pod[:branch]
|
176
|
+
git = podfile_pod[:git]
|
177
|
+
if git.nil?
|
178
|
+
git = podfile_pod[:git_format]
|
179
|
+
end
|
180
|
+
version = podfile_pod[:version]
|
181
|
+
if (branch && !branch.empty?) || (git && !git.empty?)
|
182
|
+
# 项目配置指向分支数据,以本项目为主
|
183
|
+
puts "[PodAssistant] #{podName} 指向分支数据 => #{podfile_pod}"
|
184
|
+
stable_hash[podCoreName] = podfile_pod
|
185
|
+
if podName != podCoreName
|
186
|
+
need_update_pod_data[podName] = podfile_pod
|
187
|
+
end
|
188
|
+
elsif (version && !version.empty? && (pod.is_a? String) && (version != pod))
|
189
|
+
version = version.lstrip # 去除首字母空格
|
190
|
+
initial_str = version[0..0] # 第一个字母
|
191
|
+
# 项目配置固定版本,以本项目为主
|
192
|
+
is_fixed_version = initial_str.include?('=') ? true : false # 固定版本 pod 'A','= x.x.x'
|
193
|
+
is_lessthan_version = version.include?('<') ? true : false # 限制《最高》组件版本 pod 'A','< x.x.x' 或者 pod 'A','<= x.x.x'
|
194
|
+
is_greaterthan_version = version.include?('>') ? true : false # 限制《最低》组件版本 pod 'A','> x.x.x' 或者 pod 'A','>= x.x.x'
|
195
|
+
is_fuzzy_version = version.include?('~>') ? true : false # 固定版本 pod 'A','~> x.x.x'
|
196
|
+
is_fuzzy_versionV2 = (!is_fixed_version && !is_lessthan_version && !is_greaterthan_version && !is_fuzzy_version) ? true : false # 固定版本 pod 'A','x.x.x'
|
197
|
+
if (is_fixed_version == true) || (is_lessthan_version == true) || (is_fuzzy_versionV2 == true)
|
198
|
+
puts "[PodAssistant] ⚠️ 限制组件版本 '#{podName}', '#{version}' 以项目配置为主. (最新版本=> #{pod.send(:red)})"
|
199
|
+
stable_hash[podCoreName] = version
|
200
|
+
if podName != podCoreName
|
201
|
+
need_update_pod_data[podName] = version
|
202
|
+
end
|
203
|
+
elsif (is_greaterthan_version == true) || (is_fuzzy_version == true)
|
204
|
+
# puts "[PodAssistant] '#{podName}', '#{pod.send(:red)}' 以stable配置为主."
|
205
|
+
need_update_pod_data[podName] = pod
|
206
|
+
end
|
207
|
+
else
|
208
|
+
is_podfile_data = false
|
209
|
+
newPod = nil
|
210
|
+
if pod.is_a? (Hash)
|
211
|
+
stable_branch = pod[:branch]
|
212
|
+
stable_git = pod[:git]
|
213
|
+
if stable_git.nil?
|
214
|
+
stable_git = pod[:git_format]
|
215
|
+
end
|
216
|
+
if (stable_branch && !stable_branch.empty?) || (stable_git && !stable_git.empty?)
|
217
|
+
puts "[PodAssistant] '#{podName}', '#{podfile_pod}' 以podfile配置为主[分支=>标签]."
|
218
|
+
newPod = podfile_pod
|
219
|
+
is_podfile_data = true
|
220
|
+
else
|
221
|
+
newPod = pod
|
222
|
+
end
|
223
|
+
elsif pod.is_a? (String)
|
224
|
+
if pod.include?(':branch') || pod.include?(':git') || pod.include?(':git_format')
|
225
|
+
puts "[PodAssistant] '#{podName}', '#{podfile_pod}' 以podfile配置为主[分支=>标签]."
|
226
|
+
newPod = podfile_pod
|
227
|
+
is_podfile_data = true
|
228
|
+
else
|
229
|
+
newPod = pod
|
230
|
+
end
|
231
|
+
else
|
232
|
+
newPod = podfile_pod
|
233
|
+
is_podfile_data = true
|
234
|
+
end
|
235
|
+
if is_podfile_data == true
|
236
|
+
need_update_pod_data[podCoreName] = newPod
|
237
|
+
if podName != podCoreName
|
238
|
+
need_update_pod_data[podName] = newPod
|
239
|
+
end
|
240
|
+
else
|
241
|
+
if podName != podCoreName
|
242
|
+
need_update_pod_data[podName] = newPod
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
178
246
|
end
|
179
247
|
end
|
180
248
|
end
|
@@ -182,22 +250,16 @@ module BB
|
|
182
250
|
if need_update_pod_data.count > 0
|
183
251
|
# puts "need_update_pod_data:#{need_update_pod_data}".green
|
184
252
|
# 规避指向分支/远端版本替换yml配置所有组件,避免pod指向指向多个源
|
185
|
-
need_update_pod_data.each do |
|
186
|
-
|
187
|
-
|
188
|
-
local_stable_data[podName] = pod
|
189
|
-
puts "[PodAssistant] 合并组件 #{podName} #{pod} 以项目为主".yellow
|
190
|
-
end
|
191
|
-
end
|
253
|
+
need_update_pod_data.each do |podName,pod|
|
254
|
+
stable_hash[podName] = pod
|
255
|
+
puts "[PodAssistant] merge pod #{podName} #{pod}"
|
192
256
|
end
|
193
|
-
puts "[PodAssistant] 重新保存本地stable数据".yellow
|
194
|
-
@source_manager.update_localstable_datas(local_stable_data)
|
195
257
|
else
|
196
258
|
puts "[PodAssistant] 本地stable数据无变化<===完成".yellow
|
197
259
|
end
|
198
|
-
# puts "
|
260
|
+
# puts "[PodAssistant] stable_hash:#{stable_hash}".red
|
199
261
|
stable_specs = []
|
200
|
-
|
262
|
+
stable_hash.each do |name,pod|
|
201
263
|
if pod.is_a? Hash
|
202
264
|
branch = pod[:branch]
|
203
265
|
git = pod[:git]
|
@@ -239,7 +301,7 @@ module BB
|
|
239
301
|
elsif pod.is_a? String
|
240
302
|
stable_specs.push({ names: [name], version: pod, method: REMOTE_TAG })
|
241
303
|
else
|
242
|
-
puts "unknow type data:#{pod}".red
|
304
|
+
puts "unknow type [#{name}] data:#{pod}".red
|
243
305
|
end
|
244
306
|
end
|
245
307
|
return stable_specs
|
@@ -1,36 +1,79 @@
|
|
1
|
-
require 'cocoapods-bb-PodAssistant/helpers/git_cmd_helper'
|
2
1
|
require 'cocoapods-bb-PodAssistant/config/stable_source'
|
3
2
|
|
4
3
|
module BB
|
5
|
-
class StableEnv
|
6
|
-
def initialize(
|
7
|
-
if stable_source.nil?
|
8
|
-
stable_source = StableSource.stable_default_source
|
9
|
-
end
|
10
|
-
@stable_source = stable_source
|
11
|
-
@stable_branch = stable_branch
|
12
|
-
@stable_tag = stable_tag
|
13
|
-
|
4
|
+
class StableEnv
|
5
|
+
def initialize()
|
14
6
|
@cache = BB::Cache.new()
|
15
7
|
configGitPath(@cache.cachePath)
|
8
|
+
# 自动加载stable环境
|
9
|
+
loadStaleEnv
|
16
10
|
end
|
17
11
|
|
18
12
|
# stable 环境,执行pod stable
|
19
13
|
def loadStaleEnv
|
20
|
-
|
14
|
+
unless File.exist?(File.join(Pathname.pwd, "Podfile"))
|
15
|
+
err_msg = "- Error: #{File.join(Pathname.pwd, "Podfile")} is not exit"
|
16
|
+
Pod::UI.puts "#{err_msg}".send(:red)
|
17
|
+
exit -9001
|
18
|
+
end
|
19
|
+
|
20
|
+
#获取podfile 内容
|
21
|
+
#1、删除所有注释行,避免干扰
|
22
|
+
#2、正则匹配,筛选出stable 方法
|
23
|
+
#3、执行stable 方法,获取配置
|
24
|
+
podfileContent = File.read(File.join(Pathname.pwd, "Podfile"))
|
25
|
+
podfileContent_vaild = podfileContent.lines.reject { |line| line.strip.start_with?("#") }.join
|
26
|
+
stableCommand = podfileContent_vaild.match(/^\s*stable!\s*'([^']+)'(?:,\s*(\w+):\s*'([^']+)')*/m)
|
27
|
+
unless stableCommand
|
28
|
+
puts "- Error: not stable define in the podfile! you can define to podfile:".red
|
29
|
+
puts "stable! 'https://git.babybus.co/babybus/ios/Specs/stable-specs.git', specs:'<业务线stbale名称-可选>', tag:'<标签-可选>', branch:'<分支-可选>'".green
|
30
|
+
exit -9002
|
31
|
+
end
|
32
|
+
eval(stableCommand.to_s)
|
21
33
|
end
|
22
34
|
|
23
|
-
# 开发环境,执行pod install/update
|
24
|
-
def
|
35
|
+
# 拉取stable仓库代码 hook开发环境,执行pod install/update
|
36
|
+
def system_clone_stable_git
|
25
37
|
cachePath = @cache.cachePath
|
26
|
-
puts "hook [pod install/update]
|
38
|
+
puts "hook [pod install/update] fetch stable git=>#{cachePath}"
|
27
39
|
if Dir.exist?(File.join(cachePath))
|
28
|
-
`cd #{cachePath}; git switch main; git pull --all`
|
40
|
+
# `cd #{cachePath}; git switch main; git pull --all`
|
41
|
+
system "cd #{cachePath}; git switch main; git pull --all"
|
29
42
|
else
|
30
43
|
clonePath = File.dirname(cachePath)
|
31
44
|
FileUtils.mkdir_p clonePath
|
32
|
-
`git clone #{@stable_source} #{cachePath}`
|
45
|
+
# `git clone #{@stable_source} #{cachePath}`
|
46
|
+
system "git clone #{@stable_source} #{cachePath}"
|
33
47
|
end
|
34
48
|
end
|
49
|
+
|
50
|
+
# ========podfile 约定函数规则,切勿修改
|
51
|
+
#help load podfile option
|
52
|
+
def stable!(source, options = {})
|
53
|
+
@stable_source = source
|
54
|
+
if options.has_key?(:specs)
|
55
|
+
@businessSpec = options[:specs]
|
56
|
+
end
|
57
|
+
@stable_tag = options[:tag] if options.has_key?(:tag)
|
58
|
+
@stable_branch = options[:branch] if options.has_key?(:branch)
|
59
|
+
puts "###stable env => [stable公共源]:#{source} [业务线源名称]:#{@businessSpec} branch:#{@stable_branch} tag:#{@stable_tag}".yellow
|
60
|
+
end
|
61
|
+
|
62
|
+
def stable_source
|
63
|
+
return @stable_source
|
64
|
+
end
|
65
|
+
def stable_branch
|
66
|
+
return @stable_branch
|
67
|
+
end
|
68
|
+
def stable_tag
|
69
|
+
return @stable_tag
|
70
|
+
end
|
71
|
+
def business_stable
|
72
|
+
return @businessSpec
|
73
|
+
end
|
74
|
+
# 验证stable环境是否存在
|
75
|
+
def verify_stable_env_exists
|
76
|
+
return @stable_source.empty? ? false : true
|
77
|
+
end
|
35
78
|
end
|
36
79
|
end
|
@@ -47,13 +47,25 @@ module Pod
|
|
47
47
|
class Podfile
|
48
48
|
# @!group DSL support
|
49
49
|
include Pod::Podfile::DSL
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
# pod组件合并操作(项目)
|
51
|
+
def project_pod_module_run(pod_modules, member_modules = {}, member_configs = [], skip_stable_check = false)
|
52
|
+
# Pod::UI.puts "Pod Module:#{pod_modules}"
|
53
|
+
time1 = Time.new
|
54
|
+
puts "[PodAssistant]项目pod组件组装开始操作时间:#{time1}".green
|
55
|
+
source = BB::PodModule.new(pod_modules, member_modules, member_configs, false, skip_stable_check)
|
56
|
+
pod_box_module_run(source)
|
57
|
+
time2 = Time.new
|
58
|
+
puts "[PodAssistant]项目pod组件组装结束时间:#{time2}".green
|
59
|
+
# 获取时间差
|
60
|
+
time = time2 - time1
|
61
|
+
puts "项目pod组件组装操作耗时:#{time.to_s.send(:red)}秒".green
|
62
|
+
end
|
63
|
+
# pod组件合并操作(单组件)
|
64
|
+
def pod_module_run(pod_modules, member_modules = {}, member_configs = [])
|
53
65
|
# Pod::UI.puts "Pod Module:#{pod_modules}"
|
54
66
|
time1 = Time.new
|
55
67
|
puts "[PodAssistant]pod组件组装开始操作时间:#{time1}".green
|
56
|
-
source = BB::PodModule.new(pod_modules, member_modules, member_configs,
|
68
|
+
source = BB::PodModule.new(pod_modules, member_modules, member_configs, true, true)
|
57
69
|
pod_box_module_run(source)
|
58
70
|
time2 = Time.new
|
59
71
|
puts "[PodAssistant]pod组件组装结束时间:#{time2}".green
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'cocoapods-bb-PodAssistant/command'
|
2
2
|
require 'csv'
|
3
3
|
require 'xcodeproj'
|
4
|
+
require 'cocoapods-bb-PodAssistant/config/source_manager'
|
4
5
|
|
5
6
|
class Dir
|
6
7
|
def self.size(dir)
|
@@ -49,7 +50,7 @@ module BB
|
|
49
50
|
$podStartTime = Time.new
|
50
51
|
puts "[PodAssistant] plugin hook pre_install".yellow
|
51
52
|
env = BB::StableEnv.new()
|
52
|
-
env.
|
53
|
+
env.system_clone_stable_git # 自动拉取远端git仓库数据
|
53
54
|
if $pluginIsVerbose == true
|
54
55
|
# home路径下是否存在.AllPodsTimeAndSize.csv的隐藏文件
|
55
56
|
if File.exist?("#{Dir.home}/.AllPodsTimeAndSize.csv")
|
@@ -67,6 +68,9 @@ module BB
|
|
67
68
|
end
|
68
69
|
Pod::HooksManager.register("cocoapods-bb-PodAssistant", :post_install) do |installer|
|
69
70
|
begin
|
71
|
+
source_manager = BB::SourceManager.new()
|
72
|
+
# 生成本地yml配置
|
73
|
+
source_manager.generate_localStable
|
70
74
|
$podEndTime = Time.new
|
71
75
|
puts "[PodAssistant] plugin hook post_install".yellow
|
72
76
|
puts "[PodAssistant] pod库下载耗时 GitCloneAllSize: #{$gitAllSize} M GitCloneAllTime: #{$cloneAllTime} S CDNDownloadAllSize: #{$pluginCurrentZipAllSize} M CDNAllTime: #{$downloadAllTime} S CDNDownloadAllTime: #{$cdnDownloadAllTime} S CDNUnzipAllTime: #{$cdnUnZipAllTime} S"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-bb-PodAssistant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- humin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods-core
|
@@ -79,14 +79,17 @@ files:
|
|
79
79
|
- lib/cocoapods-bb-PodAssistant/babybus/business/babybus_install_environment.rb
|
80
80
|
- lib/cocoapods-bb-PodAssistant/babybus/helpers/babybus_info_plist_helper.rb
|
81
81
|
- lib/cocoapods-bb-PodAssistant/babybus/installer/post_install_hooks.rb
|
82
|
+
- lib/cocoapods-bb-PodAssistant/babybus/linkline/target-linkline.rb
|
83
|
+
- lib/cocoapods-bb-PodAssistant/babybus/linkline/targetValidator-linkline.rb
|
84
|
+
- lib/cocoapods-bb-PodAssistant/babybus/linkline/targetdefinition-linkline.rb
|
85
|
+
- lib/cocoapods-bb-PodAssistant/babybus/stable/podfile-linkline.rb
|
82
86
|
- lib/cocoapods-bb-PodAssistant/command.rb
|
83
|
-
- lib/cocoapods-bb-PodAssistant/command/
|
84
|
-
- lib/cocoapods-bb-PodAssistant/command/
|
85
|
-
- lib/cocoapods-bb-PodAssistant/command/
|
86
|
-
- lib/cocoapods-bb-PodAssistant/command/
|
87
|
-
- lib/cocoapods-bb-PodAssistant/command/
|
88
|
-
- lib/cocoapods-bb-PodAssistant/command/stable/
|
89
|
-
- lib/cocoapods-bb-PodAssistant/command/stable/stable.rb
|
87
|
+
- lib/cocoapods-bb-PodAssistant/command/linkline.rb
|
88
|
+
- lib/cocoapods-bb-PodAssistant/command/stable.rb
|
89
|
+
- lib/cocoapods-bb-PodAssistant/command/stable/init.rb
|
90
|
+
- lib/cocoapods-bb-PodAssistant/command/stable/install.rb
|
91
|
+
- lib/cocoapods-bb-PodAssistant/command/stable/sync.rb
|
92
|
+
- lib/cocoapods-bb-PodAssistant/command/stable/update.rb
|
90
93
|
- lib/cocoapods-bb-PodAssistant/config/cache_path.rb
|
91
94
|
- lib/cocoapods-bb-PodAssistant/config/source_manager.rb
|
92
95
|
- lib/cocoapods-bb-PodAssistant/config/stable_source.rb
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module Pod
|
2
|
-
class Command
|
3
|
-
# This is an example of a cocoapods plugin adding a top-level subcommand
|
4
|
-
# to the 'pod' command.
|
5
|
-
#
|
6
|
-
# You can also create subcommands of existing or new commands. Say you
|
7
|
-
# wanted to add a subcommand to `list` to show newly deprecated pods,
|
8
|
-
# (e.g. `pod list deprecated`), there are a few things that would need
|
9
|
-
# to change.
|
10
|
-
#
|
11
|
-
# - move this file to `lib/pod/command/list/deprecated.rb` and update
|
12
|
-
# the class to exist in the the Pod::Command::List namespace
|
13
|
-
# - change this class to extend from `List` instead of `Command`. This
|
14
|
-
# tells the plugin system that it is a subcommand of `list`.
|
15
|
-
# - edit `lib/cocoapods_plugins.rb` to require this file
|
16
|
-
#
|
17
|
-
# @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
|
18
|
-
# in the `plugins.json` file, once your plugin is released.
|
19
|
-
#
|
20
|
-
class Podassistant < Command
|
21
|
-
self.summary = 'Short description of cocoapods-bb-PodAssistant.'
|
22
|
-
|
23
|
-
self.description = <<-DESC
|
24
|
-
Longer description of cocoapods-bb-PodAssistant.
|
25
|
-
DESC
|
26
|
-
|
27
|
-
# self.arguments = 'NAME'
|
28
|
-
|
29
|
-
def initialize(argv)
|
30
|
-
# @name = argv.shift_argument
|
31
|
-
super
|
32
|
-
end
|
33
|
-
|
34
|
-
def validate!
|
35
|
-
super
|
36
|
-
# help! 'A Pod name is required.' unless @name
|
37
|
-
end
|
38
|
-
|
39
|
-
def run
|
40
|
-
UI.puts "Add your implementation for the cocoapods-bb-PodAssistant plugin in #{__FILE__}"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,168 +0,0 @@
|
|
1
|
-
require 'cocoapods-bb-PodAssistant/config/source_manager'
|
2
|
-
require 'cocoapods-bb-PodAssistant/config/cache_path'
|
3
|
-
require 'cocoapods-bb-PodAssistant/helpers'
|
4
|
-
|
5
|
-
module Pod
|
6
|
-
|
7
|
-
# class StableOptions
|
8
|
-
# # define business specs,defalut is stable_specs
|
9
|
-
# option :business_specs, "stable_specs"
|
10
|
-
|
11
|
-
# # define custom lockSpecs tag
|
12
|
-
# option :tag, ""
|
13
|
-
|
14
|
-
# # define custom lockSpecs branch
|
15
|
-
# option :branch, ""
|
16
|
-
# end
|
17
|
-
|
18
|
-
class Command
|
19
|
-
class Stable < Command
|
20
|
-
require 'fileutils'
|
21
|
-
require 'cocoapods/executable.rb'
|
22
|
-
extend Executable
|
23
|
-
executable :git
|
24
|
-
|
25
|
-
self.summary = '拉取稳定lock配置'
|
26
|
-
self.description = <<-DESC
|
27
|
-
拉取稳定lock配置插件。利用版本比对进行更新配置实现对组件版本控制管理。
|
28
|
-
DESC
|
29
|
-
|
30
|
-
self.arguments = [
|
31
|
-
CLAide::Argument.new('Podfile', false)
|
32
|
-
]
|
33
|
-
def self.options
|
34
|
-
[
|
35
|
-
['--init', '初始化项目yml配置,根据当前项目Podfile.lock生成'],
|
36
|
-
['--sync', '同步远端yml配置,更新项目yml配置'],
|
37
|
-
['--install', '命令同执行`pod install操作`'],
|
38
|
-
['--update', '命令同执行`pod update操作`'],
|
39
|
-
['--update-pod', '命令同执行`pod update <组件>操作`,更新yml配置组件版本信息,多个组件使用`,`或者`空格`隔开,注意⚠️ 使用`空格`需要使用双引号'],
|
40
|
-
].concat(super)
|
41
|
-
end
|
42
|
-
|
43
|
-
def initialize(argv)
|
44
|
-
@names = argv.arguments! unless argv.arguments.empty?
|
45
|
-
@help = argv.flag?('help')
|
46
|
-
@init = argv.flag?('init')
|
47
|
-
@sync = argv.flag?('sync')
|
48
|
-
# install操作
|
49
|
-
@install = argv.flag?('install')
|
50
|
-
@update = argv.flag?('update')
|
51
|
-
# update组件数据支持多个使用`,`或者`空格`隔开
|
52
|
-
update_pods = argv.option('update-pod','')
|
53
|
-
if !update_pods.empty?
|
54
|
-
if update_pods.include?(' ')
|
55
|
-
@update_pods = update_pods.split(' ') unless update_pods.nil?
|
56
|
-
else update_pods.include?(',')
|
57
|
-
@update_pods = update_pods.split(',') unless update_pods.nil?
|
58
|
-
end
|
59
|
-
end
|
60
|
-
super
|
61
|
-
end
|
62
|
-
def validate!
|
63
|
-
super
|
64
|
-
banner! if @help
|
65
|
-
end
|
66
|
-
|
67
|
-
#help load podfile option
|
68
|
-
def stable!(source, options = {})
|
69
|
-
@ll_stable_source = source
|
70
|
-
if options.has_key?(:specs)
|
71
|
-
@businessSpec = options[:specs]
|
72
|
-
puts "当前业务使用源=>#{@businessSpec}"
|
73
|
-
end
|
74
|
-
@ll_stable_tag = options[:tag] if options.has_key?(:tag)
|
75
|
-
@ll_stable_branch = options[:branch] if options.has_key?(:branch)
|
76
|
-
@cache = BB::Cache.new()
|
77
|
-
configGitPath(@cache.cachePath)
|
78
|
-
end
|
79
|
-
|
80
|
-
######################################## Main ########################################
|
81
|
-
|
82
|
-
def run
|
83
|
-
# begin
|
84
|
-
source_manager = BB::SourceManager.new(@businessSpec)
|
85
|
-
if @init
|
86
|
-
puts "[PodAssistant] 开始配置生成当前项目yml文件".yellow
|
87
|
-
# 生成本地yml配置
|
88
|
-
source_manager.generate_localStable
|
89
|
-
puts "[PodAssistant] `pod stable --init` complete!".green
|
90
|
-
elsif @install
|
91
|
-
puts "[PodAssistant] 执行 $ pod install".yellow
|
92
|
-
system "pod install"
|
93
|
-
puts "[PodAssistant] `pod stable --install` complete!".green
|
94
|
-
elsif @update
|
95
|
-
puts "[PodAssistant] 执行 $ pod update".yellow
|
96
|
-
system "pod update"
|
97
|
-
puts "[PodAssistant] `pod stable --update` complete!".green
|
98
|
-
elsif @update_pods
|
99
|
-
# 更新单个组件
|
100
|
-
puts "更新pod组件#{@update_pods} count:#{@update_pods.count}".yellow
|
101
|
-
source_manager.update_podmodules(@update_pods)
|
102
|
-
podnames = @update_pods.join(" ")
|
103
|
-
puts "[PodAssistant] 执行 $ pod update #{podnames}".yellow
|
104
|
-
system "pod update #{podnames}"
|
105
|
-
source_manager.update_local_stable_from_podmodules(@update_pods)
|
106
|
-
podnames = @update_pods.join(",")
|
107
|
-
puts "[PodAssistant] `pod stable --update-pod=#{podnames}` complete!".green
|
108
|
-
elsif @sync
|
109
|
-
puts "开始合并远端lock数据".yellow
|
110
|
-
ll_load_stable
|
111
|
-
#2、clone origin lock spec to cache dir
|
112
|
-
ll_cloneStable
|
113
|
-
#3、fetch newest code
|
114
|
-
ll_fetch_stale_git
|
115
|
-
# 数据合并
|
116
|
-
source_manager.merge_stable_data
|
117
|
-
puts "[PodAssistant] `pod stable` complete!".green
|
118
|
-
else
|
119
|
-
puts "[PodAssistant] `pod stable` 帮助文档请查看👇".yellow
|
120
|
-
banner!
|
121
|
-
end
|
122
|
-
# rescue => exception
|
123
|
-
# puts "[pod stable] error(已捕获): #{exception}".red
|
124
|
-
# end
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
|
-
private
|
129
|
-
######################################## API ########################################
|
130
|
-
def ll_load_stable
|
131
|
-
unless File.exist?(File.join(Pathname.pwd, "Podfile"))
|
132
|
-
err_msg = "- Error: #{File.join(Pathname.pwd, "Podfile")} is not exit"
|
133
|
-
Pod::UI.puts "#{err_msg}".send(:red)
|
134
|
-
exit -9001
|
135
|
-
end
|
136
|
-
|
137
|
-
#获取podfile 内容
|
138
|
-
#1、删除所有注释行,避免干扰
|
139
|
-
#2、正则匹配,筛选出stable 方法
|
140
|
-
#3、执行stable 方法,获取配置
|
141
|
-
podfileContent = File.read(File.join(Pathname.pwd, "Podfile"))
|
142
|
-
podfileContent_vaild = podfileContent.lines.reject { |line| line.strip.start_with?("#") }.join
|
143
|
-
stableCommand = podfileContent_vaild.match(/^\s*stable!\s*'([^']+)'(?:,\s*(\w+):\s*'([^']+)')*/m)
|
144
|
-
unless stableCommand
|
145
|
-
err_msg = "- Error: not stable define in the podfile! you can define like【stable! 'https://git.babybus.co/babybus/ios/Specs/stable-specs.git', specs:'global_stable_specs'】in podfile"
|
146
|
-
Pod::UI.puts "#{err_msg}".send(:red)
|
147
|
-
exit -9002
|
148
|
-
end
|
149
|
-
eval(stableCommand.to_s)
|
150
|
-
end
|
151
|
-
def ll_cloneStable
|
152
|
-
cachePath = @cache.cachePath
|
153
|
-
unless Dir.exist?(File.join(cachePath))
|
154
|
-
clonePath = File.dirname(cachePath)
|
155
|
-
FileUtils.mkdir_p clonePath
|
156
|
-
git_clone(@stable_source,clonePath)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
def ll_fetch_stale_git
|
161
|
-
git_reset
|
162
|
-
git_fetch
|
163
|
-
git_checkout_and_pull(@stable_source, @stable_branch, @stable_tag)
|
164
|
-
end
|
165
|
-
|
166
|
-
end
|
167
|
-
end
|
168
|
-
end
|
File without changes
|
/data/lib/cocoapods-bb-PodAssistant/{command → babybus}/linkline/targetValidator-linkline.rb
RENAMED
File without changes
|
/data/lib/cocoapods-bb-PodAssistant/{command → babybus}/linkline/targetdefinition-linkline.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|