class Furion

Public Class Methods

checkUpdate() click to toggle source
# File lib/furion.rb, line 101
def self.checkUpdate
  FurionVersion.checkUpdate
end
detectConflict() click to toggle source
# File lib/furion.rb, line 76
def self.detectConflict
    ConflictDetector.detectConflict
end
fetchFile(fileName) click to toggle source
# File lib/furion.rb, line 14
def self.fetchFile(fileName)
    uri = "https://git.huya.com/chenguohao2/FurionTemplateResource/raw/master/iOS/"+fileName
    puts "download from "+uri
    data = open(uri){|f| f.read}
    file = File.new fileName, 'w+'
    file.binmode
    file << data
    file.flush
    file.close
end
genProj(name) click to toggle source
# File lib/furion.rb, line 80
def self.genProj(name)
  fileName = "FurionExample.zip"
  self.fetchFile(fileName)
  system("unzip", fileName)
  File.delete(fileName)
  ProjectGenerater.setupProject("FurionExample",name)
  FileUtils.rm_rf("FurionExample")
end
makeConfig() click to toggle source
# File lib/furion.rb, line 25
def self.makeConfig
    self.fetchFile("GenConfig.py")
    self.fetchFile("furionpod")
    self.fetchFile("example.code")
    result = `python GenConfig.py `
    File.write('data.json', result)
    `plutil -convert xml1 data.json -o MTPSDK.plist`
    if !(File.exist?'MTPSDK.plist')
      puts "error in Config Generation: "+result
    end

    FileEditor.editPodfile

    File.delete('GenConfig.py')
    File.delete('data.json')
    FileEditor.insertExampleCode
    File.delete('example.code')
    puts "pod installing..."
    `pod install`
    projName = FileEditor.getCuriOSProjName
    puts "Config finished, run "+projName+".xcworkspace to continue "
end
runCMD() click to toggle source
# File lib/furion.rb, line 90
def self.runCMD
      cmd = ARGV[0]
      if cmd == "init"
        makeConfig
      end

      if cmd == "create"
        puts "to be continue"
      end
end
updateConfig() click to toggle source
# File lib/furion.rb, line 48
def self.updateConfig

      if !(File.exist?'MTPSDK.plist')
        puts "MTPSDK.plist not exist "
        return
      end

      self.fetchFile("GenConfig.py")
      sdkWrapperDict = Plist::parse_xml("MTPSDK.plist")
      jsonObj = sdkWrapperDict.to_json
      fJson = File.open("cachedConfig.json","w")
      fJson.write(jsonObj)
      fJson.close
      result = `python GenConfig.py update`
      File.write('data.json', result)
      `plutil -convert xml1 data.json -o MTPSDK.plist`
      if !(File.exist?'MTPSDK.plist')
        puts "error in Config Generation: "+result
      end
      puts "pod installing..."
      `pod install`
      File.delete('GenConfig.py')
      File.delete('data.json')
      File.delete("cachedConfig.json")
      projName = FileEditor.getCuriOSProjName
      puts "Config finished, run "+projName+".xcworkspace to continue "
end