Class: CBin::Upload::Helper
- Inherits:
-
Object
- Object
- CBin::Upload::Helper
- Includes:
- SourcesHelper
- Defined in:
- lib/cocoapods-lhj-bin/helpers/upload_helper.rb
Instance Method Summary collapse
-
#curl_zip ⇒ Object
推送二进制 curl 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”.
-
#initialize(spec, code_dependencies, sources) ⇒ Helper
constructor
A new instance of Helper.
-
#oss_zip ⇒ Object
oss上传.
-
#push_binary_repo(binary_podsepc_json) ⇒ Object
上传二进制 podspec.
- #spec_creator ⇒ Object
- #upload ⇒ Object
Methods included from SourcesHelper
#binary_source, #code_source, #sources_manager, #sources_option, #valid_sources
Constructor Details
#initialize(spec, code_dependencies, sources) ⇒ Helper
Returns a new instance of Helper.
16 17 18 19 20 |
# File 'lib/cocoapods-lhj-bin/helpers/upload_helper.rb', line 16 def initialize(spec, code_dependencies,sources) @spec = spec @code_dependencies = code_dependencies @sources = sources end |
Instance Method Details
#curl_zip ⇒ Object
推送二进制curl 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”
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/cocoapods-lhj-bin/helpers/upload_helper.rb', line 45 def curl_zip zip_file = "#{CBin::Config::Builder.instance.library_file(@spec)}.zip" res = File.exist?(zip_file) unless res zip_file = CBin::Config::Builder.instance.framework_zip_file(@spec) + ".zip" res = File.exist?(zip_file) end if res 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}\"" print " \u4E0A\u4F20\u4E8C\u8FDB\u5236\u6587\u4EF6\n \#{command}\n" upload_result = `#{command}` puts "#{upload_result}" end res end |
#oss_zip ⇒ Object
oss上传
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/cocoapods-lhj-bin/helpers/upload_helper.rb', line 66 def oss_zip zip_file = "#{CBin::Config::Builder.instance.library_file(@spec)}.zip" res = File.exist?(zip_file) unless res zip_file = CBin::Config::Builder.instance.framework_zip_file(@spec) + ".zip" res = File.exist?(zip_file) end if res CBin::OSS::Helper.instance.upload("#{@spec.name}/#{@spec.version}/#{@spec.name}.zip", zip_file) end res end |
#push_binary_repo(binary_podsepc_json) ⇒ Object
上传二进制 podspec
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/cocoapods-lhj-bin/helpers/upload_helper.rb', line 81 def push_binary_repo(binary_podsepc_json) argvs = [ "#{binary_podsepc_json}", "--binary", "--sources=#{sources_option(@code_dependencies, @sources)},https:\/\/cdn.cocoapods.org", "--skip-import-validation", "--use-libraries", "--allow-warnings", "--verbose", "--code-dependencies" ] if @verbose argvs += ['--verbose'] end push = Pod::Command::Bin::Repo::Push.new(CLAide::ARGV.new(argvs)) push.validate! push.run end |
#spec_creator ⇒ Object
36 37 38 39 40 41 |
# File 'lib/cocoapods-lhj-bin/helpers/upload_helper.rb', line 36 def spec_creator spec_creator = CBin::SpecificationSource::Creator.new(@spec) spec_creator.create spec_creator.write_spec_file spec_creator.filename end |
#upload ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/cocoapods-lhj-bin/helpers/upload_helper.rb', line 22 def upload Dir.chdir(CBin::Config::Builder.instance.root_dir) do # 创建binary-template.podsepc # 上传二进制文件 # 上传二进制 podspec res_zip = oss_zip if res_zip filename = spec_creator push_binary_repo(filename) end res_zip end end |