Sha256: 8fa8234d54017dab34ceecf2f632b4a059f5218c2734f7ffbd62d786ccd297fa

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

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|
                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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cocoapods-jxedt-0.0.15 lib/cocoapods-jxedt/git_helper/cache_fetcher.rb
cocoapods-jxedt-0.0.14 lib/cocoapods-jxedt/git_helper/cache_fetcher.rb
cocoapods-jxedt-0.0.13 lib/cocoapods-jxedt/git_helper/cache_fetcher.rb