cocoapods-meitu-bin 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +20 -0
  3. data/README.md +56 -0
  4. data/lib/cocoapods-meitu-bin/command/bin/archive.rb +206 -0
  5. data/lib/cocoapods-meitu-bin/command/bin/auto.rb +212 -0
  6. data/lib/cocoapods-meitu-bin/command/bin/build_all.rb +345 -0
  7. data/lib/cocoapods-meitu-bin/command/bin/header_files_specifications.rb +262 -0
  8. data/lib/cocoapods-meitu-bin/command/bin/init.rb +72 -0
  9. data/lib/cocoapods-meitu-bin/command/bin/install.rb +44 -0
  10. data/lib/cocoapods-meitu-bin/command/bin/lib/lint.rb +67 -0
  11. data/lib/cocoapods-meitu-bin/command/bin/lock/dependency.rb +89 -0
  12. data/lib/cocoapods-meitu-bin/command/bin/lock/spec_repo.rb +105 -0
  13. data/lib/cocoapods-meitu-bin/command/bin/lock/version.rb +68 -0
  14. data/lib/cocoapods-meitu-bin/command/bin/lock.rb +36 -0
  15. data/lib/cocoapods-meitu-bin/command/bin/output_source.rb +146 -0
  16. data/lib/cocoapods-meitu-bin/command/bin/repo/push.rb +88 -0
  17. data/lib/cocoapods-meitu-bin/command/bin/repo/update.rb +42 -0
  18. data/lib/cocoapods-meitu-bin/command/bin/repo.rb +14 -0
  19. data/lib/cocoapods-meitu-bin/command/bin/source/add.rb +148 -0
  20. data/lib/cocoapods-meitu-bin/command/bin/source/delete.rb +59 -0
  21. data/lib/cocoapods-meitu-bin/command/bin/source/list.rb +46 -0
  22. data/lib/cocoapods-meitu-bin/command/bin/source.rb +30 -0
  23. data/lib/cocoapods-meitu-bin/command/bin/spec/create.rb +73 -0
  24. data/lib/cocoapods-meitu-bin/command/bin/spec/lint.rb +109 -0
  25. data/lib/cocoapods-meitu-bin/command/bin/spec.rb +13 -0
  26. data/lib/cocoapods-meitu-bin/command/bin/update.rb +154 -0
  27. data/lib/cocoapods-meitu-bin/command/bin/upload.rb +175 -0
  28. data/lib/cocoapods-meitu-bin/command/bin.rb +69 -0
  29. data/lib/cocoapods-meitu-bin/command.rb +1 -0
  30. data/lib/cocoapods-meitu-bin/config/config.rb +149 -0
  31. data/lib/cocoapods-meitu-bin/config/config_asker.rb +57 -0
  32. data/lib/cocoapods-meitu-bin/config/config_builder.rb +216 -0
  33. data/lib/cocoapods-meitu-bin/gem_version.rb +9 -0
  34. data/lib/cocoapods-meitu-bin/helpers/Info.plist +0 -0
  35. data/lib/cocoapods-meitu-bin/helpers/buildAll/bin_helper.rb +97 -0
  36. data/lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb +434 -0
  37. data/lib/cocoapods-meitu-bin/helpers/buildAll/podspec_util.rb +140 -0
  38. data/lib/cocoapods-meitu-bin/helpers/buildAll/zip_file_helper.rb +87 -0
  39. data/lib/cocoapods-meitu-bin/helpers/build_helper.rb +167 -0
  40. data/lib/cocoapods-meitu-bin/helpers/build_utils.rb +64 -0
  41. data/lib/cocoapods-meitu-bin/helpers/framework.rb +86 -0
  42. data/lib/cocoapods-meitu-bin/helpers/framework_builder.rb +551 -0
  43. data/lib/cocoapods-meitu-bin/helpers/library.rb +54 -0
  44. data/lib/cocoapods-meitu-bin/helpers/library_builder.rb +90 -0
  45. data/lib/cocoapods-meitu-bin/helpers/pod_size_helper.rb +54 -0
  46. data/lib/cocoapods-meitu-bin/helpers/sources_helper.rb +35 -0
  47. data/lib/cocoapods-meitu-bin/helpers/spec_creator.rb +170 -0
  48. data/lib/cocoapods-meitu-bin/helpers/spec_files_helper.rb +80 -0
  49. data/lib/cocoapods-meitu-bin/helpers/spec_source_creator.rb +304 -0
  50. data/lib/cocoapods-meitu-bin/helpers/upload_helper.rb +104 -0
  51. data/lib/cocoapods-meitu-bin/helpers.rb +5 -0
  52. data/lib/cocoapods-meitu-bin/native/acknowledgements.rb +27 -0
  53. data/lib/cocoapods-meitu-bin/native/analyzer.rb +109 -0
  54. data/lib/cocoapods-meitu-bin/native/file_accessor.rb +28 -0
  55. data/lib/cocoapods-meitu-bin/native/gen.rb +79 -0
  56. data/lib/cocoapods-meitu-bin/native/installation_options.rb +28 -0
  57. data/lib/cocoapods-meitu-bin/native/installer.rb +259 -0
  58. data/lib/cocoapods-meitu-bin/native/linter.rb +26 -0
  59. data/lib/cocoapods-meitu-bin/native/lockfile.rb +85 -0
  60. data/lib/cocoapods-meitu-bin/native/path_source.rb +33 -0
  61. data/lib/cocoapods-meitu-bin/native/pod_source_installer.rb +19 -0
  62. data/lib/cocoapods-meitu-bin/native/pod_target_installer.rb +87 -0
  63. data/lib/cocoapods-meitu-bin/native/podfile.rb +99 -0
  64. data/lib/cocoapods-meitu-bin/native/podfile_env.rb +38 -0
  65. data/lib/cocoapods-meitu-bin/native/podfile_generator.rb +201 -0
  66. data/lib/cocoapods-meitu-bin/native/podspec_finder.rb +25 -0
  67. data/lib/cocoapods-meitu-bin/native/resolver.rb +299 -0
  68. data/lib/cocoapods-meitu-bin/native/sandbox_analyzer.rb +34 -0
  69. data/lib/cocoapods-meitu-bin/native/source.rb +35 -0
  70. data/lib/cocoapods-meitu-bin/native/sources_manager.rb +21 -0
  71. data/lib/cocoapods-meitu-bin/native/specification.rb +31 -0
  72. data/lib/cocoapods-meitu-bin/native/target_validator.rb +41 -0
  73. data/lib/cocoapods-meitu-bin/native/validator.rb +40 -0
  74. data/lib/cocoapods-meitu-bin/native.rb +26 -0
  75. data/lib/cocoapods-meitu-bin/source_provider_hook.rb +68 -0
  76. data/lib/cocoapods-meitu-bin.rb +2 -0
  77. data/lib/cocoapods_plugin.rb +11 -0
  78. data/spec/command/bin_spec.rb +12 -0
  79. data/spec/spec_helper.rb +50 -0
  80. metadata +201 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e2ded6addae43bd3a4aa48791752a2351bae610330eecd697bcb6345e5e2d3ae
