cocoapods-dev-env 2.0.2 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87f011b42c1df26a04c8ac866532a91eef0f0d7e1d854bf97e369714107c0844
4
- data.tar.gz: 9befa3b3fe9f53aa5adbd201be02fa44d33ff48b56bada40c433e90235706f0d
3
+ metadata.gz: 4a038dfb3ff16131336b6a19559894287912a3f6ced0744c49a86c652cd1ddaa
4
+ data.tar.gz: ad4a7ed1a167fe98f917d8fd0c88043e5044feac82b43f20caa876f35a6bb11e
5
5
  SHA512:
6
- metadata.gz: ce2e9238b1dfb6dad9ce583adb3b9cd61bf7744e91e376dd51dfd7a516d2cbe1c8f95b2469a212c41d4b1f9cbb4be9f915f9ccb0d0b2055f52ff140fa23fe069
7
- data.tar.gz: 7d30f8dd72ef7bc78625f144e5fdd517c10f55ffec6c6985ae00fe9023673d3c6132f8cca17908f350c2bf15e55845769c684c606d729a2932ed2f5073c69f03
6
+ metadata.gz: 9aca16d5799bd66c625a996fff9bdb1d77ea5b54509403fadf000c9f4cea43d7fbc6cb2f593d3aa81a41465f5edd0cfe647c3d86da2105bdac5960238abc5f7d
7
+ data.tar.gz: 3eb99069ed6078dc8b66c912d3270abaa30a59ba704e384d7603882bde181d1a8022697e7e9fff7366f4d735744a988af65d290c3a733cb97b6572b26cff1668
data/Gemfile.lock CHANGED
@@ -1,12 +1,113 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocoapods-dev-env (2.0.2)
4
+ cocoapods-dev-env (2.1.8)
5
+ luna-binary-uploader
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
8
9
  specs:
10
+ CFPropertyList (3.0.5)
11
+ rexml
12
+ activesupport (6.1.4.6)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ zeitwerk (~> 2.3)
18
+ addressable (2.8.0)
19
+ public_suffix (>= 2.0.2, < 5.0)
20
+ algoliasearch (1.27.5)
21
+ httpclient (~> 2.8, >= 2.8.3)
22
+ json (>= 1.5.1)
23
+ atomos (0.1.3)
24
+ claide (1.1.0)
25
+ cocoapods (1.11.2)
26
+ addressable (~> 2.8)
27
+ claide (>= 1.0.2, < 2.0)
28
+ cocoapods-core (= 1.11.2)
29
+ cocoapods-deintegrate (>= 1.0.3, < 2.0)
30
+ cocoapods-downloader (>= 1.4.0, < 2.0)
31
+ cocoapods-plugins (>= 1.0.0, < 2.0)
32
+ cocoapods-search (>= 1.0.0, < 2.0)
33
+ cocoapods-trunk (>= 1.4.0, < 2.0)
34
+ cocoapods-try (>= 1.1.0, < 2.0)
35
+ colored2 (~> 3.1)
36
+ escape (~> 0.0.4)
37
+ fourflusher (>= 2.3.0, < 3.0)
38
+ gh_inspector (~> 1.0)
39
+ molinillo (~> 0.8.0)
40
+ nap (~> 1.0)
41
+ ruby-macho (>= 1.0, < 3.0)
42
+ xcodeproj (>= 1.21.0, < 2.0)
43
+ cocoapods-core (1.11.2)
44
+ activesupport (>= 5.0, < 7)
45
+ addressable (~> 2.8)
46
+ algoliasearch (~> 1.0)
47
+ concurrent-ruby (~> 1.1)
48
+ fuzzy_match (~> 2.0.4)
49
+ nap (~> 1.0)
50
+ netrc (~> 0.11)
51
+ public_suffix (~> 4.0)
52
+ typhoeus (~> 1.0)
53
+ cocoapods-deintegrate (1.0.5)
54
+ cocoapods-disable-podfile-validations (0.1.1)
55
+ cocoapods-downloader (1.5.1)
56
+ cocoapods-generate (2.0.1)
57
+ cocoapods-disable-podfile-validations (~> 0.1.1)
58
+ cocoapods-imy-bin (0.3.1.3)
59
+ cocoapods
60
+ cocoapods-generate (~> 2.0.0)
61
+ parallel
62
+ cocoapods-plugins (1.0.0)
63
+ nap
64
+ cocoapods-search (1.0.1)
65
+ cocoapods-trunk (1.6.0)
66
+ nap (>= 0.8, < 2.0)
67
+ netrc (~> 0.11)
68
+ cocoapods-try (1.2.0)
69
+ colored2 (3.1.2)
70
+ concurrent-ruby (1.1.9)
71
+ escape (0.0.4)
72
+ ethon (0.14.0)
73
+ ffi (>= 1.15.0)
74
+ ffi (1.15.3)
75
+ fourflusher (2.3.1)
76
+ fuzzy_match (2.0.4)
77
+ gh_inspector (1.1.3)
78
+ gli (2.19.0)
79
+ httpclient (2.8.3)
80
+ i18n (1.9.1)
81
+ concurrent-ruby (~> 1.0)
82
+ json (2.5.1)
83
+ luna-binary-uploader (0.1.26)
84
+ cocoapods
85
+ cocoapods-generate (~> 2.0.1)
86
+ cocoapods-imy-bin (= 0.3.1.3)
87
+ gli (= 2.19.0)
88
+ parallel
89
+ minitest (5.15.0)
90
+ molinillo (0.8.0)
91
+ nanaimo (0.3.0)
92
+ nap (1.1.0)
93
+ netrc (0.11.0)
94
+ parallel (1.21.0)
95
+ public_suffix (4.0.6)
9
96
  rake (10.5.0)
