cocoapods-aomi-bin 0.0.3 → 0.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ac2be4c4fa9559ae5533deb58daf2abd04e3c84b2ab818d45056cb332aafbee
4
- data.tar.gz: 56837043a82db02c5e1325323fa33e8b524399a9bff6437039c961ed61e9141c
3
+ metadata.gz: b467865e7e3f17d4ed5d5a010485ef7f5ee5de921452693ec070af5f764e6960
4
+ data.tar.gz: 33dd81455396d007e94d74485d99e956e5979f1c3209a83c42d00cede39f9677
5
5
  SHA512:
6
- metadata.gz: 39ae2e87cb3945b383884b3f7d711b4a45ca22a3563b23349909598034d1f294535d6eea819b0bcb60b057f3d5ec4afae3179b3415ac4d46cb6ef910e6e23724
7
- data.tar.gz: bd78e105cc549211c9b09134834b85129cc985448b5d4cd49533b870fda6bfd4be93b02fa56738e1cd3e7cf381aafad5a02268a9ced44bf300b95ca168f259e1
6
+ metadata.gz: '0485ed252dd0e8aab564fe7a497018003eb8aa820f6617380c31e08f85044ec113a0da70ae7081d9ee32e7103ab407e987ff1d37e672531ae128d261ea087fcf'
7
+ data.tar.gz: 64a0c0d933c4ff8bd203ebdf6286248cbae083ae5f1ee289570e61ba8882f62e914254b1f099eb7dc2e8a6eda11b4c96738b886cc4823acf3598feebea25f7cb
@@ -6,8 +6,13 @@ require 'cocoapods-lhj-bin/command/bin/code'
6
6
  require 'cocoapods-lhj-bin/command/bin/update'
7
7
  require 'cocoapods-lhj-bin/command/bin/install'
8
8
  require 'cocoapods-lhj-bin/command/bin/import'
9
+ require 'cocoapods-lhj-bin/command/bin/local'
9
10
  require 'cocoapods-lhj-bin/command/bin/lhj'
11
+ require 'cocoapods-lhj-bin/command/bin/config/push'
12
+ require 'cocoapods-lhj-bin/command/bin/oss/list'
13
+ require 'cocoapods-lhj-bin/command/bin/oss/del'
10
14
  require 'cocoapods-lhj-bin/helpers'
15
+ require 'cocoapods-lhj-bin/native'
11
16
 
12
17
  module Pod
13
18
  class Command
@@ -34,15 +39,12 @@ module Pod
34
39
 
35
40
  self.abstract_command = true
36
41
 
37
- self.default_subcommand = 'open'
38
42
  self.summary = '组件二进制化插件.'
39
43
  self.description = <<-DESC
40
44
  组件二进制化插件。利用源码私有源与二进制私有源实现对组件依赖类型的切换。
41
45
  DESC
42
46
 
43
47
  def initialize(argv)
44
- require 'cocoapods-aomi-bin/native'
45
-
46
48
  @help = argv.flag?('help')
47
49
  super
48
50
  end
@@ -128,7 +128,7 @@ module Pod
128
128
  @framework_output,
129
129
  @zip,
130
130
  @spec,
131
- false ,
131
+ false,
132
132
  @config)
133
133
  builder.build
134
134
  rescue Object => exception
