tuya-ci-core 0.1.2 → 0.2.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.
@@ -41,7 +41,7 @@ module TYCiCore
41
41
 
42
42
  commands = []
43
43
 
44
- commands << %W(tag tag -d #{tag}) if local
44
+ commands << %W(tag -d #{tag}) if local
45
45
  commands << %W(push origin :refs/tags/#{tag}) if remote
46
46
 
47
47
  EXE.multi_exe('git', commands, true ) unless commands.empty?
@@ -67,14 +67,16 @@ module TYCiCore
67
67
 
68
68
  git_status = EXE.exe("git", %W(status), true)
69
69
 
70
- if git_has_modify? git_status
70
+ commit_result = git_has_modify? git_status
71
+
72
+ if commit_result
71
73
  commands = [
72
74
  %W(add -u),
73
75
  %W(commit -m '#{message}')
74
76
  ]
75
-
76
77
  EXE.multi_exe("git", commands, true)
77
78
  end
79
+ commit_result
78
80
  end
79
81
 
80
82
  def self.git_commit_all(message)
@@ -88,56 +90,119 @@ module TYCiCore
88
90
  EXE.multi_exe('git', git_commit_commands, true)
89
91
  end
90
92
 
91
- def self.git_checkout_branch(branch)
92
-
93
- puts "Git checkout branch: #{branch}".green
94
-
95
- branch_origin = branch
96
- unless branch_origin.include?("/")
97
- branch_origin = "origin/" + branch_origin
98
- end
99
-
100
- target_branch = branch_origin.split('/')[-1]
101
-
102
- EXE.exe('git', %W(fetch), true )
103
-
93
+ def self.git_checkout_branch(target_branch)
94
+ puts "Git checkout branch: #{target_branch}".green
95
+ commands = [
96
+ %W(add -u),
97
+ %W(reset --hard),
98
+ %W(remote prune origin),
99
+ %W(fetch)
100
+ ]
101
+ EXE.multi_exe('git', commands, true )
104
102
  commands = []
105
- is_branch_exist = git_branch_exist? target_branch
106
-
107
- if is_branch_exist
108
- puts "Git checkout branch: #{branch} is exist".green
109
- # git_clean
110
- commands << %W(checkout #{target_branch})
103
+ if git_detached?
104
+ puts "Current status is HEAD detached".green
105
+ in_target_branch = false
111
106
  else
112
- puts "Git checkout branch: #{branch} is not exist".green
113
- commands << %W(checkout -b #{target_branch})
114
- commands << %W(push --set-upstream origin #{target_branch})
107
+ current_branch = git_current_branch
108
+ puts "Current branch is #{current_branch}".green
109
+ in_target_branch = current_branch == target_branch
110
+ commands << %W(rebase)
115
111
  end
116
112
 
117
- commands += [
118
- %W(checkout .),
119
- %W(reset --hard),
120
- %W(fetch),
121
- %W(rebase)
122
- ]
113
+ unless in_target_branch
114
+ remote_exist = git_branch_exist_remote? target_branch
115
+ local_exist = git_branch_exist_local? target_branch
116
+ puts "Git local branch: #{target_branch} is exist?: #{local_exist}".green
117
+ puts "Git remote branch: #{target_branch} is exist?: #{remote_exist}".green
118
+ if local_exist
119
+ commands << %W(checkout #{target_branch})
120
+ unless remote_exist
121
+ commands << %W(git push --set-upstream origin #{target_branch})
122
+ end
123
+ else
124
+ if remote_exist
125
+ commands << %W(checkout #{target_branch})
126
+ else
127
+ commands << %W(checkout -b #{target_branch})
128
+ commands << %W(push --set-upstream origin #{target_branch})
129
+ end
130
+ end
131
+ end
123
132
 
124
- EXE.multi_exe('git', commands, true)
133
+ commands << %W(remote prune origin)
134
+ commands << %W(fetch)
135
+ commands << %W(rebase)
125
136
 
137
+ EXE.multi_exe('git', commands, true )
126
138
  end
127
139
 
140
+ def self.git_current_branch
141
+ temp = EXE.exe('git', %W(branch))
142
+ temp.scan(/^\*\s(.*)/)[0][0]
143
+ end
128
144
 
129
145
  def self.git_clean
130
146
  EXE.multi_exe('git', [%W(add .), %W(reset --hard)], true)
131
147
  end
132
148
 
149
+ def self.git_detached?
150
+ temp = TYCiCore::EXE.exe('git', %W(status))
151
+ temp.scan(/HEAD detached at/).size > 0
152
+ end
133
153
 
134
- def self.git_branch_exist?(branch)
154
+ def self.git_branch_exist_local?(branch)
135
155
  TYCiCore::EXE.exe('git', %W(rev-parse -q --verify refs/heads/#{branch})).length > 0
136
156
  end
137
157
 
158
+ def self.git_branch_exist_remote?(branch)
159
+ temp = TYCiCore::EXE.exe('git', %W(branch -a))
160
+ temp.scan(/remotes\/origin\/#{branch}/).size > 0
161
+ end
162
+
138
163
  def self.git_has_modify?(str)
139
164
  return str.include?("Changes not staged for commit") || str.include?("Changes to be committed")
140
165
  end
141
166
 
167
+ def self.git_remote_repo_exist?(url)
168
+ `curl -s --head #{url} | grep "HTTP/1.[01] [23].."`.scan(/200 OK/).size > 0
169
+ end
170
+
171
+ def self.git_create_empty_repo_http(name, url)
172
+
173
+ end
174
+
175
+ def self.git_delete_temp_path(name)
176
+ user = ENV["HOME"]
177
+ temp_path = "#{user}/.tuya_git_temp/"
178
+ temp_path_p = "#{temp_path}#{name}"
179
+
180
+ `rm -rf #{temp_path_p}` if File.exist? temp_path_p
181
+ end
182
+
183
+ def self.git_create_empty_repos(name, url)
184
+
185
+ user = ENV["HOME"]
186
+ temp_path = "#{user}/.tuya_git_temp/"
187
+ temp_path_p = "#{temp_path}#{name}"
188
+
189
+ `mkdir -p #{temp_path_p}`
190
+
191
+ FileUtils.cd temp_path_p
192
+
193
+ `touch Readme.md`
194
+
195
+ git_commands = [
196
+ %W(init),
197
+ %W(add -A),
198
+ %W(commit -am init\ #{name}\ by\ tuya-odm),
199
+ %W(remote add origin #{url}),
200
+ %W(push --set-upstream origin master)
201
+ ]
202
+ TYCiCore::EXE.multi_exe('git', git_commands, true)
203
+
204
+ FileUtils.cd temp_path
205
+ end
206
+
142
207
  end
143
208
  end
@@ -0,0 +1,17 @@
1
+ module TYCiCore
2
+ class TuyaLanguageUpdate
3
+ def self.update
4
+ path = './.ci.json'
5
+ if File.exist? path
6
+ config = TYCiCore::Config.new path
7
+ app_version = config.value 'verify_language_symbol.ci_app_version'
8
+ app_id = config.value 'verify_language_symbol.ci_app_id'
9
+ archive = config.value 'verify_language_symbol.archive'
10
+ if archive
11
+ puts TYCiCore::EXE.exe 'python', %W(language.py -a #{app_id} -v #{app_version})
12
+ TYCiCore::EXE.exe 'git', %W(push) if TYCiCore::Git.git_commit_modify 'feat: CI update Language Success'
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,246 @@
1
+ module TYCICore
2
+
3
+ require "tuya/ci/core/git"
4
+ require "tuya/ci/core/podfile"
5
+ require "tuya/ci/core/config/odm_config_modules"
6
+
7
+ class ODMbuild
8
+
9
+ attr_accessor :template_config, :base_branch, :build_branch, :group_name, :group_spec
10
+ def initialize (template_config, default_config=nil)
11
+
12
+ if validate(template_config) # 数据校验通过以后,再进行赋值
13
+ @template_config = template_config # 客户选择的模板的配置信息
14
+
15
+ puts "ODM Builder template is : \n#{@template_config}"
16
+
17
+ @group_name = @template_config["git"]["group"]
18
+ puts "ODM Builder group name is : #{@group_name}"
19
+
20
+ @group_spec = "#{@group_name}Specs"
21
+ group_host= @template_config["git"]["host"]
22
+ @group_spec_url = "#{group_host}/#{@group_name}/#{@group_spec}.git"
23
+ puts "ODM Builder group spec #{@group_spec} #{@group_spec_url}"
24
+
25
+ @base_branch = @template_config["baseBranch"]
26
+ puts "ODM Builder base branch is : #{@base_branch}"
27
+
28
+ @build_branch = @template_config["branchName"]
29
+ puts "ODM Builder target branch is : #{@build_branch}"
30
+
31
+ @default_config = default_config unless default_config.nil? || default_config.empty? # 默认模板的部分配置信息
32
+ if @default_config.nil? || @default_config.empty?
33
+ # 业务类型 1-登录,2-首页,3-场景,4-我的,5-application 100-其他
34
+ @default_config = {
35
+ "1" => {
36
+ "module" => "TYLoginModule2"
37
+ },
38
+ "2" => {
39
+ "module" => "TYSmartHouse",
40
+ "skeleton" => "TYSmartHouseUISkeleton",
41
+ "biz" => "TYSmartHouseBizKit"
42
+ },
43
+ "3" => {
44
+ "module" => "TYSmartSceneModule",
45
+ "biz" => "TYSmartSceneBizKit"
46
+ },
47
+ "4" => {
48
+ "module" => "TYUserCenterModule",
49
+ "biz" => "TYUserCenterBizKit"
50
+ },
51
+ "5" => {
52
+ "module" => "TYSmartApplication"
53
+ }
54
+ }
55
+ end
56
+
57
+ puts "odm builder initial finish".green
58
+ end
59
+ end
60
+
61
+ def validate(config)
62
+ result_bool = false
63
+ if config.nil? || config.empty?
64
+ raise "template_config is empty"
65
+ elsif config["tid"] == 0
66
+ raise "tid is necessary in template_config"
67
+ elsif config["baseBranch"].nil? || config["baseBranch"].empty?
68
+ raise "base branch is necessary in template_config"
69
+ elsif config["branchName"].nil? || config["branchName"].empty?
70
+ raise "branch name is necessary in template_config"
71
+ else
72
+ result_bool = true
73
+ end
74
+ puts "odm prebuild validate success".green if result_bool
75
+ result_bool
76
+ end
77
+
78
+ def build # 开始预编译
79
+ raise "template config is invalid".red if @template_config.nil? || @template_config.empty?
80
+
81
+ # 检查、创建分支
82
+ check_branch()
83
+
84
+ # 根据备份 重置podfile
85
+ reset_podfile()
86
+
87
+ # 根据配置 更新podfile 更新modules.json
88
+ update_podfile_and_moodule_config()
89
+
90
+ # pod update
91
+ pod_update()
92
+
93
+ # 根据pods,生成config_modules.json中的modules部分
94
+
95
+ puts "ODM Builder setup_modules in Pods"
96
+ @module_config.setup_modules()
97
+
98
+ # 更新config_module.json
99
+ @module_config.save()
100
+
101
+
102
+ # if @is_initial
103
+ TYCiCore::Git.git_commit_modify("feat: ODM builder config update")
104
+ TYCiCore::Git.git_push
105
+ puts "ODM builder config commit finish".green
106
+ # end
107
+ end
108
+
109
+ # def test
110
+ # reset_podfile()
111
+ # update_podfile_and_moodule_config()
112
+ # @module_config.save()
113
+ # end
114
+
115
+ def check_branch
116
+ # 切换/创建 分支
117
+ TYCiCore::Git.git_checkout_branch(@base_branch) unless TYCiCore::Git.git_current_branch == @base_branch || TYCiCore::Git.git_current_branch == @build_branch
118
+ TYCiCore::Git.git_checkout_branch(@build_branch) unless TYCiCore::Git.git_current_branch == @build_branch
119
+
120
+ puts "ODM builder checkout branch finish".green
121
+ end
122
+
123
+ def reset_podfile
124
+ podfile_backup_path = "./.podfile_backup"
125
+ podfile_path = "./Podfile"
126
+
127
+ if File.exist? podfile_backup_path
128
+ podfile = File.open(podfile_path, "w")
129
+ podfile << File.read(podfile_backup_path)
130
+ podfile.close
131
+ else
132
+ podfile_backup = File.new(podfile_backup_path, "w")
133
+ podfile_backup << File.read(podfile_path)
134
+ podfile_backup.close
135
+ end
136
+ end
137
+
138
+ def update_podfile_and_moodule_config
139
+ @module_config = TYCiCore::ODMConfigModules.new()
140
+
141
+ @module_config.update_config("scheme", @group_name) unless @group_name.nil? || @group_name.empty?
142
+ @module_config.content["tabs"].clear
143
+
144
+
145
+ podfile = TYCiCore::Podfile.new()
146
+ podfile.source_add(@group_spec_url) unless @group_spec_url.nil? || @group_spec_url.empty?
147
+
148
+ @template_config["groups"].each { |group_info|
149
+ group = group_info["group"] # 模块分组 1-基础模块 2-Tab模块3-自定义模块
150
+ modules = group_info["modules"]
151
+ modules.each { |module_info|
152
+ type = module_info["type"] # 业务类型 1-登录,2-首页,3-场景,4-我的,5-application 100-其他
153
+ name = module_info["name"]
154
+ version = module_info["version"]
155
+ depends = module_info["depends"]
156
+
157
+ if group == 2
158
+ @module_config.content["tabs"] << name
159
+ puts "ODM Builder Add Tabs #{name}"
160
+ end
161
+ if type == 1
162
+ @module_config.content["login"] = name
163
+ elsif type == 5
164
+ @module_config.content["application"] = name
165
+ end
166
+
167
+ default_name = default_module_name(type)
168
+ default_skeleton = default_skeleton_name(type)
169
+
170
+ default_biz = default_biz_kit_name(type) # bizkit暂时不需要移除
171
+
172
+ pod_add_module = (depends.nil? || depends.empty?) ? Array.new : depends
173
+ pod_add_module << {"name" => name, "version" => version}
174
+
175
+ pod_delete_module = Array.new
176
+ pod_delete_module << {"name" => default_skeleton} unless default_skeleton.nil? || default_skeleton.empty?
177
+
178
+
179
+ if !default_name.nil? && !default_name.empty?
180
+ if default_biz.nil? || default_biz.empty?
181
+ # 添加mix,mix到 default模块
182
+ @module_config.add_mix(name, default_name) unless name == default_name
183
+ else
184
+ is_dependency = false
185
+ depends.each {|item|
186
+ if item["name"] == default_biz
187
+ is_dependency = true
188
+ break
189
+ end
190
+ } unless depends.nil? || depends.empty?
191
+ if !is_dependency
192
+ # 添加mix, mix到 biz模块 (可能是基于sdk开发)
193
+ @module_config.add_mix(name, default_biz)
194
+ end
195
+ pod_delete_module << {"name" => default_name}
196
+ end
197
+ end
198
+
199
+ podfile.update(nil, pod_delete_module) unless pod_delete_module.nil? || pod_delete_module.empty? # 确保先删除查,再添加
200
+ podfile.update(pod_add_module, nil) unless pod_add_module.nil? || pod_add_module.empty?
201
+
202
+
203
+ puts "ODM Builder delteModule:#{pod_delete_module} addedModule:#{pod_add_module}".green unless (pod_delete_module.nil? || pod_delete_module.empty?) && (pod_add_module.nil? || pod_add_module.empty?)
204
+ }
205
+ }
206
+
207
+ @module_config.content["tabSelect"] = @module_config.content["tabs"][0] unless @module_config.content["tabs"].nil? || @module_config.content["tabs"].empty?
208
+
209
+ podfile.save
210
+
211
+ puts "ODM builder config update finish".green
212
+ end
213
+
214
+ def pod_update
215
+ if @group_spec_url.nil? || @group_spec_url.empty?
216
+ TYCiCore::EXE.exe('pod', 'update')
217
+ else
218
+ home = ENV["HOME"]
219
+ repo_local = "#{home}/.cocoapods/repos/#{@group_spec}"
220
+ # TYCiCore::EXE.exe('pod', %W'repo add #{@group_spec} #{@group_spec_url}') unless File.exist?repo_local
221
+ if !File.exist?repo_local
222
+ `pod repo add #{@group_spec} #{@group_spec_url}`
223
+ end
224
+
225
+ pod_commands = [
226
+ %W(repo update #{@group_spec}),
227
+ %W(update --no-repo-update)
228
+ ]
229
+ TYCiCore::EXE.multi_exe('pod', pod_commands, true)
230
+
231
+ puts "ODM builder pod update finish".green
232
+ end
233
+ end
234
+
235
+
236
+ def default_module_name(type) # 根据所给type,返回默认模块名
237
+ @default_config[type.to_s]["module"] unless @default_config[type.to_s].nil? || @default_config[type.to_s].empty?
238
+ end
239
+ def default_skeleton_name(type) # 根据所给type,返回默认模块的骨架名
240
+ @default_config[type.to_s]["skeleton"] unless @default_config[type.to_s].nil? || @default_config[type.to_s].empty?
241
+ end
242
+ def default_biz_kit_name(type) # 根据所给type,返回默认模块的biz名
243
+ @default_config[type.to_s]["biz"] unless @default_config[type.to_s].nil? || @default_config[type.to_s].empty?
244
+ end
245
+ end
246
+ end
@@ -12,6 +12,9 @@ module TYCiCore
12
12
  # 3. 对于普通的Project 新增组件将只应用到第一个target
13
13
  # 4. 对Pod有封装的target 方法名约定为 pod_install, 新增组件将只应用到该方法
14
14
  #
15
+
16
+ require 'tuya/ci/core/util/file'
17
+
15
18
  class Podfile
16
19
 
17
20
  PODFILE_TARGET_METHOD = 'pod_install'
@@ -39,6 +42,21 @@ module TYCiCore
39
42
  @content.gsub!(/#{replace_old}/, replace_new)
40
43
  end
41
44
 
45
+ def source_exist(source)
46
+ TYUtil::TYFile.line_contain_content(@content, source) > 0
47
+ end
48
+
49
+ def source_add(source)
50
+ if source.nil? || source.empty?
51
+ puts "source is empty".red
52
+ elsif source_exist(source)
53
+ puts "source #{source} alread exist".yellow
54
+ else
55
+ line = TYUtil::TYFile.line_contain_content(@content, "source")
56
+ TYUtil::TYFile.add_to_line(@content, "source '#{source}'", line)
57
+ end
58
+ end
59
+
42
60
  def update(updates, deletes)
43
61
 
44
62
  puts "Podfile must contain at least one target".red unless @main_target
@@ -52,7 +70,8 @@ module TYCiCore
52
70
 
53
71
  def save
54
72
 
55
- puts "Podspec: #{@file} saved".green
73
+ puts "Podfile: #{@file} saved".green
74
+ puts "Podfile content is: \n #{@content}".green
56
75
 
57
76
  fh = File.new(@file, "w")
58
77
  fh.puts @content
@@ -90,14 +109,13 @@ module TYCiCore
90
109
  deletes.each do |delete|
91
110
  json = JSON.parse(JSON(delete))
92
111
  name = json["name"]
93
- @content.gsub!(/\s*pod\s*'#{name}(.*)'$/, "")
112
+ @content.gsub!(/^\s*pod\s*'#{name}'(.*)$/, "")
94
113
  end
95
114
 
96
115
  end
97
116
 
98
117
  def update_update_pods(updates, append_modules)
99
118
  updates.each do |update|
100
-
101
119
  json = JSON.parse(JSON(update))
102
120
  name = json["name"]
103
121
  version = json["version"]
@@ -13,32 +13,62 @@ module TYCiCore
13
13
 
14
14
  raise 'podspec cannot be nil' unless podspec
15
15
 
16
+ @podspec_json = podspec_json? podspec
16
17
  @file = TYUtil::TYFile.podspec_files(podspec)[0]
17
18
  @content = File.read(@file)
19
+ end
20
+
21
+ def value_key(key)
22
+ if @podspec_json
23
+ content_json = JSON @content
24
+ else
25
+ content_temp = TYCiCore::EXE.exe 'pod', %W(ipc spec #{@file}), true
26
+
27
+ content_temp = content_temp.match(/^\{.*\}$/m)[0]
28
+ puts content_temp
18
29
 
30
+ content_json = JSON content_temp
31
+ end
32
+ eval("content_json" << key.split('/').map { |i| "[\"" + i + "\"]" }.join) if content_json
19
33
  end
20
34
 
21
35
  def update(key, value)
36
+ unless @podspec_json
37
+ puts "Podspec: #{@file} update key: #{key} value: #{value}".green
22
38
 
23
- puts "Podspec: #{@file} update key: #{key} value: #{value}".green
39
+ res = @content.scan(/.#{key}\s*=\s*'#{value}'/)
40
+ need_update = res.size == 0
41
+ if need_update
42
+ @content.gsub!(/s.#{key}\s*=(.*?)'$/, "s.#{key} = '#{value}'")
43
+ end
44
+ need_update
45
+ end
46
+ end
24
47
 
25
- res = @content.scan(/.#{key}\s*=\s*'#{value}'/)
26
- need_update = res.size == 0
27
- if need_update
28
- @content.gsub!(/s.#{key}\s*=(.*?)'$/, "s.#{key} = '#{value}'")
48
+ def update_add(key, value, output=true)
49
+ unless @podspec_json
50
+ puts "Podspec: #{@file} update_add key: #{key} value: #{value}".green if output
51
+ res = @content.scan(/.#{key}\s*=\s*/)
52
+ key_is_exist = res.size == 0
53
+ puts key_is_exist
54
+ if key_is_exist
55
+ @content = TYUtil::TYFile.add_to_line @content, value, 8
56
+ else
57
+ @content.gsub!(/s.#{key}\s*=(.*?)'$/, "s.#{key} = #{value}")
58
+ end
59
+ key_is_exist
29
60
  end
30
- need_update
31
61
  end
32
62
 
33
63
  def save
34
-
35
64
  puts "Podspec: #{@file} saved".green
36
-
37
65
  fh = File.new(@file, "w")
38
66
  fh.puts @content
39
67
  fh.close
40
68
  end
41
69
 
70
+ def podspec_json?(podspec)
71
+ podspec.scan(/podspec.json$/).size > 0
72
+ end
42
73
  end
43
-
44
74
  end
@@ -0,0 +1,44 @@
1
+ require 'open-uri'
2
+
3
+ module TYCiCore
4
+
5
+ class RepoRelease
6
+
7
+ def release(module_name, version)
8
+ puts "Ready to release #{module_name} : #{version}".green
9
+
10
+ config = RepoReleaseCIConfig.new module_name, version
11
+
12
+ config.config.each do |item|
13
+ release_item item
14
+ end
15
+
16
+ end
17
+
18
+ def release_item(item)
19
+ item.ready
20
+ if item_lint item
21
+ repo_release_git = RepoReleaseGit.new
22
+ repo_release_git.prepare item
23
+ # download_release_content item
24
+ end
25
+ end
26
+
27
+ def download_release_content(item)
28
+ podspec = TYCiCore::PodSpec.new item.podspec
29
+ url = podspec.value_key 'source/http'
30
+ zip_path = TYCiCore::TYDownload.download url, url.split('/')[-1]
31
+
32
+ TYUtil::TYFile.unzip zip_path, './tmp'
33
+ TYUtil::TYFile.delete zip_path
34
+
35
+ end
36
+
37
+ def item_lint(item)
38
+ exist = File.exist? item.podspec
39
+ puts "#{item.podspec} is not exist".red unless exist
40
+ lint_result = exist
41
+ lint_result
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,48 @@
1
+ module TYCiCore
2
+ class SpecODM
3
+
4
+ attr_accessor :repo, :repo_url, :module_name, :module_version
5
+
6
+ def initialize(repo, repo_url, module_name, module_version)
7
+ @repo = repo
8
+ @repo_url = repo_url
9
+ @module_name = module_name
10
+ @module_version = module_version
11
+
12
+ home = ENV["HOME"]
13
+ # /Users/dong/.cocoapods/repos/TYSpecs/Specs/TestDemo/12.0.8
14
+ @repo_path = "#{home}/.cocoapods/repos/#{@repo}"
15
+ # @repo_module_path = "#{@repo_path}/Specs/#{@module_name}/#{module_version}/"
16
+ @repo_module_path = "#{@repo_path}/#{@module_name}/#{module_version}/"
17
+ end
18
+
19
+ def odm_config
20
+ add_repo unless spec_exist?
21
+ repo_update
22
+ podspec_des
23
+ end
24
+
25
+ def add_repo
26
+ TYCiCore::EXE.exe 'pod', %W(repo add #{@repo} #{@repo_url})
27
+ end
28
+
29
+ def podspec_des
30
+ podspec_path = "#{@repo_module_path}#{@module_name}.podspec"
31
+ puts "ODM #{module_name}'s podspec path is #{podspec_path}".yellow
32
+
33
+ podspec = TYCiCore::PodSpec.new podspec_path
34
+ podspec.value_key 'summary'
35
+ end
36
+
37
+ def repo_update
38
+ puts "ODM pod repo update #{@repo}".yellow
39
+ TYCiCore::EXE.exe 'pod', %W(repo update #{@repo})
40
+ end
41
+
42
+ def spec_exist?
43
+ result = File.exist? @repo_path
44
+ puts "ODM repo: #{@repo} exist? #{result}".yellow
45
+ result
46
+ end
47
+ end
48
+ end