cocoapods-imy-bin 0.3.1.3 → 0.3.1.21

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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -0
  3. data/lib/cocoapods-imy-bin/command/bin/archive.rb +18 -20
  4. data/lib/cocoapods-imy-bin/command/bin/auto.rb +12 -9
  5. data/lib/cocoapods-imy-bin/command/bin/clean.rb +126 -0
  6. data/lib/cocoapods-imy-bin/command/bin/local.rb +169 -0
  7. data/lib/cocoapods-imy-bin/command/bin/update.rb +14 -3
  8. data/lib/cocoapods-imy-bin/command/bin.rb +2 -0
  9. data/lib/cocoapods-imy-bin/config/config.rb +8 -0
  10. data/lib/cocoapods-imy-bin/gem_version.rb +1 -1
  11. data/lib/cocoapods-imy-bin/helpers/build_utils.rb +40 -9
  12. data/lib/cocoapods-imy-bin/helpers/framework_builder.rb +1 -1
  13. data/lib/cocoapods-imy-bin/helpers/local/loca_llibrary.rb +57 -0
  14. data/lib/cocoapods-imy-bin/helpers/local/local_build_helper.rb +183 -0
  15. data/lib/cocoapods-imy-bin/helpers/local/local_framework.rb +85 -0
  16. data/lib/cocoapods-imy-bin/helpers/local/local_framework_builder.rb +227 -0
  17. data/lib/cocoapods-imy-bin/helpers/local/local_library_builder.rb +96 -0
  18. data/lib/cocoapods-imy-bin/helpers/spec_source_creator.rb +10 -4
  19. data/lib/cocoapods-imy-bin/helpers/upload_helper.rb +5 -3
  20. data/lib/cocoapods-imy-bin/native/Downloader.rb +68 -0
  21. data/lib/cocoapods-imy-bin/native/Lockfile.rb +36 -0
  22. data/lib/cocoapods-imy-bin/native/installer.rb +6 -0
  23. data/lib/cocoapods-imy-bin/native/podfile.rb +7 -0
  24. data/lib/cocoapods-imy-bin/native/podfile_env.rb +5 -0
  25. data/lib/cocoapods-imy-bin/native/resolver.rb +10 -5
  26. data/lib/cocoapods-imy-bin/native.rb +3 -1
  27. data/lib/cocoapods-imy-bin/post_install_hook.rb +110 -0
  28. data/lib/cocoapods-imy-bin/source_provider_hook.rb +3 -0
  29. data/lib/cocoapods_plugin.rb +1 -0
  30. metadata +16 -6
