Class: CBin::Push::Helper

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

Instance Method Summary collapse

Methods included from SourcesHelper

#abc_source, #binary_source, #br_source, #bw_source, #code_source, #custom_business_source, #math_source, #science_source, #sources_manager, #sources_option, #sources_optionV2, #valid_sources, #valid_sourcesV2

Constructor Details

#initialize(sources = "") ⇒ Helper

Returns a new instance of Helper.



14
15
16
# File 'lib/cocoapods-bb-bin/helpers/push_spec_helper.rb', line 14

def initialize(sources="")
  @sources = sources
end

Instance Method Details

#push_binary_repo(binary_podsepc_json, isGenDylib = false) ⇒ Object

上传二进制 podspec



19
20
21
22
23
24
25
26
27
# File 'lib/cocoapods-bb-bin/helpers/push_spec_helper.rb', line 19

def push_binary_repo(binary_podsepc_json,isGenDylib=false)
  if @sources.nil? || @sources.empty?
    customsource = binary_source
  else
    customsource = custom_business_source(@sources)
  end
  puts "binary customsource=#{customsource}"
  push_customsource_repo(binary_podsepc_json, customsource, isGenDylib, true)
end

#push_customsource_repo(source_podsepc_json, customsource = code_source, isGenDylib = false, isBinary = false) ⇒ Object

上传自定义源podspec



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/cocoapods-bb-bin/helpers/push_spec_helper.rb', line 41

def push_customsource_repo(source_podsepc_json, customsource=code_source, isGenDylib=false, isBinary=false)
  argvs = [
    "#{customsource.name}",  # repo
    "#{source_podsepc_json}", # spec
    "--sources=#{customsource},https:\/\/cdn.cocoapods.org",
    "--skip-import-validation",
    "--use-libraries",
    "--allow-warnings",
    "--verbose",
    "--code-dependencies",
    '--no-cocoapods-validator', #不采用cocoapods验证
  ]
  if @verbose
    argvs += ['--verbose']
  end
  if isGenDylib # 生成动态库
    argvs += ['--dylib']
  end
  if isBinary # 是否二进制
    argvs += ['--binary']
    Pod::UI.message "上传【二进制】argvs: #{argvs}"
  else
    Pod::UI.message "上传【源码】argvs: #{argvs}"
  end
  push = Pod::Command::Bin::Repo::Push.new(CLAide::ARGV.new(argvs))
  push.validate!
  push.run
end

#push_source_repo(source_podsepc_json) ⇒ Object

上传源码podspec



30
31
32
33
34
35
36
37
38
# File 'lib/cocoapods-bb-bin/helpers/push_spec_helper.rb', line 30

def push_source_repo(source_podsepc_json)
  if @sources.nil? || @sources.empty?
    customsource = code_source
  else
    customsource = custom_business_source(@sources)
  end
  puts "source customsource=#{customsource}"
  push_customsource_repo(source_podsepc_json, customsource, false, false)
end