cocoapods-imy-hycan-bin 0.1.0
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 +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +44 -0
- data/lib/cocoapods-imy-bin.rb +2 -0
- data/lib/cocoapods-imy-bin/command.rb +2 -0
- data/lib/cocoapods-imy-bin/command/bin.rb +61 -0
- data/lib/cocoapods-imy-bin/command/bin/archive.rb +229 -0
- data/lib/cocoapods-imy-bin/command/bin/auto.rb +199 -0
- data/lib/cocoapods-imy-bin/command/bin/code.rb +479 -0
- data/lib/cocoapods-imy-bin/command/bin/dup.rb +78 -0
- data/lib/cocoapods-imy-bin/command/bin/imy.rb +46 -0
- data/lib/cocoapods-imy-bin/command/bin/init.rb +69 -0
- data/lib/cocoapods-imy-bin/command/bin/initHotKey.rb +70 -0
- data/lib/cocoapods-imy-bin/command/bin/install.rb +48 -0
- data/lib/cocoapods-imy-bin/command/bin/lib/lint.rb +69 -0
- data/lib/cocoapods-imy-bin/command/bin/repo/update.rb +43 -0
- data/lib/cocoapods-imy-bin/command/bin/spec/create.rb +73 -0
- data/lib/cocoapods-imy-bin/command/bin/spec/push.rb +114 -0
- data/lib/cocoapods-imy-bin/command/bin/update.rb +154 -0
- data/lib/cocoapods-imy-bin/config/config.rb +137 -0
- data/lib/cocoapods-imy-bin/config/config_asker.rb +57 -0
- data/lib/cocoapods-imy-bin/config/config_builder.rb +216 -0
- data/lib/cocoapods-imy-bin/config/config_hot_key.rb +103 -0
- data/lib/cocoapods-imy-bin/config/config_hot_key_asker.rb +57 -0
- data/lib/cocoapods-imy-bin/gem_version.rb +10 -0
- data/lib/cocoapods-imy-bin/helpers.rb +5 -0
- data/lib/cocoapods-imy-bin/helpers/Info.plist +0 -0
- data/lib/cocoapods-imy-bin/helpers/build_helper.rb +158 -0
- data/lib/cocoapods-imy-bin/helpers/build_utils.rb +63 -0
- data/lib/cocoapods-imy-bin/helpers/framework.rb +85 -0
- data/lib/cocoapods-imy-bin/helpers/framework_builder.rb +444 -0
- data/lib/cocoapods-imy-bin/helpers/library.rb +54 -0
- data/lib/cocoapods-imy-bin/helpers/library_builder.rb +90 -0
- data/lib/cocoapods-imy-bin/helpers/sources_helper.rb +36 -0
- data/lib/cocoapods-imy-bin/helpers/spec_creator.rb +170 -0
- data/lib/cocoapods-imy-bin/helpers/spec_files_helper.rb +77 -0
- data/lib/cocoapods-imy-bin/helpers/spec_source_creator.rb +228 -0
- data/lib/cocoapods-imy-bin/helpers/upload_helper.rb +89 -0
- data/lib/cocoapods-imy-bin/native.rb +23 -0
- data/lib/cocoapods-imy-bin/native/acknowledgements.rb +27 -0
- data/lib/cocoapods-imy-bin/native/analyzer.rb +55 -0
- data/lib/cocoapods-imy-bin/native/file_accessor.rb +28 -0
- data/lib/cocoapods-imy-bin/native/installation_options.rb +25 -0
- data/lib/cocoapods-imy-bin/native/installer.rb +135 -0
- data/lib/cocoapods-imy-bin/native/linter.rb +26 -0
- data/lib/cocoapods-imy-bin/native/path_source.rb +33 -0
- data/lib/cocoapods-imy-bin/native/pod_source_installer.rb +19 -0
- data/lib/cocoapods-imy-bin/native/pod_target_installer.rb +94 -0
- data/lib/cocoapods-imy-bin/native/podfile.rb +91 -0
- data/lib/cocoapods-imy-bin/native/podfile_env.rb +37 -0
- data/lib/cocoapods-imy-bin/native/podfile_generator.rb +199 -0
- data/lib/cocoapods-imy-bin/native/podspec_finder.rb +25 -0
- data/lib/cocoapods-imy-bin/native/resolver.rb +230 -0
- data/lib/cocoapods-imy-bin/native/sandbox_analyzer.rb +34 -0
- data/lib/cocoapods-imy-bin/native/source.rb +35 -0
- data/lib/cocoapods-imy-bin/native/sources_manager.rb +20 -0
- data/lib/cocoapods-imy-bin/native/specification.rb +31 -0
- data/lib/cocoapods-imy-bin/native/target_validator.rb +41 -0
- data/lib/cocoapods-imy-bin/native/validator.rb +40 -0
- data/lib/cocoapods-imy-bin/source_provider_hook.rb +66 -0
- data/lib/cocoapods/imy/hycan/bin.rb +12 -0
- data/lib/cocoapods/imy/hycan/bin/version.rb +9 -0
- data/lib/cocoapods_plugin.rb +3 -0
- data/spec/command/bin_spec.rb +12 -0
- data/spec/spec_helper.rb +50 -0
- metadata +180 -0
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
require 'cocoapods/target/pod_target'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
class Bin < Command
|
7
|
+
class Dup < Bin
|
8
|
+
self.summary = '在Podfile目录下,查找Pods下同名资源名'
|
9
|
+
|
10
|
+
self.description = <<-DESC
|
11
|
+
在Podfile目录下,查找Pods下同名资源名
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('NAME', false)
|
16
|
+
]
|
17
|
+
def self.options
|
18
|
+
[
|
19
|
+
['--all-clean', '删除所有已经下载的源码'],
|
20
|
+
['--clean', '删除所有指定下载的源码'],
|
21
|
+
['--list', '展示所有一级下载的源码以及其大小'],
|
22
|
+
['--source', '源码路径,本地路径,会去自动链接本地源码']
|
23
|
+
]
|
24
|
+
end
|
25
|
+
|
26
|
+
def initialize(argv)
|
27
|
+
@codeSource = argv.option('source') || nil
|
28
|
+
|
29
|
+
@config = Pod::Config.instance
|
30
|
+
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def run
|
36
|
+
target_definition = Pod::Config.instance.podfile.target_definition_list[1]
|
37
|
+
|
38
|
+
user_build_configurations = target_definition.build_configurations || Target::DEFAULT_BUILD_CONFIGURATIONS
|
39
|
+
aggregateTarget = AggregateTarget.new(Pod::Config.instance.sandbox,
|
40
|
+
target_definition.uses_frameworks?,
|
41
|
+
user_build_configurations ,
|
42
|
+
nil,
|
43
|
+
target_definition.platform,
|
44
|
+
target_definition,
|
45
|
+
Pod::Config.instance.installation_root,
|
46
|
+
nil,
|
47
|
+
nil ,
|
48
|
+
user_build_configurations)
|
49
|
+
input_file = aggregateTarget.copy_resources_script_path
|
50
|
+
output_pods_suffix_txt = File.join(Pod::Config.instance.project_root,"output_pods_suffix.txt")
|
51
|
+
output_pods_uniq_txt = File.join(Pod::Config.instance.project_root,"output_pods_uniq.txt")
|
52
|
+
ignore_array = ["bundle","mp3"]
|
53
|
+
resources_path = File.join(File.dirname(File.dirname(File.dirname(__FILE__))),"resources")
|
54
|
+
shell_file = File.join(resources_path,"Pods-check-deduplication-resources.sh")
|
55
|
+
#ruby 调用shell 文件、命令传入
|
56
|
+
# stdout shell 脚本输出的文本
|
57
|
+
# status 退出的状态
|
58
|
+
stdout, status = Open3.capture2('/bin/sh',
|
59
|
+
"#{shell_file}",
|
60
|
+
"#{input_file}",
|
61
|
+
"#{output_pods_suffix_txt}",
|
62
|
+
"#{output_pods_uniq_txt}",
|
63
|
+
"#{ignore_array}")
|
64
|
+
|
65
|
+
#重复资源 抛出异常
|
66
|
+
if status.to_i != 0
|
67
|
+
raise "由于权限不足,请手动创建 后重试"
|
68
|
+
else #重复资源,警告
|
69
|
+
raise "由于权限不足,请手动创建 后重试"
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'cocoapods-imy-bin/config/config_hot_key_asker'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Bin < Command
|
6
|
+
class Imy < Bin
|
7
|
+
self.summary = '快捷键'
|
8
|
+
self.description = <<-DESC
|
9
|
+
创建 文件,在其中保存插件需要的配置信息,
|
10
|
+
如二进制私有源地址、源码私有源地址等。
|
11
|
+
DESC
|
12
|
+
|
13
|
+
self.arguments = [
|
14
|
+
CLAide::Argument.new('1', false)
|
15
|
+
]
|
16
|
+
|
17
|
+
def self.options
|
18
|
+
[
|
19
|
+
].concat(super)
|
20
|
+
end
|
21
|
+
|
22
|
+
def initialize(argv)
|
23
|
+
@hot_key = argv.shift_argument || '1'
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
def run
|
28
|
+
CBin.config_hot_key.set_hot_key_index(@hot_key)
|
29
|
+
UI.puts "cd #{CBin.config_hot_key.hot_key_dir}".yellow
|
30
|
+
|
31
|
+
if Dir.exist?(CBin.config_hot_key.hot_key_dir)
|
32
|
+
Dir.chdir(CBin.config_hot_key.hot_key_dir) do
|
33
|
+
UI.puts " #{CBin.config_hot_key.hot_key_cmd}".yellow
|
34
|
+
system CBin.config_hot_key.hot_key_cmd
|
35
|
+
end
|
36
|
+
else
|
37
|
+
raise "配置项中文件目录不存在 #{CBin.config_hot_key.hot_key_dir}"
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'cocoapods-imy-bin/config/config_asker'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Bin < Command
|
6
|
+
class Init < Bin
|
7
|
+
self.summary = '初始化插件的快捷键.'
|
8
|
+
self.description = <<-DESC
|
9
|
+
创建 文件,在其中保存插件需要的配置信息,
|
10
|
+
如快捷键1 快捷键2 所对应执行的命令
|
11
|
+
DESC
|
12
|
+
|
13
|
+
def self.options
|
14
|
+
[
|
15
|
+
['--bin-url=URL', '配置文件地址,直接从此地址下载配置文件']
|
16
|
+
].concat(super)
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize(argv)
|
20
|
+
@bin_url = argv.option('bin-url')
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def run
|
25
|
+
if @bin_url.nil?
|
26
|
+
config_with_asker
|
27
|
+
else
|
28
|
+
config_with_url(@bin_url)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def config_with_url(url)
|
35
|
+
require 'open-uri'
|
36
|
+
|
37
|
+
UI.puts "开始下载配置文件...\n"
|
38
|
+
file = open(url)
|
39
|
+
contents = YAML.safe_load(file.read)
|
40
|
+
|
41
|
+
UI.puts "开始同步配置文件...\n"
|
42
|
+
CBin.config.sync_config(contents.to_hash)
|
43
|
+
UI.puts "设置完成.\n".green
|
44
|
+
rescue Errno::ENOENT => e
|
45
|
+
raise Informative, "配置文件路径 #{url} 无效,请确认后重试."
|
46
|
+
end
|
47
|
+
|
48
|
+
def config_with_asker
|
49
|
+
asker = CBin::Config::Asker.new
|
50
|
+
asker.wellcome_message
|
51
|
+
|
52
|
+
config = {}
|
53
|
+
template_hash = CBin.config.template_hash
|
54
|
+
template_hash.each do |k, v|
|
55
|
+
default = begin
|
56
|
+
CBin.config.send(k)
|
57
|
+
rescue StandardError
|
58
|
+
nil
|
59
|
+
end
|
60
|
+
config[k] = asker.ask_with_answer(v[:description], default, v[:selection])
|
61
|
+
end
|
62
|
+
|
63
|
+
CBin.config.sync_config(config)
|
64
|
+
asker.done_message
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
|
2
|
+
require 'cocoapods-imy-bin/config/config_hot_key_asker'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
class Bin < Command
|
7
|
+
class Inithk < Bin
|
8
|
+
self.summary = '初始化快捷键配置.'
|
9
|
+
self.description = <<-DESC
|
10
|
+
创建 文件,在其中保存插件需要的配置信息,
|
11
|
+
如二进制私有源地址、源码私有源地址等。
|
12
|
+
DESC
|
13
|
+
|
14
|
+
def self.options
|
15
|
+
[
|
16
|
+
['--bin-url=URL', '配置文件地址,直接从此地址下载配置文件']
|
17
|
+
].concat(super)
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(argv)
|
21
|
+
@bin_url = argv.option('bin-url')
|
22
|
+
super
|
23
|
+
end
|
24
|
+
|
25
|
+
def run
|
26
|
+
if @bin_url.nil?
|
27
|
+
config_with_asker
|
28
|
+
else
|
29
|
+
config_with_url(@bin_url)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def config_with_url(url)
|
36
|
+
require 'open-uri'
|
37
|
+
|
38
|
+
UI.puts "开始下载配置文件...\n"
|
39
|
+
file = open(url)
|
40
|
+
contents = YAML.safe_load(file.read)
|
41
|
+
|
42
|
+
UI.puts "开始同步配置文件...\n"
|
43
|
+
CBin.config_hot_key.sync_config(contents.to_hash)
|
44
|
+
UI.puts "设置完成.\n".green
|
45
|
+
rescue Errno::ENOENT => e
|
46
|
+
raise Informative, "配置文件路径 #{url} 无效,请确认后重试."
|
47
|
+
end
|
48
|
+
|
49
|
+
def config_with_asker
|
50
|
+
asker = CBin::Config_Hot_Key::Asker.new
|
51
|
+
asker.wellcome_message
|
52
|
+
|
53
|
+
config = {}
|
54
|
+
template_hash = CBin.config_hot_key.template_hash
|
55
|
+
template_hash.each do |k, v|
|
56
|
+
default = begin
|
57
|
+
CBin.config_hot_key.send(k)
|
58
|
+
rescue StandardError
|
59
|
+
nil
|
60
|
+
end
|
61
|
+
config[k] = asker.ask_with_answer(v[:description], default, v[:selection])
|
62
|
+
end
|
63
|
+
|
64
|
+
CBin.config_hot_key.sync_config(config)
|
65
|
+
asker.done_message
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
|
2
|
+
require 'cocoapods-imy-bin/command/bin/update'
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Bin < Command
|
6
|
+
class Install < Bin
|
7
|
+
include Pod
|
8
|
+
|
9
|
+
self.summary = 'pod install 拦截器,会加载本地Podfile_local文件,DSL加载到原始Podfile文件中。'
|
10
|
+
|
11
|
+
self.description = <<-DESC
|
12
|
+
pod install 拦截器,会加载本地Podfile_local文件
|
13
|
+
会通过DSL加载到原始Podfile文件中
|
14
|
+
支持 pod 'xxx' 各种写法
|
15
|
+
支持 post_install/pre_install钩子,采用覆盖做法
|
16
|
+
DESC
|
17
|
+
def self.options
|
18
|
+
[
|
19
|
+
['--binary', 'set ENV["BINARY"] to true'],
|
20
|
+
['--repo-update', 'Force running `pod repo update` before install'],
|
21
|
+
['--deployment', 'Disallow any changes to the Podfile or the Podfile.lock during installation'],
|
22
|
+
['--clean-install', 'Ignore the contents of the project cache and force a full pod installation. This only ' \
|
23
|
+
'applies to projects that have enabled incremental installation']
|
24
|
+
].concat(super).reject { |(name, _)| name == '--no-repo-update' }
|
25
|
+
end
|
26
|
+
|
27
|
+
def initialize(argv)
|
28
|
+
if argv.flag?('binary')
|
29
|
+
ENV['BINARY'] = 'true'
|
30
|
+
end
|
31
|
+
@update = argv.flag?('update')
|
32
|
+
super
|
33
|
+
@additional_args = argv.remainder!
|
34
|
+
end
|
35
|
+
|
36
|
+
def run
|
37
|
+
Update.load_local_podfile
|
38
|
+
argvs = [
|
39
|
+
*@additional_args
|
40
|
+
]
|
41
|
+
gen = Pod::Command::Install.new(CLAide::ARGV.new(argvs))
|
42
|
+
gen.validate!
|
43
|
+
gen.run
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'cocoapods-imy-bin/config/config'
|
2
|
+
require 'cocoapods-imy-bin/native/podfile'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
class Bin < Command
|
7
|
+
class Lib < Bin
|
8
|
+
class Lint < Lib
|
9
|
+
self.summary = 'lint 组件.'
|
10
|
+
self.description = <<-DESC
|
11
|
+
lint 二进制组件 / 源码组件
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('NAME.podspec', false)
|
16
|
+
]
|
17
|
+
|
18
|
+
# lib lint 不会下载 source,所以不能进行二进制 lint
|
19
|
+
# 要 lint 二进制版本,需要进行 spec lint,此 lint 会去下载 source
|
20
|
+
def self.options
|
21
|
+
[
|
22
|
+
['--code-dependencies', '使用源码依赖进行 lint'],
|
23
|
+
['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
|
24
|
+
['--allow-prerelease', '允许使用 prerelease 的版本 lint']
|
25
|
+
].concat(Pod::Command::Lib::Lint.options).concat(super).uniq
|
26
|
+
end
|
27
|
+
|
28
|
+
def initialize(argv)
|
29
|
+
@loose_options = argv.flag?('loose-options')
|
30
|
+
@code_dependencies = argv.flag?('code-dependencies')
|
31
|
+
@sources = argv.option('sources') || []
|
32
|
+
@allow_prerelease = argv.flag?('allow-prerelease')
|
33
|
+
@podspec = argv.shift_argument
|
34
|
+
super
|
35
|
+
|
36
|
+
@additional_args = argv.remainder!
|
37
|
+
end
|
38
|
+
|
39
|
+
def run
|
40
|
+
Podfile.execute_with_bin_plugin do
|
41
|
+
Podfile.execute_with_allow_prerelease(@allow_prerelease) do
|
42
|
+
Podfile.execute_with_use_binaries(!@code_dependencies) do
|
43
|
+
argvs = [
|
44
|
+
@podspec || code_spec_files.first,
|
45
|
+
"--sources=#{sources_option(@code_dependencies, @sources)}",
|
46
|
+
*@additional_args
|
47
|
+
]
|
48
|
+
|
49
|
+
if @loose_options
|
50
|
+
argvs << '--allow-warnings'
|
51
|
+
if code_spec&.all_dependencies&.any?
|
52
|
+
argvs << '--use-libraries'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
lint = Pod::Command::Lib::Lint.new(CLAide::ARGV.new(argvs))
|
57
|
+
lint.validate!
|
58
|
+
lint.run
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'parallel'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Bin < Command
|
6
|
+
class Repo < Bin
|
7
|
+
class Update < Repo
|
8
|
+
self.summary = '更新私有源'
|
9
|
+
|
10
|
+
self.arguments = [
|
11
|
+
CLAide::Argument.new('NAME', false)
|
12
|
+
]
|
13
|
+
|
14
|
+
def self.options
|
15
|
+
[
|
16
|
+
['--all', '更新所有私有源,默认只更新二进制相关私有源']
|
17
|
+
].concat(super)
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(argv)
|
21
|
+
@all = argv.flag?('all')
|
22
|
+
@name = argv.shift_argument
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
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
|
+
UI.puts "更新私有源仓库 #{source.to_s}".yellow
|
33
|
+
source.update(show_output)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'cocoapods-imy-bin/helpers'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Bin < Command
|
6
|
+
class Spec < Bin
|
7
|
+
class Create < Spec
|
8
|
+
self.summary = '创建二进制 spec.'
|
9
|
+
self.description = <<-DESC
|
10
|
+
根据源码 podspec 文件,创建对应的二进制 podspec 文件.
|
11
|
+
DESC
|
12
|
+
|
13
|
+
def self.options
|
14
|
+
[
|
15
|
+
['--platforms=ios', '生成二进制 spec 支持的平台'],
|
16
|
+
['--template-podspec=A.binary-template.podspec', '生成拥有 subspec 的二进制 spec 需要的模版 podspec, 插件会更改 version 和 source'],
|
17
|
+
['--no-overwrite', '不允许覆盖']
|
18
|
+
].concat(super)
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(argv)
|
22
|
+
@platforms = argv.option('platforms', 'ios')
|
23
|
+
@allow_overwrite = argv.flag?('overwrite', true)
|
24
|
+
@template_podspec = argv.option('template-podspec')
|
25
|
+
@podspec = argv.shift_argument
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
UI.puts "开始读取 podspec 文件...\n"
|
31
|
+
|
32
|
+
code_spec = Pod::Specification.from_file(spec_file)
|
33
|
+
if template_spec_file
|
34
|
+
template_spec = Pod::Specification.from_file(template_spec_file)
|
35
|
+
end
|
36
|
+
|
37
|
+
if binary_spec && !@allow_overwrite
|
38
|
+
UI.warn "二进制 podspec 文件 #{binary_spec_files.first} 已存在.\n"
|
39
|
+
else
|
40
|
+
UI.puts "开始生成二进制 podspec 文件...\n"
|
41
|
+
spec_file = create_binary_spec_file(code_spec, template_spec)
|
42
|
+
UI.puts "创建二进制 podspec 文件 #{spec_file} 成功.\n".green
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def template_spec_file
|
47
|
+
@template_spec_file ||= begin
|
48
|
+
if @template_podspec
|
49
|
+
find_spec_file(@template_podspec)
|
50
|
+
else
|
51
|
+
binary_template_spec_file
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def spec_file
|
57
|
+
@spec_file ||= begin
|
58
|
+
if @podspec
|
59
|
+
find_spec_file(@podspec)
|
60
|
+
else
|
61
|
+
if code_spec_files.empty?
|
62
|
+
raise Informative, '当前目录下没有找到可用源码 podspec.'
|
63
|
+
end
|
64
|
+
|
65
|
+
code_spec_files.first
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|