4
+ data.tar.gz: e21f5ee83d04b03bab18f0ff2c74eeccfdcb7a130b33885930a50917343384f4
5
+ SHA512:
6
+ metadata.gz: 2c4c2090c2564e939f6908c38b283d5528f23553a70583e3f05e1441ba683297d315fc93de37d76803ff0bcf5eddb8c29ecab8fa486bef4d44fd5a7c90f03998
7
+ data.tar.gz: fe8543e5d321fa5a34a7cb37e6a7bc30149a19ee6d2ebc4fd8bfeb7db2126b907b68bd949df44ad3ecfb6cbdf7f87169a4e9e50ce96ce4ef654e7ffa356fbcb7
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008-present, Meitu, Inc.
2
+ All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # cocoapods-meitu-bin
2
+
3
+ ## 简介
4
+
5
+ `cocoapods-meitu-bin`是`CocoaPods`的二进制插件,提供了二进制相关的功能,如基于壳工程的二进制制作、二进制 / 源码切换等
6
+
7
+ ## 安装
8
+
9
+ `cocoapods-meitu-bin`有2种安装方式:
10
+
11
+ * 安装到本机目录
12
+ * 使用`Gemfile`
13
+
14
+ ### 安装到本机目录
15
+
16
+ ```shell
17
+ $ sudo gem install cocoapods-meitu-bin
18
+ ```
19
+
20
+ ### 使用Gemfile
21
+
22
+ 在`Gemfile`中添加如下代码,然后执行`bundle install`
23
+
24
+ ```ruby
25
+ gem 'cocoapods-meitu-bin'
26
+ ```
27
+
28
+ ## 使用
29
+
30
+ ### 制作二进制
31
+
32
+ 进入`Podfile`所在目录,执行`pod bin build-all`即可,根据需要添加相应的`option`选项,支持的`option`选项如下:
33
+
34
+ | 选项 | 含义 |
35
+ |---|---|
36
+ | `--clean` | 全部二进制包制作完成后删除编译临时目录 |
37
+ | `--clean-single` | 每制作完一个二进制包就删除该编译临时目录 |
38
+ | `--repo-update` | 更新`Podfile`中指定的`repo`仓库 |
39
+ | `--full-build` | 是否全量编译 |
40
+ | `--skip-simulator` | 是否跳过模拟器编译 |
41
+ | `--configuration=configName` | 在构建每个目标时使用`configName`指定构建配置,如:`Debug`、`Release`等 |
42
+
43
+ > 如果想查看详细信息,可以使用`pod bin build-all --help`来查看帮助文档
44
+
45
+ ### 使用二进制
46
+
47
+ 在`Podfile`中添加如下代码,然后执行`pod install`即可
48
+
49
+ ```ruby
50
+ # 加载插件
51
+ plugin 'cocoapods-meitu-bin'
52
+ # 开启二进制
53
+ use_binaries!
54
+ # 设置源码白名单
55
+ set_use_source_pods ['AFNetworking']
56
+ ```
@@ -0,0 +1,206 @@
1
+ require 'cocoapods-meitu-bin/native/podfile'
2
+ require 'cocoapods/command/gen'
3
+ require 'cocoapods/generate'
4
+ require 'cocoapods-meitu-bin/helpers/framework_builder'
5
+ require 'cocoapods-meitu-bin/helpers/library_builder'
6
+ require 'cocoapods-meitu-bin/helpers/build_helper'
7
+ require 'cocoapods-meitu-bin/helpers/spec_source_creator'
8
+ require 'cocoapods-meitu-bin/config/config_builder'
9
+ require 'cocoapods-meitu-bin/command/bin/lib/lint'
10
+
11
+ module Pod
12
+ class Command
13
+ class Bin < Command
14
+ class Archive < Bin
15
+
16
+ @@missing_binary_specs = []
17
+
18
+ self.summary = '将组件归档为 .a 或 .framework(目前仅支持静态 framework )'
19
+ self.description = <<-DESC
20
+ 将组件归档为 .a 或 .framework ,仅支持iOS平台
21
+
22
+ 此静态 framework 不包含依赖组件的 symbol
23
+
24
+ 目前仅支持 .framework,.a 尚未验证是否可以
25
+ DESC
26
+
27
+ def self.options
28
+ [
29
+ ['--all-make', '对该组件的依赖库,全部制作为二进制组件'],
30
+ ['--code-dependencies', '使用源码依赖'],
31
+ ['--no-clean', '保留构建中间产物'],
32
+ ['--sources', '私有源地址,多个用分号区分'],
33
+ ['--framework-output', '输出framework文件'],
34
+ ['--no-zip', '不压缩静态库 为 zip'],
35
+ ['--configuration', 'Build the specified configuration (e.g. Debug). Defaults to Release'],
36
+ ['--env', "该组件上传的环境 %w[dev debug_iphoneos release_iphoneos]"]
37
+ ].concat(Pod::Command::Gen.options).concat(super).uniq
38
+ end
39
+
40
+ self.arguments = [
41
+ CLAide::Argument.new('NAME.podspec', false)
42
+ ]
43
+
44
+ def initialize(argv)
45
+ @podspec = argv.shift_argument
46
+
47
+ @code_dependencies = argv.flag?('code-dependencies')
48
+ @framework_output = argv.flag?('framework-output', false )
49
+ @clean = argv.flag?('no-clean', false)
50
+ @zip = argv.flag?('zip', true)
51
+ @all_make = argv.flag?('all-make', false )
52
+ @sources = argv.option('sources') || []
53
+ @platform = Platform.new(:ios)
54
+
55
+ @config = argv.option('configuration', 'Release')
56
+
57
+ @framework_path
58
+ super
59
+
60
+ @additional_args = argv.remainder!
61
+ @build_finshed = false
62
+ end
63
+
64
+ def run
65
+ # 清除之前的缓存
66
+ zip_dir = CBin::Config::Builder.instance.zip_dir
67
+ FileUtils.rm_rf(zip_dir) if File.exist?(zip_dir)
68
+ # 加载podspec
69
+ @spec = Specification.from_file(spec_file)
70
+ # 如果有 default_subspecs 报错提示
71
+ raise Informative, "#{@spec.root.name} (#{@spec.root.version}) 有default_subspecs:#{@spec.default_subspecs},请注释掉重新执行命令!" unless @spec.default_subspecs.empty?
72
+ # 生成xcode工程
73
+ generate_project
74
+ # 构建当前库
75
+ build_root_spec
76
+
77
+ sources_sepc = Array.new
78
+ sources_sepc << @spec
79
+ # 如果有 --all-make 选项,则打包依赖组件
80
+
81
+ sources_sepc.concat(build_dependencies) if @all_make
82
+
83
+ # 返回所有打包二进制组件的podspec
84
+ sources_sepc
85
+ end
86
+
87
+ # 构建当前库
88
+ def build_root_spec
89
+ builder = CBin::Build::Helper.new(@spec,
90
+ @platform,
91
+ @framework_output,
92
+ @zip,
93
+ @spec,
94
+ CBin::Config::Builder.instance.white_pod_list.include?(@spec.name),
95
+ @config,
96
+ @installers.size > 0 ? @installers[0] : nil)
97
+ builder.build
98
+ builder.clean_workspace if @clean && !@all_make
99
+ end
100
+
101
+ # 构建依赖库
102
+ def build_dependencies
103
+ @build_finshed = true
104
+ #如果没要求,就清空依赖库数据
105
+ sources_sepc = []
106
+ @@missing_binary_specs.uniq.each do |spec|
107
+ next if spec.name.include?('/') # 过滤subspec
108
+ next if spec.name == @spec.name # 过滤当前库
109
+ #过滤白名单
110
+ next if CBin::Config::Builder.instance.white_pod_list.include?(spec.name)
111
+ #过滤 git
112
+ if spec.source[:git] && spec.source[:git]
113
+ spec_git = spec.source[:git]
114
+ spec_git_res = false
115
+ CBin::Config::Builder.instance.ignore_git_list.each do |ignore_git|
116
+ spec_git_res = spec_git.include?(ignore_git)
117
+ break if spec_git_res
118
+ end
119
+ next if spec_git_res
120
+ end
121
+ UI.warn "#{spec.name}.podspec 带有 vendored_frameworks 字段,请检查是否有效!!!" if spec.attributes_hash['vendored_frameworks']
122
+ UI.warn "#{spec.name}.podspec 带有 vendored_libraries 字段,请检查是否有效!!!" if spec.attributes_hash['vendored_libraries']
123
+ next if (spec.attributes_hash['vendored_frameworks'] || spec.attributes_hash['vendored_libraries']) && @spec.name != spec.name
124
+ next if (spec.attributes_hash['ios.vendored_frameworks'] || spec.attributes_hash['ios.vendored_libraries']) && @spec.name != spec.name
125
+ #获取没有制作二进制版本的spec集合
126
+ sources_sepc << spec
127
+ end
128
+
129
+ fail_build_specs = []
130
+ sources_sepc.uniq.each do |spec|
131
+ begin
132
+ builder = CBin::Build::Helper.new(spec,
133
+ @platform,
134
+ @framework_output,
135
+ @zip,
136
+ @spec,
137
+ false ,
138
+ @config,
139
+ nil )
140
+ builder.build
141
+ rescue Object => exception
142
+ UI.puts exception
143
+ fail_build_specs << spec
144
+ end
145
+ end
146
+
147
+ if fail_build_specs.any?
148
+ fail_build_specs.uniq.each do |spec|
149
+ UI.warn "【#{spec.name} | #{spec.version}】组件二进制版本编译失败 ."
150
+ end
151
+ end
152
+ sources_sepc - fail_build_specs
153
+ end
154
+
155
+ # 解析器传过来的
156
+ def Archive.missing_binary_specs(missing_binary_specs)
157
+ @@missing_binary_specs = missing_binary_specs unless @build_finshed
158
+ end
159
+
160
+ private
161
+
162
+ # 生成xcode工程
163
+ def generate_project
164
+ Podfile.execute_with_bin_plugin do
165
+ Podfile.execute_with_use_binaries(!@code_dependencies) do
166
+ argvs = [
167
+ "--sources=#{sources_option(@code_dependencies, @sources)},https:\/\/cdn.cocoapods.org",
168
+ "--gen-directory=#{CBin::Config::Builder.instance.gen_dir}",
169
+ '--clean',
170
+ *@additional_args
171
+ ]
172
+
173
+ podfile= File.join(Pathname.pwd, "Podfile")
174
+ if File.exist?(podfile)
175
+ argvs += ['--use-podfile']
176
+ argvs += ["--podfile-path=#{podfile}"]
177
+ end
178
+
179
+ argvs << spec_file if spec_file
180
+
181
+ gen = Pod::Command::Gen.new(CLAide::ARGV.new(argvs))
182
+ gen.validate!
183
+ @installers = gen.run
184
+ end
185
+ end
186
+ end
187
+
188
+ # 查找podspec
189
+ def spec_file
190
+ @spec_file ||= begin
191
+ if @podspec
192
+ find_spec_file(@podspec)
193
+ else
194
+ if code_spec_files.empty?
195
+ raise Informative, '当前目录下没有找到可用源码 podspec.'
196
+ end
197
+
198
+ spec_file = code_spec_files.first
199
+ spec_file
200
+ end
201
+ end
202
+ end
203
+ end
204
+ end
205
+ end
206
+ end
@@ -0,0 +1,212 @@
1
+ require 'cocoapods-meitu-bin/command/bin/auto'
2
+ require 'cocoapods-meitu-bin/helpers/upload_helper'
3
+
4
+ module Pod
5
+ class Command
6
+ class Bin < Command
7
+ class Auto < Bin
8
+ self.summary = '一键打包二进制并上传'
9
+ self.description = <<-DESC
10
+ 生成二进制文件并上传至文件服务器,生成二进制 podspec 并上传至二进制私有源
11
+ DESC
12
+
13
+ self.arguments = [
14
+ CLAide::Argument.new('NAME.podspec', false)
15
+ ]
16
+ def self.options
17
+ [
18
+ ['--push-source-podspec', '上传源码 podspec '],
19
+ ['--code-dependencies', '使用源码依赖'],
20
+ ['--allow-prerelease', '允许使用 prerelease 的版本'],
21
+ ['--no-clean', '保留构建中间产物'],
22
+ ['--framework-output', '输出framework文件'],
23
+ ['--no-zip', '不压缩静态 framework 为 zip'],
24
+ ['--all-make', '对该组件的依赖库,全部制作为二进制组件'],
25
+ ['--configuration', 'Build the specified configuration (e.g. Release ). Defaults to Debug'],
26
+ ['--env', "该组件上传的环境 %w[dev debug_iphoneos release_iphoneos]"]
27
+ ].concat(Pod::Command::Gen.options).concat(super).uniq
28
+ end
29
+
30
+ def initialize(argv)
31
+
32
+ @env = argv.option('env') || 'dev'
33
+ CBin.config.set_configuration_env(@env)
34
+
35
+ # @podspec = argv.shift_argument || find_podspec
36
+ @podspec = argv.shift_argument
37
+
38
+ @push_source_podspec = argv.flag?('push-source-podspec')
39
+ @code_dependencies = argv.flag?('code-dependencies')
40
+ @allow_prerelease = argv.flag?('allow-prerelease')
41
+ @framework_output = argv.flag?('framework-output', false)
42
+ @clean = argv.flag?('clean', true)
43
+ @zip = argv.flag?('zip', true)
44
+ @all_make = argv.flag?('all-make', false)
45
+ @verbose = argv.flag?('verbose', false)
46
+ @sources = argv.option('sources', 'https://cdn.cocoapods.org')
47
+ @config = argv.option('configuration', 'Release')
48
+
49
+ super
50
+
51
+ # !!! 这一行加载在 super 的后面,否则会出现问题,切记 !!!
52
+ @additional_args = argv.remainder!
53
+ end
54
+
55
+ def validate!
56
+ super
57
+ raise Informative, '当前目录下没有 podspec 文件' if @podspec.nil? && code_spec_files.size == 0
58
+ raise Informative, '当前目录有多个 podspec 文件,请指定具体的 podspec 文件' if @podspec.nil? && code_spec_files.size > 1
59
+ end
60
+
61
+ def run
62
+ @podspec = find_podspec unless @podspec
63
+ @specification = Specification.from_file(@podspec)
64
+
65
+ # 归档.a或.framework
66
+ sources_sepc = run_archive
67
+
68
+ fail_push_specs = []
69
+ sources_sepc.uniq.each do |spec|
70
+ begin
71
+ # 上传所有打包好的二进制文件及podspec
72
+ fail_push_specs << spec unless CBin::Upload::Helper.new(spec,@code_dependencies,@sources).upload
73
+ rescue Object => exception
74
+ UI.puts exception
75
+ fail_push_specs << spec
76
+ end
77
+ end
78
+
79
+ if fail_push_specs.any?
80
+ fail_push_specs.uniq.each do |spec|
81
+ UI.warn "【#{spec.name} | #{spec.version}】组件spec push失败 ."
82
+ end
83
+ end
84
+
85
+ success_specs = sources_sepc - fail_push_specs
86
+ if success_specs.any?
87
+ auto_success = ""
88
+ success_specs.uniq.each do |spec|
89
+ auto_success += "#{spec.name} | #{spec.version}\n"
90
+ UI.message "【 #{spec.name} | #{spec.version} 】二进制组件制作完成".green
91
+ end
92
+ UI.message auto_success
93
+ ENV['auto_success'] = auto_success
94
+ end
95
+ #pod repo update
96
+ UI.title("Updating Spec Repositories\n".yellow) do
97
+ Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new([])).run
98
+ end
99
+
100
+ # 上传源码podspec
101
+ UI.title("Pushing source podspec for #{@specification.name}") do
102
+ Pod::Command::Bin::Repo::Push.new(CLAide::ARGV.new([@podspec, '--loose-options'])).run
103
+ end if @push_source_podspec
104
+
105
+ end
106
+
107
+ #制作二进制包
108
+ def run_archive
109
+ argvs = [
110
+ "--sources=#{sources_option(@code_dependencies, @sources)},https:\/\/cdn.cocoapods.org"
111
+ ]
112
+
113
+ argvs += @additional_args unless @additional_args.nil?
114
+
115
+ argvs << @podspec if @podspec
116
+ argvs.delete(Array.new)
117
+
118
+ unless @clean
119
+ argvs += ['--no-clean']
120
+ end
121
+ if @code_dependencies
122
+ argvs += ['--code-dependencies']
123
+ end
124
+ if @verbose
125
+ argvs += ['--verbose']
126
+ end
127
+ if @allow_prerelease
128
+ argvs += ['--allow-prerelease']
129
+ end
130
+ if @framework_output
131
+ argvs += ['--framework-output']
132
+ end
133
+ if @all_make
134
+ argvs += ['--all-make']
135
+ end
136
+ # if @env
137
+ # argvs += ["--env=#{@env}"]
138
+ # end
139
+ argvs += ["--configuration=#{@config}"]
140
+
141
+ archive = Pod::Command::Bin::Archive.new(CLAide::ARGV.new(argvs))
142
+ archive.validate!
143
+ sources_sepc = archive.run
144
+ sources_sepc
145
+ end
146
+
147
+ def code_podsepc_extname
148
+ '.podsepc'
149
+ end
150
+
151
+ def binary_podsepc_json
152
+ "#{@specification.name}.binary.podspec.json"
153
+ end
154
+
155
+ def binary_template_podsepc
156
+ "#{@specification.name}.binary-template.podspec"
157
+ end
158
+
159
+ def template_spec_file
160
+ @template_spec_file ||= begin
161
+ if @template_podspec
162
+ find_spec_file(@template_podspec)
163
+ else
164
+ binary_template_spec_file
165
+ end
166
+ end
167
+ end
168
+
169
+ def spec_file
170
+ @spec_file ||= begin
171
+ if @podspec
172
+ find_spec_file(@podspec) || @podspec
173
+ else
174
+ if code_spec_files.empty?
175
+ raise Informative, '当前目录下没有找到可用源码 podspec.'
176
+ end
177
+
178
+ spec_file = if @binary
179
+ code_spec = Pod::Specification.from_file(code_spec_files.first)
180
+ if template_spec_file
181
+ template_spec = Pod::Specification.from_file(template_spec_file)
182
+ end
183
+ create_binary_spec_file(code_spec, template_spec)
184
+ else
185
+ code_spec_files.first
186
+ end
187
+ spec_file
188
+ end
189
+ end
190
+ end
191
+
192
+ #Dir.glob 可替代
193
+ def find_podspec
194
+ name = nil
195
+ Pathname.pwd.children.each do |child|
196
+ # puts child
197
+ if File.file?(child)
198
+ if child.extname == '.podspec'
199
+ name = File.basename(child)
200
+ unless name.include?("binary-template")
201
+ return name
202
+ end
203
+ end
204
+ end
205
+ end
206
+ return name
207
+ end
208
+
209
+ end
210
+ end
211
+ end
212
+ end