Sha256: 8b4ca9220adb919c7efd4de1ed2c5005e70da6e08a494cb7265b2ca4537ab59e

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

require 'digest'

module CBin
  module BuildAll
    class BinHelper
      include Pod

      def initialize
        super
        @specs_str_md5_hash = Hash.new
      end

      # 二进制版本号(x.y.z.bin[md5前6位])
      def version(pod_name, original_version, specifications)
        # 有缓存从缓存中取,没有则新建
        if @specs_str_md5_hash[pod_name].nil?
          specs = specifications.map(&:name).select { |spec|
            spec.include?(pod_name) && !spec.include?('/Binary')
          }.sort!
          specs << xcode_version
          specs_str = specs.join('')
          specs_str_md5 = Digest::MD5.hexdigest(specs_str)[0,6]
          @specs_str_md5_hash[pod_name] = specs_str_md5
        else
          specs_str_md5 = @specs_str_md5_hash[pod_name]
        end
        "#{original_version}.bin#{specs_str_md5}"
      end

      def xcode_version
        @xcode_version ||= begin
                             `xcodebuild -version`.split(' ').join('')
                           end
      end
      
      def self.xcode_version
          xcode_version = `xcodebuild -version`.split(' ').join('')
          xcode_version
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cocoapods-mtxx-bin-0.0.13 lib/cocoapods-mtxx-bin/helpers/buildAll/bin_helper.rb
cocoapods-mtxx-bin-0.0.12 lib/cocoapods-mtxx-bin/helpers/buildAll/bin_helper.rb
cocoapods-mtxx-bin-0.0.10 lib/cocoapods-mtxx-bin/helpers/buildAll/bin_helper.rb