@@ -0,0 +1,43 @@
1
+ #coding:utf-8
2
+ require 'cocoapods-lhj-bin/helpers/oss_helper'
3
+ require 'yaml'
4
+
5
+ module Pod
6
+ class Command
7
+ class Bin < Command
8
+ class Init < Bin
9
+ class Push < Init
10
+ self.summary = '推送配置文档到OSS.'
11
+
12
+ def initialize(argv)
13
+ super
14
+ end
15
+
16
+ def run
17
+ push
18
+ end
19
+
20
+ def push
21
+ file = File.expand_path("#{Pod::Config.instance.home_dir}/bin_dev.yml")
22
+ CBin::OSS::Helper.instance.upload('bin_dev.yml', file)
23
+ end
24
+
25
+ def trans
26
+ key_map = {}
27
+ path = '/Users/lihaijian/workspace/cocoa/cocoapods-lhj-bin-build-temp/zh2Hant.properties'
28
+ File.open(path, 'r+') do |f|
29
+ f.each_line do |line|
30
+ arr = line.split('=')
31
+ key = [arr[0][2, 4].hex].pack("U")
32
+ val = arr[1].strip!
33
+ key_map[key] = [val[2, 4].hex].pack("U")
34
+ end
35
+ end
36
+ File.open('/Users/lihaijian/workspace/cocoa/cocoapods-lhj-bin-build-temp/zh2hant.yml', 'w') { |f| f.write key_map.to_yaml }
37
+ end
38
+
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,144 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'csv'
4
+
5
+ module Pod
6
+ class Command
7
+ class Bin < Command
8
+ class Local < Bin
9
+ self.summary = '生成国际化文件'
10
+
11
+ def self.options
12
+ [
13
+ %w[--key Key在csv中第几列,默认为0],
14
+ %w[--cn 中文在csv中第几列,默认为1],
15
+ %w[--en 英文文在csv中第几列,默认为2]
16
+ ]
17
+ end
18
+
19
+ def initialize(argv)
20
+ @current_path = argv.shift_argument || Dir.pwd
21
+ @key_col = argv.option('key').to_i || 0
22
+ @cn_col = argv.option('cn', 1).to_i || 1
23
+ @en_col = argv.option('en', 2).to_i || 2
24
+ @key_map = {}
25
+ @trans_map = {}
26
+ @trans_map_invert = {}
27
+ super
28
+ end
29
+
30
+ def run
31
+ load_trans_map
32
+ read_csv_file
33
+ write_en_strings
34
+ write_zh_cn_strings
35
+ write_zh_hk_strings
36
+ end
37
+
38
+ def en_dir_name
39
+ 'en.lproj'
40
+ end
41
+
42
+ def zh_hk_dir_name
43
+ 'zh-hk.lproj'
44
+ end
45
+
46
+ def zh_cn_dir_name
47
+ 'zh-cn.lproj'
48
+ end
49
+
50
+ def generate_file_name
51
+ 'Localizable.strings'
52
+ end
53
+
54
+ def yaml_file
55
+ File.join(Pod::Config.instance.home_dir, 'zh2hant.yml')
56
+ end
57
+
58
+ def load_trans_map
59
+ require 'yaml'
60
+ down_load_yaml unless File.exist?(yaml_file)
61
+ contents = YAML.safe_load(File.open(yaml_file))
62
+ @trans_map = contents.to_hash
63
+ @trans_map_invert = @trans_map.invert
64
+ end
65
+
66
+ def down_load_yaml
67
+ require 'open-uri'
68
+ UI.puts "开始下载简繁配置文件...\n"
69
+ URI.open('http://aomi-ios-repo.oss-cn-shenzhen.aliyuncs.com/zh2hant.yml') do |i|
70
+ File.open(yaml_file, 'w+') do |f|
71
+ f.write(i.read)
72
+ end
73
+ end
74
+ end
75
+
76
+ def read_csv_file
77
+ Dir.glob("#{@current_path}/**/*.csv").each do |p|
78
+ CSV.foreach(p) { |row| @key_map[row[@key_col]] = { zh: row[@cn_col], en: row[@en_col] } unless row[0] =~ /[\u4e00-\u9fa5]/ }
79
+ end
80
+ end
81
+
82
+ def format_str(type, area = :cn)
83
+ str = ''
84
+ @key_map.each do |k, v|
85
+ val = v[type]
86
+ case area
87
+ when :hk
88
+ val = trans_zh_hk_str val
89
+ when :cn
90
+ val = trans_zh_cn_str val
91
+ end
92
+ str += "\"#{k}\" = \"#{val}\";\n"
93
+ end
94
+ str
95
+ end
96
+
97
+ def trans_zh_cn_str(input)
98
+ out = []
99
+ input.each_char do |c|
100
+ out << (@trans_map_invert[c] || c)
101
+ end
102
+ out.join('')
103
+ end
104
+
105
+ def trans_zh_hk_str(input)
106
+ out = []
107
+ input.each_char do |c|
108
+ out << (@trans_map[c] || c)
109
+ end
110
+ out.join('')
111
+ end
112
+
113
+ def write_to_file(file, contents)
114
+ FileUtils.rm_rf(file) if File.exist?(file)
115
+ FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(File.dirname(file))
116
+ File.open(file, 'w+') do |f|
117
+ f.write(contents)
118
+ end
119
+ end
120
+
121
+ def generate_file(file, type)
122
+ content = format_str(type)
123
+ write_to_file(file, content)
124
+ end
125
+
126
+ def write_en_strings
127
+ file = File.join(@current_path, en_dir_name, generate_file_name)
128
+ generate_file(file, :en)
129
+ end
130
+
131
+ def write_zh_cn_strings
132
+ file = File.join(@current_path, zh_cn_dir_name, generate_file_name)
133
+ generate_file(file, :zh)
134
+ end
135
+
136
+ def write_zh_hk_strings
137
+ file = File.join(@current_path, zh_hk_dir_name, generate_file_name)
138
+ content = format_str(:zh, :hk)
139
+ write_to_file(file, content)
140
+ end
141
+ end
142
+ end
143
+ end
144
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+ require 'cocoapods-lhj-bin/helpers/oss_helper'
3
+
4
+ module Pod
5
+ class Command
6
+ class Bin < Command
7
+ class OSS < Bin
8
+ class Del < OSS
9
+ self.summary = '删除OSS的key'
10
+
11
+ self.arguments = [
12
+ CLAide::Argument.new('--key=XX', true)
13
+ ]
14
+
15
+ def self.options
16
+ [
17
+ ['--key', 'OSS对应的key']
18
+ ]
19
+ end
20
+
21
+ def initialize(argv)
22
+ @key = argv.option('key')
23
+ super
24
+ end
25
+
26
+ def validate!
27
+ help! "请输入key" unless @key
28
+ super
29
+ end
30
+
31
+ def run
32
+ CBin::OSS::Helper.instance.delete(@key)
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+ require 'cocoapods-lhj-bin/helpers/oss_helper'
3
+
4
+ module Pod
5
+ class Command
6
+ class Bin < Command
7
+ class OSS < Bin
8
+ class List < OSS
9
+ self.summary = '查看OSS列表'
10
+
11
+ def initialize(argv)
12
+ super
13
+ end
14
+
15
+ def run
16
+ objects = CBin::OSS::Helper.instance.list
17
+ objects.each do |o|
18
+ path = "#{CBin::OSS::Helper.instance.url_path}/#{o.key}"
19
+ UI.puts path.green
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,5 +1,5 @@
1
1
  module CBin
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.8'
3
3
  end
