Class: Pod::Downloader::Git
- Inherits:
-
Object
- Object
- Pod::Downloader::Git
- Includes:
- Config::Mixin
- Defined in:
- lib/cocoapods-archthin/downloader_arch.rb
Instance Method Summary collapse
- #debug_log(str) ⇒ Object
- #download! ⇒ Object
- #download_git_jfrog!(arch, git_file_url) ⇒ Object
- #orig_git_download! ⇒ Object
Instance Method Details
#debug_log(str) ⇒ Object
138 139 140 141 142 |
# File 'lib/cocoapods-archthin/downloader_arch.rb', line 138 def debug_log(str) if config.verbose? puts str end end |
#download! ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/cocoapods-archthin/downloader_arch.rb', line 102 def download! # puts "tag-> #{options[:tag]}" # puts "name-> #{name}" # puts "target_path-> #{target_path}" ref = [:commit] || [:tag] || [:branch] arch = ENV['arch'] ? ENV['arch'] : ENV['ARCH'] arch = arch.to_s git_file_url=url+"#{ref}" # jfrog 上存储的名字是 git 地址和ref值拼接一起,取md5值 debug_log("git_file_key_url: #{git_file_url}") if arch.empty? orig_git_download! else arch = arch.downcase if arch != 'arm64' && arch != 'armv7' && arch != 'i386' && arch != 'x86_64' && arch != '64' UI.puts "\narch=#{arch} 设置无效,目前只支持arch=arm64、arch=armv7、arch=x86_64、arch=i386、arch=64\n".yellow orig_git_download! elsif ArchThin_util::has_arch_in_jfrog(arch, git_file_url) # UI.puts "\nGit 转 jfrog 下载\n".green debug_log("Git 转 jfrog 下载") download_git_jfrog!(arch, git_file_url) else UI.puts "【Arch-thin】没有找到对应 #{arch} 架构包".yellow orig_git_download! end end end |
#download_git_jfrog!(arch, git_file_url) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/cocoapods-archthin/downloader_arch.rb', line 82 def download_git_jfrog!(arch, git_file_url) UI.puts "【Arch-thin】下载 #{arch} 架构包" #.green debug_log("原始git 地址 -> url:#{url}") debug_log("options->: #{}") # base_url = url.chomp('.git').chomp('/') # ref = options[:commit] || options[:tag] || options[:branch] #|| 'master' # download_url = "#{base_url}/archive/#{ref.to_s}.tar.gz" # puts "git download -> url:#{url}" # puts "ref -> #{ref}" download_url = ArchThin_util::arch_file_url(arch, git_file_url) debug_log("arch file: #{download_url}") ENV['arch'] = nil ENV['ARCH'] = nil Http.new(target_path, download_url, {}).download ENV['arch'] = arch end |
#orig_git_download! ⇒ Object
100 |
# File 'lib/cocoapods-archthin/downloader_arch.rb', line 100 alias_method :orig_git_download!, :download! |