Class: CBin::BuildAll::BinHelper

Inherits:
Object
  • Object
show all
Includes:
Pod
Defined in:
lib/cocoapods-mtxx-bin/helpers/buildAll/bin_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Pod

match_version?

Constructor Details

#initializeBinHelper

Returns a new instance of BinHelper.



8
9
10
11
# File 'lib/cocoapods-mtxx-bin/helpers/buildAll/bin_helper.rb', line 8

def initialize
  super
  @specs_str_md5_hash = Hash.new
end

Class Method Details

.configurationObject



48
49
50
# File 'lib/cocoapods-mtxx-bin/helpers/buildAll/bin_helper.rb', line 48

def self.configuration
  Pod::Config.instance.podfile.configuration
end

.xcode_versionObject



43
44
45
46
# File 'lib/cocoapods-mtxx-bin/helpers/buildAll/bin_helper.rb', line 43

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

Instance Method Details

#configurationObject



37
38
39
40
41
# File 'lib/cocoapods-mtxx-bin/helpers/buildAll/bin_helper.rb', line 37

def configuration
  @configuration ||= begin
                       Pod::Config.instance.podfile.configuration
                     end
end

#version(pod_name, original_version, specifications) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cocoapods-mtxx-bin/helpers/buildAll/bin_helper.rb', line 14

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 << configuration
    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

#xcode_versionObject



31
32
33
34
35
# File 'lib/cocoapods-mtxx-bin/helpers/buildAll/bin_helper.rb', line 31

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