4
4
 
5
5
  module Pod
@@ -9,6 +9,7 @@ module CBin
9
9
  attr_reader :versions_path
10
10
  attr_reader :swift_module_path
11
11
  attr_reader :fwk_path
12
+ attr_reader :root_resources_path
12
13
 
13
14
  def initialize(name, platform)
14
15
  @name = name
@@ -77,6 +78,11 @@ module CBin
77
78
  @resources_path.mkpath unless @resources_path.exist?
78
79
  end
79
80
 
81
+ def make_root_resources
82
+ @root_resources_path = @fwk_path + Pathname.new('Resources')
83
+ @root_resources_path.mkpath unless @root_resources_path.exist?
84
+ end
85
+
80
86
  def make_root
81
87
  @root_path = Pathname.new(@platform)
82
88
  @root_path.mkpath unless @root_path.exist?
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # copy from https://github.com/CocoaPods/cocoapods-packager
2
3
 
3
4
  require 'cocoapods-lhj-bin/helpers/framework'
@@ -11,7 +12,7 @@ module CBin
11
12
  class Builder
12
13
  include Pod
13
14
  #Debug下还待完成
14
- def initialize(spec, file_accessor, platform, source_dir, isRootSpec = true, build_model="Debug")
15
+ def initialize(spec, file_accessor, platform, source_dir, isRootSpec = true, build_model='Debug')
15
16
  @spec = spec
16
17
  @source_dir = source_dir
17
18
  @file_accessor = file_accessor
@@ -22,9 +23,7 @@ module CBin
22
23
  vendored_static_frameworks = file_accessor.vendored_static_frameworks.map do |framework|
23
24
  path = framework
