iOS webp使用及Pod hook

Podfile 部分内容:

$:.unshift __dir__
require 'Podfile_Hook.rb'
#公有库
source 'https://github.com/CocoaPods/Specs.git'
def githubRepo
    pod 'SDWebImage', '4.4.2'
    pod 'SDWebImage/WebP'
    Pod::UI.puts '公有库集成'
end

Podfile_Hook.rb文件内容:

#hook installer
class Pod::Installer

    def create_pod_installer_hbc(pod_name)
      
      if ((pod_name <=> 'libwebp') == 0)
          libwebp_pod_target = nil
          pod_targets.each do |pod_target|
            if ((pod_target.root_spec.name <=> 'libwebp') == 0)
                libwebp_pod_target = pod_target
                customSource = { :git => 'https://github.com/webmproject/libwebp.git', :tag => 'v0.6.1' }
                libwebp_pod_target.root_spec.source = customSource
            end
          end
      end
      create_pod_installer_Orig(pod_name)
    end

    alias_method :create_pod_installer_Orig, :create_pod_installer
    alias_method :create_pod_installer, :create_pod_installer_hbc

end

你可能感兴趣的:(iOS webp使用及Pod hook)