cocoapods-bin 0.1.1 → 0.1.2
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/Gemfile.lock +1 -1
- data/README.md +35 -14
- data/cocoapods-bin.gemspec +3 -3
- data/lib/cocoapods-bin/command/bin/list.rb +26 -26
- data/lib/cocoapods-bin/command/bin/open.rb +46 -46
- data/lib/cocoapods-bin/command/bin/repo/update.rb +24 -24
- data/lib/cocoapods-bin/command/bin/search.rb +47 -47
- data/lib/cocoapods-bin/config/config.rb +59 -59
- data/lib/cocoapods-bin/gem_version.rb +4 -4
- data/lib/cocoapods-bin/helpers/spec_creator.rb +107 -107
- data/lib/cocoapods-bin/native/analyzer.rb +19 -19
- data/lib/cocoapods-bin/native/podfile.rb +49 -49
- data/lib/cocoapods-bin/native/resolver.rb +95 -95
- data/lib/cocoapods-bin/native/source_provider_hook.rb +6 -6
- data/lib/cocoapods-bin/native/specification.rb +3 -3
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf5d790603abfbbc6e4624f826b0102b94753d15
|
4
|
+
data.tar.gz: 976cfee2a3ebb99b648b6bf7f0e293fb662cadc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c187df578219cf4f1f465061614ffee3c84dc0a740998fcd4560acf5c1646aab11b71060f009cfbd56003bb7a7db3f60231751507ef739d2bedab7f26a665b7
|
7
|
+
data.tar.gz: 458effc98e7baeea263496fef51a39465eadf71f512ce0479dfd277e594fa7cadc5a814d567bc43ef066399ba7eedea6993728963f6dec197c1f988c21ac3aa7
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,11 +2,13 @@
|
|
2
2
|
|
3
3
|
组件二进制化插件。
|
4
4
|
|
5
|
+
[基于 CocoaPods 的组件二进制化实践](https://triplecc.github.io/2019/01/21/%E5%9F%BA%E4%BA%8ECocoaPods%E7%9A%84%E7%BB%84%E4%BB%B6%E4%BA%8C%E8%BF%9B%E5%88%B6%E5%8C%96%E5%AE%9E%E8%B7%B5/)
|
6
|
+
|
5
7
|
## 概要
|
6
8
|
|
7
9
|
本插件所关联的组件二进制化策略:
|
8
10
|
|
9
|
-
预先将打包成 `.a` 或者 `.framework`
|
11
|
+
预先将打包成 `.a` 或者 `.framework` 的组件(目前接入此插件必须使用 `.framework`)保存到静态服务器上,并在 `install` 时,去下载组件对应的二进制版本,以减少组件编译时间,达到加快 App 打包、组件 lint、组件发布等操作的目的。
|
10
12
|
|
11
13
|
使用本插件需要提供以下资源:
|
12
14
|
|
@@ -34,31 +36,31 @@
|
|
34
36
|
你可以在对应目录下手动添加编辑该文件. 文件包含的配置信息样式如下:
|
35
37
|
|
36
38
|
---
|
37
|
-
code_repo_url: git@git.
|
38
|
-
binary_repo_url: git@git.
|
39
|
+
code_repo_url: git@git.xxxxxx.net:ios/cocoapods-spec.git
|
40
|
+
binary_repo_url: git@git.xxxxxx.net:ios/cocoapods-spec-binary.git
|
39
41
|
binary_download_url: http://iosframeworkserver-shopkeeperclient.app.2dfire.com/download/%s/%s.zip
|
40
42
|
download_file_type: zip
|
41
43
|
|
42
44
|
|
43
45
|
源码私有源 Git 地址
|
44
|
-
旧值:git@git.
|
46
|
+
旧值:git@git.xxxxxx.net:ios/cocoapods-spec.git
|
45
47
|
>
|
46
48
|
```
|
47
49
|
|
48
|
-
|
50
|
+
按提示输入源码私有源、二进制私有源、二进制下载地址、下载文件类型后,插件就配置完成了。其中 `binary_download_url` 需要预留组件名称与组件版本占位符,插件内部会依次替换 `%s` 为相应组件的值。
|
49
51
|
|
50
52
|
`cococapod-bin` 也支持从 url 下载配置文件,方便对多台机器进行配置:
|
51
53
|
|
52
54
|
```shell
|
53
|
-
➜ ~ pod bin init --bin-url=http://git.
|
55
|
+
➜ ~ pod bin init --bin-url=http://git.xxxxxx.net/qingmu/cocoapods-tdfire-binary-config/raw/master/bin.yml
|
54
56
|
```
|
55
57
|
|
56
58
|
配置文件模版内容如下,根据不同团队的需求定制即可:
|
57
59
|
|
58
60
|
```yaml
|
59
61
|
---
|
60
|
-
code_repo_url: git@git.
|
61
|
-
binary_repo_url: git@git.
|
62
|
+
code_repo_url: git@git.xxxxxx.net:ios/cocoapods-spec.git
|
63
|
+
binary_repo_url: git@git.xxxxxx.net:ios/cocoapods-spec-binary.git
|
62
64
|
binary_download_url: http://iosframeworkserver-shopkeeperclient.app.2dfire.com/download/%s/%s.zip
|
63
65
|
download_file_type: zip
|
64
66
|
```
|
@@ -206,7 +208,7 @@ TODO: Add long description of the pod here.
|
|
206
208
|
'A' => ['A/Assets/*']
|
207
209
|
}
|
208
210
|
s.subspec 'B' do |ss|
|
209
|
-
|
211
|
+
ss.dependency 'YYModel'
|
210
212
|
ss.source_files = 'A/Classes/**/*'
|
211
213
|
end
|
212
214
|
end
|
@@ -233,6 +235,7 @@ TODO: Add long description of the pod here.
|
|
233
235
|
ss.public_header_files = "#{s.name}.framework/Headers/*", "#{s.name}.framework/Versions/A/Headers/*"
|
234
236
|
# 结合实际打包后的资源产出文件类型编写
|
235
237
|
ss.resources = "#{s.name}.framework/Resources/*.{bundle}", "#{s.name}.framework/Versions/A/Resources/*.{bundle}"
|
238
|
+
ss.dependency 'YYModel'
|
236
239
|
end
|
237
240
|
|
238
241
|
s.subspec 'B' do |ss|
|
@@ -280,7 +283,12 @@ end
|
|
280
283
|
"resources": [
|
281
284
|
"A.framework/Resources/*.{bundle}",
|
282
285
|
"A.framework/Versions/A/Resources/*.{bundle}"
|
283
|
-
]
|
286
|
+
],
|
287
|
+
"dependencies": {
|
288
|
+
"YYModel": [
|
289
|
+
|
290
|
+
]
|
291
|
+
}
|
284
292
|
},
|
285
293
|
{
|
286
294
|
"name": "B",
|
@@ -292,10 +300,9 @@ end
|
|
292
300
|
}
|
293
301
|
]
|
294
302
|
}
|
295
|
-
|
296
303
|
```
|
297
304
|
|
298
|
-
####
|
305
|
+
#### pod bin spec lint
|
299
306
|
|
300
307
|
```shell
|
301
308
|
➜ ~ pod bin spec lint --help
|
@@ -388,13 +395,13 @@ Resolving dependencies of `Podfile`
|
|
388
395
|
```yaml
|
389
396
|
...
|
390
397
|
SPEC REPOS:
|
391
|
-
"git@git.
|
398
|
+
"git@git.xxxxxx.net:ios/cocoapods-spec-binary.git":
|
392
399
|
- AFNetworking
|
393
400
|
- Aspects
|
394
401
|
- CocoaSecurity
|
395
402
|
- DACircularProgress
|
396
403
|
...
|
397
|
-
"git@git.
|
404
|
+
"git@git.xxxxxx.net:ios/cocoapods-spec.git":
|
398
405
|
- ActivityForRestApp
|
399
406
|
- AMapFrameworks
|
400
407
|
- AssemblyComponent
|
@@ -433,6 +440,20 @@ end
|
|
433
440
|
set_use_source_pods ['YYModel']
|
434
441
|
```
|
435
442
|
|
443
|
+
如果 CocoaPods 版本为 1.5.3 ,终端会输出以下内容,表示 YYModel 的参照源从二进制私有源切换到了源码私有源:
|
444
|
+
|
445
|
+
```shell
|
446
|
+
Analyzing dependencies
|
447
|
+
Fetching podspec for `A` from `../`
|
448
|
+
Downloading dependencies
|
449
|
+
Using A (0.1.0)
|
450
|
+
Installing YYModel 1.0.4.2 (source changed to `git@git.xxxxxx.net:ios/cocoapods-spec.git` from `git@git.xxxxxx.net:ios/cocoapods-spec-binary.git`)
|
451
|
+
Generating Pods project
|
452
|
+
Integrating client project
|
453
|
+
Sending stats
|
454
|
+
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.
|
455
|
+
```
|
456
|
+
|
436
457
|
#### 其他设置
|
437
458
|
|
438
459
|
插件默认开启多线程下载组件资源,如果要禁用这个功能,Podfile 添加以下代码即可:
|
data/cocoapods-bin.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = CBin::VERSION
|
9
9
|
spec.authors = ['tripleCC']
|
10
10
|
spec.email = ['triplec.linux@gmail.com']
|
11
|
-
spec.description = %q{
|
12
|
-
spec.summary = %q{
|
13
|
-
spec.homepage = 'https://github.com/
|
11
|
+
spec.description = %q{cocoapods pods source switcher.}
|
12
|
+
spec.summary = %q{cocoapods-bin is a plugin which helps develpers switching pods between source code and binary.}
|
13
|
+
spec.homepage = 'https://github.com/tripleCC/cocoapods-bin'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
@@ -5,41 +5,41 @@ module Pod
|
|
5
5
|
self.summary = '展示二进制 pods .'
|
6
6
|
|
7
7
|
def self.options
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
[
|
9
|
+
['--code', '展示源码 pods'],
|
10
|
+
['--diff', '展示缺少二进制版本的源码 pods'],
|
11
|
+
['--update', '展示前执行 `pod bin repo update`'],
|
12
|
+
].concat(super)
|
13
|
+
end
|
14
14
|
|
15
15
|
def initialize(argv)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
@update = argv.flag?('update')
|
17
|
+
@code = argv.flag?('code')
|
18
|
+
@diff = argv.flag?('diff')
|
19
|
+
super
|
20
|
+
end
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
def run
|
23
|
+
update_if_necessary!
|
24
24
|
|
25
|
-
|
25
|
+
source = @code ? code_source : binary_source
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
sets = if @diff
|
28
|
+
binary_pod_set_names = binary_source.pod_sets.map(&:name)
|
29
|
+
sets = code_source.pod_sets.reject { |set| binary_pod_set_names.include?(set.name) }
|
30
|
+
else
|
31
|
+
source.pod_sets
|
32
|
+
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
sets.each { |set| UI.pod(set, :name_and_version) }
|
35
|
+
UI.puts "\n#{sets.count} pods were found"
|
36
|
+
end
|
37
37
|
|
38
|
-
|
38
|
+
def update_if_necessary!
|
39
39
|
UI.section("\nUpdating Spec Repositories\n".yellow) do
|
40
|
-
|
40
|
+
Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new([])).run
|
41
41
|
end if @update
|
42
|
-
|
42
|
+
end
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -5,54 +5,54 @@ module Pod
|
|
5
5
|
self.summary = '打开 workspace 工程.'
|
6
6
|
|
7
7
|
def self.options
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
[
|
9
|
+
['--install', '先执行 install, 再执行 open. 相当于 pod install && pod bin open'],
|
10
|
+
['--update', '先执行 update, 再执行 open. 相当于 pod update && pod bin open'],
|
11
|
+
['--deep=5', '查找深度.'],
|
12
|
+
]
|
13
|
+
end
|
14
14
|
|
15
15
|
def initialize(argv)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
16
|
+
@install = argv.flag?('install')
|
17
|
+
@update = argv.flag?('update')
|
18
|
+
@deep = argv.option('deep').try(:to_i) || 3
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def run
|
23
|
+
if @install || @update
|
24
|
+
command_class = Object.const_get("Pod::Command::#{@install ? 'Install' : 'Update'}")
|
25
|
+
command = command_class.new(CLAide::ARGV.new([]))
|
26
|
+
command.validate!
|
27
|
+
command.run
|
28
|
+
end
|
29
|
+
|
30
|
+
path = find_in_children(Pathname.pwd.children, @deep) ||
|
31
|
+
find_in_parent(Pathname.pwd.parent, @deep)
|
32
|
+
if path
|
33
|
+
`open #{path}`
|
34
|
+
else
|
35
|
+
UI.puts "#{Pathname.pwd} 目录, 搜索上下深度 #{@deep} , 无法找到 xcworkspace 文件.".red
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def find_in_children(paths, deep)
|
40
|
+
deep -= 1
|
41
|
+
pathname = paths.find { |ph| ph.extname == '.xcworkspace' }
|
42
|
+
|
43
|
+
return pathname if pathname || paths.empty? || deep <= 0
|
44
|
+
|
45
|
+
find_in_children(paths.select(&:directory?).flat_map(&:children), deep)
|
46
|
+
end
|
47
|
+
|
48
|
+
def find_in_parent(path, deep)
|
49
|
+
deep -= 1
|
50
|
+
pathname = path.children.find {|fn| fn.extname == '.xcworkspace'}
|
51
|
+
|
52
|
+
return pathname if pathname || deep <= 0
|
53
|
+
|
54
|
+
find_in_parent(path.parent, deep)
|
55
|
+
end
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -3,38 +3,38 @@ require 'parallel'
|
|
3
3
|
module Pod
|
4
4
|
class Command
|
5
5
|
class Bin < Command
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
class Repo < Bin
|
7
|
+
class Update < Repo
|
8
|
+
self.summary = '更新私有源'
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
self.arguments = [
|
11
|
+
CLAide::Argument.new('NAME', false),
|
12
|
+
]
|
13
13
|
|
14
|
-
|
14
|
+
def self.options
|
15
15
|
[
|
16
16
|
['--all', '更新所有私有源,默认只更新二进制相关私有源'],
|
17
17
|
].concat(super)
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
def initialize(argv)
|
21
|
+
@all = argv.flag?('all')
|
22
|
+
@name = argv.shift_argument
|
23
|
+
super
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
26
|
+
def run
|
27
|
+
show_output = !config.silent?
|
28
|
+
if @name || @all
|
29
|
+
config.sources_manager.update(@name, show_output)
|
30
|
+
else
|
31
|
+
Parallel.each(valid_sources, in_threads: 4) do |source|
|
32
|
+
source.update(show_output)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -5,62 +5,62 @@ module Pod
|
|
5
5
|
self.summary = '查找二进制 spec.'
|
6
6
|
|
7
7
|
self.arguments = [
|
8
|
-
|
9
|
-
|
8
|
+
CLAide::Argument.new('QUERY', true),
|
9
|
+
]
|
10
10
|
|
11
11
|
def self.options
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
[
|
13
|
+
['--code', '查找源码 spec'],
|
14
|
+
['--stats', '展示额外信息'],
|
15
|
+
['--no-pager', '不以 pager 形式展示'],
|
16
|
+
['--regex', '`QUERY` 视为正则'],
|
17
|
+
]
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
def initialize(argv)
|
21
|
+
@code = argv.flag?('code')
|
22
|
+
@stats = argv.flag?('stats')
|
23
|
+
@use_pager = argv.flag?('pager', true)
|
24
|
+
@use_regex = argv.flag?('regex')
|
25
|
+
@query = argv.arguments! unless argv.arguments.empty?
|
26
|
+
super
|
27
|
+
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
def validate!
|
30
|
+
super
|
31
|
+
help! '必须指定查找的组件.' unless @query
|
32
|
+
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
def run
|
35
|
+
query_regex = @query.reduce([]) { |result, q|
|
36
|
+
result << (@use_regex ? q : Regexp.escape(q))
|
37
|
+
}.join(' ').strip
|
38
38
|
|
39
|
-
|
39
|
+
source = @code ? code_source : binary_source
|
40
40
|
|
41
|
-
|
42
|
-
|
41
|
+
aggregate = Pod::Source::Aggregate.new([source])
|
42
|
+
sets = aggregate.search_by_name(query_regex, true)
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
if(@use_pager)
|
45
|
+
UI.with_pager { print_sets(sets) }
|
46
|
+
else
|
47
|
+
print_sets(sets)
|
48
|
+
end
|
49
|
+
end
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
51
|
+
def print_sets(sets)
|
52
|
+
sets.each do |set|
|
53
|
+
begin
|
54
|
+
if @stats
|
55
|
+
UI.pod(set, :stats)
|
56
|
+
else
|
57
|
+
UI.pod(set, :normal)
|
58
|
+
end
|
59
|
+
rescue DSLError
|
60
|
+
UI.warn "Skipping `#{set.name}` because the podspec contains errors."
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
@@ -1,76 +1,76 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
|
3
3
|
module CBin
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
class Config
|
5
|
+
def config_file
|
6
|
+
File.expand_path("#{Pod::Config.instance.home_dir}/bin.yml")
|
7
|
+
end
|
8
8
|
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
10
|
+
def template_hash
|
11
|
+
{
|
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] },
|
17
|
+
}
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
def sync_config(config)
|
21
|
+
File.open(config_file, 'w+') do |f|
|
22
22
|
f.write(config.to_yaml)
|
23
23
|
end
|
24
|
-
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
def default_config
|
27
|
+
@default_config ||= Hash[template_hash.map { |k, v| [k, v[:default]] }]
|
28
|
+
end
|
29
29
|
|
30
|
-
|
30
|
+
private
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
32
|
+
def load_config
|
33
|
+
if File.exists?(config_file)
|
34
|
+
YAML.load_file(config_file)
|
35
|
+
else
|
36
|
+
default_config
|
37
|
+
end
|
38
|
+
end
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
40
|
+
def config
|
41
|
+
@config ||= begin
|
42
|
+
@config = OpenStruct.new load_config
|
43
|
+
validate!
|
44
|
+
@config
|
45
|
+
end
|
46
|
+
end
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
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)
|
55
|
+
end
|
56
|
+
end
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
def respond_to_missing?(method, include_private = false)
|
59
|
+
config.respond_to?(method) || super
|
60
|
+
end
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
62
|
+
def method_missing(method, *args, &block)
|
63
|
+
if config.respond_to?(method)
|
64
|
+
config.send(method, *args)
|
65
|
+
elsif template_hash.keys.include?(method.to_s)
|
66
|
+
raise Pod::Informative, "#{method} 字段必须在配置文件 #{config_file} 中设置, 请执行 init 命令配置或手动修改配置文件".red
|
67
|
+
else
|
68
|
+
super
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
72
|
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
def self.config
|
74
|
+
@config ||= Config.new
|
75
|
+
end
|
76
76
|
end
|