24
25
  extn = File.extname path
25
- if extn.downcase == '.framework'
26
- path = File.join(path,File.basename(path, extn))
27
- end
26
+ path = File.join(path,File.basename(path, extn)) if extn.downcase == '.framework'
28
27
  path
29
28
  end
30
29
 
@@ -42,9 +41,6 @@ module CBin
42
41
 
43
42
  # if CBin::Build::Utils.is_swift_module(@spec) || !CBin::Build::Utils.uses_frameworks?
44
43
  # UI.section("Building static Library #{@spec}") do
45
- # # defines = compile
46
- #
47
- # # build_sim_libraries(defines)
48
44
  # output = framework.versions_path + Pathname.new(@spec.name)
49
45
  #
50
46
  # build_static_library_for_ios(output)
@@ -58,9 +54,6 @@ module CBin
58
54
  # else
59
55
  # begin
60
56
  UI.section("Building framework #{@spec}") do
61
- # defines = compile
62
-
63
- # build_sim_libraries(defines)
64
57
  output = framework.fwk_path + Pathname.new(@spec.name)
65
58
 
66
59
  copy_static_framework_dir_for_ios
@@ -69,12 +62,6 @@ module CBin
69
62
 
70
63
  # copy_license
71
64
  copy_framework_resources
72
-
73
- #cp_to_source_dir#
74
-
75
- # rescue Object => exception
76
- # UI.puts exception
77
- # end
78
65
  end
79
66
  # end
80
67
 
@@ -112,9 +99,7 @@ module CBin
112
99
 
113
100
  def static_libs_in_sandbox(build_dir = 'build')
114
101
  file = Dir.glob("#{build_dir}/lib#{target_name}.a")
115
- unless file
116
- UI.warn "file no find = #{build_dir}/lib#{target_name}.a"
117
- end
102
+ UI.warn "file no find = #{build_dir}/lib#{target_name}.a" unless file
118
103
  file
119
104
  end
120
105
 
@@ -129,7 +114,7 @@ module CBin
129
114
  static_libs += static_libs_in_sandbox("build-#{arch}") + @vendored_libraries
130
115
  end
131
116
 
132
- build_path = Pathname("build")
117
+ build_path = Pathname('build')
133
118
  build_path.mkpath unless build_path.exist?
134
119
 
135
120
  libs = (ios_architectures + ios_architectures_sim) .map do |arch|
@@ -158,19 +143,19 @@ module CBin
158
143
  # iphone5,iphone5s以下的模拟器
159
144
  # >x86_64
160
145
  # iphone6以上的模拟器
161
- archs = %w[arm64 armv7]
146
+ %w[arm64 armv7]
162
147
  # archs = %w[x86_64 arm64 armv7s i386]
163
148
  # @vendored_libraries.each do |library|
164
149
  # archs = `lipo -info #{library}`.split & archs
165
150
  # end
166
- archs
151
+
167
152
  end
168
153
 
169
154
  def ios_architectures_sim
170
155
 
171
- archs = %w[x86_64]
172
- # TODO 处理是否需要 i386
173
- archs
156
+ %w[x86_64]
157
+ # TODO: 处理是否需要 i386
158
+
174
159
  end
175
160
 
176
161
  def compile
@@ -193,7 +178,7 @@ module CBin
193
178
  end
194
179
 
195
180
  def is_debug_model
196
- @build_model == "Debug"
181
+ @build_model == 'Debug'
197
182
  end
198
183
 
199
184
  def target_name
@@ -208,10 +193,10 @@ module CBin
208
193
 
209
194
  def xcodebuild(defines = '', args = '', build_dir = 'build', build_model = 'Debug')
210
195
 
211
- unless File.exist?("Pods.xcodeproj") #cocoapods-generate v2.0.0
212
- command = "xcodebuild #{defines} #{args} CONFIGURATION_BUILD_DIR=#{File.join(File.expand_path("..", build_dir), File.basename(build_dir))} clean build -configuration #{build_model} -target #{target_name} -project ./Pods/Pods.xcodeproj 2>&1"
213
- else
196
+ if File.exist?('Pods.xcodeproj')
214
197
  command = "xcodebuild #{defines} #{args} CONFIGURATION_BUILD_DIR=#{build_dir} clean build -configuration #{build_model} -target #{target_name} -project ./Pods.xcodeproj 2>&1"
