module Jxedt module CacheFetcher def self.fetch require_relative 'git_command' repo = Jxedt.config.git_remote_repo cache_path = Jxedt.config.git_cache_path branch = Jxedt.config.cache_branch commander = Jxedt::GitCommand.new(cache_path) commander.git_fetch(repo, branch) end def self.sync(binary_hash, to_dir) # fetch fetch require_relative 'zip' cache_dir = Pathname.new(Jxedt.config.git_cache_path) + "GeneratedFrameworks" to_dir = Pathname.new(to_dir) binary_hash.each do |name, checksum| next if checksum.nil? zip_file = cache_dir + name + "#{checksum}.zip" next unless zip_file.exist? file_path = to_dir + name + "#{checksum}.checksum" next if file_path.exist? # 存在同校验和的文件,跳过 file_path.parent.rmtree if file_path.parent.exist? Jxedt::ZipUtils.unzip(zip_file, :to_dir => to_dir) Pod::UI.puts "✅ 已从缓存下载组件#{name}, 校验和:#{checksum}".yellow end end end end