cocoapods-tj 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +1 -0
- data/lib/cocoapods-tj/command/bin/archive.rb +203 -0
- data/lib/cocoapods-tj/command/bin/auto.rb +189 -0
- data/lib/cocoapods-tj/command/bin/code.rb +198 -0
- data/lib/cocoapods-tj/command/bin/imy.rb +45 -0
- data/lib/cocoapods-tj/command/bin/init.rb +65 -0
- data/lib/cocoapods-tj/command/bin/initHotKey.rb +66 -0
- data/lib/cocoapods-tj/command/bin/install.rb +41 -0
- data/lib/cocoapods-tj/command/bin/lib/lint.rb +66 -0
- data/lib/cocoapods-tj/command/bin/local.rb +142 -0
- data/lib/cocoapods-tj/command/bin/repo/update.rb +42 -0
- data/lib/cocoapods-tj/command/bin/spec/create.rb +68 -0
- data/lib/cocoapods-tj/command/bin/spec/push.rb +114 -0
- data/lib/cocoapods-tj/command/bin/update.rb +144 -0
- data/lib/cocoapods-tj/command/bin.rb +42 -0
- data/lib/cocoapods-tj/command.rb +2 -0
- data/lib/cocoapods-tj/config/config.rb +129 -0
- data/lib/cocoapods-tj/config/config_asker.rb +49 -0
- data/lib/cocoapods-tj/config/config_builder.rb +201 -0
- data/lib/cocoapods-tj/config/config_hot_key.rb +102 -0
- data/lib/cocoapods-tj/config/config_hot_key_asker.rb +48 -0
- data/lib/cocoapods-tj/gem_version.rb +10 -0
- data/lib/cocoapods-tj/helpers/Info.plist +0 -0
- data/lib/cocoapods-tj/helpers/build_helper.rb +154 -0
- data/lib/cocoapods-tj/helpers/build_utils.rb +62 -0
- data/lib/cocoapods-tj/helpers/framework.rb +79 -0
- data/lib/cocoapods-tj/helpers/framework_builder.rb +391 -0
- data/lib/cocoapods-tj/helpers/library.rb +54 -0
- data/lib/cocoapods-tj/helpers/library_builder.rb +89 -0
- data/lib/cocoapods-tj/helpers/local/loca_llibrary.rb +57 -0
- data/lib/cocoapods-tj/helpers/local/local_build_helper.rb +177 -0
- data/lib/cocoapods-tj/helpers/local/local_framework.rb +85 -0
- data/lib/cocoapods-tj/helpers/local/local_framework_builder.rb +226 -0
- data/lib/cocoapods-tj/helpers/local/local_library_builder.rb +91 -0
- data/lib/cocoapods-tj/helpers/sources_helper.rb +32 -0
- data/lib/cocoapods-tj/helpers/spec_creator.rb +150 -0
- data/lib/cocoapods-tj/helpers/spec_files_helper.rb +73 -0
- data/lib/cocoapods-tj/helpers/spec_source_creator.rb +189 -0
- data/lib/cocoapods-tj/helpers/upload_helper.rb +81 -0
- data/lib/cocoapods-tj/helpers.rb +5 -0
- data/lib/cocoapods-tj/native/acknowledgements.rb +26 -0
- data/lib/cocoapods-tj/native/analyzer.rb +29 -0
- data/lib/cocoapods-tj/native/file_accessor.rb +20 -0
- data/lib/cocoapods-tj/native/installation_options.rb +21 -0
- data/lib/cocoapods-tj/native/installer.rb +106 -0
- data/lib/cocoapods-tj/native/linter.rb +26 -0
- data/lib/cocoapods-tj/native/path_source.rb +29 -0
- data/lib/cocoapods-tj/native/pod_source_installer.rb +18 -0
- data/lib/cocoapods-tj/native/pod_target_installer.rb +81 -0
- data/lib/cocoapods-tj/native/podfile.rb +91 -0
- data/lib/cocoapods-tj/native/podfile_env.rb +37 -0
- data/lib/cocoapods-tj/native/podfile_generator.rb +135 -0
- data/lib/cocoapods-tj/native/podspec_finder.rb +23 -0
- data/lib/cocoapods-tj/native/resolver.rb +202 -0
- data/lib/cocoapods-tj/native/sandbox_analyzer.rb +11 -0
- data/lib/cocoapods-tj/native/source.rb +35 -0
- data/lib/cocoapods-tj/native/sources_manager.rb +18 -0
- data/lib/cocoapods-tj/native/specification.rb +10 -0
- data/lib/cocoapods-tj/native/target_validator.rb +41 -0
- data/lib/cocoapods-tj/native/validator.rb +40 -0
- data/lib/cocoapods-tj/native.rb +23 -0
- data/lib/cocoapods-tj/source_provider_hook.rb +50 -0
- data/lib/cocoapods-tj.rb +2 -0
- data/lib/cocoapods_plugin.rb +3 -0
- data/spec/command/bin_spec.rb +12 -0
- data/spec/spec_helper.rb +50 -0
- metadata +182 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'cocoapods-tj/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
|
+
DESC
|
11
|
+
|
12
|
+
def self.options
|
13
|
+
[
|
14
|
+
['--bin-url=URL', '配置文件地址,直接从此地址下载配置文件']
|
15
|
+
].concat(super)
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(argv)
|
19
|
+
@bin_url = argv.option('bin-url')
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def run
|
24
|
+
if @bin_url.nil?
|
25
|
+
config_with_asker
|
26
|
+
else
|
27
|
+
config_with_url(@bin_url)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def config_with_url(url)
|
34
|
+
require 'open-uri'
|
35
|
+
|
36
|
+
file = open(url)
|
37
|
+
contents = YAML.safe_load(file.read)
|
38
|
+
|
39
|
+
CBin.config.sync_config(contents.to_hash)
|
40
|
+
rescue Errno::ENOENT => e
|
41
|
+
raise Informative, "配置文件路径 #{url} 无效,请确认后重试."
|
42
|
+
end
|
43
|
+
|
44
|
+
def config_with_asker
|
45
|
+
asker = CBin::Config::Asker.new
|
46
|
+
asker.wellcome_message
|
47
|
+
|
48
|
+
config = {}
|
49
|
+
template_hash = CBin.config.template_hash
|
50
|
+
template_hash.each do |k, v|
|
51
|
+
default = begin
|
52
|
+
CBin.config.send(k)
|
53
|
+
rescue StandardError
|
54
|
+
nil
|
55
|
+
end
|
56
|
+
config[k] = asker.ask_with_answer(v[:description], default, v[:selection])
|
57
|
+
end
|
58
|
+
|
59
|
+
CBin.config.sync_config(config)
|
60
|
+
asker.done_message
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
|
2
|
+
require 'cocoapods-tj/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
|
+
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
|
+
file = open(url)
|
38
|
+
contents = YAML.safe_load(file.read)
|
39
|
+
|
40
|
+
CBin.config_hot_key.sync_config(contents.to_hash)
|
41
|
+
rescue Errno::ENOENT => e
|
42
|
+
raise Informative, "配置文件路径 #{url} 无效,请确认后重试."
|
43
|
+
end
|
44
|
+
|
45
|
+
def config_with_asker
|
46
|
+
asker = CBin::Config_Hot_Key::Asker.new
|
47
|
+
asker.wellcome_message
|
48
|
+
|
49
|
+
config = {}
|
50
|
+
template_hash = CBin.config_hot_key.template_hash
|
51
|
+
template_hash.each do |k, v|
|
52
|
+
default = begin
|
53
|
+
CBin.config_hot_key.send(k)
|
54
|
+
rescue StandardError
|
55
|
+
nil
|
56
|
+
end
|
57
|
+
config[k] = asker.ask_with_answer(v[:description], default, v[:selection])
|
58
|
+
end
|
59
|
+
|
60
|
+
CBin.config_hot_key.sync_config(config)
|
61
|
+
asker.done_message
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
require 'cocoapods-tj/command/bin/update'
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Bin < Command
|
6
|
+
class Install < Bin
|
7
|
+
include Pod
|
8
|
+
|
9
|
+
self.summary = ''
|
10
|
+
|
11
|
+
self.description = <<-DESC
|
12
|
+
|
13
|
+
DESC
|
14
|
+
def self.options
|
15
|
+
[
|
16
|
+
['--repo-update', 'Force running `pod repo update` before install'],
|
17
|
+
['--deployment', 'Disallow any changes to the Podfile or the Podfile.lock during installation'],
|
18
|
+
['--clean-install', 'Ignore the contents of the project cache and force a full pod installation. This only ' \
|
19
|
+
'applies to projects that have enabled incremental installation']
|
20
|
+
].concat(super).reject { |(name, _)| name == '--no-repo-update' }
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(argv)
|
24
|
+
@update = argv.flag?('update')
|
25
|
+
super
|
26
|
+
@additional_args = argv.remainder!
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
Update.load_local_podfile
|
31
|
+
argvs = [
|
32
|
+
*@additional_args
|
33
|
+
]
|
34
|
+
gen = Pod::Command::Install.new(CLAide::ARGV.new(argvs))
|
35
|
+
gen.validate!
|
36
|
+
gen.run
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'cocoapods-tj/config/config'
|
2
|
+
require 'cocoapods-tj/native/podfile'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
class Bin < Command
|
7
|
+
class Lib < Bin
|
8
|
+
class Lint < Lib
|
9
|
+
self.summary = ''
|
10
|
+
self.description = <<-DESC
|
11
|
+
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('NAME.podspec', false)
|
16
|
+
]
|
17
|
+
def self.options
|
18
|
+
[
|
19
|
+
['--code-dependencies', '使用源码依赖进行 lint'],
|
20
|
+
['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
|
21
|
+
['--allow-prerelease', '允许使用 prerelease 的版本 lint']
|
22
|
+
].concat(Pod::Command::Lib::Lint.options).concat(super).uniq
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize(argv)
|
26
|
+
@loose_options = argv.flag?('loose-options')
|
27
|
+
@code_dependencies = argv.flag?('code-dependencies')
|
28
|
+
@sources = argv.option('sources') || []
|
29
|
+
@allow_prerelease = argv.flag?('allow-prerelease')
|
30
|
+
@podspec = argv.shift_argument
|
31
|
+
super
|
32
|
+
|
33
|
+
@additional_args = argv.remainder!
|
34
|
+
end
|
35
|
+
|
36
|
+
def run
|
37
|
+
Podfile.execute_with_bin_plugin do
|
38
|
+
Podfile.execute_with_allow_prerelease(@allow_prerelease) do
|
39
|
+
Podfile.execute_with_use_binaries(!@code_dependencies) do
|
40
|
+
argvs = [
|
41
|
+
@podspec || code_spec_files.first,
|
42
|
+
"--sources=#{sources_option(@code_dependencies, @sources)}",
|
43
|
+
*@additional_args
|
44
|
+
]
|
45
|
+
|
46
|
+
if @loose_options
|
47
|
+
argvs << '--allow-warnings'
|
48
|
+
if code_spec&.all_dependencies&.any?
|
49
|
+
argvs << '--use-libraries'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
lint = Pod::Command::Lib::Lint.new(CLAide::ARGV.new(argvs))
|
54
|
+
lint.validate!
|
55
|
+
lint.run
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
|
2
|
+
require 'cocoapods-tj/native/podfile'
|
3
|
+
require 'cocoapods/command/gen'
|
4
|
+
require 'cocoapods/generate'
|
5
|
+
require 'cocoapods-tj/helpers/local/local_framework_builder'
|
6
|
+
require 'cocoapods-tj/helpers/local/local_library_builder'
|
7
|
+
require 'cocoapods-tj/helpers/local/local_build_helper'
|
8
|
+
require 'cocoapods-tj/helpers/spec_source_creator'
|
9
|
+
require 'cocoapods-tj/config/config_builder'
|
10
|
+
|
11
|
+
module Pod
|
12
|
+
class Command
|
13
|
+
class Bin < Command
|
14
|
+
class Local < Bin
|
15
|
+
self.summary = ''
|
16
|
+
self.description = <<-DESC
|
17
|
+
|
18
|
+
DESC
|
19
|
+
|
20
|
+
def self.options
|
21
|
+
[
|
22
|
+
['--no-clean', '保留构建中间产物'],
|
23
|
+
['--framework-output', '输出framework文件'],
|
24
|
+
['--no-zip', '不压缩静态 framework 为 zip'],
|
25
|
+
['--make-binary-specs', '需要制作spec集合'],
|
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
|
+
@env = argv.option('env') || 'dev'
|
32
|
+
CBin.config.set_configuration_env(@env)
|
33
|
+
|
34
|
+
|
35
|
+
@make_binary_specs = argv.option('make-binary-specs') || []
|
36
|
+
@framework_output = argv.flag?('framework-output', false)
|
37
|
+
@clean = argv.flag?('no-clean', true)
|
38
|
+
@zip = argv.flag?('zip', true)
|
39
|
+
@sources = argv.option('sources') || []
|
40
|
+
@platform = Platform.new(:ios)
|
41
|
+
|
42
|
+
@target_name = CBin::Config::Builder.instance.target_name
|
43
|
+
@local_build_dir_name = CBin::Config::Builder.instance.xcode_build_name
|
44
|
+
@local_build_dir = CBin::Config::Builder.instance.xcode_build_dir
|
45
|
+
|
46
|
+
@framework_path
|
47
|
+
super
|
48
|
+
end
|
49
|
+
|
50
|
+
def run
|
51
|
+
|
52
|
+
|
53
|
+
sources_spec = []
|
54
|
+
Dir.chdir(CBin::Config::Builder.instance.local_psec_dir) do
|
55
|
+
spec_files = Dir.glob(%w[*.json *.podspec])
|
56
|
+
spec_files.each do |file|
|
57
|
+
spec = Pod::Specification.from_file(file)
|
58
|
+
sources_spec << spec
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
build(sources_spec)
|
63
|
+
end
|
64
|
+
|
65
|
+
def build(make_binary_specs)
|
66
|
+
sources_sepc = []
|
67
|
+
make_binary_specs.uniq.each do |spec|
|
68
|
+
next if spec.name.include?('/')
|
69
|
+
next if spec.name == @target_name
|
70
|
+
next if CBin::Config::Builder.instance.white_pod_list.include?(spec.name)
|
71
|
+
if spec.source[:git] && spec.source[:git]
|
72
|
+
spec_git = spec.source[:git]
|
73
|
+
spec_git_res = false
|
74
|
+
CBin::Config::Builder.instance.ignore_git_list.each do |ignore_git|
|
75
|
+
spec_git_res = spec_git.include?(ignore_git)
|
76
|
+
break if spec_git_res
|
77
|
+
end
|
78
|
+
next if spec_git_res
|
79
|
+
end
|
80
|
+
UI.warn "#{spec.name}.podspec 带有 vendored_frameworks 字段,请检查是否有效!!!" if spec.attributes_hash['vendored_frameworks']
|
81
|
+
next if spec.attributes_hash['vendored_frameworks'] && @target_name != spec.name #过滤带有vendored_frameworks的
|
82
|
+
next if (spec.attributes_hash['ios'] && spec.attributes_hash['ios']['vendored_frameworks']) #过滤带有vendored_frameworks的
|
83
|
+
|
84
|
+
next unless library_exist(spec)
|
85
|
+
|
86
|
+
sources_sepc << spec
|
87
|
+
end
|
88
|
+
|
89
|
+
fail_build_specs = []
|
90
|
+
sources_sepc.uniq.each do |spec|
|
91
|
+
begin
|
92
|
+
builder = CBin::LocalBuild::Helper.new(spec,
|
93
|
+
@platform,
|
94
|
+
@framework_output,
|
95
|
+
@zip,
|
96
|
+
@clean,
|
97
|
+
@target_name,
|
98
|
+
@local_build_dir_name,
|
99
|
+
@local_build_dir)
|
100
|
+
builder.build
|
101
|
+
CBin::Upload::Helper.new(spec, @code_dependencies, @sources).upload
|
102
|
+
rescue StandardError
|
103
|
+
fail_build_specs << spec
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
if fail_build_specs.any?
|
108
|
+
fail_build_specs.uniq.each do |spec|
|
109
|
+
UI.warn "【#{spec.name} | #{spec.version}】组件二进制版本编译失败 ."
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
success_specs = sources_sepc - fail_build_specs
|
114
|
+
if success_specs.any?
|
115
|
+
success_specs.uniq.each do |spec|
|
116
|
+
UI.warn " =======【 #{spec.name} | #{spec.version} 】二进制组件制作完成 !!!"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
# pod repo update
|
120
|
+
UI.section("\nUpdating Spec Repositories\n".yellow) do
|
121
|
+
Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new([])).run
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
private
|
126
|
+
|
127
|
+
def library_exist(spec)
|
128
|
+
File.exist?(File.join(@local_build_dir, "lib#{spec.name}.a")) || is_framework(spec)
|
129
|
+
end
|
130
|
+
|
131
|
+
def is_framework(spec)
|
132
|
+
res = File.exist?(File.join(@local_build_dir, "#{spec.name}.framework"))
|
133
|
+
unless res
|
134
|
+
res = File.exist?(File.join(CBin::Config::Builder.instance.xcode_BuildProductsPath_dir, "#{spec.name}","Swift Compatibility Header"))
|
135
|
+
end
|
136
|
+
res
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
@@ -0,0 +1,42 @@
|
|
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
|
+
source.update(show_output)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'cocoapods-tj/helpers'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Bin < Command
|
6
|
+
class Spec < Bin
|
7
|
+
class Create < Spec
|
8
|
+
self.summary = ''
|
9
|
+
self.description = <<-DESC
|
10
|
+
|
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
|
+
code_spec = Pod::Specification.from_file(spec_file)
|
31
|
+
if template_spec_file
|
32
|
+
template_spec = Pod::Specification.from_file(template_spec_file)
|
33
|
+
end
|
34
|
+
|
35
|
+
if binary_spec && !@allow_overwrite
|
36
|
+
else
|
37
|
+
spec_file = create_binary_spec_file(code_spec, template_spec)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def template_spec_file
|
42
|
+
@template_spec_file ||= begin
|
43
|
+
if @template_podspec
|
44
|
+
find_spec_file(@template_podspec)
|
45
|
+
else
|
46
|
+
binary_template_spec_file
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def spec_file
|
52
|
+
@spec_file ||= begin
|
53
|
+
if @podspec
|
54
|
+
find_spec_file(@podspec)
|
55
|
+
else
|
56
|
+
if code_spec_files.empty?
|
57
|
+
raise Informative, '当前目录下没有找到可用源码 podspec.'
|
58
|
+
end
|
59
|
+
|
60
|
+
code_spec_files.first
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require 'cocoapods-tj/config/config'
|
2
|
+
require 'cocoapods-tj/native/podfile'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
class Bin < Command
|
7
|
+
class Repo < Bin
|
8
|
+
class Push < Repo
|
9
|
+
self.summary = ''
|
10
|
+
self.description = <<-DESC
|
11
|
+
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('NAME.podspec', false)
|
16
|
+
]
|
17
|
+
|
18
|
+
def self.options
|
19
|
+
[
|
20
|
+
['--binary', '发布组件的二进制版本'],
|
21
|
+
['--template-podspec=A.binary-template.podspec', '生成拥有 subspec 的二进制 spec 需要的模版 podspec, 插件会更改 version 和 source'],
|
22
|
+
['--reserve-created-spec', '保留生成的二进制 spec 文件'],
|
23
|
+
['--code-dependencies', '使用源码依赖进行 lint'],
|
24
|
+
['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
|
25
|
+
['--allow-prerelease', '允许使用 prerelease 的版本 lint']
|
26
|
+
].concat(Pod::Command::Repo::Push.options).concat(super).uniq
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize(argv)
|
30
|
+
@podspec = argv.shift_argument
|
31
|
+
@binary = argv.flag?('binary')
|
32
|
+
@loose_options = argv.flag?('loose-options')
|
33
|
+
@code_dependencies = argv.flag?('code-dependencies')
|
34
|
+
@sources = argv.option('sources') || []
|
35
|
+
@reserve_created_spec = argv.flag?('reserve-created-spec')
|
36
|
+
@template_podspec = argv.option('template-podspec')
|
37
|
+
@allow_prerelease = argv.flag?('allow-prerelease')
|
38
|
+
super
|
39
|
+
|
40
|
+
@additional_args = argv.remainder!
|
41
|
+
end
|
42
|
+
|
43
|
+
def run
|
44
|
+
Podfile.execute_with_bin_plugin do
|
45
|
+
Podfile.execute_with_allow_prerelease(@allow_prerelease) do
|
46
|
+
Podfile.execute_with_use_binaries(!@code_dependencies) do
|
47
|
+
argvs = [
|
48
|
+
repo,
|
49
|
+
"--sources=#{sources_option(@code_dependencies, @sources)}",
|
50
|
+
*@additional_args
|
51
|
+
]
|
52
|
+
|
53
|
+
argvs << spec_file if spec_file
|
54
|
+
|
55
|
+
if @loose_options
|
56
|
+
argvs += ['--allow-warnings', '--use-json']
|
57
|
+
if code_spec&.all_dependencies&.any?
|
58
|
+
argvs << '--use-libraries'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
|
63
|
+
push.validate!
|
64
|
+
push.run
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
ensure
|
69
|
+
clear_binary_spec_file_if_needed unless @reserve_created_spec
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def template_spec_file
|
75
|
+
@template_spec_file ||= begin
|
76
|
+
if @template_podspec
|
77
|
+
find_spec_file(@template_podspec)
|
78
|
+
else
|
79
|
+
binary_template_spec_file
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def spec_file
|
85
|
+
@spec_file ||= begin
|
86
|
+
if @podspec
|
87
|
+
find_spec_file(@podspec)
|
88
|
+
else
|
89
|
+
if code_spec_files.empty?
|
90
|
+
raise Informative, '当前目录下没有找到可用源码 podspec.'
|
91
|
+
end
|
92
|
+
|
93
|
+
spec_file = if @binary
|
94
|
+
code_spec = Pod::Specification.from_file(code_spec_files.first)
|
95
|
+
if template_spec_file
|
96
|
+
template_spec = Pod::Specification.from_file(template_spec_file)
|
97
|
+
end
|
98
|
+
create_binary_spec_file(code_spec, template_spec)
|
99
|
+
else
|
100
|
+
code_spec_files.first
|
101
|
+
end
|
102
|
+
spec_file
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def repo
|
108
|
+
@binary ? binary_source.name : code_source.name
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|