@@ -0,0 +1,183 @@
1
+
2
+
3
+ # copy from https://github.com/CocoaPods/cocoapods-packager
4
+
5
+ require 'cocoapods-imy-bin/native/podfile'
6
+ require 'cocoapods/command/gen'
7
+ require 'cocoapods/generate'
8
+ require 'cocoapods-imy-bin/helpers/framework_builder'
9
+ require 'cocoapods-imy-bin/helpers/library_builder'
10
+ require 'cocoapods-imy-bin/config/config_builder'
11
+
12
+ module CBin
13
+ class LocalBuild
14
+ class Helper
15
+ include Pod
16
+ #class var
17
+ @@build_defines = ""
18
+ #Debug下还待完成
19
+ def initialize(spec,
20
+ platform,
21
+ framework_output,
22
+ zip,
23
+ clean,
24
+ target_name,
25
+ local_build_dir_name,
26
+ local_build_dir)
27
+ @spec = spec
28
+ @target_name = target_name
29
+ @platform = platform
30
+
31
+ @framework_output = framework_output
32
+ @zip = zip
33
+ @local_build_dir_name = local_build_dir_name
34
+ @local_build_dir = local_build_dir
35
+ @clean = clean
36
+ @framework_path
37
+ @is_library = !is_framework
38
+ end
39
+
40
+ def build
41
+ UI.section("Building static framework #{@spec}") do
42
+ begin
43
+ build_static_framework
44
+ if @is_library
45
+ build_static_library
46
+ zip_static_framework if @zip &&= @framework_output
47
+ zip_static_library
48
+ else
49
+ zip_static_framework
50
+ end
51
+
52
+ clean_workspace if @clean
53
+ rescue Exception => e
54
+ puts e.message
55
+ puts e.backtrace.inspect
56
+ return false
57
+ end
58
+ end
59
+ return true
60
+ end
61
+
62
+ def build_static_framework
63
+ file_accessor = Sandbox::FileAccessor.new(Pathname.new('.').expand_path, @spec.consumer(@platform))
64
+ Dir.chdir(workspace_directory) do
65
+ builder = CBin::LocalFramework::Builder.new(@spec, file_accessor, @platform, @local_build_dir_name,@local_build_dir, @is_library, frameWork_dir)
66
+ @framework_path = builder.create
67
+ end
68
+ end
69
+
70
+ def build_static_library
71
+ source_dir = zip_dir
72
+ file_accessor = Sandbox::FileAccessor.new(Pathname.new('.').expand_path, @spec.consumer(@platform))
73
+ Dir.chdir(workspace_directory) do
74
+ builder = CBin::LocalLibrary::Builder.new(@spec, file_accessor, @platform, source_dir,@framework_path)
75
+ builder.build
76
+ end
77
+ end
78
+
79
+ def zip_static_framework
80
+ Dir.chdir(zip_dir) do
81
+ # output_name = "#{framework_name}.zip"
82
+ output_name = File.join(zip_dir, framework_name_zip)
83
+ unless File.exist?(framework_name)
84
+ UI.warn "没有需要压缩的 framework 文件:#{framework_name}"
85
+ end
86
+
87
+ UI.puts "Compressing #{framework_name} into #{output_name}"
88
+ `zip --symlinks -r #{output_name} #{framework_name}`
89
+
90
+ end
91
+ end
92
+
93
+ def zip_static_library
94
+ Dir.chdir(zip_dir) do
95
+ output_library = "#{library_name}.zip"
96
+ unless File.exist?(library_name)
97
+ raise Informative, "没有需要压缩的 library 文件:#{library_name}"
98
+ end
99
+
100
+ UI.puts "Compressing #{library_name} into #{output_library}"
101
+
102
+ `zip --symlinks -r #{output_library} #{library_name}`
103
+ end
104
+
105
+ end
106
+
107
+
108
+ def clean_workspace
109
+ UI.puts 'Cleaning workspace'
110
+
111
+ FileUtils.rm_rf(gen_name)
112
+ Dir.chdir(zip_dir) do
113
+ FileUtils.rm_rf(framework_name) if @zip
114
+ FileUtils.rm_rf(library_name)
115
+ FileUtils.rm_rf(framework_name) unless @framework_output
116
+ FileUtils.rm_rf("#{framework_name}.zip") unless @framework_output
117
+ end
118
+ end
119
+
120
+ def framework_name
121
+ CBin::Config::Builder.instance.framework_name(@spec)
122
+ end
123
+
124
+ def framework_name_zip
125
+ CBin::Config::Builder.instance.framework_name_version(@spec) + ".zip"
126
+ end
127
+
128
+ def library_name
129
+ CBin::Config::Builder.instance.library_name(@spec)
130
+ end
131
+
132
+ def workspace_directory
133
+ @local_build_dir
134
+ end
135
+
136
+ def zip_dir
137
+ CBin::Config::Builder.instance.zip_dir
138
+ end
139
+
140
+ def gen_name
141
+ CBin::Config::Builder.instance.gen_name
142
+ end
143
+
144
+ def is_library
145
+ File.exist?(File.join(@local_build_dir, "lib#{@spec.name}.a"))
146
+ end
147
+
148
+ # 使用了user_framework 会有#{@spec.name}.framework
149
+ # 未使用的 需要判断文件
150
+ def is_framework
151
+ res = File.exist?(File.join(@local_build_dir, "#{@spec.name}.framework"))
152
+ unless res
153
+ res = File.exist?(File.join(CBin::Config::Builder.instance.xcode_BuildProductsPath_dir, "#{@spec.name}","Swift Compatibility Header"))
154
+ end
155
+ res
156
+ end
157
+
158
+ def frameWork_dir
159
+ dir = File.join(@local_build_dir, "#{@spec.name}.framework")
160
+ unless File.exist?(dir)
161
+ dir = File.join(CBin::Config::Builder.instance.xcode_BuildProductsPath_dir, "#{@spec.name}")
162
+ end
163
+ dir
164
+ end
165
+
166
+ def spec_file
167
+ @spec_file ||= begin
168
+ if @podspec
169
+ find_spec_file(@podspec)
170
+ else
171
+ if code_spec_files.empty?
172
+ raise Informative, '当前目录下没有找到可用源码 podspec.'
173
+ end
174
+
175
+ spec_file = code_spec_files.first
176
+ spec_file
177
+ end
178
+ end
179
+ end
180
+
181
+ end
182
+ end
183
+ end
@@ -0,0 +1,85 @@
1
+
2
+
3
+ # copy from https://github.com/CocoaPods/cocoapods-packager
4
+
5
+ module CBin
6
+ class LocalFramework
7
+ attr_reader :headers_path
8
+ attr_reader :module_map_path
9
+ attr_reader :resources_path
10
+ attr_reader :root_path
11
+ attr_reader :versions_path
12
+ attr_reader :swift_module_path
13
+ attr_reader :fwk_path
14
+
15
+ def initialize(name, platform, local_build_dir)
16
+ @name = name
17
+ @platform = platform
18
+ @local_build_dir = local_build_dir
19
+ end
20
+
21
+ def make
22
+ make_root
23
+ make_framework
24
+ make_headers
25
+ make_resources
26
+ make_current_version
27
+ end
28
+
29
+ def delete_resources
30
+ Pathname.new(@resources_path).rmtree
31
+ (Pathname.new(@fwk_path) + Pathname.new('Resources')).delete
32
+ end
33
+
34
+ def remove_current_version
35
+ FileUtils.rm_f(File.join(@fwk_path,@name))
36
+ FileUtils.rm_f(File.join(@fwk_path,"Headers"))
37
+ FileUtils.rm_f(File.join(@fwk_path,"Resources"))
38
+
39
+ FileUtils.cp_r("#{@versions_path}/.", @fwk_path)
40
+ # FileUtils.remove_dir(@versions_path)
41
+ FileUtils.remove_dir("#{@fwk_path}/Versions")
42
+
43
+ # current_version_path = @versions_path + Pathname.new('../Current')
44
+ # `ln -sf A #{current_version_path}`
45
+ # `ln -sf Versions/Current/Headers #{@fwk_path}/`
46
+ # `ln -sf Versions/Current/Resources #{@fwk_path}/`
47
+ # `ln -sf Versions/Current/#{@name} #{@fwk_path}/`
48
+ end
49
+ private
50
+
51
+ def make_current_version
52
+ current_version_path = @versions_path + Pathname.new('../Current')
53
+ `ln -sf A #{current_version_path}`
54
+ `ln -sf Versions/Current/Headers #{@fwk_path}/`
55
+ `ln -sf Versions/Current/Resources #{@fwk_path}/`
56
+ `ln -sf Versions/Current/#{@name} #{@fwk_path}/`
57
+ end
58
+
59
+ def make_framework
60
+ @fwk_path = @root_path + Pathname.new(@name + '.framework')
61
+ FileUtils.remove_dir(@fwk_path) if @fwk_path.exist?
62
+ @fwk_path.mkdir unless @fwk_path.exist?
63
+
64
+ @module_map_path = @fwk_path + Pathname.new('Modules')
65
+ @versions_path = @fwk_path + Pathname.new('Versions/A')
66
+ @fwk_path.exist?
67
+ @swift_module_path = @module_map_path + Pathname.new(@name + '.swiftmodule')
68
+ end
69
+
70
+ def make_headers
71
+ @headers_path = @versions_path + Pathname.new('Headers')
72
+ @headers_path.mkpath unless @headers_path.exist?
73
+ end
74
+
75
+ def make_resources
76
+ @resources_path = @versions_path + Pathname.new('Resources')
77
+ @resources_path.mkpath unless @resources_path.exist?
78
+ end
79
+
80
+ def make_root
81
+ @root_path = Pathname.new(File.join(@local_build_dir, @platform))
82
+ @root_path.mkpath unless @root_path.exist?
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,227 @@
1
+
2
+
3
+ # copy from https://github.com/CocoaPods/cocoapods-packager
4
+
5
+ require 'cocoapods-imy-bin/helpers/local/local_framework'
6
+ require 'English'
7
+ require 'cocoapods-imy-bin/config/config_builder'
8
+ require 'shellwords'
9
+
10
+ module CBin
11
+ class LocalFramework
12
+ class Builder
13
+ include Pod
14
+ #Debug下还待完成
15
+ def initialize(spec, file_accessor, platform, local_build_dir_name, local_build_dir, is_library = true, framework_BuildProductsPath = "")
16
+ @spec = spec
17
+ @file_accessor = file_accessor
18
+ @platform = platform
19
+ @local_build_dir_name = local_build_dir_name
20
+ @local_build_dir = local_build_dir
21
+ @is_library = is_library
22
+ @framework_BuildProductsPath = framework_BuildProductsPath
23
+ end
24
+
25
+ def create
26
+ begin
27
+ #如果是.a 文件, 或者 swift下,是.a文件的
28
+ if @is_library || (!@is_library && @framework_BuildProductsPath != framework_name)
29
+
30
+ UI.section("Building static library #{@spec}") do
31
+ output = framework.versions_path + Pathname.new(@spec.name)
32
+ build_static_library_for_ios(output)
33
+ res = copy_headers
34
+ # maybe fails for copy_headers
35
+ if res
36
+ copy_resources
37
+ cp_to_source_dir
38
+ else
39
+ FileUtils.remove_dir(framework.fwk_path) if File.exist?(framework.fwk_path)
40
+ return nil
41
+ end
42
+ end
43
+
44
+ else
45
+ UI.section("Building static framework #{@spec}") do
46
+ output = File.join(CBin::Config::Builder.instance.zip_dir,"#{@spec.name}.framework")
47
+ build_static_framework_for_ios(output)
48
+ end
49
+ end
50
+
51
+ rescue StandardError
52
+ UI.warn "【#{spec.name} | #{spec.version}】组件二进制版本组装失败 ."
53
+ end
54
+
55
+ framework
56
+ end
57
+
58
+ private
59
+
60
+ def cp_to_source_dir
61
+ # 删除Versions 软链接
62
+ framework.remove_current_version if CBin::Build::Utils.is_swift_module(@spec)
63
+
64
+ target_dir = File.join(CBin::Config::Builder.instance.root_dir,CBin::Config::Builder.instance.framework_file(@spec))
65
+ FileUtils.rm_rf(target_dir) if File.exist?(target_dir)
66
+
67
+ zip_dir = CBin::Config::Builder.instance.zip_dir
68
+ FileUtils.mkdir_p(zip_dir) unless File.exist?(zip_dir)
69
+
70
+ `cp -fa #{@platform}/#{CBin::Config::Builder.instance.framework_name(@spec)} #{target_dir}`
71
+ end
72
+
73
+
74
+ def copy_headers
75
+ #by slj 如果没有头文件,去 "Headers/Public"拿
76
+ # if public_headers.empty?
77
+ Dir.chdir(File.join(Pod::Config.instance.installation_root,'Pods')) do
78
+
79
+ if File.exist?("./Headers/Public/#{@spec.name}")
80
+ #走 podsepc中的public_headers
81
+ public_headers = Array.new
82
+
83
+ Dir.chdir("./Headers/Public/#{@spec.name}") do
84
+ headers = Dir.glob('**/*.h')
85
+ headers.each do |h|
86
+ public_headers << Pathname.new(File.join(Dir.pwd,h))
87
+ end
88
+ end
89
+
90
+ UI.message "Copying public headers #{public_headers.map(&:basename).map(&:to_s)}"
91
+
92
+ public_headers.each do |h|
93
+ `ditto #{h} #{framework.headers_path}/#{h.basename}`
94
+ end
95
+
96
+ # If custom 'module_map' is specified add it to the framework distribution
97
+ # otherwise check if a header exists that is equal to 'spec.name', if so
98
+ # create a default 'module_map' one using it.
99
+ if !@spec.module_map.nil?
100
+ module_map_file = @file_accessor.module_map
101
+ if Pathname(module_map_file).exist?
102
+ module_map = File.read(module_map_file)
103
+ end
104
+ elsif public_headers.map(&:basename).map(&:to_s).include?("#{@spec.name}-umbrella.h")
105
+ module_map = <<-MAP
106
+ framework module #{@spec.name} {
107
+ umbrella header "#{@spec.name}-umbrella.h"
108
+
109
+ export *
110
+ module * { export * }
111
+ }
112
+ MAP
113
+ end
114
+
115
+ unless module_map.nil?
116
+ UI.message "Writing module map #{module_map}"
117
+ unless framework.module_map_path.exist?
118
+ framework.module_map_path.mkpath
119
+ end
120
+ File.write("#{framework.module_map_path}/module.modulemap", module_map)
121
+
122
+ # unless framework.swift_module_path.exist?
123
+ # framework.swift_module_path.mkpath
124
+ # end
125
+ # DO BuildProductsPath swiftModule拷贝到 framework.swift_module_path
126
+ swiftmodule_path = File.join(@framework_BuildProductsPath, "#{@spec.name}.swiftmodule")
127
+ if File.directory?(swiftmodule_path)
128
+ FileUtils.cp_r("#{swiftmodule_path}/.", framework.swift_module_path)
129
+ end
130
+ swift_Compatibility_Header = "#{@framework_BuildProductsPath}/Swift\ Compatibility\ Header/#{@spec.name}-Swift.h"
131
+ FileUtils.cp(swift_Compatibility_Header,framework.headers_path) if File.exist?(swift_Compatibility_Header)
132
+ info_plist_file = File.join(File.dirname(File.dirname(__FILE__)),"info.plist")
133
+ FileUtils.cp(info_plist_file,framework.fwk_path)
134
+ end
135
+ else
136
+ UI.warn "== Headers/Public/#{@spec.name} no exist"
137
+ return false
138
+ end
139
+
140
+ end
141
+ return true
142
+ end
143
+
144
+ def copy_resources
145
+
146
+
147
+ Dir.chdir(Pod::Config.instance.sandbox_root) do
148
+
149
+ bundles = Dir.glob('./build/*.bundle')
150
+
151
+ bundle_names = [@spec, *@spec.recursive_subspecs].flat_map do |spec|
152
+ consumer = spec.consumer(@platform)
153
+ consumer.resource_bundles.keys +
154
+ consumer.resources.map do |r|
155
+ File.basename(r, '.bundle') if File.extname(r) == 'bundle'
156
+ end
157
+ end.compact.uniq
158
+
159
+ bundles.select! do |bundle|
160
+ bundle_name = File.basename(bundle, '.bundle')
161
+ bundle_names.include?(bundle_name)
162
+ end
163
+
164
+ if bundles.count > 0
165
+ UI.message "Copying bundle files #{bundles}"
166
+ bundle_files = bundles.join(' ')
167
+ `cp -rp #{bundle_files} #{framework.resources_path} 2>&1`
168
+ end
169
+
170
+ real_source_dir = @spec.name
171
+ resources = [@spec, *@spec.recursive_subspecs].flat_map do |spec|
172
+ expand_paths(real_source_dir, spec.consumer(@platform).resources)
173
+ end.compact.uniq
174
+
175
+ if (resources.count == 0 || (resources.count == 1 && resources[0].count == 0)) && bundles.count == 0
176
+ framework.delete_resources
177
+ return
178
+ end
179
+
180
+ if resources.count > 0
181
+ #把 路径转义。 避免空格情况下拷贝失败
182
+ escape_resource = []
183
+ resources.each do |source|
184
+ escape_resource << Shellwords.join(source)
185
+ end
186
+ UI.message "Copying resources #{escape_resource}"
187
+ `cp -rp #{escape_resource.join(' ')} #{framework.resources_path}`
188
+ end
189
+
190
+ end
191
+
192
+ end
193
+
194
+
195
+ def build_static_library_for_ios(output)
196
+ `cp -rp #{library_name} #{output}`
197
+ end
198
+
199
+ def build_static_framework_for_ios(output)
200
+ FileUtils.cp_r(framework_name, output)
201
+ end
202
+
203
+ def library_name
204
+ File.join(@local_build_dir, "lib#{@spec.name}.a")
205
+ end
206
+
207
+ def framework_name
208
+ File.join(@local_build_dir, "#{@spec.name}.framework")
209
+ end
210
+
211
+ def expand_paths(source_dir, path_specs)
212
+ path_specs.map do |path_spec|
213
+ Dir.glob(File.join(source_dir, path_spec))
214
+ end
215
+ end
216
+
217
+ def framework
218
+ @framework ||= begin
219
+ framework = CBin::LocalFramework.new(@spec.name, @platform.name.to_s,@local_build_dir)
220
+ framework.make
221
+ framework
222
+ end
223
+ end
224
+
225
+ end
226
+ end
227
+ end
@@ -0,0 +1,96 @@
1
+
2
+
3
+
4
+ # copy from https://github.com/CocoaPods/cocoapods-packager
5
+
6
+ require 'cocoapods-imy-bin/helpers/framework.rb'
7
+ require 'cocoapods-imy-bin/helpers/library.rb'
8
+
9
+ require 'English'
10
+
11
+ module CBin
12
+ class LocalLibrary
13
+ class Builder
14
+ include Pod
15
+
16
+ def initialize(spec, file_accessor, platform, source_dir,framework_path)
17
+ @spec = spec
18
+ @source_dir = source_dir
19
+ @file_accessor = file_accessor
20
+ @platform = platform
21
+ @framework = framework_path
22
+ @source_files = "#{@source_dir}/#{library.name_path}"
23
+ @source_zip_file = "#{@source_files}.zip"
24
+ end
25
+
26
+ def build
27
+ UI.section("Building static library #{@spec}") do
28
+
29
+ begin
30
+ clean_source_dir
31
+ copy_headers
32
+ copy_library
33
+ copy_resources
34
+ cp_to_source_dir
35
+ rescue Exception => e
36
+ puts e.message
37
+ puts e.backtrace.inspect
38
+ end
39
+
40
+ end
41
+ end
42
+
43
+ private
44
+
45
+ def clean_source_dir
46
+ FileUtils.rm_rf(@source_files) if File.exist?(@source_files)
47
+ FileUtils.rm_rf(@source_zip_file) if File.exist?(@source_zip_file)
48
+ end
49
+
50
+ def cp_to_source_dir
51
+ target_dir = library.versions_path
52
+ dest_file = "#{@source_dir}/#{library.name_path}"
53
+ FileUtils.rm_rf(dest_file) if File.exist?(dest_file)
54
+
55
+ `cp -fa #{target_dir} #{dest_file}/`
56
+ end
57
+
58
+ def copy_headers
59
+ FileUtils.cp_r(framework.headers_path,library.versions_path) if File.exist?(framework.headers_path)
60
+ end
61
+
62
+ def copy_library
63
+ src_file = "#{framework.versions_path}/#{@spec.name}"
64
+ unless File.exist?(src_file)
65
+ raise Informative, "framework没有文件:#{src_file}"
66
+ end
67
+
68
+ dest_file = "#{library.versions_path}/#{@spec.name}"
69
+ rename_dest_file = "#{library.versions_path}/lib#{@spec.name}.a"
70
+ FileUtils.cp_r(src_file,dest_file)
71
+ File.rename(dest_file, rename_dest_file ) if File.exist?(dest_file)
72
+ end
73
+
74
+ def copy_resources
75
+ FileUtils.cp_r(framework.resources_path,library.versions_path) if File.exist?(framework.resources_path)
76
+ end
77
+
78
+
79
+ def framework
80
+ @framework ||= begin
81
+ framework = Framework.new(@spec.name, @platform.name.to_s)
82
+ framework.make
83
+ framework
84
+ end
85
+ end
86
+
87
+ def library
88
+ @library ||= begin
89
+ library = Library.new(@spec.name, @platform.name.to_s,@spec.version)
90
+ library.make
91
+ library
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
@@ -85,10 +85,6 @@ module CBin
85
85
  spec_hash.delete('resource_bundles')
