From ba869e6016e497b3a8a83ee36d578e1de0272b7a Mon Sep 17 00:00:00 2001 From: rzaitov Date: Fri, 1 Nov 2013 15:08:44 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=83=20=D0=B2=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=B8=D0=B7=20=D0=B1=D1=8D=D0=BA=D0=B0=D0=BF=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommandBuilders/RestoreBackupCommandBuilder.py | 6 +----- scripts/IosSteps.txt | 2 +- scripts/StepRunner/StepsRunner.py | 5 +++++ scripts/commands/RestoreBackupCommand.py | 11 ++--------- scripts/parser/BackupParser/RestoreBackupParser.py | 1 + 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/scripts/CommandBuilders/RestoreBackupCommandBuilder.py b/scripts/CommandBuilders/RestoreBackupCommandBuilder.py index 4b7c9a3..5dbdb34 100644 --- a/scripts/CommandBuilders/RestoreBackupCommandBuilder.py +++ b/scripts/CommandBuilders/RestoreBackupCommandBuilder.py @@ -3,10 +3,6 @@ from parser.BackupParser.RestoreBackupParser import RestoreBackupParser class RestoreBackupCommandBuilder: - def __init__(self, pathProvider): - assert pathProvider is not None - self.__pathProvider = pathProvider - def isRestoreBackup(self, line): assert line is not None @@ -21,5 +17,5 @@ class RestoreBackupCommandBuilder: parser = RestoreBackupParser() parser.parseLine(line) - command = RestoreBackupCommand(self.__pathProvider) + command = RestoreBackupCommand() return command diff --git a/scripts/IosSteps.txt b/scripts/IosSteps.txt index 7f629ff..935e91b 100644 --- a/scripts/IosSteps.txt +++ b/scripts/IosSteps.txt @@ -15,6 +15,6 @@ create dirs 'Output/Appstore/Artifacts' copy 'BuildSample/BuildSample/Output/BuildSample-1.2.3.ipa' to 'Output/Appstore/Artifacts' sh cp -a BuildSample/BuildSample/Output/ Output/Appstore/ - +restore from backup sh echo hello from Rustam \ No newline at end of file diff --git a/scripts/StepRunner/StepsRunner.py b/scripts/StepRunner/StepsRunner.py index 33987ba..542cbe0 100644 --- a/scripts/StepRunner/StepsRunner.py +++ b/scripts/StepRunner/StepsRunner.py @@ -5,6 +5,7 @@ from CommandBuilders.MakeDirsCommandBuilder import MakeDirsCommandBuilder from CommandBuilders.PatchCsprojCommandBuilder import PatchCsprojCommandBuilder from CommandBuilders.PatchInfoplistCommandBuilder import PatchInfoplistCommandBuilder from CommandBuilders.RemoveProjectCommandBuilder import RemoveProjectCommandBuilder +from CommandBuilders.RestoreBackupCommandBuilder import RestoreBackupCommandBuilder from CommandBuilders.ShCommandBuilder import ShCommandBuilder from commands.ValueProvider import ValueProvider @@ -18,6 +19,7 @@ class StepsRunner: self.shCommandBuilder = ShCommandBuilder() self.removeProjectBuilder = RemoveProjectCommandBuilder() self.createBackupBuilder = CreateBackupCommandBuilder() + self.restoreFromBackupBuilder = RestoreBackupCommandBuilder() self.createDirs = MakeDirsCommandBuilder() self.patchCsproj = PatchCsprojCommandBuilder(config, self.valueProvider) self.patchInfoPlist = PatchInfoplistCommandBuilder(self.valueProvider) @@ -69,6 +71,9 @@ class StepsRunner: elif self.copyBuilder.isCopy(line): cmd =self.copyBuilder.getCommandFor(line) cmd.execute() + elif self.restoreFromBackupBuilder.isRestoreBackup(line): + cmd = self.restoreFromBackupBuilder.getCommandFor(line) + cmd.execute() else: msg = "unrecognised step. Line: '{0}'".format(line) raise Exception(msg) \ No newline at end of file diff --git a/scripts/commands/RestoreBackupCommand.py b/scripts/commands/RestoreBackupCommand.py index edf56de..f92362a 100644 --- a/scripts/commands/RestoreBackupCommand.py +++ b/scripts/commands/RestoreBackupCommand.py @@ -3,18 +3,11 @@ import shutil class RestoreBackupCommand: - def __init__(self, pathProvider): - assert pathProvider is not None - - self.__pathProvider = pathProvider - def execute(self): - baseDir = self.__pathProvider.resolveAbsPath('.') - - dirPairs = [(name, "backup.{0}".format(name)) for name in os.listdir(baseDir) if os.path.isdir(self.__pathProvider.resolveAbsPath(name)) and not name.startswith('backup.')] + dirPairs = [(name, "backup.{0}".format(name)) for name in os.listdir('.') if os.path.isdir(name) and not name.startswith('backup.')] for pair in dirPairs: - absPair = (self.__pathProvider.resolveAbsPath(pair[0]), self.__pathProvider.resolveAbsPath(pair[1])) + absPair = (pair[0], pair[1]) if not os.path.exists(absPair[1]): continue diff --git a/scripts/parser/BackupParser/RestoreBackupParser.py b/scripts/parser/BackupParser/RestoreBackupParser.py index f8bafb5..52ac72b 100644 --- a/scripts/parser/BackupParser/RestoreBackupParser.py +++ b/scripts/parser/BackupParser/RestoreBackupParser.py @@ -16,4 +16,5 @@ class RestoreBackupParser(LineParser): assert line is not None isValid = line.startswith('restore from backup') + return isValid