class Escalator::Setup

Attributes

command[RW]
config_data[RW]
cover_data[RW]

Public Class Methods

run(command) click to toggle source
# File lib/escalator/setup.rb, line 7
def run command
  @command = command
  if command.set_zshcompletion
    pluginPath = File.expand_path "../../../resources/zsh_plugin/escalator", __FILE__
    FileUtils.cp_r pluginPath, command.custom_plugins
    return
  end
  prepareContext
  exportPlist
end

Private Class Methods

exportPlist() click to toggle source
# File lib/escalator/setup.rb, line 62
def exportPlist
  configPlist = CFPropertyList::List.new
  configPlist.format = CFPropertyList::List::FORMAT_XML
  configPlist.value = CFPropertyList.guess config_data
  configPlist.save command.output_path + "/ConfigInfo.plist"
  if command.commands.include? "resign"
    coverPlist = CFPropertyList::List.new
    coverPlist.format = CFPropertyList::List::FORMAT_XML
    coverPlist.value = CFPropertyList.guess cover_data
    coverPlist.save command.output_path + "/CoverInfo.plist"
  end
end
prepareContext() click to toggle source
# File lib/escalator/setup.rb, line 26
def prepareContext
  @config_data = Hash.new
  @cover_data  = Hash.new
  if command.commands.include? "confuse"
    config_data["keywords"] = ["混淆词1", "混淆词2"]
  end
  if command.commands.include? "archive"
    config_data["method"] = "app-store 或者 ad-hoc"
  end
  if command.commands.include? "resign"
    config_data["key_id"] = "AppStore Connect 拷贝"
    config_data["issuer_id"] = "AppStore Connect 拷贝"
    config_data["keyfile_path"] = "AppStore Connect 下载的 .p8 文件的绝对路径"
    config_data["user_password"] = "当前电脑用户密码"
    config_data["CFBundleIdentifier"] = "新的唯一标识符"
    config_data["CFBundleShortVersionString"] = "版本号"
    config_data["CFBundleVersion"] = "初始 Build 号"
    config_data["apple_id"] = "可缺省: 对应的苹果开发者账户, 如果含有 APP GROUP 推荐添加此字段"
    config_data["CFBundleName"] = "可缺省: 新包名"
    config_data["CFBundleExecutable"] = "可缺省: 新的二进制名"
    config_data["CFBundleDisplayName"] = "可缺省: 新的 APP 名称"
    config_data["iconAssets_path"] = "可缺省: 包含新 AppIcon 的 .xcassets 文件的绝对路径"

    cover_data["CFBundleVersion"] = "可缺省: 覆盖全局配置中的 Build 号规则"
    cover_data["CFBundleName"] = "可缺省: 覆盖全局配置中的 新包名"
    cover_data["CFBundleExecutable"] = "可缺省: 覆盖全局配置中的 新的二进制名"
    cover_data["CFBundleDisplayName"] = "可缺省: 覆盖全局配置中的 新的 APP 名称"
  end
  if command.commands.include? "upload"
    config_data["key_id"] = "AppStore Connect 拷贝"
    config_data["issuer_id"] = "AppStore Connect 拷贝"
    config_data["keyfile_path"] = "AppStore Connect 下载的 .p8 文件的绝对路径"
    config_data["CFBundleIdentifier"] = "新的唯一标识符"
  end
end