def printInfo(): gamesFolderPath = config.getFMCGamesFolderPath() games = config.getFMCGames() numberOfGames = len(games) utils.openPar("SHIPPER - The script will ship via fastlane in " + str(numberOfGames) + " games" + "\nProjects path: " + gamesFolderPath)
def launchUnityForAllGames(askForEachProject): if not utils.readYesNo("The script will launch the next game when you close the previous. Continue?", True): return for g in config.getFMCGames(): if not askForEachProject or utils.readYesNo("Open " + g.internalGameName + "?", True): g.launchUnity(None, True)
def printInfo(): gamesFolderPath = config.getFMCGamesFolderPath() numberOfGames = len(config.getFMCGames()) utils.openPar("PROJECT BUILDER - this script will build " + str(numberOfGames) + " games" + "\nProjects path: " + gamesFolderPath + "\nNOTE:this might take a long time!") utils.waitForEnterKey()
def pullAll(): games = config.getFMCGames() numberOfGames = len(games) gamesWithFilesToCommit = Game.getGamesWithFilesToCommit(False, False) if len(gamesWithFilesToCommit) > 0: print( "WARNING - the following games have files to commit! You can use 'status' to check them:" ) for g in gamesWithFilesToCommit: print(g.gamePath) if not utils.readYesNo( "Do you want to proceed? All games will be resetted!", True): return gameNumber = 1 for g in games: utils.openPar("(" + str(gameNumber) + "/" + str(numberOfGames) + ") UPDATING: " + g.gamePath) pull(g, False) utils.closePar("SUCCESSFULLY UPDATED: " + g.gamePath) utils.printWhiteLines(2) gameNumber += 1 utils.closePar("FINISHED")
def getGamesWithFilesToCommit(showWhich, showNothingToCommitMessage): games = [] utils.printWhiteLines(1) for g in config.getFMCGames(): hasFiles = g.hasFilesToCommit(showWhich, showNothingToCommitMessage) if hasFiles: games.append(g); if showWhich: utils.printWhiteLines(1) return games
def fillAllIOSTestInfo(): games = config.getFMCGames() numberOfGames = len(games) gameNumber = 1 for game in games: #for each game in the fmc folder utils.openPar("(" + str(gameNumber) + "/" + str(numberOfGames) + ") FILLING TESTFLIGHT TEST INFO FOR : " + game.gamePath) fillIOSTestInfo(game) gameNumber += 1 utils.printWhiteLines(2)
def checkAllIOS(): games = config.getFMCGames() numberOfGames = len(games) gameNumber = 1 for game in games: #for each game in the fmc folder utils.openPar("(" + str(gameNumber) + "/" + str(numberOfGames) + ") CHECKING APP STORE FOR: " + game.gamePath) checkIOS(game) gameNumber += 1 utils.printWhiteLines(2)
def updateAllIOSTesters(): games = config.getFMCGames() numberOfGames = len(games) gameNumber = 1 for game in games: #for each game in the fmc folder utils.openPar("(" + str(gameNumber) + "/" + str(numberOfGames) + ") UPDATING TESTERS: " + game.gamePath) updateIOSTesters(game, shipOnAndroid, shipOnIOS) gameNumber += 1 utils.printWhiteLines(2)
def shipAll(shipOnAndroid, shipOnIOS): games = config.getFMCGames() numberOfGames = len(games) gameNumber = 1 for game in games: #for each game in the fmc folder utils.openPar("(" + str(gameNumber) + "/" + str(numberOfGames) + ") SHIPPING: " + game.gamePath) ship(game, shipOnAndroid, shipOnIOS) gameNumber += 1 utils.printWhiteLines(2)
def printInfo(): fmcRepoURL = config.getFMCRepoURL() gamesFolderPath = config.getFMCGamesFolderPath() numberOfGames = len(config.getFMCGames()) utils.openPar( "FRAMEWORK PULL - The script will pull the fmc subtree in " + str(numberOfGames) + " games" + "\nProjects path: " + gamesFolderPath + "\nFramework repo: " + fmcRepoURL + "\nNOTE:The script is going to git reset hard every project!")
def pick(allowNone, noneMessage = "None"): games = config.getFMCGames() game = None if allowNone: print(f"0 - [{noneMessage}]") i = 1; for g in games: print(str(i) + " - " + g.internalGameName) i += 1 utils.printWhiteLines(1) projectNumber = -1 min = 0 if allowNone else 1 while projectNumber < min or projectNumber > i-1: projectNumber = utils.readIntInRange("Insert the project number:", min, i-1) if projectNumber > 0: game = games[projectNumber-1] return game
def buildAll(buildAndroid, buildIOS): printInfo() games = config.getFMCGames() numberOfGames = len(games) errorsOccured = False gameNumber = 1 for game in games: #for each project in the fmc folder utils.openPar("(" + str(gameNumber) + "/" + str(numberOfGames) + ") BUILDING: " + game.gamePath) errorsOccured = errorsOccured or build(game, buildAndroid, buildIOS) gameNumber += 1 utils.printWhiteLines(1) if errorsOccured: utils.closePar("COMPLETED WITH ERRORS") else: utils.closePar("FINISHED")
def printInfo(): games = config.getFMCGames() numberOfGames = len(games) utils.openPar("ANDROID SIGNER - The script, if needed, will create a keystore file in " + str(numberOfGames) + " games" + "\nProjects path: " + gamesFolderPath)
def signAll(): games = config.getFMCGames() numberOfGames = len(games) gameNumber = 1 for g in games:#for each game in the fmc folder sign(g)
def reactToCommand(command): commandList = utils.parList(command) targetedGame = config.getTargetGame() games = config.getFMCGames() firstCommand = commandList[0]; secondCommand = None if len(commandList) > 1: secondCommand = commandList[1]; #Since platforms are useful for more commands, let's check them here targetAndroid = False targetIOS = False if "android" in commandList: targetAndroid = True if "ios" in commandList: targetIOS = True if not (targetAndroid or targetIOS): targetAndroid = True targetIOS = True if command == "info": printInfo() elif firstCommand == "create": gameName = "" if secondCommand is not None: gameName = secondCommand creator.createNewProject(gameName) elif firstCommand == "untarget": targeter.untarget() else: #if here, we are working on existing games #trying to find the targeted game toTarget = targetedGame if secondCommand is not None: if secondCommand != "" and secondCommand != "all" and not Game.isValidGame(secondCommand): for g in games: if g.internalGameName.startswith(secondCommand) and utils.readYesNo("Did you mean " + g.internalGameName + "?", True): secondCommand = g.internalGameName break if Game.isValidGame(secondCommand): toTarget = Game.fromInternalName(secondCommand) if firstCommand == "target": if toTarget is not None: targeter.target(secondCommand) else: targeter.target(None) elif firstCommand == "unity": if "all" in commandList: Game.launchUnityForAllGames("ask" in commandList) else: if toTarget is None: toTarget = Game.pick(True, "All") if toTarget is None: Game.launchUnityForAllGames("ask" in commandList) #The user selected "All" else: toTarget.launchUnity(None, False) elif firstCommand == "status": if toTarget is not None and secondCommand != "all": toTarget.hasFilesToCommit(True,True) else: gamesWithFilesToCommit = Game.getGamesWithFilesToCommit(True,False) if len(gamesWithFilesToCommit) <= 0: print("CLEAN - All games have no files to commit!") elif firstCommand == "pull": if "all" in commandList: puller.pullAll() else: if toTarget is None: toTarget = Game.pick(True, "All") if toTarget is None: puller.pullAll() #The user selected "All" else: puller.pull(toTarget, True) elif firstCommand == "push": #By default uses targeted game. If overridden, use the given one if toTarget is None: toTarget = Game.pick(False) pusher.push(toTarget) #if targeted game is None, a picker will appear elif firstCommand == "sign": if "all" in commandList: signer.signAll() else: if toTarget is None: toTarget = Game.pick(True, "All") if toTarget is None: signer.signall() #The user selected "All" else: signer.sign(toTarget) elif firstCommand == "build": if "all" in commandList: builder.buildAll(targetAndroid, targetIOS) else: if toTarget is None: toTarget = Game.pick(True, "All") if toTarget is None: builder.buildAll(targetAndroid, targetIOS) #The user selected "All" else: builder.build(toTarget, targetAndroid, targetIOS) elif firstCommand == "ship": if "all" in commandList: shipper.shipAll(targetAndroid, targetIOS) else: if toTarget is None: toTarget = Game.pick(True, "All") if toTarget is None: shipper.shipAll(targetAndroid, targetIOS) #The user selected "All" else: shipper.ship(toTarget, targetAndroid, targetIOS) elif firstCommand == "test": if "all" in commandList: shipper.updateAllIOSTesters() else: if toTarget is None: toTarget = Game.pick(True, "All") if toTarget is None: shipper.updateAllIOSTesters() #The user selected "All" else: shipper.updateIOSTesters(toTarget) elif firstCommand == "check": if "all" in commandList: shipper.checkAllIOS() else: if toTarget is None: toTarget = Game.pick(True, "All") if toTarget is None: shipper.checkAllIOS(targetAndroid, targetIOS) #The user selected "All" else: shipper.checkIOS(toTarget) elif firstCommand == "fill": if "all" in commandList: shipper.fillAllIOSTestInfo() else: if toTarget is None: toTarget = Game.pick(True, "All") if toTarget is None: shipper.fillAllIOSTestInfo() #The user selected "All" else: shipper.fillIOSTestInfo(toTarget) else: if command != "": print("invalid command. Use 'info' to get a list of available commands.")