Class: CBin::Upload::Helper

Inherits:
Object
  • Object
show all
Includes:
SourcesHelper
Defined in:
lib/cocoapods-bb-bin/helpers/upload_helper.rb

Instance Method Summary collapse

Methods included from SourcesHelper

#binary_source, #code_source, #sources_manager, #sources_option, #sources_optionV2, #valid_sources, #valid_sourcesV2

Constructor Details

#initialize(spec, code_dependencies, sources, pushsourcespec = false) ⇒ Helper

Returns a new instance of Helper.



18
19
20
21
22
23
# File 'lib/cocoapods-bb-bin/helpers/upload_helper.rb', line 18

def initialize(spec,code_dependencies,sources, pushsourcespec = false)
  @spec = spec
  @code_dependencies = code_dependencies
  @sources = sources
  @pushsourcespec = pushsourcespec # 推送源码
end

Instance Method Details

#upload(isGenDylib = false) ⇒ Object



25
26
27
28
29
# File 'lib/cocoapods-bb-bin/helpers/upload_helper.rb', line 25

def upload(isGenDylib=false)
  Dir.chdir(CBin::Config::Builder.instance.root_dir) do
    return upload_binary_file(own_source_binary_file, isGenDylib, @spec.name)
  end
end

#upload_binary_file(zip_file, isGenDylib = false, vendored_framework_name = nil) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/cocoapods-bb-bin/helpers/upload_helper.rb', line 31

def upload_binary_file(zip_file, isGenDylib=false, vendored_framework_name=nil)
  Dir.chdir(CBin::Config::Builder.instance.root_dir) do
    # 创建binary-template.podsepc
    # 上传二进制文件
    # 上传二进制 podspec
    puts "开始准备上传二进制文件 zip:#{zip_file}".yellow
    isupload = binary_upload(zip_file)
    puts "上传二进制文件完成 状态:#{isupload}".green
    if isupload
      is_xcframework = false
      [
        "xcframework.zip", # 三方库
        "xcframework_#{@spec.version}.zip", # 自有库
      ].each do |name|
        is_xcframework = zip_file.include?(name)
        if is_xcframework == true
          break
        end
      end
      # is_xcframework = zip_file.include?('xcframework.zip')
      filename = spec_creator(vendored_framework_name, is_xcframework)
      Pod::UI.puts "上传二进制 podspec: #{filename} zip:#{zip_file} 是否动态库: #{isGenDylib} vendored_framework_name:#{vendored_framework_name} is_xcframework:#{is_xcframework}"
      push_helper = CBin::Push::Helper.new()
      push_helper.push_binary_repo(filename,isGenDylib)
      # 上传源码 podspec
      if @pushsourcespec
        Pod::UI.puts "上传源码 podspec: #{@spec_creator.sourceSpecFilePath}"
        push_helper.push_source_repo(@spec_creator.sourceSpecFilePath)
      end
    end
    isupload
  end
end