97
+ rexml (3.2.5)
98
+ ruby-macho (2.5.1)
99
+ typhoeus (1.4.0)
100
+ ethon (>= 0.9.0)
101
+ tzinfo (2.0.4)
102
+ concurrent-ruby (~> 1.0)
103
+ xcodeproj (1.21.0)
104
+ CFPropertyList (>= 2.3.3, < 4.0)
105
+ atomos (~> 0.1.3)
106
+ claide (>= 1.0.2, < 2.0)
107
+ colored2 (~> 3.1)
108
+ nanaimo (~> 0.3.0)
109
+ rexml (~> 3.2.4)
110
+ zeitwerk (2.5.4)
10
111
 
11
112
  PLATFORMS
12
113
  ruby
@@ -17,4 +118,4 @@ DEPENDENCIES
17
118
  rake (~> 10.0)
18
119
 
19
120
  BUNDLED WITH
20
- 2.1.4
121
+ 2.2.20
data/README.md CHANGED
@@ -42,6 +42,14 @@ Finally the state clean submodule will be removed automatically.
42
42
  3. When you define "dev_env" to "release", and run ```pod install``` .
43
43
  We want to use the release version in cocoapods repo. And do many check for state, and help you to release the not released pod.
44
44
 
45
+ 新增功能: 支持读取宿主工程的Podfile.lock文件,来获取宿主工程中的依赖,无需在单独的库的example工程中引用对应的pod
46
+ 此功能默认开启, 等同于在顶部写入如下配置: use_parent_lock_info!
47
+ 关闭方法 use_parent_lock_info! false
48
+ 宿主工程路径默认为"../../../"(因为默认放到developing_pods子文件夹下,对应的库文件夹下的Example文件夹下,故需要回溯三层)
49
+ 配置宿主工程相对路径的方法 use_parent_lock_info! :path => '../'
50
+ 暂不支持配置绝对路径,未来也不建议配置绝对路径指向固定的位置
51
+
52
+
45
53
 
46
54
  ## Development
47
55
 
