Sha256: 2afad71f933da6026f940fff517a62954041eac890638e17ca0caa06ab3ec1a6

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

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

1 entries across 1 versions & 1 rubygems

Version Path
cocoapods-jxedt-0.0.13 lib/cocoapods-jxedt/binary/hooks/post_install.rb