Class: CheckUpdateTools

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-mPaaS/checkUpdateTools.rb

Class Method Summary collapse

Class Method Details

.checkNew(version) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cocoapods-mPaaS/checkUpdateTools.rb', line 5

def self.checkNew(version)
  # 先判断本地
  content_hash = BaselineTools.getContentFileByVersion(version)

  unless content_hash["updateTime"]
    hasNewVerison(version)
    return
  end

  # 取远程
  component_hash = BaselineTools.getComponentHashByBaseline(version, false)
  if component_hash
    component_hash["updateTime"].to_i > content_hash["updateTime"].to_i ? hasNewVerison(version) : hasNoUpdate(version, content_hash["version_code"])
  end

end

.hasNewVerison(version) ⇒ Object

对外隐藏 ?



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cocoapods-mPaaS/checkUpdateTools.rb', line 23

def self.hasNewVerison(version)
  LogTools.p_yellow Pod::MPAAS::Localization.t('mpaas.update_check.start_check')
  LogTools.p_red "The baseline #{version} has new version !"

  begin
      BaselineTools.updateContentFileByComponent(version, true, false)
  rescue => exception
      LogTools.p_red exception.to_s
  end

  LogTools.p_red ""
  LogTools.p_red "you can run 'pod mpaas update #{version}' to update it, then run 'pod install' again"
  LogTools.p_yellow Pod::MPAAS::Localization.t('mpaas.update_check.check_finished')
end

.hasNoUpdate(version, version_code) ⇒ Object



38
39
40
41
# File 'lib/cocoapods-mPaaS/checkUpdateTools.rb', line 38

def self.hasNoUpdate(version, version_code)
  last_version = version_code ? ("." + version_code.to_s) : "";
  LogTools.p_yellow "The baseline #{version}#{last_version} is the latest version ..."
end