Sha256: e718cd2ca6b2a96d5bc99eb0cc4004cd6e6ad1192cee2dd572af706f14304171

Contents?: true

Size: 1.47 KB

Versions: 3

Compression:

Stored size: 1.47 KB

Contents

module Jxedt
    class PostInstall
        def initialize(installer_context)
            @installer_context = installer_context
        end

        def run
            # check binary switch
            return unless Jxedt.config.binary_switch?
            
            require_relative '../helper/prebuild_sandbox'

            # :post_install过程校验两次`pod install`的值
            validate_pod_checksum unless @installer_context.sandbox.is_a?(Pod::PrebuildSandbox)
        end

        def validate_pod_checksum            
            original_installer = ObjectSpace.each_object(Pod::Installer).reject {|installer| installer.sandbox.is_a?(Pod::PrebuildSandbox) }.first
            return if original_installer.nil?

            check_result = original_installer.lockfile == @installer_context.sandbox.source_lockfile
            unless check_result
                validation_failed = []
                lockfile = original_installer.lockfile
                source_lockfile = @installer_context.sandbox.source_lockfile
                lockfile.internal_data["SPEC CHECKSUMS"].each_key { |name| 
                    value1 = lockfile.spec_checksums_hash_key(name)
                    value2 = source_lockfile.spec_checksums_hash_key(name)
                    validation_failed << name if value1.nil? || value2.nil? || value1 != value2
                }
                Pod::UI.warn "Lockfile文件校验失败,请检查Pod组件: #{validation_failed}"
            end
        end
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cocoapods-jxedt-0.0.12 lib/cocoapods-jxedt/binary/hooks/post_install.rb
cocoapods-jxedt-0.0.10 lib/cocoapods-jxedt/binary/hooks/post_install.rb
cocoapods-jxedt-0.0.9 lib/cocoapods-jxedt/binary/hooks/post_install.rb