@@ -0,0 +1,21 @@
1
+ {
2
+ "folders": [
3
+ {
4
+ "path": "."
5
+ }
6
+ ],
7
+ "settings": {
8
+ "ruby.useBundler": true, //run non-lint commands with bundle exec
9
+ "ruby.useLanguageServer": true, // use the internal language server (see below)
10
+ "ruby.lint": {
11
+ "rubocop": {
12
+ "useBundler": false // enable rubocop via bundler
13
+ }
14
+ },
15
+ "ruby.format": "rubocop",
16
+ "ruby.codeCompletion": "rcodetools",
17
+ "ruby.intellisense": "rubyLocate",
18
+ "editor.formatOnPaste": true,
19
+ "editor.formatOnSave": true, // use rubocop for formatting
20
+ }
21
+ }
@@ -1,7 +1,7 @@
1
1
  module Cocoapods
2
2
  module Dev
3
3
  module Env
4
- VERSION = "2.0.2"
4
+ VERSION = '2.2.1'
5
5
  end
6
6
  end
7
7
  end
@@ -1,485 +1,3 @@
1
- require "file_processer"
2
- require "luna-binary-uploader"
3
-
4
- Pod::HooksManager.register('cocoapods-dev-env', :pre_install) do |installer|
5
- podfile = installer.podfile
6
- #puts installer.instance_variables
7
- # forbidden submodule not cloned
8
- # 会引起submodule HEAD回滚,不靠谱,先注释掉
9
- # `
10
- # git submodule update --init --recursive
11
- # `
12
- end
13
-
14
- Pod::HooksManager.register('cocoapods-dev-env', :post_install) do |installer|
15
- #puts installer.instance_variables
16
- end
17
-
18
-
19
- $processedPodsState = Hash.new
20
- $processedPodsOptions = Hash.new
21
-
22
- module Pod
23
- class DevEnv
24
- def self.keyword
25
- :dev_env # 'dev'/'beta'/'release'
26
- end
27
- def self.binary_key
28
- :dev_env_use_binary # true / false
29
- end
30
- UI.message "🎉 plugin cocoapods-dev-env loaded 🎉".green
31
- end
32
- class Podfile
33
- class TargetDefinition
34
- attr_reader :binary_repo_url
35
- attr_reader :binary_source
36
-
37
- def searchAndOpenLocalExample(path)
38
- _currentDir = Dir.pwd
39
- Dir.chdir(path)
40
- Dir.chdir("Example")
41
- `pod install`
42
- projPaths = Dir::glob("*.xcworkspace")
43
- if projPaths.count > 0
44
- `open -a Terminal ./`
45
- `open #{projPaths[0]}`
46
- end
47
- Dir.chdir(_currentDir)
48
- end
49
-
50
- def checkAndRemoveSubmodule(path)
51
- _currentDir = Dir.pwd
52
- Dir.chdir(path)
53
- output = `git status -s`
54
- puts output
55
- if output.length == 0
56
- output = `git status`
57
- if output.include?("push")
58
- raise "submodule #{path} 移除失败,有推送的修改"
59
- end
60
- else
61
- raise "submodule #{path} 移除失败,有未提交的修改"
62
- end
63
- Dir.chdir(_currentDir)
64
- `
65
- git submodule deinit #{path}
66
- rm -rf #{path}
67
- git rm #{path}
68
- `
69
- end
70
-
71
- def checkTagIsEqualToHead(tag, path)
72
- _currentDir = Dir.pwd
73
- Dir.chdir(path)
74
- result = `git describe --abbrev=4 HEAD`
75
- Dir.chdir(_currentDir)
76
- if result.include?(tag)
77
- return true
78
- else
79
- return checkTagOrBranchIsEqalToHead(tag, path)
80
- end
81
- end
82
-
83
- # 这个函数有问题有时候拿不到相同的commit id
84
- def checkTagOrBranchIsEqalToHead(branchOrTag, path)
85
- _currentDir = Dir.pwd
86
- Dir.chdir(path)
87
- headCommitID = `git rev-parse HEAD`
88
- tagCommitID = `git rev-parse #{branchOrTag}`
89
- UI.puts "#{`pwd`} headCommitID:#{headCommitID} \n #{branchOrTag}ComitID:#{tagCommitID}"
90
- Dir.chdir(_currentDir)
91
- return (headCommitID.length > 0 && headCommitID == tagCommitID)
92
- end
93
-
94
- def checkGitStatusAndPush(pod_name)
95
- output = `git status -s`
96
- puts output
97
- if output.length == 0
98
- output = `git status`
99
- if output.include?("push")
100
- ret = system("git push")
101
- if ret != true
102
- raise "💔 #{pod_name.yellow} push 失败"
103
- end
104
- end
105
- else
106
- raise "💔 #{pod_name.yellow} 有未提交的数据"
107
- end
108
- end
109
-
110
- def checkRemoteTagExist(tag)
111
- `git push --tags`
112
- ret = system("git ls-remote --exit-code origin refs/tags/#{tag}")
113
- return ret
114
- end
115
-
116
- def addGitTagAndPush(tag, pod_name)
117
- ret = system("git tag #{tag}")
118
- if ret == true
119
- ret = system("git push origin #{tag}")
120
- if ret != true
121
- raise "💔 #{pod_name.yellow} push tag 失败"
122
- end
123
- end
124
- return ret
125
- end
126
-
127
- def inputNeedJumpForReson(str)
128
- if ARGV.include? '--silent'
129
- return false
130
- end
131
-
132
- puts str.green
133
- puts '是(Y), 任意其他输入或直接回车跳过'.green
134
- input = STDIN.gets
135
- if input[0,1] == "Y"
136
- return true
137
- else
138
- return false
139
- end
140
- end
141
-
142
- def getReposStrForLint()
143
- if podfile.sources.size == 0
144
- return ""
145
- end
146
- str = " --sources="
147
- podfile.sources.each do |source|
148
- str += source
149
- str += ","
150
- end
151
- UI.puts str
152
- return str
153
- end
154
-
155
- def getUserRepoAddress()
156
- if podfile.sources.size == 0
157
- raise "💔 发布release必须配置仓库的地址, e.g.: source 'https://github.com/CocoaPods/Specs.git'"
158
- end
159
- index = nil
160
- begin
161
- UI.puts "\n\n⌨️ 请输入要发布到的cocoapods仓库序号, 按回车确认: ".yellow
162
- num = 1
163
- podfile.sources.each do |source|
164
- UI.puts "#{num.to_s.yellow}. #{source.green}"
165
- num += 1
166
- end
167
- index = STDIN.gets.to_i - 1
168
- end until (index >= 0 && index < podfile.sources.size)
169
- source = podfile.sources[index]
170
- UI.puts "#{"选择了发布到: ".yellow}. #{source.green}(#{index + 1})"
171
- return source
172
- end
173
-
174
- def changeVersionInCocoapods(name, newVersion)
175
- if (newVersion == nil)
176
- UI.puts "💔 切换版本号的版本现在为空,无法设置版本号".yellow
177
- return
178
- end
179
- newVersion = get_pure_version(newVersion)
180
- specName = name + ".podspec"
181
- FileProcesserManager.new(specName,
182
- [
183
- FileProcesser.new(-> (fileContent) {
184
- return fileContent.gsub(/(\.version *= *')(.*')/, "\\1" + newVersion + "'")
185
- })
186
- ]).process()
187
- `git add #{specName}
188
- git commit -m "Mod: 修改版本号为:#{newVersion} by cocoapods_dev_env plugin"`
189
- end
190
-
191
- ## --- option for setting using prebuild framework ---
192
-
193
- def parse_pod_dev_env(name, requirements)
194
- options = requirements.last
195
- pod_name = Specification.root_name(name)
196
- last_options = $processedPodsOptions[pod_name]
197
-
198
- if (last_options != nil)
199
- UI.message "#{name.green} use last_options: #{last_options.to_s.green}"
200
- if options != nil && options.is_a?(Hash)
201
- requirements[requirements.length - 1] = last_options
202
- else
203
- requirements.push(last_options)
204
- end
205
- elsif options.is_a?(Hash)
206
- use_binary = options.delete(Pod::DevEnv::binary_key)
207
- dev_env = options.delete(Pod::DevEnv::keyword)
208
-
209
- deal_dev_env_with_options(dev_env, options, pod_name, name, requirements)
210
- if dev_env != 'dev'
211
- binary_processer(dev_env, pod_name, use_binary, options, requirements)
212
- end
213
-
214
-
215
- if dev_env || use_binary
216
- $processedPodsOptions[pod_name] = options.clone
217
- requirements.pop if options.empty?
218
- end
219
- end
220
- end
221
-
222
- def deal_dev_env_with_options(dev_env, options, pod_name, name, requirements)
223
- if dev_env == nil
224
- return
225
- end
226
- UI.message "pod #{name.green} dev-env: #{dev_env.green}"
227
- git = options.delete(:git)
228
- branch = options.delete(:branch)
229
- tag = options.delete(:tag)
230
- path = options.delete(:path)
231
- if path == nil
232
- path = "./developing_pods/#{pod_name}"
233
- end
234
- if git == nil || git.length == 0
235
- raise "💔 #{pod_name.yellow} 未定义:git => 'xxx'库地址"
236
- end
237
- if branch == nil || branch.length == 0
238
- raise "💔 #{pod_name.yellow} 未定义:branch => 'xxx'"
239
- end
240
- if tag == nil || tag.length == 0
241
- raise "💔 #{pod_name.yellow} 未定义:tag => 'xxx', tag 将会作为 dev模式下载最新代码检查的依据,beta模式引用的tag 以及 release模式引用的版本号"
242
- end
243
-
244
- if dev_env == 'subtree'
245
- if !File.directory?(path)
246
- _toplevelDir = `git rev-parse --show-toplevel`
247
- _currentDir = `pwd`
248
- _subtreeDir = path
249
- if _currentDir != _toplevelDir
250
- Dir.chdir(_toplevelDir)
251
- _end = path
252
- if _end[0,2] == './'
253
- _end = _end[1, _end.length - 1]
254
- else
255
- _end = '/' + _end
256
- end
257
- _subtreeDir = './' + _currentDir[_toplevelDir.length, _currentDir.length - _toplevelDir.length] + path
258
- end
259
- _cmd = "git subtree add --prefix #{_subtreeDir} #{git} #{branch} --squash"
260
- UI.puts _cmd
261
- system(_cmd)
262
- Dir.chdir(_currentDir)
263
- end
264
- options[:path] = path
265
- if requirements.length >= 2
266
- requirements.delete_at(0)
267
- end
268
- UI.message "pod #{pod_name.green} enabled #{"subtree".green}-mode 🍺"
269
- elsif dev_env == 'dev'
270
- # 开发模式,使用path方式引用本地的submodule git库
271
- if !File.directory?(path)
272
- UI.puts "add submodule for #{pod_name.green}".yellow
273
- _cmd = "git submodule add --force -b #{branch} #{git} #{path}"
274
- UI.puts _cmd
275
- system(_cmd)
276
-
277
- _currentDir = Dir.pwd
278
- Dir.chdir(path)
279
-
280
- curGitRemoteUrl = `git remote get-url origin`.rstrip()
281
- if curGitRemoteUrl == git
282
- _cmd = "git reset --hard"
283
- UI.puts _cmd
284
- system(_cmd)
285
- end
286
- Dir.chdir(_currentDir)
287
-
288
- # if inputNeedJumpForReson("本地库#{pod_name} 开发模式加载完成,是否自动打开Example工程")
289
- # searchAndOpenLocalExample(path)
290
- # end
291
- if !checkTagIsEqualToHead(tag, path) && !checkTagIsEqualToHead("#{tag}_beta", path)
292
- raise "💔 #{pod_name.yellow} branch:#{branch.yellow} 与 tag:#{tag.yellow}[_beta] 内容不同步,请自行确认所用分支和tag后重新执行 pod install"
293
- end
294
- else
295
- # if inputNeedJumpForReson("本地库#{pod_name} 处于开发模式,是否自动打开Example工程")
296
- # searchAndOpenLocalExample(path)
297
- # end
298
- end
299
- options[:path] = path
300
- if requirements.length >= 2
301
- requirements.delete_at(0)
302
- end
303
- UI.message "pod #{pod_name.green} enabled #{"dev".green}-mode 🍺"
304
- elsif dev_env == 'beta'
305
- # Beta模式,使用tag引用远端git库的代码
306
- originTag = tag
307
- tag = "#{tag}_beta"
308
- if File.directory?(path)
309
- # 从Dev模式刚刚切换过来,需要打tag并且push
310
- UI.puts "release beta-version for #{pod_name.green}".yellow
311
- _currentDir = Dir.pwd
312
- Dir.chdir(path)
313
- # 已经进入到podspec的文件夹中了
314
- checkGitStatusAndPush(pod_name) # push一下
315
- ret = checkRemoteTagExist(tag)
316
- if ret == true
317
- # tag已经存在,要么没改动,要么已经手动打过tag,要么是需要引用老版本tag的代码
318
- if checkTagOrBranchIsEqalToHead(tag, "./")
319
- UI.puts "#{pod_name.green} 检测到未做任何调整,或已手动打过Tag"
320
- else
321
- if !inputNeedJumpForReson("是否跳过beta发布并删除本地submodule(直接引用远端库)")
322
- raise "💔 #{pod_name.yellow} tag:#{tag.yellow} 已存在, 且与当前Commit不对应. 请确认拉到本地之后已经在podfile中手动修改tag版本号"
323
- end
324
- end
325
- else
326
- # tag不存在,
327
- changeVersionInCocoapods(pod_name, originTag)
328
- checkGitStatusAndPush(pod_name) # 再push一下
329
- addGitTagAndPush(tag, pod_name)
330
- end
331
- Dir.chdir(_currentDir)
332
- checkAndRemoveSubmodule(path)
333
- end
334
- options[:git] = git
335
- options[:tag] = tag
336
- if requirements.length >= 2
337
- requirements.delete_at(0)
338
- end
339
- UI.message "enabled #{"beta".green}-mode for #{pod_name.green}"
340
- elsif dev_env == 'release'
341
- # Release模式,直接使用远端对应的版本
342
- if File.directory?(path)
343
- UI.puts "release release-version for #{pod_name.green}".yellow
344
- _currentDir = Dir.pwd
345
- Dir.chdir(path)
346
- verboseParamStr = ""
347
- if Config.instance.verbose
348
- verboseParamStr = " --verbose"
349
- end
350
- ret = system("pod lib lint --skip-import-validation --fail-fast --allow-warnings#{getReposStrForLint()}#{verboseParamStr}")
351
- if ret != true
352
- raise "💔 #{pod_name.yellow} lint 失败"
353
- end
354
- checkGitStatusAndPush(pod_name)
355
- changeVersionInCocoapods(pod_name, tag)
356
- checkGitStatusAndPush(pod_name)
357
- ret = addGitTagAndPush(tag, pod_name)
358
- if ret == false
359
- if checkTagOrBranchIsEqalToHead(tag, "./")
360
- UI.puts "#{pod_name.green} 已经打过tag".yellow
361
- else
362
- raise "💔 #{pod_name.yellow} tag:#{tag.yellow} 已存在, 请确认已经手动修改tag版本号"
363
- end
364
- end
365
- ## TODO:: 发布到的目标库名称需要用变量设置
366
- repoAddrs = getUserRepoAddress()
367
- cmd = "pod repo push #{repoAddrs} #{pod_name}.podspec --skip-import-validation --allow-warnings --use-modular-headers#{getReposStrForLint()}#{verboseParamStr}"
368
- UI.puts cmd.green
369
- ret = system(cmd)
370
- if ret != true
371
- raise "💔 #{pod_name.yellow} 发布失败"
372
- end
373
- ## 到最后统一执行,判断如果当次release过
374
- `pod repo update`
375
- Dir.chdir(_currentDir)
376
- checkAndRemoveSubmodule(path)
377
- end
378
- if requirements.length < 2
379
- requirements.insert(0, "#{get_pure_version(tag)}")
380
- end
381
- UI.message "enabled #{"release".green}-mode for #{pod_name.green}"
382
- else
383
- raise "💔 :dev_env 必须要设置成 dev/beta/release之一,不接受其他值"
384
- end
385
- end
386
-
387
- def binary_processer(dev_env, pod_name, use_binary, options, requirements)
388
- if use_binary && use_binary == true
389
- if options[:tag] != nil
390
- begin
391
- version = get_pure_version(options[:tag])
392
- spec = binary_source.specification_path(pod_name, Version.new(version))
393
- if spec
394
- if requirements.length < 2
395
- options.delete(:git)
396
- options.delete(:path)
397
- options.delete(:tag)
398
- options[:source] = binary_repo_url
399
- requirements.insert(0, "#{version}")
400
- else
401
- UI.puts "pod '#{pod_name}' :tag => #{options[:tag]} version: #{version} 对应的版本,但是已经标记版本号#{requirements}, 不知道用哪个".red
402
- end
403
- else
404
- UI.puts "pod '#{pod_name}' :tag => #{options[:tag]} version: #{version} 没有找到: tag 对应的版本".red
405
- end
406
- rescue => exception
407
- UI.puts "pod '#{pod_name}' :tag => #{options[:tag]} version: #{version} 没有找到: tag 对应的版本".red
408
- else
409
-
410
- end
411
- else
412
- options.delete(:git)
413
- options.delete(:path)
414
- options.delete(:tag)
415
- options[:source] = binary_repo_url
416
- end
417
-
418
- else
419
- if options[:source] == nil
420
- begin
421
- sources = find_pod_repos(pod_name).sources.select{|item| item.url.downcase != binary_repo_url.downcase } if options.empty?
422
- if sources != nil
423
- if sources.length >= 2
424
- UI.puts "#{pod_name.green} 有多个source #{sources}".yellow
425
- source_url = sources.detect{|item| item.url.downcase != Pod::TrunkSource::TRUNK_REPO_URL.downcase && item.url.downcase != "https://github.com/CocoaPods/Specs.git".downcase}.url
426
- else
427
- source_url = sources.first.url
428
- end
429
- end
430
- options[:source] = source_url if source_url != nil
431
- rescue => exception
432
- UI.puts "#{pod_name} exception:#{exception}".red
433
- else
434
-
435
- end
436
- end
437
- end
438
- UI.puts "#{pod_name.green} :source=> #{options[:source].green} by cocoapods-dev-env" if options[:source] != nil
439
- UI.message "#{pod_name.yellow} options #{options} by cocoapods-dev-env" if options[:source] != nil
440
- UI.message "#{pod_name.yellow} requirements #{requirements} by cocoapods-dev-env" if options[:source] != nil
441
- end
442
-
443
- def binary_repo_url
444
- if @binary_repo_url == nil
445
- @binary_repo_url = Luna::Binary::Common.instance.binary_repo_url #从luna-binary-uploader里获取binary_repo_url
446
- end
447
- return @binary_repo_url
448
- end
449
-
450
- def binary_source
451
- if @binary_source == nil
452
- @binary_source = Pod::Config.instance.sources_manager.all.detect{|item| item.url.downcase == binary_repo_url.downcase}
453
- end
454
- return @binary_source
455
- end
456
-
457
- def get_pure_version(version)
458
- return version.split.last.scan(/\d+/).join('.')
459
- end
460
-
461
- def find_pod_repos(pod_name) #等同pod search
462
- sets = Pod::Config.instance.sources_manager.search_by_name(pod_name)
463
- if sets.count == 1
464
- set = sets.first
465
- elsif sets.map(&:name).include?(pod_name)
466
- set = sets.find { |s| s.name == pod_name }
467
- else
468
- names = sets.map(&:name) * ', '
469
- raise Informative, "More than one spec found for '#{pod_name}':\n#{names}"
470
- end
471
- return set
472
- end
473
-
474
- # ---- patch method ----
475
- # We want modify `store_pod` method, but it's hard to insert a line in the
476
- # implementation. So we patch a method called in `store_pod`.
477
- old_method = instance_method(:parse_inhibit_warnings)
478
-
479
- define_method(:parse_inhibit_warnings) do |name, requirements|
480
- parse_pod_dev_env(name, requirements)
481
- old_method.bind(self).(name, requirements)
482
- end
483
- end
484
- end
485
- end
1
+ require 'dev_env_entry'
2
+ require 'resolver_binary'
3
+ require 'resolver_universal_dependency'