Class: Pod::Tdfire::BinaryUrlManager
- Inherits:
-
Object
- Object
- Pod::Tdfire::BinaryUrlManager
- Defined in:
- lib/cocoapods-tdfire-binary/binary_url_manager.rb
Class Method Summary collapse
- .delete_binary(name, version) ⇒ Object
- .get_pull_url_for_pod_version(pod, version) ⇒ Object
- .host ⇒ Object
- .list_binary ⇒ Object
- .post_push_url(name, version, path, commit = nil, commit_hash = nil) ⇒ Object
- .private_cocoapods_url ⇒ Object
- .pull_url_for_pod_version(pod, version) ⇒ Object
- .push_url ⇒ Object
- .run_curl(command, time_out = 5) ⇒ Object
- .search_binary(name) ⇒ Object
- .template_lib_url ⇒ Object
Class Method Details
.delete_binary(name, version) ⇒ Object
27 28 29 30 |
# File 'lib/cocoapods-tdfire-binary/binary_url_manager.rb', line 27 def self.delete_binary(name, version) command = "curl -X 'DELETE' #{host}/framework/#{name}/#{version} -O -J" run_curl command end |
.get_pull_url_for_pod_version(pod, version) ⇒ Object
10 11 12 13 14 |
# File 'lib/cocoapods-tdfire-binary/binary_url_manager.rb', line 10 def self.get_pull_url_for_pod_version(pod, version) command = "curl #{pull_url_for_pod_version(pod, version)} > #{pod}.framework.zip" run_curl command, 20 end |
.host ⇒ Object
52 53 54 |
# File 'lib/cocoapods-tdfire-binary/binary_url_manager.rb', line 52 def self.host BinaryConfig.instance.server_host end |
.list_binary ⇒ Object
32 33 34 35 |
# File 'lib/cocoapods-tdfire-binary/binary_url_manager.rb', line 32 def self.list_binary() command = "curl #{host}/frameworks\?allinfo=true" run_curl command end |
.post_push_url(name, version, path, commit = nil, commit_hash = nil) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/cocoapods-tdfire-binary/binary_url_manager.rb', line 20 def self.post_push_url(name, version, path, commit = nil, commit_hash = nil) param = %Q[-F "frameworkName=#{name}" -F "version=#{version}" -F "changelog=#{commit}" -F "featureName=#{commit}" -F "framework=@#{path}" -F "commitHash=#{commit_hash}"] command = "curl #{push_url} #{param}" run_curl command, 20 end |
.private_cocoapods_url ⇒ Object
56 57 58 |
# File 'lib/cocoapods-tdfire-binary/binary_url_manager.rb', line 56 def self.private_cocoapods_url BinaryConfig.instance.repo_url end |
.pull_url_for_pod_version(pod, version) ⇒ Object
6 7 8 |
# File 'lib/cocoapods-tdfire-binary/binary_url_manager.rb', line 6 def self.pull_url_for_pod_version(pod, version) host + "/download/#{pod}/#{version}" end |
.push_url ⇒ Object
16 17 18 |
# File 'lib/cocoapods-tdfire-binary/binary_url_manager.rb', line 16 def self.push_url host + "/upload" #+ param end |
.run_curl(command, time_out = 5) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/cocoapods-tdfire-binary/binary_url_manager.rb', line 42 def self.run_curl(command, time_out = 5) Pod::UI. "CURL: \n" + command + "\n" result = `#{command} -s -m #{time_out}` raise Pod::Informative, "执行 #{command} 失败,查看网络或者 binary_config.yml 配置." if $?.exitstatus != 0 result end |
.search_binary(name) ⇒ Object
37 38 39 40 |
# File 'lib/cocoapods-tdfire-binary/binary_url_manager.rb', line 37 def self.search_binary(name) command = "curl #{host}/framework/#{name}" run_curl command end |
.template_lib_url ⇒ Object
60 61 62 |
# File 'lib/cocoapods-tdfire-binary/binary_url_manager.rb', line 60 def self.template_lib_url BinaryConfig.instance.template_url end |