198
+ else #cocoapods-generate v2.0.0
199
+ command = "xcodebuild #{defines} #{args} CONFIGURATION_BUILD_DIR=#{File.join(File.expand_path('..', build_dir), File.basename(build_dir))} clean build -configuration #{build_model} -target #{target_name} -project ./Pods/Pods.xcodeproj 2>&1"
215
200
  end
216
201
 
217
202
  UI.message "command = #{command}"
@@ -230,14 +215,12 @@ module CBin
230
215
 
231
216
  def copy_headers
232
217
  #走 podsepc中的public_headers
233
- public_headers = Array.new
218
+ public_headers = []
234
219
 
235
220
  #by slj 如果没有头文件,去 "Headers/Public"拿
236
221
  # if public_headers.empty?
237
222
  spec_header_dir = "./Headers/Public/#{@spec.name}"
238
- unless File.exist?(spec_header_dir)
239
- spec_header_dir = "./Pods/Headers/Public/#{@spec.name}"
240
- end
223
+ spec_header_dir = "./Pods/Headers/Public/#{@spec.name}" unless File.exist?(spec_header_dir)
241
224
  raise "copy_headers #{spec_header_dir} no exist " unless File.exist?(spec_header_dir)
242
225
  Dir.chdir(spec_header_dir) do
243
226
  headers = Dir.glob('*.h')
@@ -258,9 +241,7 @@ module CBin
258
241
  # create a default 'module_map' one using it.
259
242
  if !@spec.module_map.nil?
260
243
  module_map_file = @file_accessor.module_map
261
- if Pathname(module_map_file).exist?
262
- module_map = File.read(module_map_file)
263
- end
244
+ module_map = File.read(module_map_file) if Pathname(module_map_file).exist?
264
245
  elsif public_headers.map(&:basename).map(&:to_s).include?("#{@spec.name}-umbrella.h")
265
246
  module_map = <<-MAP
266
247
  framework module #{@spec.name} {
@@ -274,9 +255,7 @@ module CBin
274
255
 
275
256
  unless module_map.nil?
276
257
  UI.message "Writing module map #{module_map}"
277
- unless framework.module_map_path.exist?
278
- framework.module_map_path.mkpath
279
- end
258
+ framework.module_map_path.mkpath unless framework.module_map_path.exist?
280
259
  File.write("#{framework.module_map_path}/module.modulemap", module_map)
281
260
 
282
261
  # unless framework.swift_module_path.exist?
@@ -286,20 +265,16 @@ module CBin
286
265
  archs = ios_architectures + ios_architectures_sim
287
266
  archs.map do |arch|
288
267
  swift_module = "build-#{arch}/#{@spec.name}.swiftmodule"
289
- if File.directory?(swift_module)
290
- FileUtils.cp_r("#{swift_module}/.", framework.swift_module_path)
291
- end
268
+ FileUtils.cp_r("#{swift_module}/.", framework.swift_module_path) if File.directory?(swift_module)
292
269
  end
293
270
  swift_Compatibility_Header = "build-#{archs.first}/Swift\ Compatibility\ Header/#{@spec.name}-Swift.h"
294
271
  FileUtils.cp(swift_Compatibility_Header,framework.headers_path) if File.exist?(swift_Compatibility_Header)
295
- info_plist_file = File.join(File.dirname(__FILE__),"info.plist")
272
+ info_plist_file = File.join(File.dirname(__FILE__),'info.plist')
296
273
  FileUtils.cp(info_plist_file,framework.fwk_path)
297
274
  end
298
275
  end
299
276
 
300
- def copy_swift_header
301
-
302
- end
277
+ def copy_swift_header; end
303
278
 
304
279
  def copy_license
305
280
  UI.message 'Copying license'
@@ -327,7 +302,7 @@ module CBin
327
302
  bundle_names.include?(bundle_name)
328
303
  end
329
304
 
330
- if bundles.count > 0
305
+ if bundles.count.positive?
331
306
  UI.message "Copying bundle files #{bundles}"
332
307
  bundle_files = bundles.join(' ')
