Class: CBin::Upload::Helper
- Inherits:
-
Object
- Object
- CBin::Upload::Helper
- Includes:
- SourcesHelper
- Defined in:
- lib/cocoapods-fy-bin/helpers/upload_helper.rb
Instance Method Summary collapse
-
#curl_zip ⇒ Object
推送二进制.
-
#del_zip ⇒ Object
如果存在相同的版本号先删除组件二进制.
-
#initialize(spec, code_dependencies, sources) ⇒ Helper
constructor
A new instance of Helper.
-
#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.
19 20 21 22 23 24 |
# File 'lib/cocoapods-fy-bin/helpers/upload_helper.rb', line 19 def initialize(spec,code_dependencies,sources) @spec = spec @code_dependencies = code_dependencies @sources = sources @remote_helper = CBin::Remote::Helper.new end |
Instance Method Details
#curl_zip ⇒ Object
推送二进制
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/cocoapods-fy-bin/helpers/upload_helper.rb', line 63 def curl_zip zip_file = CBin::Config::Builder.instance.framework_zip_file(@spec) res = File.exist?(zip_file) if res print <<EOF 上传二进制文件 #{@spec.name} #{@spec.version} #{CBin.config.configuration_env} EOF @remote_helper.upload(@spec.name, @spec.version, CBin.config.configuration_env, zip_file) if res end res end |
#del_zip ⇒ Object
如果存在相同的版本号先删除组件二进制
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/cocoapods-fy-bin/helpers/upload_helper.rb', line 49 def del_zip print <<EOF 删除已上传的二进制文件 #{@spec.name} #{@spec.version} #{CBin.config.configuration_env} EOF result = @remote_helper.exist?(@spec.name, @spec.version, CBin.config.configuration_env) if result print <<EOF 删除中 EOF @remote_helper.delete(@spec.name, @spec.version, CBin.config.configuration_env) end end |
#push_binary_repo(binary_podsepc_json) ⇒ Object
上传二进制 podspec
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/cocoapods-fy-bin/helpers/upload_helper.rb', line 78 def push_binary_repo(binary_podsepc_json) argvs = [ "#{binary_podsepc_json}", "--binary", "--sources=#{sources_option(@code_dependencies, @sources)}", "--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
41 42 43 44 45 46 |
# File 'lib/cocoapods-fy-bin/helpers/upload_helper.rb', line 41 def spec_creator spec_creator = CBin::SpecificationSource::Creator.new(@spec) spec_creator.create spec_creator.write_spec_file spec_creator.filename end |
#upload ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/cocoapods-fy-bin/helpers/upload_helper.rb', line 26 def upload del_zip Dir.chdir(CBin::Config::Builder.instance.root_dir) do # 创建binary-template.podsepc # 上传二进制文件 # 上传二进制 podspec res_zip = curl_zip if res_zip filename = spec_creator push_binary_repo(filename) end res_zip end end |