cocoapods-bb-PodAssistant 0.3.12.6 → 0.3.13.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: ab54c5c6b56fecf79f80409e4640b1d490fd1a43cbb3cb25c6950d7b0e4ce41b
4
- data.tar.gz: 3d9919e095514e2186967ede9e18cec1fb89aa6a6295ba687ce8f5c220c0b52c
3
+ metadata.gz: e987c7880cf9a36436c3340d58f869212e12862eb34a7035d65a1240c37fa6e1
4
+ data.tar.gz: 6d4ecac719da36fcee693b1f14527245bf8a731d3395e784b071af5c0376adc3
5
5
  SHA512:
6
- metadata.gz: 43bcced09599301509cf6b5754cffda942fe35098dfab75a675be1bc1b5a1bdbb70d650c12055a2ad3ff668de7a55571db09c13329394f2248a1c322c13cc3fb
7
- data.tar.gz: 3d1005b0fb44134cff7ffa413e2c7290a42616b89fde98811c91c54dab636cbf39f65ec3982fa1e0c583f937b573b18cf0741ae4131bce5e2947be8aa6433875
6
+ metadata.gz: 2654efaca16ff583496a8f218538b65f6e917580599299bbd2f6f476d62ebc680b1f430c0c46efaf5465adfc0dc41b15ff4b92d8d183e50c0641b280fc49b8d6
7
+ data.tar.gz: c4212306220fb74f197dd8040e623e9aa7980665e0f3ddf3db0a318c81ee1d94bb7b48eba86628683123b660549b5501e75e18f7daa5c619887db3c0bfdb9305
@@ -11,11 +11,17 @@ module Pod
11
11
  常用命令如下:\n
12
12
  更新所有公共组件: `pod stable push`\n
13
13
  更新指定公共组件: `pod stable push <组件名称>`\n
14
+ 更新指定spec公共组件: `pod stable push <组件名称> --stable-specs-index=spec 索引`\n
14
15
  更新指定公共组件/移除组件: `pod stable push <组件名称> --remove=组件名称` #多个移除名称带`,`\n
15
16
  更新指定公共组件/带依赖关系: `pod stable push <组件名称> --dependencies=组件名称` #多个依赖名称带`,`\n
16
17
  更新指定公共组件/带依赖关系/移除组件: `pod stable push <组件名称> --dependencies=组件名称 --remove=组件名称` #多个依赖名称带`,`\n
17
- 参数说明:--dependencies 依赖组件 --remove 需要移除组件 --update-matrix 更新矩阵产品公共业务线 --update-common 更新公共组件
18
+ 参数说明:\n
19
+ --dependencies=依赖组件\n
20
+ --remove=需要移除组件\n
21
+ --stable-specs-index=指定业务specs索引-0:公共(默认) 1:矩阵全线升级 2:拉布 3:科学 4:思维\n
18
22
  DESC
23
+ # --update-matrix 更新矩阵产品公共业务线\n
24
+ # --update-common 更新公共组件\n
19
25
 
