Sha256: 78ef52bc0cff49409fcd83b041db2cc86f8c7ad9fa507ae855c0581746758b6f

Contents?: true

Size: 1.23 KB

Versions: 6

Compression:

Stored size: 1.23 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|
                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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cocoapods-jxedt-0.0.21 lib/cocoapods-jxedt/git_helper/cache_fetcher.rb
cocoapods-jxedt-0.0.20 lib/cocoapods-jxedt/git_helper/cache_fetcher.rb
cocoapods-jxedt-0.0.19 lib/cocoapods-jxedt/git_helper/cache_fetcher.rb
cocoapods-jxedt-0.0.18 lib/cocoapods-jxedt/git_helper/cache_fetcher.rb
cocoapods-jxedt-0.0.17 lib/cocoapods-jxedt/git_helper/cache_fetcher.rb
cocoapods-jxedt-0.0.16 lib/cocoapods-jxedt/git_helper/cache_fetcher.rb