Class: CBin::Upload::Helper
- Inherits:
-
Object
- Object
- CBin::Upload::Helper
- Includes:
- SourcesHelper
- Defined in:
- lib/cocoapods-mtxx-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.
-
#push_binary_repo(binary_podsepc_json) ⇒ Object
上传二进制 podspec.
-
#spec_creator ⇒ Object
创建二进制podspec.
-
#upload ⇒ Object
创建binary-template.podsepc 上传二进制文件 上传二进制 podspec.
Methods included from SourcesHelper
#binary_source, #code_source_list, #sources_manager, #sources_option, #valid_sources
Constructor Details
#initialize(spec, code_dependencies, sources) ⇒ Helper
Returns a new instance of Helper.
19 20 21 22 23 |
# File 'lib/cocoapods-mtxx-bin/helpers/upload_helper.rb', line 19 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”
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/cocoapods-mtxx-bin/helpers/upload_helper.rb', line 55 def curl_zip # output_name = File.join(CBin::Config::Builder.instance.zip_dir, CBin::Config::Builder.instance.framework_name_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 Pod::UI.title "Uploading binary zip file #{@spec.name} (#{@spec.version})" do command = "curl -F \"name=#{@spec.module_name}\" -F \"version=#{@spec.version}\" -F \"file=@#{zip_file}\" #{CBin.config.binary_upload_url_str}" Pod::UI.info "#{command}" json = `#{command}` Pod::UI.info json error_code = JSON.parse(json)["error_code"] if error_code == 0 Pod::UI.info "#{@spec.name} (#{@spec.version}) 上传成功".green else Pod::UI.info "#{@spec.name} (#{@spec.version}) 上传失败".red raise Informative, "#{@spec.name} (#{@spec.version}) 上传失败" end end end res end |
#push_binary_repo(binary_podsepc_json) ⇒ Object
上传二进制 podspec
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/cocoapods-mtxx-bin/helpers/upload_helper.rb', line 82 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
创建二进制podspec
43 44 45 46 47 48 49 50 51 |
# File 'lib/cocoapods-mtxx-bin/helpers/upload_helper.rb', line 43 def spec_creator spec_creator = CBin::SpecificationSource::Creator.new(@spec) # 创建二进制podspec spec_creator.create # 将二进制podspec写入文件 spec_creator.write_spec_file # 返回二进制podspec文件路径 spec_creator.filename end |
#upload ⇒ Object
创建binary-template.podsepc 上传二进制文件 上传二进制 podspec
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cocoapods-mtxx-bin/helpers/upload_helper.rb', line 28 def upload Dir.chdir(CBin::Config::Builder.instance.root_dir) do # 上传zip包 res_zip = curl_zip if res_zip # 创建二进制podspec filename = spec_creator # 上传二进制 podspec push_binary_repo(filename) end res_zip end end |