333
308
  `cp -rp #{bundle_files} #{framework.resources_path} 2>&1`
@@ -335,13 +310,11 @@ module CBin
335
310
 
336
311
  real_source_dir = @source_dir
337
312
  unless @isRootSpec
338
- spec_source_dir = File.join(Dir.pwd,"#{@spec.name}")
339
- unless File.exist?(spec_source_dir)
340
- spec_source_dir = File.join(Dir.pwd,"Pods/#{@spec.name}")
341
- end
313
+ spec_source_dir = File.join(Dir.pwd,@spec.name.to_s)
314
+ spec_source_dir = File.join(Dir.pwd,"Pods/#{@spec.name}") unless File.exist?(spec_source_dir)
342
315
  raise "copy_resources #{spec_source_dir} no exist " unless File.exist?(spec_source_dir)
343
316
 
344
- spec_source_dir = File.join(Dir.pwd,"#{@spec.name}")
317
+ spec_source_dir = File.join(Dir.pwd,@spec.name.to_s)
345
318
  real_source_dir = spec_source_dir
346
319
  end
347
320
 
@@ -349,12 +322,12 @@ module CBin
349
322
  expand_paths(real_source_dir, spec.consumer(@platform).resources)
350
323
  end.compact.uniq
351
324
 
352
- if resources.count == 0 && bundles.count == 0
325
+ if resources.count.zero? && bundles.count.zero?
353
326
  framework.delete_resources
354
327
  return
355
328
  end
356
329
 
357
- if resources.count > 0
330
+ if resources.count.positive?
358
331
  #把 路径转义。 避免空格情况下拷贝失败
359
332
  escape_resource = []
360
333
  resources.each do |source|
@@ -385,7 +358,7 @@ module CBin
385
358
  static_libs += static_libs_in_sandbox("build-#{arch}") + @vendored_libraries
386
359
  end
387
360
 
388
- build_path = Pathname("build")
361
+ build_path = Pathname('build')
389
362
  build_path.mkpath unless build_path.exist?
390
363
 
391
364
  libs = (ios_architectures + ios_architectures_sim) .map do |arch|
@@ -402,18 +375,14 @@ module CBin
402
375
  archs = ios_architectures + ios_architectures_sim
403
376
  framework_dir = "build-#{ios_architectures_sim.first}/#{@spec.name}.framework"
404
377
  framework_dir = "build-#{ios_architectures.first}/#{@spec.name}.framework" unless File.exist?(framework_dir)
405
- unless File.exist?(framework_dir)
406
- raise "#{framework_dir} path no exist"
407
- end
378
+ raise "#{framework_dir} path no exist" unless File.exist?(framework_dir)
408
379
  File.join(Dir.pwd, "build-#{ios_architectures_sim.first}/#{@spec.name}.framework")
409
380
  FileUtils.cp_r(framework_dir, framework.root_path)
410
381
 
411
- # todo 所有架构的swiftModule拷贝到 framework.swift_module_path
382
+ # TODO: 所有架构的swiftModule拷贝到 framework.swift_module_path
412
383
  archs.map do |arch|
413
384
  swift_module = "build-#{arch}/#{@spec.name}.framework/Modules/#{@spec.name}.swiftmodule"
414
- if File.directory?(swift_module)
415
- FileUtils.cp_r("#{swift_module}/.", framework.swift_module_path)
416
- end
385
+ FileUtils.cp_r("#{swift_module}/.", framework.swift_module_path) if File.directory?(swift_module)
417
386
  end
418
387
 
419
388
  # 删除Versions 软链接
@@ -422,8 +391,14 @@ module CBin
422
391
 
423
392
  def copy_framework_resources
424
393
  resources = Dir.glob("#{framework.fwk_path + Pathname.new('Resources')}/*")
425
- if resources.count == 0
426
- framework.delete_resources
394
+ framework.delete_resources if resources.count.zero?
395
+
396
+ consumer = @spec.consumer(@platform)
397
+ if consumer.resource_bundles.keys.any?
398
+ consumer.resource_bundles.each_key do |bundle_name|
399
+ bundle_file = "build-arm64/#{bundle_name}.bundle"
400
+ `cp -fa #{bundle_file} #{framework.fwk_path.to_s}`
401
+ end
427
402
  end
