# copy from https://github.com/CocoaPods/cocoapods-packager require 'cocoapods-tdf-bin/native/podfile' require 'cocoapods/command/gen' require 'cocoapods/generate' require 'cocoapods-tdf-bin/helpers/framework_builder' require 'cocoapods-tdf-bin/helpers/library_builder' require 'cocoapods-tdf-bin/helpers/sources_helper' require 'cocoapods-tdf-bin/helpers/spec_source_creator' require 'cocoapods-tdf-bin/command/bin/spec/push' module CBin class Upload class Helper include CBin::SourcesHelper def initialize(spec,code_dependencies,sources) @spec = spec @code_dependencies = code_dependencies @sources = sources end def upload Dir.chdir(CBin::Config::Builder.instance.root_dir) do # 创建binary-template.podsepc # 上传二进制文件 # 上传二进制 podspec res_framework = curl_framework if res_framework filename = spec_creator push_binary_repo(filename) end res_framework end end def spec_creator spec_creator = CBin::SpecificationSource::Creator.new(@spec) spec_creator.create spec_creator.write_spec_file spec_creator.filename end #推送二进制 # curl http://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" def curl_framework zip_file = "#{CBin::Config::Builder.instance.zip_dir}/#{@spec.name}.xcframework.zip" res = File.exist?(zip_file) if res command = "curl #{CBin.config.bin_upload_url} -F \"frameworkName=#{@spec.name}\" -F \"version=#{@spec.version}\" -F \"changelog=#{@spec.name}_#{@spec.version}_log\" -F \"framework=@#{zip_file}\"" print <