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,150 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'cocoapods'
|
4
|
+
require 'cocoapods-tj/config/config'
|
5
|
+
|
6
|
+
module CBin
|
7
|
+
class Specification
|
8
|
+
class Creator
|
9
|
+
attr_reader :code_spec
|
10
|
+
attr_reader :template_spec
|
11
|
+
attr_reader :spec
|
12
|
+
|
13
|
+
def initialize(code_spec, template_spec, platforms = 'ios')
|
14
|
+
@code_spec = code_spec
|
15
|
+
@template_spec = template_spec
|
16
|
+
@platforms = Array(platforms)
|
17
|
+
validate!
|
18
|
+
end
|
19
|
+
|
20
|
+
def validate!
|
21
|
+
raise Pod::Informative, '源码 podspec 不能为空 .' unless code_spec
|
22
|
+
if code_spec.subspecs.any? && template_spec.nil?
|
23
|
+
raise Pod::Informative, "不支持自动生成存在 subspec 的二进制 podspec , 需要提供模版文件 #{code_spec.name}.binary.podspec.template ."
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def create
|
28
|
+
spec = template_spec ? create_from_code_spec_and_template_spec : create_from_code_spec
|
29
|
+
|
30
|
+
Pod::UI.message '生成二进制 podspec 内容: '
|
31
|
+
spec.to_pretty_json.split("\n").each do |text|
|
32
|
+
Pod::UI.message text
|
33
|
+
end
|
34
|
+
|
35
|
+
spec
|
36
|
+
end
|
37
|
+
|
38
|
+
def write_spec_file(file = filename)
|
39
|
+
create unless spec
|
40
|
+
|
41
|
+
File.open(file, 'w+') do |f|
|
42
|
+
f.write(spec.to_pretty_json)
|
43
|
+
end
|
44
|
+
|
45
|
+
@filename = file
|
46
|
+
end
|
47
|
+
|
48
|
+
def clear_spec_file
|
49
|
+
File.delete(filename) if File.exist?(filename)
|
50
|
+
end
|
51
|
+
|
52
|
+
def filename
|
53
|
+
@filename ||= "#{spec.name}.binary.podspec.json"
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def create_from_code_spec
|
59
|
+
@spec = code_spec.dup
|
60
|
+
|
61
|
+
@spec.vendored_frameworks = "#{code_spec.root.name}.framework"
|
62
|
+
|
63
|
+
# Resources
|
64
|
+
extnames = []
|
65
|
+
extnames << '*.bundle' if code_spec_consumer.resource_bundles.any?
|
66
|
+
if code_spec_consumer.resources.any?
|
67
|
+
extnames += code_spec_consumer.resources.map { |r| File.basename(r) }
|
68
|
+
end
|
69
|
+
if extnames.any?
|
70
|
+
@spec.resources = framework_contents('Resources').flat_map { |r| extnames.map { |e| "#{r}/#{e}" } }
|
71
|
+
end
|
72
|
+
|
73
|
+
# Source Location
|
74
|
+
@spec.source = binary_source
|
75
|
+
|
76
|
+
# Source Code
|
77
|
+
@spec.source_files = framework_contents('Headers/*')
|
78
|
+
@spec.public_header_files = framework_contents('Headers/*')
|
79
|
+
|
80
|
+
# Unused for binary
|
81
|
+
spec_hash = @spec.to_hash
|
82
|
+
# spec_hash.delete('license')
|
83
|
+
spec_hash.delete('resource_bundles')
|
84
|
+
spec_hash.delete('exclude_files')
|
85
|
+
spec_hash.delete('preserve_paths')
|
86
|
+
|
87
|
+
spec_hash.delete('vendored_libraries')
|
88
|
+
spec_hash['vendored_libraries'] = binary_vendored_libraries
|
89
|
+
|
90
|
+
|
91
|
+
platforms = spec_hash['platforms']
|
92
|
+
selected_platforms = platforms.select { |k, _v| @platforms.include?(k) }
|
93
|
+
spec_hash['platforms'] = selected_platforms.empty? ? platforms : selected_platforms
|
94
|
+
|
95
|
+
@spec = Pod::Specification.from_hash(spec_hash)
|
96
|
+
@spec
|
97
|
+
end
|
98
|
+
|
99
|
+
def create_from_code_spec_and_template_spec
|
100
|
+
@spec = template_spec.dup
|
101
|
+
|
102
|
+
@spec.version = code_spec.version
|
103
|
+
@spec.source = binary_source
|
104
|
+
|
105
|
+
@spec.source_files = binary_source_files
|
106
|
+
@spec.public_header_files = binary_public_header_files
|
107
|
+
@spec.vendored_libraries = binary_vendored_libraries
|
108
|
+
|
109
|
+
@spec.resources = binary_resources if @spec.attributes_hash.keys.include?("resources")
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
@spec
|
114
|
+
end
|
115
|
+
|
116
|
+
def binary_source
|
117
|
+
{ http: format(CBin.config.binary_download_url, code_spec.root.name, code_spec.version), type: CBin.config.download_file_type }
|
118
|
+
end
|
119
|
+
|
120
|
+
def code_spec_consumer(_platform = :ios)
|
121
|
+
code_spec.consumer(:ios)
|
122
|
+
end
|
123
|
+
|
124
|
+
def framework_contents(name)
|
125
|
+
["#{code_spec.root.name}.framework", "#{code_spec.root.name}.framework/Versions/A"].map { |path| "#{path}/#{name}" }
|
126
|
+
end
|
127
|
+
|
128
|
+
def binary_source_files
|
129
|
+
{ http: format(CBin.config.binary_download_url, code_spec.root.name, code_spec.version), type: CBin.config.download_file_type }
|
130
|
+
end
|
131
|
+
|
132
|
+
def binary_source_files
|
133
|
+
"bin_#{code_spec.name}_#{code_spec.version}/Headers/*"
|
134
|
+
end
|
135
|
+
|
136
|
+
def binary_public_header_files
|
137
|
+
"bin_#{code_spec.name}_#{code_spec.version}/Headers/*.h"
|
138
|
+
end
|
139
|
+
|
140
|
+
def binary_vendored_libraries
|
141
|
+
"bin_#{code_spec.name}_#{code_spec.version}/*.a"
|
142
|
+
end
|
143
|
+
|
144
|
+
def binary_resources
|
145
|
+
"bin_#{code_spec.name}_#{code_spec.version}/Resources/*"
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'cocoapods-tj/native/sources_manager.rb'
|
4
|
+
require 'cocoapods-tj/helpers/spec_creator'
|
5
|
+
|
6
|
+
module CBin
|
7
|
+
module SpecFilesHelper
|
8
|
+
def spec_files
|
9
|
+
@spec_files ||= Pathname.glob('*.podspec{,.json}')
|
10
|
+
end
|
11
|
+
|
12
|
+
def binary_spec_files
|
13
|
+
@binary_spec_files ||= Pathname.glob('*.binary.podspec{,.json}')
|
14
|
+
end
|
15
|
+
|
16
|
+
def binary_template_spec_files
|
17
|
+
@binary_spec_template_files ||= Pathname.glob('*.binary-template.podspec{,.json}')
|
18
|
+
end
|
19
|
+
|
20
|
+
def binary_template_spec_file
|
21
|
+
@binary_spec_template_file ||= binary_template_spec_files.first
|
22
|
+
end
|
23
|
+
|
24
|
+
def code_spec_files
|
25
|
+
@code_spec_files ||= spec_files - binary_spec_files - binary_template_spec_files
|
26
|
+
end
|
27
|
+
|
28
|
+
def code_spec
|
29
|
+
if code_spec_files.first
|
30
|
+
Pod::Specification.from_file(code_spec_files.first)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def binary_spec
|
35
|
+
if binary_spec_files.first
|
36
|
+
Pod::Specification.from_file(binary_spec_files.first)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def binary_template_spec
|
41
|
+
if binary_template_spec_file
|
42
|
+
Pod::Specification.from_file(binary_template_spec_file)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def find_spec_file(podspec)
|
47
|
+
path = Pathname(podspec)
|
48
|
+
raise Pod::Informative, "无法找到 #{podspec}" unless path.exist?
|
49
|
+
|
50
|
+
path
|
51
|
+
end
|
52
|
+
|
53
|
+
def create_binary_spec_file(code_spec, template_spec)
|
54
|
+
|
55
|
+
|
56
|
+
unless code_spec
|
57
|
+
raise Pod::Informative, '没有二进制 podspec 的情况下,必须要提供源码 podspec.'
|
58
|
+
end
|
59
|
+
if code_spec.subspecs.any? && template_spec.nil?
|
60
|
+
raise Pod::Informative, '拥有 subspec 的组件,在生成二进制 podspec 时,必须要提供模版 podspec.'
|
61
|
+
end
|
62
|
+
|
63
|
+
@spec_creator = CBin::Specification::Creator.new(code_spec, template_spec)
|
64
|
+
@spec_creator.create
|
65
|
+
@spec_creator.write_spec_file
|
66
|
+
@spec_creator.filename
|
67
|
+
end
|
68
|
+
|
69
|
+
def clear_binary_spec_file_if_needed
|
70
|
+
@spec_creator&.clear_spec_file
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,189 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'cocoapods'
|
4
|
+
require 'cocoapods-tj/config/config'
|
5
|
+
|
6
|
+
module CBin
|
7
|
+
class SpecificationSource
|
8
|
+
class Creator
|
9
|
+
attr_reader :code_spec
|
10
|
+
attr_reader :spec
|
11
|
+
|
12
|
+
def initialize(code_spec, platforms = 'ios')
|
13
|
+
@code_spec = code_spec
|
14
|
+
@platforms = Array(platforms)
|
15
|
+
validate!
|
16
|
+
end
|
17
|
+
|
18
|
+
def validate!
|
19
|
+
raise Pod::Informative, '源码 podspec 不能为空 .' unless code_spec
|
20
|
+
end
|
21
|
+
|
22
|
+
def create
|
23
|
+
# spec = nil
|
24
|
+
if CBin::Build::Utils.is_framework(@code_spec)
|
25
|
+
spec = create_framework_from_code_spec
|
26
|
+
else
|
27
|
+
spec = create_from_code_spec
|
28
|
+
end
|
29
|
+
|
30
|
+
spec
|
31
|
+
end
|
32
|
+
|
33
|
+
def write_spec_file(file = filename)
|
34
|
+
create unless spec
|
35
|
+
|
36
|
+
FileUtils.mkdir_p(CBin::Config::Builder.instance.binary_json_dir) unless File.exist?(CBin::Config::Builder.instance.binary_json_dir)
|
37
|
+
FileUtils.rm_rf(file) if File.exist?(file)
|
38
|
+
|
39
|
+
File.open(file, 'w+') do |f|
|
40
|
+
# f.write("# MARK: converted automatically by plugin cocoapods-tj @slj \r\n")
|
41
|
+
f.write(spec.to_pretty_json)
|
42
|
+
end
|
43
|
+
|
44
|
+
@filename = file
|
45
|
+
end
|
46
|
+
|
47
|
+
def clear_spec_file
|
48
|
+
File.delete(filename) if File.exist?(filename)
|
49
|
+
end
|
50
|
+
|
51
|
+
def filename
|
52
|
+
@filename ||= "#{CBin::Config::Builder.instance.binary_json_dir_name}/#{spec.name}.binary.podspec.json"
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def create_from_code_spec
|
58
|
+
@spec = code_spec.dup
|
59
|
+
|
60
|
+
extnames = []
|
61
|
+
extnames << '*.bundle' if code_spec_consumer.resource_bundles.any?
|
62
|
+
if code_spec_consumer.resources.any?
|
63
|
+
extnames += code_spec_consumer.resources.map { |r| File.basename(r) }
|
64
|
+
end
|
65
|
+
if extnames.any?
|
66
|
+
@spec.resources = framework_contents('Resources').flat_map { |r| extnames.map { |e| "#{r}/#{e}" } }
|
67
|
+
end
|
68
|
+
|
69
|
+
# Source Location
|
70
|
+
@spec.source = binary_source
|
71
|
+
|
72
|
+
# Source Code
|
73
|
+
# @spec.source_files = framework_contents('Headers/*')
|
74
|
+
# @spec.public_header_files = framework_contents('Headers/*')
|
75
|
+
|
76
|
+
# Unused for binary
|
77
|
+
spec_hash = @spec.to_hash
|
78
|
+
# spec_hash.delete('license')
|
79
|
+
spec_hash.delete('resource_bundles')
|
80
|
+
spec_hash.delete('exclude_files')
|
81
|
+
spec_hash.delete('preserve_paths')
|
82
|
+
|
83
|
+
spec_hash.delete('subspecs')
|
84
|
+
spec_hash.delete('default_subspecs')
|
85
|
+
spec_hash.delete('default_subspec')
|
86
|
+
spec_hash.delete('vendored_frameworks')
|
87
|
+
spec_hash.delete('vendored_framework')
|
88
|
+
|
89
|
+
|
90
|
+
spec_hash.delete('vendored_libraries')
|
91
|
+
|
92
|
+
|
93
|
+
platforms = spec_hash['platforms']
|
94
|
+
selected_platforms = platforms.select { |k, _v| @platforms.include?(k) }
|
95
|
+
spec_hash['platforms'] = selected_platforms.empty? ? platforms : selected_platforms
|
96
|
+
|
97
|
+
@spec = Pod::Specification.from_hash(spec_hash)
|
98
|
+
|
99
|
+
@spec.prepare_command = "" if @spec.prepare_command
|
100
|
+
@spec.version = code_spec.version
|
101
|
+
@spec.source = binary_source
|
102
|
+
@spec.source_files = binary_source_files
|
103
|
+
@spec.public_header_files = binary_public_header_files
|
104
|
+
@spec.vendored_libraries = binary_vendored_libraries
|
105
|
+
@spec.resources = binary_resources if @spec.attributes_hash.keys.include?("resources")
|
106
|
+
@spec.description = <<-EOF
|
107
|
+
「 」
|
108
|
+
#{@spec.description}
|
109
|
+
EOF
|
110
|
+
@spec
|
111
|
+
end
|
112
|
+
|
113
|
+
def create_framework_from_code_spec
|
114
|
+
@spec = code_spec.dup
|
115
|
+
|
116
|
+
@spec.vendored_frameworks = "#{code_spec.root.name}.framework"
|
117
|
+
|
118
|
+
extnames = []
|
119
|
+
extnames << '*.bundle' if code_spec_consumer.resource_bundles.any?
|
120
|
+
if code_spec_consumer.resources.any?
|
121
|
+
extnames += code_spec_consumer.resources.map { |r| File.basename(r) }
|
122
|
+
end
|
123
|
+
if extnames.any?
|
124
|
+
@spec.resources = framework_contents('Resources').flat_map { |r| extnames.map { |e| "#{r}/#{e}" } }
|
125
|
+
end
|
126
|
+
|
127
|
+
@spec.source = binary_source
|
128
|
+
|
129
|
+
spec_hash = @spec.to_hash
|
130
|
+
# spec_hash.delete('license')
|
131
|
+
spec_hash.delete('resource_bundles')
|
132
|
+
spec_hash.delete('exclude_files')
|
133
|
+
spec_hash.delete('preserve_paths')
|
134
|
+
|
135
|
+
vendored_libraries = spec_hash.delete('vendored_libraries')
|
136
|
+
vendored_libraries = Array(vendored_libraries).reject { |l| l.end_with?('.a') }
|
137
|
+
if vendored_libraries.any?
|
138
|
+
spec_hash['vendored_libraries'] = vendored_libraries
|
139
|
+
end
|
140
|
+
|
141
|
+
platforms = spec_hash['platforms']
|
142
|
+
selected_platforms = platforms.select { |k, _v| @platforms.include?(k) }
|
143
|
+
spec_hash['platforms'] = selected_platforms.empty? ? platforms : selected_platforms
|
144
|
+
|
145
|
+
@spec = Pod::Specification.from_hash(spec_hash)
|
146
|
+
@spec.description = <<-EOF
|
147
|
+
「 」
|
148
|
+
#{@spec.description}
|
149
|
+
EOF
|
150
|
+
@spec
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
def binary_source
|
155
|
+
{ http: format(CBin.config.binary_download_url, code_spec.root.name, code_spec.version), type: CBin.config.download_file_type }
|
156
|
+
end
|
157
|
+
|
158
|
+
def code_spec_consumer(_platform = :ios)
|
159
|
+
code_spec.consumer(:ios)
|
160
|
+
end
|
161
|
+
|
162
|
+
def framework_contents(name)
|
163
|
+
["#{code_spec.root.name}.framework", "#{code_spec.root.name}.framework/Versions/A"].map { |path| "#{path}/#{name}" }
|
164
|
+
end
|
165
|
+
|
166
|
+
def binary_source_files
|
167
|
+
{ http: format(CBin.config.binary_download_url, code_spec.root.name, code_spec.version), type: CBin.config.download_file_type }
|
168
|
+
end
|
169
|
+
|
170
|
+
def binary_source_files
|
171
|
+
"bin_#{code_spec.name}_#{code_spec.version}/Headers/*"
|
172
|
+
end
|
173
|
+
|
174
|
+
def binary_public_header_files
|
175
|
+
"bin_#{code_spec.name}_#{code_spec.version}/Headers/*.h"
|
176
|
+
end
|
177
|
+
|
178
|
+
def binary_vendored_libraries
|
179
|
+
"bin_#{code_spec.name}_#{code_spec.version}/*.a"
|
180
|
+
end
|
181
|
+
|
182
|
+
def binary_resources
|
183
|
+
"bin_#{code_spec.name}_#{code_spec.version}/Resources/*"
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
@@ -0,0 +1,81 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
# copy from https://github.com/CocoaPods/cocoapods-packager
|
4
|
+
|
5
|
+
require 'cocoapods-tj/native/podfile'
|
6
|
+
require 'cocoapods/command/gen'
|
7
|
+
require 'cocoapods/generate'
|
8
|
+
require 'cocoapods-tj/helpers/framework_builder'
|
9
|
+
require 'cocoapods-tj/helpers/library_builder'
|
10
|
+
require 'cocoapods-tj/helpers/sources_helper'
|
11
|
+
require 'cocoapods-tj/command/bin/spec/push'
|
12
|
+
|
13
|
+
module CBin
|
14
|
+
class Upload
|
15
|
+
class Helper
|
16
|
+
include CBin::SourcesHelper
|
17
|
+
|
18
|
+
def initialize(spec,code_dependencies,sources)
|
19
|
+
@spec = spec
|
20
|
+
@code_dependencies = code_dependencies
|
21
|
+
@sources = sources
|
22
|
+
end
|
23
|
+
|
24
|
+
def upload
|
25
|
+
Dir.chdir(CBin::Config::Builder.instance.root_dir) do
|
26
|
+
|
27
|
+
res_zip = curl_zip
|
28
|
+
if res_zip
|
29
|
+
filename = spec_creator
|
30
|
+
push_binary_repo(filename)
|
31
|
+
end
|
32
|
+
res_zip
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def spec_creator
|
37
|
+
spec_creator = CBin::SpecificationSource::Creator.new(@spec)
|
38
|
+
spec_creator.create
|
39
|
+
spec_creator.write_spec_file
|
40
|
+
spec_creator.filename
|
41
|
+
end
|
42
|
+
|
43
|
+
def curl_zip
|
44
|
+
zip_file = "#{CBin::Config::Builder.instance.library_file(@spec)}.zip"
|
45
|
+
res = File.exist?(zip_file)
|
46
|
+
unless res
|
47
|
+
zip_file = CBin::Config::Builder.instance.framework_zip_file(@spec) + ".zip"
|
48
|
+
res = File.exist?(zip_file)
|
49
|
+
end
|
50
|
+
if res
|
51
|
+
`curl #{CBin.config.binary_upload_url} -F "name=#{@spec.name}" -F "version=#{@spec.version}" -F "annotate=#{@spec.name}_#{@spec.version}_log" -F "file=@#{zip_file}"` if res
|
52
|
+
end
|
53
|
+
|
54
|
+
res
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
# 上传二进制 podspec
|
59
|
+
def push_binary_repo(binary_podsepc_json)
|
60
|
+
argvs = [
|
61
|
+
"#{binary_podsepc_json}",
|
62
|
+
"--binary",
|
63
|
+
"--sources=#{sources_option(@code_dependencies, @sources)},https:\/\/cdn.cocoapods.org",
|
64
|
+
"--skip-import-validation",
|
65
|
+
"--use-libraries",
|
66
|
+
"--allow-warnings",
|
67
|
+
"--verbose",
|
68
|
+
"--code-dependencies"
|
69
|
+
]
|
70
|
+
if @verbose
|
71
|
+
argvs += ['--verbose']
|
72
|
+
end
|
73
|
+
|
74
|
+
push = Pod::Command::Bin::Repo::Push.new(CLAide::ARGV.new(argvs))
|
75
|
+
push.validate!
|
76
|
+
push.run
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
module Generator
|
5
|
+
class Acknowledgements
|
6
|
+
def license_text(spec)
|
7
|
+
return nil unless spec.license
|
8
|
+
|
9
|
+
text = spec.license[:text]
|
10
|
+
unless text
|
11
|
+
if license_file = spec.license[:file]
|
12
|
+
license_path = file_accessor(spec).root + license_file
|
13
|
+
if File.exist?(license_path)
|
14
|
+
text = IO.read(license_path)
|
15
|
+
else
|
16
|
+
|
17
|
+
end
|
18
|
+
elsif license_file = file_accessor(spec).license
|
19
|
+
text = IO.read(license_file)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
text
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
require 'parallel'
|
4
|
+
require 'cocoapods'
|
5
|
+
|
6
|
+
module Pod
|
7
|
+
class Installer
|
8
|
+
class Analyzer
|
9
|
+
|
10
|
+
alias old_update_repositories update_repositories
|
11
|
+
def update_repositories
|
12
|
+
if installation_options.update_source_with_multi_processes
|
13
|
+
|
14
|
+
Parallel.each(sources.uniq(&:url), in_processes: 4) do |source|
|
15
|
+
if source.git?
|
16
|
+
config.sources_manager.update(source.name, true)
|
17
|
+
else
|
18
|
+
end
|
19
|
+
end
|
20
|
+
@specs_updated = true
|
21
|
+
else
|
22
|
+
old_update_repositories
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'macho'
|
2
|
+
require 'cocoapods'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Sandbox
|
6
|
+
class FileAccessor
|
7
|
+
def dynamic_binary?(binary)
|
8
|
+
@cached_dynamic_binary_results ||= {}
|
9
|
+
return @cached_dynamic_binary_results[binary] unless @cached_dynamic_binary_results[binary].nil?
|
10
|
+
return false unless binary.file?
|
11
|
+
|
12
|
+
@cached_dynamic_binary_results[binary] = MachO.open(binary).dylib?
|
13
|
+
rescue MachO::MachOError
|
14
|
+
@cached_dynamic_binary_results[binary] = true
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
require 'cocoapods'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Installer
|
6
|
+
class InstallationOptions
|
7
|
+
def self.env_option(key, default = true)
|
8
|
+
option key, ENV[key.to_s].nil? ? default : ENV[key.to_s] == 'true'
|
9
|
+
end
|
10
|
+
|
11
|
+
defaults.delete('warn_for_multiple_pod_sources')
|
12
|
+
env_option :warn_for_multiple_pod_sources, false
|
13
|
+
|
14
|
+
env_option :warn_for_unsecure_source, false
|
15
|
+
|
16
|
+
env_option :install_with_multi_threads, true
|
17
|
+
|
18
|
+
env_option :update_source_with_multi_processes, true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|