428
403
  end
429
404
 
@@ -0,0 +1,35 @@
1
+ require 'aliyun/oss'
2
+ require 'cocoapods-lhj-bin/config/config'
3
+
4
+ module CBin
5
+ class OSS
6
+ class Helper
7
+ def initialize
8
+ @client = Aliyun::OSS::Client.new(endpoint: CBin.config.oss_endpoint,
9
+ access_key_id: CBin.config.oss_access_key_id,
10
+ access_key_secret: CBin.config.oss_access_key_secret)
11
+ @bucket = @client.get_bucket(CBin.config.oss_bucket)
12
+ end
13
+
14
+ def url_path
15
+ "http://#{CBin.config.oss_bucket}.#{CBin.config.oss_endpoint}"
16
+ end
17
+
18
+ def upload(key, file)
19
+ @bucket.put_object(key, :file => file)
20
+ end
21
+
22
+ def list
23
+ @bucket.list_objects
24
+ end
25
+
26
+ def delete(key)
27
+ @bucket.delete_object(key)
28
+ end
29
+
30
+ def self.instance
31
+ @instance ||= new
32
+ end
33
+ end
34
+ end
35
+ end
@@ -62,14 +62,16 @@ module CBin
62
62
  # @spec.vendored_frameworks = "#{code_spec.root.name}.framework"
63
63
 
64
64
  # Resources
65
- extnames = []
66
- extnames << '*.bundle' if code_spec_consumer.resource_bundles.any?
67
- if code_spec_consumer.resources.any?
68
- extnames += code_spec_consumer.resources.map { |r| File.basename(r) }
69
- end
70
- if extnames.any?
71
- @spec.resources = framework_contents('Resources').flat_map { |r| extnames.map { |e| "#{r}/#{e}" } }
65
+ # extnames = []
66
+ # extnames << '*.bundle' if code_spec_consumer.resource_bundles.any?
67
+ if code_spec_consumer.resources.keys.any?
68
+ extnames = code_spec_consumer.resource_bundles.keys.map { |r| "#{code_spec.root.name}.framework/#{r}.bundle" }
69
+ @spec.resources = extnames
72
70
  end
71
+ # if extnames.any?
72
+ # @spec.resources = framework_contents('Resources').flat_map { |r| extnames.map { |e| "#{r}/#{e}" } }
73
+ # @spec.resources = extnames
74
+ # end
73
75
 
74
76
  # Source Location
75
77
  @spec.source = binary_source
@@ -132,14 +134,18 @@ module CBin
132
134
  @spec.vendored_frameworks = "#{code_spec.root.name}.framework"
133
135
 
134
136
  # Resources
135
- extnames = []
136
- extnames << '*.bundle' if code_spec_consumer.resource_bundles.any?
137
- if code_spec_consumer.resources.any?
138
- extnames += code_spec_consumer.resources.map { |r| File.basename(r) }
139
- end
140
- if extnames.any?
141
- @spec.resources = framework_contents('Resources').flat_map { |r| extnames.map { |e| "#{r}/#{e}" } }
137
+ # extnames = []
138
+ # extnames << '*.bundle' if code_spec_consumer.resource_bundles.any?
139
+ if code_spec_consumer.resource_bundles.keys.any?
140
+ extnames = code_spec_consumer.resource_bundles.keys.map { |r| "#{code_spec.root.name}.framework/#{r}.bundle" }
141
+ @spec.resources = extnames
142
142
  end
143
+ # if code_spec_consumer.resources.any?
144
+ # extnames += code_spec_consumer.resources.map { |r| File.basename(r) }
145
+ # end
146
+ # if extnames.any?
147
+ # @spec.resources = framework_contents('Resources').flat_map { |r| extnames.map { |e| "#{r}/#{e}" } }
148
+ # end
143
149
 
144
150
  # Source Location
145
151
  @spec.source = binary_source
@@ -1,4 +1,4 @@
1
- require 'aliyun/oss'
1
+ require 'cocoapods-lhj-bin/helpers/oss_helper'
2
2
  require 'cocoapods-lhj-bin/native/podfile'
3
3
  require 'cocoapods/command/gen'