86
86
  spec_hash.delete('exclude_files')
87
87
  spec_hash.delete('preserve_paths')
88
-
89
- spec_hash.delete('subspecs')
90
- spec_hash.delete('default_subspecs')
91
- spec_hash.delete('default_subspec')
92
88
  spec_hash.delete('vendored_frameworks')
93
89
  spec_hash.delete('vendored_framework')
94
90
 
@@ -124,6 +120,16 @@ module CBin
124
120
  「 converted automatically by plugin cocoapods-imy-bin @厦门美柚 - slj 」
125
121
  #{@spec.description}
126
122
  EOF
123
+
124
+ # 处理一下 subspecs ,使用相同的配置
125
+ if @spec.subspecs
126
+ @spec.subspecs.each do |subspec|
127
+ subspec.source_files = binary_source_files
128
+ subspec.public_header_files = binary_public_header_files
129
+ subspec.vendored_libraries = binary_vendored_libraries
130
+ subspec.resources = binary_resources if @spec.attributes_hash.keys.include?("resources")
131
+ end
132
+ end
127
133
  @spec
128
134
  end
129
135
 
@@ -43,7 +43,7 @@ module CBin
43
43
  end
44
44
 
45
45
  #推送二进制
46
- # curl http://ci.xxx:9192/frameworks -F "name=IMYFoundation" -F "version=7.7.4.2" -F "annotate=IMYFoundation_7.7.4.2_log" -F "file=@bin_zip/bin_IMYFoundation_7.7.4.2.zip"
46
+ # curl http://ci.xxx:9192/frameworks -F "name=IMYFoundation" -F "version=7.7.4.2" -F "annotate=IMYFoundation_7.7.4.2_log" -F "file=@bin-zip/bin_IMYFoundation_7.7.4.2.zip"
47
47
  def curl_zip
48
48
  zip_file = "#{CBin::Config::Builder.instance.library_file(@spec)}.zip"
49
49
  res = File.exist?(zip_file)
@@ -52,11 +52,13 @@ module CBin
52
52
  res = File.exist?(zip_file)
53
53
  end
54
54
  if res
55
+ command = "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}\""
55
56
  print <<EOF
56
57
  上传二进制文件
57
- 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}"
58
+ #{command}
58
59
  EOF
59
- `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
60
+ upload_result = `#{command}`
61
+ puts "#{upload_result}"
60
62
  end
61
63
 
62
64
  res