cocoapods-bin 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +23 -13
- data/lib/cocoapods-bin/command/bin/init.rb +1 -1
- data/lib/cocoapods-bin/config/config.rb +32 -8
- data/lib/cocoapods-bin/config/config_asker.rb +10 -5
- data/lib/cocoapods-bin/gem_version.rb +1 -1
- data/lib/cocoapods-bin/helpers/spec_creator.rb +1 -1
- data/lib/cocoapods-bin/native/resolver.rb +6 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '099b776f3a313bc711cd177c6d0f2e8d6093ca5b'
|
4
|
+
data.tar.gz: c248bed6b96f9d7ab0c1f1b1a2beb39791ba6de8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94a788389b9f95791a8306f53877b152941874c54ef7821c533af03f76a60dc8e95972376798f88a5b74aa326c2d87334cd274de9e796131f46140ed9e92f914
|
7
|
+
data.tar.gz: b08348f047c8caba57940c126123126d5e3583a7914e0ac2ca8c956261c90206c1dbfec02b479fba57e0f2bdf948aed71fb0298e408c5ae066b088284e4b58e1
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cocoapods-bin (0.0
|
4
|
+
cocoapods-bin (0.1.0)
|
5
5
|
cocoapods (~> 1.4)
|
6
6
|
parallel
|
7
7
|
|
@@ -68,7 +68,7 @@ GEM
|
|
68
68
|
nanaimo (0.2.6)
|
69
69
|
nap (1.1.0)
|
70
70
|
netrc (0.11.0)
|
71
|
-
parallel (1.
|
71
|
+
parallel (1.13.0)
|
72
72
|
prettybacon (0.0.2)
|
73
73
|
bacon (~> 1.2)
|
74
74
|
rake (12.3.2)
|
data/README.md
CHANGED
@@ -31,21 +31,21 @@
|
|
31
31
|
|
32
32
|
开始设置二进制化初始信息.
|
33
33
|
所有的信息都会保存在 /Users/songruiwang/.cocoapods/bin.yml 文件中.
|
34
|
-
你可以在对应目录下手动添加编辑该文件.
|
34
|
+
你可以在对应目录下手动添加编辑该文件. 文件包含的配置信息样式如下:
|
35
35
|
|
36
36
|
---
|
37
|
-
code_repo_url:
|
38
|
-
binary_repo_url:
|
39
|
-
binary_download_url:
|
37
|
+
code_repo_url: git@git.2dfire.net:ios/cocoapods-spec.git
|
38
|
+
binary_repo_url: git@git.2dfire.net:ios/cocoapods-spec-binary.git
|
39
|
+
binary_download_url: http://iosframeworkserver-shopkeeperclient.app.2dfire.com/download/%s/%s.zip
|
40
|
+
download_file_type: zip
|
40
41
|
|
41
42
|
|
42
|
-
源码私有源 Git
|
43
|
+
源码私有源 Git 地址
|
43
44
|
旧值:git@git.2dfire.net:ios/cocoapods-spec.git
|
44
45
|
>
|
45
|
-
|
46
46
|
```
|
47
47
|
|
48
|
-
|
48
|
+
按提示输入源码私有源、二进制私有源、二进制下载地址、下载文件类型后,插件就配置完成了。
|
49
49
|
|
50
50
|
`cococapod-bin` 也支持从 url 下载配置文件,方便对多台机器进行配置:
|
51
51
|
|
@@ -60,13 +60,12 @@ binary_download_url: 二进制下载地址,内部会依次传入组件名称
|
|
60
60
|
code_repo_url: git@git.2dfire.net:ios/cocoapods-spec.git
|
61
61
|
binary_repo_url: git@git.2dfire.net:ios/cocoapods-spec-binary.git
|
62
62
|
binary_download_url: http://iosframeworkserver-shopkeeperclient.app.2dfire.com/download/%s/%s.zip
|
63
|
+
download_file_type: zip
|
63
64
|
```
|
64
65
|
|
65
66
|
配置时,不需要手动添加源码和二进制私有源的 repo,插件在找不到对应 repo 时会主动 clone。
|
66
67
|
|
67
|
-
|
68
|
-
|
69
|
-
插件为了保证资源类型的多样性,在生成二进制 podspec 时并没有定死 source 的 `:type` 字段,所以 CocoaPods 只能从 url 中获取资源类型。在下载 http/https 资源时,CocoaPods 会根据路径的 extname 检查资源类型,不符合要求的话(zip、tgz、tar、tbz、txz、dmg)就会直接抛错。这里提到了 **二进制 podspec 的自动生成**,后面会详细介绍。
|
68
|
+
插件配置完后,就可以部署静态资源服务器了。对于静态资源服务器,这里不做赘述,只提示一点:在生成二进制 podspec 时,插件会根据 `download_file_type` 设置 source 的 `:type` 字段。在下载 http/https 资源时,CocoaPods 会根据 `:type` 字段的类型采取相应的解压方式,如果设置错误就会抛错。这里提到了 **二进制 podspec 的自动生成**,后面会详细介绍。
|
70
69
|
|
71
70
|
这里额外说下打包工具 [cocoapods-packager](https://github.com/CocoaPods/cocoapods-packager) 和 [Carthage](https://github.com/Carthage/Carthage/issues) ,前者可以通过 podspec 进行打包,只要保证 lint 通过了,就可以打成 `.framework`,很方便,但是作者几乎不维护了,后者需要结合组件工程。具体使用哪个可以结合自身团队,甚至可以自己写打包脚本。
|
72
71
|
|
@@ -164,7 +163,8 @@ end
|
|
164
163
|
"qingmu": "qingmu@2dfire.com"
|
165
164
|
},
|
166
165
|
"source": {
|
167
|
-
"http": "http://iosframeworkserver-shopkeeperclient.app.2dfire.com/download/A/0.1.0.zip"
|
166
|
+
"http": "http://iosframeworkserver-shopkeeperclient.app.2dfire.com/download/A/0.1.0.zip",
|
167
|
+
"type": "zip"
|
168
168
|
},
|
169
169
|
"platforms": {
|
170
170
|
"ios": "8.0"
|
@@ -226,16 +226,20 @@ TODO: Add long description of the pod here.
|
|
226
226
|
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
227
227
|
s.author = { 'qingmu' => 'qingmu@2dfire.com' }
|
228
228
|
s.ios.deployment_target = '8.0'
|
229
|
+
|
229
230
|
s.subspec "Binary" do |ss|
|
230
231
|
ss.vendored_frameworks = "#{s.name}.framework"
|
231
232
|
ss.source_files = "#{s.name}.framework/Headers/*", "#{s.name}.framework/Versions/A/Headers/*"
|
232
233
|
ss.public_header_files = "#{s.name}.framework/Headers/*", "#{s.name}.framework/Versions/A/Headers/*"
|
233
|
-
|
234
|
+
# 结合实际打包后的资源产出文件类型编写
|
235
|
+
ss.resources = "#{s.name}.framework/Resources/*.{bundle}", "#{s.name}.framework/Versions/A/Resources/*.{bundle}"
|
234
236
|
end
|
237
|
+
|
235
238
|
s.subspec 'B' do |ss|
|
236
239
|
ss.dependency "#{s.name}/Binary"
|
237
240
|
end
|
238
241
|
end
|
242
|
+
|
239
243
|
```
|
240
244
|
|
241
245
|
最终生成的二进制 podspec 如下:
|
@@ -258,7 +262,8 @@ end
|
|
258
262
|
},
|
259
263
|
"version": "0.1.0",
|
260
264
|
"source": {
|
261
|
-
"http": "http://iosframeworkserver-shopkeeperclient.app.2dfire.com/download/A/0.1.0.zip"
|
265
|
+
"http": "http://iosframeworkserver-shopkeeperclient.app.2dfire.com/download/A/0.1.0.zip",
|
266
|
+
"type": "zip"
|
262
267
|
},
|
263
268
|
"subspecs": [
|
264
269
|
{
|
@@ -271,6 +276,10 @@ end
|
|
271
276
|
"public_header_files": [
|
272
277
|
"A.framework/Headers/*",
|
273
278
|
"A.framework/Versions/A/Headers/*"
|
279
|
+
],
|
280
|
+
"resources": [
|
281
|
+
"A.framework/Resources/*.{bundle}",
|
282
|
+
"A.framework/Versions/A/Resources/*.{bundle}"
|
274
283
|
]
|
275
284
|
},
|
276
285
|
{
|
@@ -283,6 +292,7 @@ end
|
|
283
292
|
}
|
284
293
|
]
|
285
294
|
}
|
295
|
+
|
286
296
|
```
|
287
297
|
|
288
298
|
#### pod bin spec lint
|
@@ -54,7 +54,7 @@ module Pod
|
|
54
54
|
template_hash = CBin.config.template_hash
|
55
55
|
template_hash.each do |k, v|
|
56
56
|
default = CBin.config.send(k) rescue nil
|
57
|
-
config[k] = asker.ask_with_answer(v, default)
|
57
|
+
config[k] = asker.ask_with_answer(v[:description], default, v[:selection])
|
58
58
|
end
|
59
59
|
|
60
60
|
CBin.config.sync_config(config)
|
@@ -6,11 +6,14 @@ module CBin
|
|
6
6
|
File.expand_path("#{Pod::Config.instance.home_dir}/bin.yml")
|
7
7
|
end
|
8
8
|
|
9
|
+
|
9
10
|
def template_hash
|
10
11
|
{
|
11
|
-
'code_repo_url' => '源码私有源 Git
|
12
|
-
'binary_repo_url' => '二进制私有源 Git
|
13
|
-
'binary_download_url' => '二进制下载地址,内部会依次传入组件名称与版本,替换字符串中的 %s
|
12
|
+
'code_repo_url' => { description: '源码私有源 Git 地址', default: 'git@git.2dfire.net:ios/cocoapods-spec.git' },
|
13
|
+
'binary_repo_url' => { description: '二进制私有源 Git 地址', default: 'git@git.2dfire.net:ios/cocoapods-spec-binary.git' },
|
14
|
+
'binary_download_url' => { description: '二进制下载地址,内部会依次传入组件名称与版本,替换字符串中的 %s ', default: 'http://iosframeworkserver-shopkeeperclient.app.2dfire.com/download/%s/%s.zip' },
|
15
|
+
# 'binary_type' => { description: '二进制打包类型', default: 'framework', selection: %w[framework library] },
|
16
|
+
'download_file_type' => { description: '下载二进制文件类型', default: 'zip', selection: %w[zip tgz tar tbz txz dmg] },
|
14
17
|
}
|
15
18
|
end
|
16
19
|
|
@@ -20,24 +23,45 @@ module CBin
|
|
20
23
|
end
|
21
24
|
end
|
22
25
|
|
26
|
+
def default_config
|
27
|
+
@default_config ||= Hash[template_hash.map { |k, v| [k, v[:default]] }]
|
28
|
+
end
|
29
|
+
|
23
30
|
private
|
24
31
|
|
25
32
|
def load_config
|
26
33
|
if File.exists?(config_file)
|
27
34
|
YAML.load_file(config_file)
|
28
35
|
else
|
29
|
-
|
36
|
+
default_config
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def config
|
41
|
+
@config ||= begin
|
42
|
+
@config = OpenStruct.new load_config
|
43
|
+
validate!
|
44
|
+
@config
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def validate!
|
49
|
+
template_hash.each do |k, v|
|
50
|
+
selection = v[:selection]
|
51
|
+
next if !selection || selection.empty?
|
52
|
+
config_value = @config.send(k)
|
53
|
+
next unless config_value
|
54
|
+
raise Pod::Informative, "#{k} 字段的值必须限定在可选值 [ #{selection.join(' / ')} ] 内".red unless selection.include?(config_value)
|
30
55
|
end
|
31
56
|
end
|
32
57
|
|
33
58
|
def respond_to_missing?(method, include_private = false)
|
34
|
-
|
59
|
+
config.respond_to?(method) || super
|
35
60
|
end
|
36
61
|
|
37
62
|
def method_missing(method, *args, &block)
|
38
|
-
|
39
|
-
|
40
|
-
@config.send(method, *args)
|
63
|
+
if config.respond_to?(method)
|
64
|
+
config.send(method, *args)
|
41
65
|
elsif template_hash.keys.include?(method.to_s)
|
42
66
|
raise Pod::Informative, "#{method} 字段必须在配置文件 #{config_file} 中设置, 请执行 init 命令配置或手动修改配置文件".red
|
43
67
|
else
|
@@ -8,15 +8,17 @@ module CBin
|
|
8
8
|
print ' > '.green
|
9
9
|
end
|
10
10
|
|
11
|
-
def ask_with_answer(question, pre_answer)
|
11
|
+
def ask_with_answer(question, pre_answer, selection)
|
12
12
|
print "\n#{question}\n"
|
13
13
|
|
14
|
+
print_selection_info = -> { print "可选值:[ #{selection.join(' / ')} ]\n" if selection }
|
15
|
+
print_selection_info.call
|
14
16
|
print "旧值:#{pre_answer}\n" unless pre_answer.nil?
|
15
17
|
|
16
18
|
answer = ''
|
17
19
|
loop do
|
18
20
|
show_prompt
|
19
|
-
answer = STDIN.gets.chomp
|
21
|
+
answer = STDIN.gets.chomp.strip
|
20
22
|
|
21
23
|
if answer == '' && !pre_answer.nil?
|
22
24
|
answer = pre_answer
|
@@ -24,7 +26,10 @@ module CBin
|
|
24
26
|
print "\n"
|
25
27
|
end
|
26
28
|
|
27
|
-
|
29
|
+
unless answer.empty?
|
30
|
+
break if !selection || selection.include?(answer)
|
31
|
+
print_selection_info.call
|
32
|
+
end
|
28
33
|
end
|
29
34
|
|
30
35
|
answer
|
@@ -36,9 +41,9 @@ module CBin
|
|
36
41
|
|
37
42
|
开始设置二进制化初始信息.
|
38
43
|
所有的信息都会保存在 #{CBin.config.config_file} 文件中.
|
39
|
-
你可以在对应目录下手动添加编辑该文件.
|
44
|
+
你可以在对应目录下手动添加编辑该文件. 文件包含的配置信息样式如下:
|
40
45
|
|
41
|
-
#{CBin.config.
|
46
|
+
#{CBin.config.default_config.to_yaml}
|
42
47
|
EOF
|
43
48
|
end
|
44
49
|
|
@@ -97,7 +97,7 @@ module CBin
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def binary_source
|
100
|
-
{ http: CBin.config.binary_download_url % [code_spec.root.name, code_spec.version] }
|
100
|
+
{ http: CBin.config.binary_download_url % [code_spec.root.name, code_spec.version], type: CBin.config.download_file_type }
|
101
101
|
end
|
102
102
|
|
103
103
|
def code_spec_consumer(platform = :ios)
|
@@ -18,6 +18,7 @@ module Pod
|
|
18
18
|
sources_manager = Config.instance.sources_manager
|
19
19
|
use_source_pods = podfile.use_source_pods
|
20
20
|
|
21
|
+
missing_binary_specs = []
|
21
22
|
specs_by_target.each do |target, rspecs|
|
22
23
|
# use_binaries 并且 use_source_pods 不包含
|
23
24
|
use_binary_rspecs = if podfile.use_binaries? || podfile.use_binaries_selector
|
@@ -61,7 +62,7 @@ module Pod
|
|
61
62
|
rspec
|
62
63
|
rescue Pod::StandardError => error
|
63
64
|
# 没有从新的 source 找到对应版本组件,直接返回原 rspec
|
64
|
-
|
65
|
+
missing_binary_specs << rspec.spec if use_binary
|
65
66
|
rspec
|
66
67
|
end
|
67
68
|
|
@@ -69,6 +70,10 @@ module Pod
|
|
69
70
|
end.compact
|
70
71
|
end
|
71
72
|
|
73
|
+
missing_binary_specs.uniq.each do |spec|
|
74
|
+
UI.message "【#{spec.name} | #{spec.version}】组件无对应二进制版本 , 将采用源码依赖."
|
75
|
+
end if missing_binary_specs.any?
|
76
|
+
|
72
77
|
specs_by_target
|
73
78
|
end
|
74
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-bin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tripleCC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|