4
4
  require 'cocoapods/generate'
@@ -17,8 +17,6 @@ module CBin
17
17
  @spec = spec
18
18
  @code_dependencies = code_dependencies
19
19
  @sources = sources
20
- @client = Aliyun::OSS::Client.new(endpoint: CBin.config.oss_endpoint, access_key_id: CBin.config.oss_access_key_id, access_key_secret: CBin.config.oss_access_key_secret )
21
- @bucket = @client.get_bucket(CBin.config.oss_bucket)
22
20
  end
23
21
 
24
22
  def upload
@@ -73,7 +71,7 @@ EOF
73
71
  res = File.exist?(zip_file)
74
72
  end
75
73
  if res
76
- @bucket.put_object("#{@spec.name}/#{@spec.version}/#{@spec.name}.zip", :file => zip_file)
74
+ CBin::OSS::Helper.instance.upload("#{@spec.name}/#{@spec.version}/#{@spec.name}.zip", zip_file)
77
75
  end
78
76
  res
79
77
  end
@@ -126,7 +126,7 @@ module Pod
126
126
  source = use_binary ? sources_manager.binary_source : sources_manager.code_source
127
127
 
128
128
  spec_version = rspec.spec.version
129
- UI.message 'cocoapods-lhj-bin 插件'
129
+ UI.message 'cocoapods-aomi-bin 插件'
130
130
  UI.message "- 开始处理 #{rspec.spec.name} #{spec_version} 组件."
131
131
 
132
132
  begin
@@ -6,7 +6,7 @@ Pod::HooksManager.register('cocoapods-aomi-bin', :pre_install) do |_context, _|
6
6
  require 'cocoapods-lhj-bin/native'
7
7
 
8
8
  #pod bin update || install 不走这里
9
- if $ARGV[1] = 'update' || $ARGV[1] != 'install'
9
+ if $ARGV[1] == 'update' || $ARGV[1] == 'install'
10
10
 
11
11
  else
12
12
  # pod bin repo update 更新二进制私有源
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-aomi-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - lihaijian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-28 00:00:00.000000000 Z
11
+ date: 2021-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -109,6 +109,7 @@ files:
109
109
  - lib/cocoapods-lhj-bin/command/bin/archive.rb
110
110
  - lib/cocoapods-lhj-bin/command/bin/auto.rb
111
111
  - lib/cocoapods-lhj-bin/command/bin/code.rb
112
+ - lib/cocoapods-lhj-bin/command/bin/config/push.rb
112
113
  - lib/cocoapods-lhj-bin/command/bin/dup.rb
113
114
  - lib/cocoapods-lhj-bin/command/bin/import.rb
114
115
  - lib/cocoapods-lhj-bin/command/bin/init.rb
@@ -116,6 +117,9 @@ files:
116
117
  - lib/cocoapods-lhj-bin/command/bin/install.rb
117
118
  - lib/cocoapods-lhj-bin/command/bin/lhj.rb
118
119
  - lib/cocoapods-lhj-bin/command/bin/lib/lint.rb
120
+ - lib/cocoapods-lhj-bin/command/bin/local.rb
121
+ - lib/cocoapods-lhj-bin/command/bin/oss/del.rb
122
+ - lib/cocoapods-lhj-bin/command/bin/oss/list.rb
119
123
  - lib/cocoapods-lhj-bin/command/bin/repo/update.rb
120
124
  - lib/cocoapods-lhj-bin/command/bin/spec/create.rb
121
125
  - lib/cocoapods-lhj-bin/command/bin/spec/push.rb
@@ -134,6 +138,7 @@ files:
134
138
  - lib/cocoapods-lhj-bin/helpers/framework_builder.rb
135
139
  - lib/cocoapods-lhj-bin/helpers/library.rb
136
140
  - lib/cocoapods-lhj-bin/helpers/library_builder.rb
141
+ - lib/cocoapods-lhj-bin/helpers/oss_helper.rb
137
142
  - lib/cocoapods-lhj-bin/helpers/sources_helper.rb
138
143
  - lib/cocoapods-lhj-bin/helpers/spec_creator.rb
139
144
  - lib/cocoapods-lhj-bin/helpers/spec_files_helper.rb