cocoapods-aomi-bin 0.0.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.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +22 -0
  3. data/README.md +11 -0
  4. data/lib/cocoapods-lhj-bin.rb +2 -0
  5. data/lib/cocoapods-lhj-bin/command.rb +1 -0
  6. data/lib/cocoapods-lhj-bin/command/bin.rb +58 -0
  7. data/lib/cocoapods-lhj-bin/command/bin/archive.rb +233 -0
  8. data/lib/cocoapods-lhj-bin/command/bin/auto.rb +200 -0
  9. data/lib/cocoapods-lhj-bin/command/bin/code.rb +232 -0
  10. data/lib/cocoapods-lhj-bin/command/bin/dup.rb +78 -0
  11. data/lib/cocoapods-lhj-bin/command/bin/import.rb +130 -0
  12. data/lib/cocoapods-lhj-bin/command/bin/init.rb +69 -0
  13. data/lib/cocoapods-lhj-bin/command/bin/initHotKey.rb +70 -0
  14. data/lib/cocoapods-lhj-bin/command/bin/install.rb +44 -0
  15. data/lib/cocoapods-lhj-bin/command/bin/lhj.rb +46 -0
  16. data/lib/cocoapods-lhj-bin/command/bin/lib/lint.rb +69 -0
  17. data/lib/cocoapods-lhj-bin/command/bin/repo/update.rb +43 -0
  18. data/lib/cocoapods-lhj-bin/command/bin/spec/create.rb +73 -0
  19. data/lib/cocoapods-lhj-bin/command/bin/spec/push.rb +115 -0
  20. data/lib/cocoapods-lhj-bin/command/bin/update.rb +153 -0
  21. data/lib/cocoapods-lhj-bin/config/config.rb +147 -0
  22. data/lib/cocoapods-lhj-bin/config/config_asker.rb +57 -0
  23. data/lib/cocoapods-lhj-bin/config/config_builder.rb +216 -0
  24. data/lib/cocoapods-lhj-bin/config/config_hot_key.rb +103 -0
  25. data/lib/cocoapods-lhj-bin/config/config_hot_key_asker.rb +57 -0
  26. data/lib/cocoapods-lhj-bin/gem_version.rb +9 -0
  27. data/lib/cocoapods-lhj-bin/helpers.rb +5 -0
  28. data/lib/cocoapods-lhj-bin/helpers/Info.plist +0 -0
  29. data/lib/cocoapods-lhj-bin/helpers/build_helper.rb +158 -0
  30. data/lib/cocoapods-lhj-bin/helpers/build_utils.rb +93 -0
  31. data/lib/cocoapods-lhj-bin/helpers/framework.rb +85 -0
  32. data/lib/cocoapods-lhj-bin/helpers/framework_builder.rb +444 -0
  33. data/lib/cocoapods-lhj-bin/helpers/library.rb +54 -0
  34. data/lib/cocoapods-lhj-bin/helpers/library_builder.rb +90 -0
  35. data/lib/cocoapods-lhj-bin/helpers/sources_helper.rb +34 -0
  36. data/lib/cocoapods-lhj-bin/helpers/spec_creator.rb +168 -0
  37. data/lib/cocoapods-lhj-bin/helpers/spec_files_helper.rb +75 -0
  38. data/lib/cocoapods-lhj-bin/helpers/spec_source_creator.rb +220 -0
  39. data/lib/cocoapods-lhj-bin/helpers/upload_helper.rb +105 -0
  40. data/lib/cocoapods-lhj-bin/native.rb +19 -0
  41. data/lib/cocoapods-lhj-bin/native/acknowledgements.rb +27 -0
  42. data/lib/cocoapods-lhj-bin/native/analyzer.rb +55 -0
  43. data/lib/cocoapods-lhj-bin/native/file_accessor.rb +28 -0
  44. data/lib/cocoapods-lhj-bin/native/installation_options.rb +25 -0
  45. data/lib/cocoapods-lhj-bin/native/installer.rb +135 -0
  46. data/lib/cocoapods-lhj-bin/native/linter.rb +26 -0
  47. data/lib/cocoapods-lhj-bin/native/path_source.rb +33 -0
  48. data/lib/cocoapods-lhj-bin/native/pod_source_installer.rb +19 -0
  49. data/lib/cocoapods-lhj-bin/native/pod_target_installer.rb +94 -0
  50. data/lib/cocoapods-lhj-bin/native/podfile.rb +91 -0
  51. data/lib/cocoapods-lhj-bin/native/podfile_env.rb +37 -0
  52. data/lib/cocoapods-lhj-bin/native/podfile_generator.rb +199 -0
  53. data/lib/cocoapods-lhj-bin/native/podspec_finder.rb +25 -0
  54. data/lib/cocoapods-lhj-bin/native/resolver.rb +230 -0
  55. data/lib/cocoapods-lhj-bin/native/sandbox_analyzer.rb +34 -0
  56. data/lib/cocoapods-lhj-bin/native/source.rb +35 -0
  57. data/lib/cocoapods-lhj-bin/native/sources_manager.rb +20 -0
  58. data/lib/cocoapods-lhj-bin/native/specification.rb +31 -0
  59. data/lib/cocoapods-lhj-bin/native/target_validator.rb +41 -0
  60. data/lib/cocoapods-lhj-bin/native/validator.rb +40 -0
  61. data/lib/cocoapods-lhj-bin/source_provider_hook.rb +66 -0
  62. data/lib/cocoapods_plugin.rb +2 -0
  63. data/spec/command/bin_spec.rb +12 -0
  64. data/spec/spec_helper.rb +50 -0
  65. metadata +178 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5a2fc6b5b095570dddec6fe7ae36250adfaf03cfd232a2cd0cd872e9d95fd047