20
26
  self.arguments = [
21
27
  CLAide::Argument.new('POD_NAMES', false, true),
@@ -25,8 +31,7 @@ module Pod
25
31
  [
26
32
  ['--dependencies', '依赖组件名称,多个使用`,`隔开'],
27
33
  ['--remove', '移除公共组件名称,多个使用`,`隔开'],
28
- ['--update-matrix', '更新[矩阵]产品公共业务线,默认true'],
29
- ['--update-common', '更新公共组件,默认false'],
34
+ ['--stable-specs-index', '指定业务specs索引-0:公共(默认) 1:矩阵全线升级 2:拉布 3:科学 4:思维,参照podfile配置信息'],
30
35
  ].concat(super)
31
36
  end
32
37
 
@@ -34,65 +39,99 @@ module Pod
34
39
  @pods = argv.arguments!
35
40
  @dependencies = argv.option('dependencies', nil)&.split(',')
36
41
  @remove = argv.option('remove', nil)&.split(',')
37
- @is_pub = argv.flag?('update-common', false)
38
- @is_matrix = !@is_pub # argv.flag?('update-matrix', true)
42
+ @version = argv.option('version')
43
+ @stable_specs_index = argv.option('stable-specs-index', 0).to_i
44
+ @is_public_data = false
39
45
  super
40
46
  end
41
47
 
42
48
  def run
43
49
  puts "[PodAssistant] 开始执行 $ pod stable push".yellow
44
- source_manager = BB::SourceManager.new(false, @is_matrix)
50
+ puts "stable_specs_project_name:#{get_stable_project_name} stable_specs_name:#{get_stable_spec_name}"
51
+
52
+ source_manager = BB::SourceManager.new(false, get_stable_spec_name)
45
53
  cachePath = source_manager.cache_path
46
54
  puts "stable cache git=>#{cachePath}"
47
55
  Dir.chdir(File.join(cachePath)) {
48
- # puts "pwd:#{`pwd`}".green
49
- path = @is_matrix ? matrix_stable_path : common_stable_path
50
- Dir.chdir(File.join(path)) {
51
- commit_msg = ""
52
- if @pods.any?
53
- if (@pods.length > 1) && (@dependencies)
54
- puts "❌ 无效指令,不能处理多个组件#{@pods}依赖,更新组件仅支持单组件".red
55
- puts "举例:pod stable push <单组件> --dependencies=<多组件>".green
56
- puts "详见 pod stable push --help".green
57
- system "pod stable push --help"
58
- exit
59
- elsif (@pods.length == 1) && (@dependencies || @remove)
60
- pod_name=@pods.first
61
- dependencies_hash = {}
62
- if @dependencies
63
- dependencies_hash[pod_name] = @dependencies
56
+ path = get_stable_project_path
57
+ # puts "path:#{path}".red
58
+ if Dir.exist?(path)
59
+ Dir.chdir(File.join(path)) {
60
+ commit_msg = ""
61
+ if @pods.any?
62
+ if (@pods.length > 1) && (@dependencies)
63
+ puts " 无效指令,不能处理多个组件#{@pods}依赖,更新组件仅支持单组件".red
64
+ puts "举例:pod stable push <单组件> --dependencies=<多组件>".green
65
+ puts "详见 pod stable push --help".green
66
+ system "pod stable push --help"
67
+ exit
68
+ elsif (@pods.length == 1) && (@dependencies || @remove)
69
+ pod_name=@pods.first
70
+ dependencies_hash = {}
71
+ if @dependencies
72
+ dependencies_hash[pod_name] = @dependencies
73
+ end
74
+ if @is_public_data
75
+ source_manager.update_common_dependencies_and_remove_data(dependencies_hash, @remove)
76
+ else
77
+ source_manager.update_business_dependencies_and_remove_data(dependencies_hash, @remove)
78
+ end
64
79
  end
65
- if @is_matrix
66
- source_manager.update_business_dependencies_and_remove_data(dependencies_hash, @remove)
67
- else
68
- source_manager.update_common_dependencies_and_remove_data(dependencies_hash, @remove)
80
+ pods_str = @pods.join(" ")
81
+ system "pod stable update #{pods_str}"
82
+ commit_msg = "update pod #{pods_str}"
83
+ else
84
+ if (@dependencies) || (@remove)
85
+ puts "❌ 无效指令,没有制定组件名称 详见 pod stable push --help".red
86
+ system "pod stable push --help"
87
+ exit
69
88
  end
89
+ system "pod stable update"
70
90
  end
71
- pods_str = @pods.join(" ")
72
- system "pod stable update #{pods_str}"
73
- commit_msg = "update pod #{pods_str}"
74
- else
75
- if (@dependencies) || (@remove)
76
- puts "❌ 无效指令,没有制定组件名称 详见 pod stable push --help".red
77
- system "pod stable push --help"
78
- exit
79
- end
80
- system "pod stable update"
81
- end
82
- # 提交spec本地lock依赖,避免pod stable push <组件>出现组件版本回退问题
83
- source_manager.commit_localspec_data(@is_matrix, commit_msg)
84
- }
91
+ # 提交spec本地lock依赖,避免pod stable push <组件>出现组件版本回退问题
92
+ source_manager.commit_localspec_data(commit_msg)
93
+ }
94
+ else
95
+ puts "❌ 无效stable工程,请确认:#{get_stable_project_name}是否创建,at@hm".red
96
+ exit
97
+ end
85
98
  }
86
99
  end
87
-
88
- # 公共stable目录
89
- private def common_stable_path
90
- return File.join(Dir.pwd, 'Common_Stable')
100
+ # 0:公共(默认) 1:矩阵全线升级 2:拉布 3:科学 4:思维
101
+ private def get_stable_spec_name
102
+ case @stable_specs_index
103
+ when 1 # 全线矩阵产品公共stable目录
104
+ return 'global_stable_specs'
105
+ when 2 # labu产品公共stable目录
106
+ return 'labu_stable_specs'
107
+ when 3 # science产品公共stable目录
108
+ return 'science_stable_specs'
109
+ when 4 # math产品公共stable目录
110
+ return 'math_stable_specs'
111
+ else # 公共stable目录
112
+ return 'stable_specs'
113
+ end
91
114
  end
92
- # 全线矩阵产品公共stable目录
93
- private def matrix_stable_path
94
- return File.join(Dir.pwd, 'Matrix_Common_Stable')
115
+ # 0:公共(默认) 1:矩阵全线升级 2:拉布 3:科学 4:思维
116
+ private def get_stable_project_name
117
+ case @stable_specs_index
118
+ when 1 # 全线矩阵产品公共stable目录
119
+ return 'Matrix_Common_Stable'
120
+ when 2 # labu产品公共stable目录
121
+ return 'labu_Common_Stable'
122
+ when 3 # science产品公共stable目录
123
+ return 'science_Common_Stable'
124
+ when 4 # math产品公共stable目录
125
+ return 'math_Common_Stable'
126
+ else # 公共stable目录
127
+ @is_public_data = true
128
+ return 'Common_Stable'
129
+ end
95
130
  end
131
+ private def get_stable_project_path
132
+ return File.join(Dir.pwd, get_stable_project_name)
133
+ end
134
+
96
135
  end
97
136
  end
98
137
  end
@@ -8,9 +8,9 @@ require 'cocoapods-bb-PodAssistant/config/data_config'
8
8
  # 数据源管理
9
9
  module BB
10
10
  class SourceManager
11
- def initialize(verify_stable_env=true, isMatrix=false)
12
- @env = BB::StableEnv.new(verify_stable_env, isMatrix)
13
- @businessSpecName = @env.business_stable
11
+ def initialize(verify_stable_env=true, businessSpec=nil)
12
+ @env = BB::StableEnv.new(verify_stable_env, businessSpec)
13
+ @businessSpecName = businessSpec
14
14
  @stableMgr = BB::StableManager.new(@env, verify_stable_env)
15
15
  end
16
16
 
@@ -197,13 +197,8 @@ module BB
197
197
  def update_business_dependencies_and_remove_data(dependencies_pods, remove_pods)
198
198
  update_dependencies_and_remove_data(business_stable_yaml, business_stable_datas, dependencies_pods, remove_pods)
199
199
  end
200
- def commit_localspec_data(is_matrix, commit_msg)
201
- if is_matrix
202
- stable_yaml = business_stable_yaml
203
- else
204
- stable_yaml = public_stable_yaml
205
- end
206
- commit_git_data(stable_yaml, commit_msg)
200
+ def commit_localspec_data(commit_msg)
201
+ commit_git_data(business_stable_yaml, commit_msg)
207
202
  end
208
203
  def commit_git_data(stable_yaml, commit_msg)
209
204
  @stableMgr.commit_data(stable_yaml, commit_msg)
@@ -1,3 +1,3 @@
1
1
  module CocoapodsBbPodassistant
2
- VERSION = "0.3.12.6"
2
+ VERSION = "0.3.13.0"
3
3
  end
@@ -2,9 +2,9 @@ require 'cocoapods-bb-PodAssistant/config/stable_source'
2
2
 
3
3
  module BB
4
4
  class StableEnv
5
- def initialize(verify_stable_env=true, isMatrix=false)
5
+ def initialize(verify_stable_env=true, businessSpec=nil)
6
6
  @cache = BB::Cache.new(nil, verify_stable_env)
7
- @isMatrix = isMatrix
7
+ @businessSpec = businessSpec
8
8
  configGitPath(@cache.cachePath)
9
9
  if verify_stable_env
10
10
  # 自动加载stable环境
@@ -102,14 +102,8 @@ module BB
102
102
  return @stable_tag
103
103
  end
104
104
  def business_stable
105
- if @businessSpec.nil? && @isMatrix
106
- return default_matrix_business_stable
107
- end
108
105
  return @businessSpec
109
106
  end
110
- def default_matrix_business_stable
111
- return "global_stable_specs"
112
- end
113
107
  # 验证stable环境是否存在
114
108
  def verify_stable_env_exists
115
109
  return @stable_source.empty? ? false : true
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.12.6
4
+ version: 0.3.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - humin