Class: GM::SpecificationInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-byte-csjm/gm.rb

Overview

对应cocoapods 的Specification

Constant Summary collapse

@@possibilities =
{}

Class Method Summary collapse

Class Method Details

.get_a_specfication(name, version) ⇒ Object



320
321
322
323
324
325
# File 'lib/cocoapods-byte-csjm/gm.rb', line 320

def self.get_a_specfication(name, version)
  result =  @@possibilities[name].find { |specification|
    specification.version.version == version
  }
  result
end

.get_infoObject



316
317
318
# File 'lib/cocoapods-byte-csjm/gm.rb', line 316

def self.get_info()
    @@possibilities
end

.get_specfication(info_list = []) ⇒ Object



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/cocoapods-byte-csjm/gm.rb', line 327

def self.get_specfication(info_list = [])

  ##请注意, 这里可能获取不到对应的Specfication 实例, 此时需要报错并提示媒体使用pod update
  result =  info_list.map{|info|
    info['is_find'] = false
    adapter_name = GM::Adn_Adapter.get_adapter_from_adn_abbreviation info["adn_name"]
    @@possibilities[adapter_name].find { |specification|
      info['is_find'] = true if specification.version.version == info["adn_adapter_version"]
      specification.version.version == info["adn_adapter_version"]
    }
  }.flatten
  unfind_list = info_list.select{ |info|
    info['is_find'] == false
  }
  if unfind_list.size > 0
    ins  = get_info
    str = "adapters("
    unfind_list.each {|item|
      str << GM::Adn_Adapter.get_adapter_from_adn_abbreviation(info["item"]) + "->" + item["adn_adapter_version"]+ " "
    }
    str << ")"
    raise "CSJM error: #{str} 版本未找到,请执行 `pod update --verbose`"
  end
    result
end

.update(name = '', possibilities) ⇒ Object



309
310
311
312
313
314
# File 'lib/cocoapods-byte-csjm/gm.rb', line 309

def self.update(name = '', possibilities)
    if name.length > 0
        @@possibilities[name] ||= []
        @@possibilities[name] = @@possibilities[name] | possibilities
    end
end