4
+ data.tar.gz: 286dedaef6a35e1a124b4558236ea3597297c740ba467bdf5909abbfa081434a
5
+ SHA512:
6
+ metadata.gz: 66663a4f6020566926e0a3c7d68b264dd51f632290277dcbddfdd121333b04e68cf6a1f847d1816324fe20e37e692d1c3700e203df17a4495752728ab94b33d0
7
+ data.tar.gz: c2826845e78a12982977eb3e9f65d3bcb778aa89039265d08e13e2cce9d0bca3f3feb232325c6b6baf355c5df25e10f026bb7ca19584d0a23a9be404e24e97a8
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2021 lihaijian <sanan.li@qq.com>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # cocoapods-lhj-bin
2
+
3
+ A description of cocoapods-lhj-bin.
4
+
5
+ ## Installation
6
+
7
+ $ gem install cocoapods-lhj-bin
8
+
9
+ ## Usage
10
+
11
+ $ pod spec bin POD_NAME
@@ -0,0 +1,2 @@
1
+ require 'cocoapods-lhj-bin/gem_version'
2
+ require 'cocoapods-lhj-bin/native/sources_manager'
@@ -0,0 +1 @@
1
+ require 'cocoapods-lhj-bin/command/bin'
@@ -0,0 +1,58 @@
1
+ require 'cocoapods-lhj-bin/command/bin/initHotKey'
2
+ require 'cocoapods-lhj-bin/command/bin/init'
3
+ require 'cocoapods-lhj-bin/command/bin/archive'
4
+ require 'cocoapods-lhj-bin/command/bin/auto'
5
+ require 'cocoapods-lhj-bin/command/bin/code'
6
+ require 'cocoapods-lhj-bin/command/bin/update'
7
+ require 'cocoapods-lhj-bin/command/bin/install'
8
+ require 'cocoapods-lhj-bin/command/bin/import'
9
+ require 'cocoapods-lhj-bin/command/bin/lhj'
10
+ require 'cocoapods-lhj-bin/helpers'
11
+
12
+ module Pod
13
+ class Command
14
+ # This is an example of a cocoapods plugin adding a top-level subcommand
15
+ # to the 'pod' command.
16
+ #
17
+ # You can also create subcommands of existing or new commands. Say you
18
+ # wanted to add a subcommand to `list` to show newly deprecated pods,
19
+ # (e.g. `pod list deprecated`), there are a few things that would need
20
+ # to change.
21
+ #
22
+ # - move this file to `lib/pod/command/list/deprecated.rb` and update
23
+ # the class to exist in the the Pod::Command::List namespace
24
+ # - change this class to extend from `List` instead of `Command`. This
25
+ # tells the plugin system that it is a subcommand of `list`.
26
+ # - edit `lib/cocoapods_plugins.rb` to require this file
27
+ #
28
+ # @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
29
+ # in the `plugins.json` file, once your plugin is released.
30
+ #
31
+ class Bin < Command
32
+ include CBin::SourcesHelper
33
+ include CBin::SpecFilesHelper
34
+
35
+ self.abstract_command = true
36
+
37
+ self.default_subcommand = 'open'
38
+ self.summary = '组件二进制化插件.'
39
+ self.description = <<-DESC
40
+ 组件二进制化插件。利用源码私有源与二进制私有源实现对组件依赖类型的切换。
41
+ DESC
42
+
43
+ def initialize(argv)
44
+ require 'cocoapods-lhj-bin/native'
45
+
46
+ @help = argv.flag?('help')
47
+ super
48
+ end
49
+
50
+ def validate!
51
+ super
52
+ # 这里由于 --help 是在 validate! 方法中提取的,会导致 --help 失效
53
+ # pod lib create 也有这个问题
54
+ banner! if @help
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,233 @@
1
+ require 'cocoapods-lhj-bin/native/podfile'
2
+ require 'cocoapods/command/gen'
3
+ require 'cocoapods/generate'
4
+ require 'cocoapods-lhj-bin/helpers/framework_builder'
5
+ require 'cocoapods-lhj-bin/helpers/library_builder'
6
+ require 'cocoapods-lhj-bin/helpers/build_helper'
7
+ require 'cocoapods-lhj-bin/helpers/spec_files_helper'
8
+ require 'cocoapods-lhj-bin/helpers/spec_source_creator'
9
+ require 'cocoapods-lhj-bin/config/config_builder'
10
+ require 'cocoapods-lhj-bin/command/bin/lib/lint'
11
+ require 'xcodeproj'
12
+
13
+ module Pod
14
+ class Command
15
+ class Bin < Command
16
+ class Archive < Bin
17
+
18
+ @@missing_binary_specs = []
19
+
20
+ self.summary = '将组件归档为静态库 .a.'
21
+ self.description = <<-DESC
22
+ 将组件归档为静态库 framework,仅支持 iOS 平台
23
+ 此静态 framework 不包含依赖组件的 symbol
24
+ DESC
25
+
26
+ def self.options
27
+ [
28
+ ['--all-make', '对该组件的依赖库,全部制作为二进制组件'],
29
+ ['--code-dependencies', '使用源码依赖'],
30
+ ['--no-clean', '保留构建中间产物'],
31
+ ['--sources', '私有源地址,多个用分号区分'],
32
+ ['--framework-output', '输出framework文件'],
33
+ ['--no-zip', '不压缩静态库 为 zip'],
34
+ ['--configuration', 'Build the specified configuration (e.g. Debug). Defaults to Release'],
35
+ ['--env', "该组件上传的环境 %w[dev debug_iphoneos release_iphoneos]"]
36
+ ].concat(Pod::Command::Gen.options).concat(super).uniq
37
+ end
38
+
39
+ self.arguments = [
40
+ CLAide::Argument.new('NAME.podspec', false)
41
+ ]
42
+
43
+ def initialize(argv)
44
+ @env = argv.option('env') || 'dev'
45
+ CBin.config.set_configuration_env(@env)
46
+ UI.warn "====== cocoapods-lhj-bin #{CBin::VERSION} 版本 ======== \n "
47
+ UI.warn "====== #{@env} 环境 ======== \n "
48
+
49
+ @code_dependencies = argv.flag?('code-dependencies')
50
+ @framework_output = argv.flag?('framework-output', false )
51
+ @clean = argv.flag?('no-clean', false)
52
+ @zip = argv.flag?('zip', true)
53
+ @all_make = argv.flag?('all-make', false )
54
+ @sources = argv.option('sources') || []
55
+ @platform = Platform.new(:ios)
56
+
57
+ @config = argv.option('configuration', 'Release')
58
+
59
+ @framework_path
60
+ super
61
+
62
+ @additional_args = argv.remainder!
63
+ @spec_file = @additional_args[0]
64
+ @build_finshed = false
65
+ end
66
+
67
+ def run
68
+ # 清除之前的缓存
69
+ CBin::Config::Builder.instance.clean
70
+
71
+ @spec = Specification.from_file(spec_file)
72
+ generate_project
73
+
74
+ swift_pods_buildsetting
75
+
76
+ build_root_spec
77
+
78
+ sources_sepc = Array.new
79
+ sources_sepc << @spec
80
+ sources_sepc.concat(build_dependencies) if @all_make
81
+
82
+ sources_sepc
83
+ end
84
+
85
+ def build_root_spec
86
+ builder = CBin::Build::Helper.new(@spec,
87
+ @platform,
88
+ @framework_output,
89
+ @zip,
90
+ @spec,
91
+ CBin::Config::Builder.instance.white_pod_list.include?(@spec.name),
92
+ @config)
93
+ builder.build
94
+ builder.clean_workspace if @clean && !@all_make
95
+ end
96
+
97
+ def build_dependencies
98
+ @build_finshed = true
99
+ #如果没要求,就清空依赖库数据
100
+ sources_sepc = []
101
+ @@missing_binary_specs.uniq.each do |spec|
102
+ next if spec.name.include?('/')
103
+ next if spec.name == @spec.name
104
+ #过滤白名单
105
+ next if CBin::Config::Builder.instance.white_pod_list.include?(spec.name)
106
+ #过滤 git
107
+ if spec.source[:git] && spec.source[:git]
108
+ spec_git = spec.source[:git]
109
+ spec_git_res = false
110
+ CBin::Config::Builder.instance.ignore_git_list.each do |ignore_git|
111
+ spec_git_res = spec_git.include?(ignore_git)
112
+ break if spec_git_res
113
+ end
114
+ next if spec_git_res
115
+ end
116
+ UI.warn "#{spec.name}.podspec 带有 vendored_frameworks 字段,请检查是否有效!!!" if spec.attributes_hash['vendored_frameworks']
117
+ next if spec.attributes_hash['vendored_frameworks'] && @spec.name != spec.name #过滤带有vendored_frameworks的
118
+ next if spec.attributes_hash['ios.vendored_frameworks'] && @spec.name != spec.name #过滤带有vendored_frameworks的
119
+ #获取没有制作二进制版本的spec集合
120
+ sources_sepc << spec
121
+ end
122
+
123
+ fail_build_specs = []
124
+ sources_sepc.uniq.each do |spec|
125
+ begin
126
+ builder = CBin::Build::Helper.new(spec,
127
+ @platform,
128
+ @framework_output,
129
+ @zip,
130
+ @spec,
131
+ false ,
132
+ @config)
133
+ builder.build
134
+ rescue Object => exception
135
+ UI.puts exception
136
+ fail_build_specs << spec
137
+ end
138
+ end
139
+
140
+ if fail_build_specs.any?
141
+ fail_build_specs.uniq.each do |spec|
142
+ UI.warn "【#{spec.name} | #{spec.version}】组件二进制版本编译失败 ."
143
+ end
144
+ end
145
+ sources_sepc - fail_build_specs
146
+ end
147
+
148
+ # 解析器传过来的
149
+ def Archive.missing_binary_specs(missing_binary_specs)
150
+ @@missing_binary_specs = missing_binary_specs unless @build_finshed
151
+ end
152
+
153
+ private
154
+
155
+ def generate_project
156
+ Podfile.execute_with_bin_plugin do
157
+ Podfile.execute_with_use_binaries(!@code_dependencies) do
158
+ argvs = [
159
+ "--sources=#{sources_option(@code_dependencies, @sources)}",
160
+ "--gen-directory=#{CBin::Config::Builder.instance.gen_dir}",
161
+ '--clean',
162
+ "--verbose",
163
+ *@additional_args
164
+ ]
165
+
166
+ podfile= File.join(Pathname.pwd, "Podfile")
167
+ if File.exist?(podfile)
168
+ argvs += ['--use-podfile']
169
+ end
170
+
171
+
172
+ unless CBin::Build::Utils.is_framework(@podspec)
173
+ argvs += ['--use-libraries']
174
+ end
175
+
176
+ argvs << spec_file if spec_file
177
+
178
+ gen = Pod::Command::Gen.new(CLAide::ARGV.new(argvs))
179
+ gen.validate!
180
+ gen.run
181
+ end
182
+ end
183
+ end
184
+
185
+ def swift_pods_buildsetting
186
+ # swift_project_link_header
187
+ worksppace_path = File.expand_path("#{CBin::Config::Builder.instance.gen_dir}/#{@spec.name}")
188
+ path = File.join(worksppace_path, "Pods.xcodeproj")
189
+ path = File.join(worksppace_path, "Pods/Pods.xcodeproj") unless File.exist?(path)
190
+ raise Informative, "#{path} File no exist, please check" unless File.exist?(path)
191
+ project = Xcodeproj::Project.open(path)
192
+ project.build_configurations.each do |x|
193
+ x.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = true #设置生成swift inter
194
+ end
195
+ project.save
196
+ end
197
+
198
+ # def swift_project_link_header
199
+ # worksppace_path = Pod::Config.instance.installation_root
200
+ # Dir.chdir(worksppace_path) do
201
+ # shell_script = <<-'SH'.strip_heredoc
202
+ # ditto "${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h" "${CBin::Config::Builder.instance.gen_dir}"
203
+ # SH
204
+ # shell_script
205
+ #
206
+ # # project = Xcodeproj::Project.open(Dir.glob('*.xcodeproj').first)
207
+ # # project.build_configurations.each do |x|
208
+ # # x.build_settings['DERIVED_SOURCES_DIR']
209
+ # # end
210
+ # end
211
+ # end
212
+
213
+ def spec_file
214
+ @spec_file ||= begin
215
+ if @podspec
216
+ find_spec_file(@podspec)
217
+ else
218
+ if code_spec_files.empty?
219
+ raise Informative, '当前目录下没有找到可用源码 podspec.'
220
+ end
221
+
222
+ spec_file = code_spec_files.first
223
+ spec_file
224
+ end
225
+ end
226
+ end
227
+
228
+
229
+
230
+ end
231
+ end
232
+ end
233
+ end
@@ -0,0 +1,200 @@
1
+ require 'cocoapods-lhj-bin/command/bin/auto'
2
+ require 'cocoapods-lhj-bin/helpers/upload_helper'
3
+
4
+ module Pod
5
+ class Command
6
+ class Bin < Command
7
+ class Auto < Bin
8
+ self.summary = '打开 workspace 工程.'
9
+
10
+ self.arguments = [
11
+ CLAide::Argument.new('NAME.podspec', false)
12
+ ]
13
+ def self.options
14
+ [
15
+ ['--code-dependencies', '使用源码依赖'],
16
+ ['--allow-prerelease', '允许使用 prerelease 的版本'],
17
+ ['--no-clean', '保留构建中间产物'],
18
+ ['--framework-output', '输出framework文件'],
19
+ ['--no-zip', '不压缩静态 framework 为 zip'],
20
+ ['--all-make', '对该组件的依赖库,全部制作为二进制组件'],
21
+ ['--configuration', 'Build the specified configuration (e.g. Release ). Defaults to Debug'],
22
+ ['--env', "该组件上传的环境 %w[dev debug_iphoneos release_iphoneos]"]
23
+ ].concat(Pod::Command::Gen.options).concat(super).uniq
24
+ end
25
+
26
+ def initialize(argv)
27
+
28
+ @env = argv.option('env') || 'dev'
29
+ CBin.config.set_configuration_env(@env)
30
+
31
+ @podspec = argv.shift_argument || find_podspec
32
+ @specification = Specification.from_file(@podspec)
33
+
34
+ @code_dependencies = argv.flag?('code-dependencies')
35
+ @allow_prerelease = argv.flag?('allow-prerelease')
36
+ @framework_output = argv.flag?('framework-output', false)
37
+ @clean = argv.flag?('clean', true)
38
+ @zip = argv.flag?('zip', true)
39
+ @all_make = argv.flag?('all-make', false)
40
+ @verbose = argv.flag?('verbose', true)
41
+
42
+ @config = argv.option('configuration', 'Debug')
43
+ @additional_args = argv.remainder!
44
+
45
+ super
46
+ end
47
+
48
+ def validate!
49
+ help! "未找到 podspec文件" unless @podspec
50
+ super
51
+ end
52
+
53
+ def run
54
+ @specification = Specification.from_file(@podspec)
55
+
56
+ source_specs = run_archive
57
+
58
+ fail_push_specs = []
59
+ source_specs.uniq.each do |spec|
60
+ begin
61
+ fail_push_specs << spec unless CBin::Upload::Helper.new(spec, @code_dependencies, @sources).upload
62
+ rescue Object => exception
63
+ UI.puts exception
64
+ fail_push_specs << spec
65
+ end
66
+ end
67
+
68
+ # CBin::Upload::Helper.new(@specification, @code_dependencies, @sources).upload
69
+
70
+ if fail_push_specs.any?
71
+ fail_push_specs.uniq.each do |spec|
72
+ UI.warn "【#{spec.name} | #{spec.version}】组件spec push失败 ."
73
+ end
74
+ end
75
+
76
+ success_specs = source_specs - fail_push_specs
77
+ if success_specs.any?
78
+ auto_success = ""
79
+ success_specs.uniq.each do |spec|
80
+ auto_success += "#{spec.name} | #{spec.version}\n"
81
+ UI.warn "===【 #{spec.name} | #{spec.version} 】二进制组件制作完成 !!! "
82
+ end
83
+ puts "============== auto_success"
84
+ puts auto_success
85
+ ENV['auto_success'] = auto_success
86
+ end
87
+ #pod repo update
88
+ UI.section("\nUpdating Spec Repositories\n".yellow) do
89
+ Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new([])).run
90
+ end
91
+
92
+ end
93
+
94
+ #制作二进制包
95
+
96
+ def run_archive
97
+ argvs = [
98
+ "--sources=#{sources_option(@code_dependencies, @sources)},https:\/\/cdn.cocoapods.org",
99
+ @additional_args
100
+ ]
101
+
102
+ argvs << spec_file if spec_file
103
+ argvs.delete(Array.new)
104
+
105
+ unless @clean
106
+ argvs += ['--no-clean']
107
+ end
108
+ if @code_dependencies
109
+ argvs += ['--code-dependencies']
110
+ end
111
+ if @verbose
112
+ argvs += ['--verbose']
113
+ end
114
+ if @allow_prerelease
115
+ argvs += ['--allow-prerelease']
116
+ end
117
+ if @framework_output
118
+ argvs += ['--framework-output']
119
+ end
120
+ if @all_make
121
+ argvs += ['--all-make']
122
+ end
123
+ if @env
124
+ argvs += ["--env=#{@env}"]
125
+ end
126
+ argvs += ["--configuration=#{@config}"]
127
+
128
+ archive = Pod::Command::Bin::Archive.new(CLAide::ARGV.new(argvs))
129
+ archive.validate!
130
+ source_specs = archive.run
131
+ source_specs
132
+ end
133
+
134
+
135
+ def code_podsepc_extname
136
+ '.podsepc'
137
+ end
138
+
139
+ def binary_podsepc_json
140
+ "#{@specification.name}.binary.podspec.json"
141
+ end
142
+
143
+ def binary_template_podsepc
144
+ "#{@specification.name}.binary-template.podspec"
145
+ end
146
+
147
+ def template_spec_file
148
+ @template_spec_file ||= begin
149
+ if @template_podspec
150
+ find_spec_file(@template_podspec)
151
+ else
152
+ binary_template_spec_file
153
+ end
154
+ end
155
+ end
156
+
157
+ def spec_file
158
+ @spec_file ||= begin
159
+ if @podspec
160
+ find_spec_file(@podspec) || @podspec
161
+ else
162
+ if code_spec_files.empty?
163
+ raise Informative, '当前目录下没有找到可用源码 podspec.'
164
+ end
165
+
166
+ spec_file = if @binary
167
+ code_spec = Pod::Specification.from_file(code_spec_files.first)
168
+ if template_spec_file
169
+ template_spec = Pod::Specification.from_file(template_spec_file)
170
+ end
171
+ create_binary_spec_file(code_spec, template_spec)
172
+ else
173
+ code_spec_files.first
174
+ end
175
+ spec_file
176
+ end
177
+ end
178
+ end
179
+
180
+ #Dir.glob 可替代
181
+ def find_podspec
182
+ name = nil
183
+ Pathname.pwd.children.each do |child|
184
+ puts child
185
+ if File.file?(child)
186
+ if child.extname == '.podspec'
187
+ name = File.basename(child)
188
+ unless name.include?("binary-template")
189
+ return name
190
+ end
191
+ end
192
+ end
193
+ end
194
+ return name
195
+ end
196
+
197
+ end
198
+ end
199
+ end
200
+ end