From 56fe80c45bba79cf12728c4d76cf578e6cade5fd Mon Sep 17 00:00:00 2001 From: rzaitov Date: Mon, 11 Nov 2013 20:08:51 +0400 Subject: [PATCH 01/17] =?UTF-8?q?=D0=BF=D0=BE=D1=84=D0=B8=D0=BA=D1=81?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B?= =?UTF-8?q?=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F/=D1=83?= =?UTF-8?q?=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F/=D0=B2=D0=BE=D1=81?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=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 --- .../CreateBackupCommandBuilder.py | 2 +- .../DeleteBackupCommandBuilder.py | 6 ++-- .../RestoreBackupCommandBuilder.py | 6 ++-- .../Tests/UnitTests/ParserBackup/__init__.py | 1 + .../ParserBackup/test_create_backup.py | 25 +++++++++++++ .../ParserBackup/test_deleteBackup.py | 25 +++++++++++++ .../ParserBackup/test_restoreBackup.py | 25 +++++++++++++ .../BaseBackupCommand/BaseBackupCommand.py | 17 +++++++++ .../BaseBackupCommand/CreateBackupCommand.py | 14 ++++++++ .../BaseBackupCommand/DeleteBackupCommand.py | 12 +++++++ .../BaseBackupCommand/RestoreBackupCommand.py | 14 ++++++++ .../commands/BaseBackupCommand/__init__.py | 1 + .../commands/CreateBackupCommand.py | 14 -------- .../commands/DeleteBackupCommand.py | 11 ------ .../commands/RestoreBackupCommand.py | 18 ---------- .../parsers/ParserBackup/BackupArguments.py | 11 ++++++ .../ParserBackup/CreateBackupArguments.py | 11 ------ .../ParserBackup/CreateBackupParser.py | 25 ++++--------- .../ParserBackup/DeleteBackupParser.py | 19 ++++------ .../parsers/ParserBackup/ParserBackupBase.py | 36 +++++++++++++++++++ .../ParserBackup/RestoreBackupParser.py | 20 ++++------- scripts/TouchinBuild/run_manual_tests.py | 9 +++-- 22 files changed, 212 insertions(+), 110 deletions(-) create mode 100644 scripts/TouchinBuild/Tests/UnitTests/ParserBackup/__init__.py create mode 100644 scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_create_backup.py create mode 100644 scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_deleteBackup.py create mode 100644 scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_restoreBackup.py create mode 100644 scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py create mode 100644 scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py create mode 100644 scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py create mode 100644 scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py create mode 100644 scripts/TouchinBuild/commands/BaseBackupCommand/__init__.py delete mode 100644 scripts/TouchinBuild/commands/CreateBackupCommand.py delete mode 100644 scripts/TouchinBuild/commands/DeleteBackupCommand.py delete mode 100644 scripts/TouchinBuild/commands/RestoreBackupCommand.py create mode 100644 scripts/TouchinBuild/parsers/ParserBackup/BackupArguments.py delete mode 100644 scripts/TouchinBuild/parsers/ParserBackup/CreateBackupArguments.py create mode 100644 scripts/TouchinBuild/parsers/ParserBackup/ParserBackupBase.py diff --git a/scripts/TouchinBuild/CommandBuilders/CreateBackupCommandBuilder.py b/scripts/TouchinBuild/CommandBuilders/CreateBackupCommandBuilder.py index c6719da..a1de956 100644 --- a/scripts/TouchinBuild/CommandBuilders/CreateBackupCommandBuilder.py +++ b/scripts/TouchinBuild/CommandBuilders/CreateBackupCommandBuilder.py @@ -1,4 +1,4 @@ -from commands.CreateBackupCommand import CreateBackupCommand +from commands.BaseBackupCommand.CreateBackupCommand import CreateBackupCommand from parsers.ParserBackup.CreateBackupParser import CreateBackupParser diff --git a/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py b/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py index 4e66812..05d0720 100644 --- a/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py +++ b/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py @@ -1,4 +1,4 @@ -from commands.DeleteBackupCommand import DeleteBackupCommand +from commands.BaseBackupCommand.DeleteBackupCommand import DeleteBackupCommand from parsers.ParserBackup.DeleteBackupParser import DeleteBackupParser @@ -18,7 +18,7 @@ class DeleteBackupCommandBuilder: assert line is not None parser = DeleteBackupParser() - parser.parseLine(line) + backupArguments = parser.parseLine(line) - command = DeleteBackupCommand() + command = DeleteBackupCommand(backupArguments) return command diff --git a/scripts/TouchinBuild/CommandBuilders/RestoreBackupCommandBuilder.py b/scripts/TouchinBuild/CommandBuilders/RestoreBackupCommandBuilder.py index dc9404b..bef5c0c 100644 --- a/scripts/TouchinBuild/CommandBuilders/RestoreBackupCommandBuilder.py +++ b/scripts/TouchinBuild/CommandBuilders/RestoreBackupCommandBuilder.py @@ -1,4 +1,4 @@ -from commands.RestoreBackupCommand import RestoreBackupCommand +from commands.BaseBackupCommand.RestoreBackupCommand import RestoreBackupCommand from parsers.ParserBackup.RestoreBackupParser import RestoreBackupParser @@ -18,7 +18,7 @@ class RestoreBackupCommandBuilder: assert line is not None parser = RestoreBackupParser() - parser.parseLine(line) + backupArguments = parser.parseLine(line) - command = RestoreBackupCommand() + command = RestoreBackupCommand(backupArguments) return command diff --git a/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/__init__.py b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/__init__.py new file mode 100644 index 0000000..cc31abc --- /dev/null +++ b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/__init__.py @@ -0,0 +1 @@ +__author__ = 'rzaitov' diff --git a/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_create_backup.py b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_create_backup.py new file mode 100644 index 0000000..43af7bb --- /dev/null +++ b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_create_backup.py @@ -0,0 +1,25 @@ +import unittest +from parsers.ParserBackup.CreateBackupParser import CreateBackupParser + + +class TestCreateBackup(unittest.TestCase): + def setUp(self): + self.parser = CreateBackupParser() + + def test_parseCurrentDir(self): + line = "create backup for '.'" + backupArg = self.parser.parseLine(line) + + self.assertEqual('.', backupArg.folderPath) + + def test_parseRelativePath(self): + line = "create backup for '../Some/Path'" + backupArg = self.parser.parseLine(line) + + self.assertEqual('../Some/Path', backupArg.folderPath) + + def test_parseAbsPath(self): + line = "create backup for '/Some/Abs/Path'" + backupArg = self.parser.parseLine(line) + + self.assertEqual('/Some/Abs/Path', backupArg.folderPath) \ No newline at end of file diff --git a/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_deleteBackup.py b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_deleteBackup.py new file mode 100644 index 0000000..153da7b --- /dev/null +++ b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_deleteBackup.py @@ -0,0 +1,25 @@ +import unittest +from parsers.ParserBackup.DeleteBackupParser import DeleteBackupParser + + +class TestDeleteBackup(unittest.TestCase): + def setUp(self): + self.parser = DeleteBackupParser() + + def test_parseCurrentDir(self): + line = "delete backup '.'" + backupArg = self.parser.parseLine(line) + + self.assertEqual('.', backupArg.folderPath) + + def test_parseRelativePath(self): + line = "delete backup '../Some/Path'" + backupArg = self.parser.parseLine(line) + + self.assertEqual('../Some/Path', backupArg.folderPath) + + def test_parseAbsPath(self): + line = "delete backup '/Some/Abs/Path'" + backupArg = self.parser.parseLine(line) + + self.assertEqual('/Some/Abs/Path', backupArg.folderPath) \ No newline at end of file diff --git a/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_restoreBackup.py b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_restoreBackup.py new file mode 100644 index 0000000..589e897 --- /dev/null +++ b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_restoreBackup.py @@ -0,0 +1,25 @@ +import unittest +from parsers.ParserBackup.RestoreBackupParser import RestoreBackupParser + + +class TestRestoreBackup(unittest.TestCase): + def setUp(self): + self.parser = RestoreBackupParser() + + def test_parseCurrentDir(self): + line = "restore from backup '.'" + backupArg = self.parser.parseLine(line) + + self.assertEqual('.', backupArg.folderPath) + + def test_parseRelativePath(self): + line = "restore from backup '../Some/Path'" + backupArg = self.parser.parseLine(line) + + self.assertEqual('../Some/Path', backupArg.folderPath) + + def test_parseAbsPath(self): + line = "restore from backup '/Some/Abs/Path'" + backupArg = self.parser.parseLine(line) + + self.assertEqual('/Some/Abs/Path', backupArg.folderPath) \ No newline at end of file diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py new file mode 100644 index 0000000..1ac6215 --- /dev/null +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py @@ -0,0 +1,17 @@ +import os + + +class BaseBackupCommand: + def __init__(self, backupArguments): + assert backupArguments is not None + + self.backupArguments = backupArguments + + def getAbsSrc(self): + return self.getAbs(self.backupArguments.getSourceFolderName()) + + def getAbsDst(self): + return self.getAbs(self.backupArguments.getBackupFolderName()) + + def getAbs(self, path): + return os.path.abspath(path) \ No newline at end of file diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py new file mode 100644 index 0000000..f7ae199 --- /dev/null +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py @@ -0,0 +1,14 @@ +import shutil +from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand + + +class CreateBackupCommand(BaseBackupCommand): + def __init__(self, backupArguments): + BaseBackupCommand.__init__(self, backupArguments) + + def execute(self): + src = self.getAbsSrc() + backupDir = self.getAbsDst() + + shutil.rmtree(backupDir, ignore_errors=True) + shutil.copytree(src, backupDir, symlinks=False) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py new file mode 100644 index 0000000..1e0c319 --- /dev/null +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py @@ -0,0 +1,12 @@ +import shutil +from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand + + +class DeleteBackupCommand(BaseBackupCommand): + def __init__(self, backupArguments): + BaseBackupCommand.__init__(self, backupArguments) + + def execute(self): + backupDir = self.getAbsDst() + + shutil.rmtree(backupDir, ignore_errors=True) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py new file mode 100644 index 0000000..35ac176 --- /dev/null +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py @@ -0,0 +1,14 @@ +import shutil +from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand + + +class RestoreBackupCommand(BaseBackupCommand): + def __init__(self, backupArguments): + BaseBackupCommand.__init__(self, backupArguments) + + def execute(self): + src = self.getAbsSrc() + backupDir = self.getAbsDst() + + shutil.rmtree(src, ignore_errors=True) + shutil.copytree(backupDir, src, symlinks=False) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/__init__.py b/scripts/TouchinBuild/commands/BaseBackupCommand/__init__.py new file mode 100644 index 0000000..cc31abc --- /dev/null +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/__init__.py @@ -0,0 +1 @@ +__author__ = 'rzaitov' diff --git a/scripts/TouchinBuild/commands/CreateBackupCommand.py b/scripts/TouchinBuild/commands/CreateBackupCommand.py deleted file mode 100644 index fde6715..0000000 --- a/scripts/TouchinBuild/commands/CreateBackupCommand.py +++ /dev/null @@ -1,14 +0,0 @@ -import shutil - -class CreateBackupCommand: - def __init__(self, backupArguments): - assert backupArguments is not None - - self.__backupArguments = backupArguments - - def execute(self): - src = self.__backupArguments.getSourceFolderName() - dst = self.__backupArguments.getBackupFolderName() - - shutil.rmtree(dst, ignore_errors=True) - shutil.copytree(src, dst, symlinks=False) diff --git a/scripts/TouchinBuild/commands/DeleteBackupCommand.py b/scripts/TouchinBuild/commands/DeleteBackupCommand.py deleted file mode 100644 index ac5dddc..0000000 --- a/scripts/TouchinBuild/commands/DeleteBackupCommand.py +++ /dev/null @@ -1,11 +0,0 @@ -import os -import shutil - -class DeleteBackupCommand: - def __init__(self): - pass - - def execute(self): - dirs = [name for name in os.listdir('.') if os.path.isdir(os.path.join('.', name)) & name.startswith('backup.')] - for d in dirs: - shutil.rmtree(d) \ No newline at end of file diff --git a/scripts/TouchinBuild/commands/RestoreBackupCommand.py b/scripts/TouchinBuild/commands/RestoreBackupCommand.py deleted file mode 100644 index dfb9247..0000000 --- a/scripts/TouchinBuild/commands/RestoreBackupCommand.py +++ /dev/null @@ -1,18 +0,0 @@ -import os -import shutil - - -class RestoreBackupCommand: - def __init__(self): - pass - - def execute(self): - 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 = (pair[0], pair[1]) - if not os.path.exists(absPair[1]): - continue - - shutil.rmtree(absPair[0]) # delete src - shutil.copytree(absPair[1], absPair[0]) # restore from backup diff --git a/scripts/TouchinBuild/parsers/ParserBackup/BackupArguments.py b/scripts/TouchinBuild/parsers/ParserBackup/BackupArguments.py new file mode 100644 index 0000000..fd8d84a --- /dev/null +++ b/scripts/TouchinBuild/parsers/ParserBackup/BackupArguments.py @@ -0,0 +1,11 @@ +class BackupArguments: + def __init__(self): + self.folderPath = None + + def getSourceFolderName(self): + return self.folderPath + + def getBackupFolderName(self): + return "backup.{0}".format(self.folderPath) + + diff --git a/scripts/TouchinBuild/parsers/ParserBackup/CreateBackupArguments.py b/scripts/TouchinBuild/parsers/ParserBackup/CreateBackupArguments.py deleted file mode 100644 index fbeea2b..0000000 --- a/scripts/TouchinBuild/parsers/ParserBackup/CreateBackupArguments.py +++ /dev/null @@ -1,11 +0,0 @@ -class CreateBackupArguments: - def __init__(self): - self.folderName = None - - def getSourceFolderName(self): - return self.folderName - - def getBackupFolderName(self): - return "backup.{0}".format(self.folderName) - - diff --git a/scripts/TouchinBuild/parsers/ParserBackup/CreateBackupParser.py b/scripts/TouchinBuild/parsers/ParserBackup/CreateBackupParser.py index f8a782c..cd9462b 100644 --- a/scripts/TouchinBuild/parsers/ParserBackup/CreateBackupParser.py +++ b/scripts/TouchinBuild/parsers/ParserBackup/CreateBackupParser.py @@ -1,32 +1,19 @@ import re -from parsers.ParserBackup.CreateBackupArguments import CreateBackupArguments -from parsers.LineParser import LineParser +from parsers.ParserBackup.ParserBackupBase import ParserBackupBase -class CreateBackupParser(LineParser): +class CreateBackupParser(ParserBackupBase): def __init__(self): - LineParser.__init__(self) - self.__createBackupArguments = CreateBackupArguments() + ParserBackupBase.__init__(self) - def parseLine(self, line): + def getMatchInfo(self, line): assert line is not None folderNameRegexp = r"'(?P[^']+)'$" - regexpSource = self.startsWith('create backup for') + folderNameRegexp + regexpSource = self.startsWith('create') + self.than('backup') + self.than('for') + folderNameRegexp regexp = re.compile(regexpSource, re.UNICODE) match = regexp.match(line) - self._guardMatch(match, line, regexpSource) - - folderName = match.group('folder') - self.__createBackupArguments.folderName = folderName - - return self.__createBackupArguments - - def isValidLine(self, line): - assert line is not None - - isValid = line.startswith('create backup') - return isValid + return match, regexpSource \ No newline at end of file diff --git a/scripts/TouchinBuild/parsers/ParserBackup/DeleteBackupParser.py b/scripts/TouchinBuild/parsers/ParserBackup/DeleteBackupParser.py index 2b4e3cc..c210f32 100644 --- a/scripts/TouchinBuild/parsers/ParserBackup/DeleteBackupParser.py +++ b/scripts/TouchinBuild/parsers/ParserBackup/DeleteBackupParser.py @@ -1,23 +1,18 @@ import re -from parsers.LineParser import LineParser +from parsers.ParserBackup.ParserBackupBase import ParserBackupBase -class DeleteBackupParser(LineParser): +class DeleteBackupParser(ParserBackupBase): def __init__(self): - LineParser.__init__(self) + ParserBackupBase.__init__(self) - def parseLine(self, line): + def getMatchInfo(self, line): assert line is not None - regexpSource = r'delete backup\s*' + folderNameRegexp = r"'(?P[^']+)'$" + regexpSource = self.startsWith('delete') + self.than('backup') + folderNameRegexp regexp = re.compile(regexpSource, re.UNICODE) match = regexp.match(line) - self._guardMatch(match, line, regexpSource) - - def isValidLine(self, line): - assert line is not None - - isValid = line.startswith('delete backup') - return isValid + return match, regexpSource \ No newline at end of file diff --git a/scripts/TouchinBuild/parsers/ParserBackup/ParserBackupBase.py b/scripts/TouchinBuild/parsers/ParserBackup/ParserBackupBase.py new file mode 100644 index 0000000..96ffba6 --- /dev/null +++ b/scripts/TouchinBuild/parsers/ParserBackup/ParserBackupBase.py @@ -0,0 +1,36 @@ +import re + +from parsers.LineParser import LineParser +from parsers.ParserBackup.BackupArguments import BackupArguments + + +class ParserBackupBase(LineParser): + def __init__(self): + LineParser.__init__(self) + self.__backupArguments = BackupArguments() + + def parseLine(self, line): + assert line is not None + + mathInfo = self.getMatchInfo(line) + match = mathInfo[0] + regexpSource = mathInfo[1] + + self._guardMatch(match, line, regexpSource) + + folderName = match.group('folder') + self.__backupArguments.folderPath = folderName + + return self.__backupArguments + + def getMatchInfo(self, line): + return None, None + + def isValidLine(self, line): + assert line is not None + + matchInfo = self.getMatchInfo(line) + match = matchInfo[0] + + return match is not None + diff --git a/scripts/TouchinBuild/parsers/ParserBackup/RestoreBackupParser.py b/scripts/TouchinBuild/parsers/ParserBackup/RestoreBackupParser.py index 5a6c10f..54285a6 100644 --- a/scripts/TouchinBuild/parsers/ParserBackup/RestoreBackupParser.py +++ b/scripts/TouchinBuild/parsers/ParserBackup/RestoreBackupParser.py @@ -1,24 +1,18 @@ import re -from parsers.LineParser import LineParser +from parsers.ParserBackup.ParserBackupBase import ParserBackupBase -class RestoreBackupParser(LineParser): +class RestoreBackupParser(ParserBackupBase): def __init__(self): - LineParser.__init__(self) + ParserBackupBase.__init__(self) - def parseLine(self, line): + def getMatchInfo(self, line): assert line is not None - regexpSource = self.startsWith('restore') + self.than('from') + self.endsWith('backup') + folderNameRegexp = r"'(?P[^']+)'$" + regexpSource = self.startsWith('restore') + self.than('from') + self.than('backup') + folderNameRegexp regexp = re.compile(regexpSource, re.UNICODE) match = regexp.match(line) - self._guardMatch(match, line, regexpSource) - - def isValidLine(self, line): - assert line is not None - - isValid = line.startswith('restore from backup') - return isValid - + return match, regexpSource \ No newline at end of file diff --git a/scripts/TouchinBuild/run_manual_tests.py b/scripts/TouchinBuild/run_manual_tests.py index bee8872..c0fff48 100644 --- a/scripts/TouchinBuild/run_manual_tests.py +++ b/scripts/TouchinBuild/run_manual_tests.py @@ -9,9 +9,9 @@ os.chdir(baseDir) #import Tests.ManualTests.csproj_test #import ManualTests.info_plist_test #import ManualTests.copy_test -#import ManualTests.create_backup_test -#import ManualTests.delete_backup_test -#import ManualTests.restore_backup_test +import Tests.ManualTests.create_backup_test +#import Tests.ManualTests.delete_backup_test +#import Tests.ManualTests.restore_backup_test #import ManualTests.csproj_test #import ManualTests.run_sh_command #import ManualTests.make_dirs @@ -21,5 +21,4 @@ os.chdir(baseDir) #import Tests.ManualTests.testflight_test #import Tests.ManualTests.install_profile #import Tests.ManualTests.macros_include_test - -import Tests.ManualTests.resolve_settings \ No newline at end of file +#import Tests.ManualTests.resolve_settings \ No newline at end of file From 91fce4f1b64a3574afed208c2f9fd535195769ea Mon Sep 17 00:00:00 2001 From: rzaitov Date: Mon, 11 Nov 2013 20:15:54 +0400 Subject: [PATCH 02/17] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D1=82=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=20=D0=BA=D0=BE=D0=BC?= =?UTF-8?q?=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F/=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F/=D0=B2=D0=BE=D1=81=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B8=D0=B7=20=D0=B1=D1=8D?= =?UTF-8?q?=D0=BA=D0=B0=D0=BF=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py | 2 +- scripts/TouchinBuild/Tests/ManualTests/restore_backup_test.py | 2 +- scripts/TouchinBuild/run_manual_tests.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py b/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py index 4c312c4..92f6b2e 100644 --- a/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py +++ b/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py @@ -1,6 +1,6 @@ from CommandBuilders.DeleteBackupCommandBuilder import DeleteBackupCommandBuilder -line = "delete backup" +line = "delete backup 'BuildSample'" cmdBuilder = DeleteBackupCommandBuilder() command = cmdBuilder.getCommandFor(line) diff --git a/scripts/TouchinBuild/Tests/ManualTests/restore_backup_test.py b/scripts/TouchinBuild/Tests/ManualTests/restore_backup_test.py index a61e390..a966f43 100644 --- a/scripts/TouchinBuild/Tests/ManualTests/restore_backup_test.py +++ b/scripts/TouchinBuild/Tests/ManualTests/restore_backup_test.py @@ -1,6 +1,6 @@ from CommandBuilders.RestoreBackupCommandBuilder import RestoreBackupCommandBuilder -line = "restore from backup" +line = "restore from backup 'BuildSample'" builder = RestoreBackupCommandBuilder() command = builder.getCommandFor(line) diff --git a/scripts/TouchinBuild/run_manual_tests.py b/scripts/TouchinBuild/run_manual_tests.py index c0fff48..6ae322c 100644 --- a/scripts/TouchinBuild/run_manual_tests.py +++ b/scripts/TouchinBuild/run_manual_tests.py @@ -9,8 +9,8 @@ os.chdir(baseDir) #import Tests.ManualTests.csproj_test #import ManualTests.info_plist_test #import ManualTests.copy_test -import Tests.ManualTests.create_backup_test -#import Tests.ManualTests.delete_backup_test +#import Tests.ManualTests.create_backup_test +import Tests.ManualTests.delete_backup_test #import Tests.ManualTests.restore_backup_test #import ManualTests.csproj_test #import ManualTests.run_sh_command From c1806fdf2fb09d2ad468f70a22e768555c320251 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 11:44:36 +0400 Subject: [PATCH 03/17] =?UTF-8?q?=D1=83=D0=B1=D1=80=D0=B0=D0=BB=20=D0=BD?= =?UTF-8?q?=D0=B5=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D1=83=D0=B5?= =?UTF-8?q?=D0=BC=D1=8B=D0=B9=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommandBuilders/CreateBackupCommandBuilder.py | 4 ++-- .../CommandBuilders/DeleteBackupCommandBuilder.py | 4 ++-- .../CommandBuilders/RestoreBackupCommandBuilder.py | 4 ++-- .../Tests/ManualTests/create_backup_test.py | 2 +- .../UnitTests/ParserBackup/test_create_backup.py | 12 ++++++------ .../UnitTests/ParserBackup/test_deleteBackup.py | 12 ++++++------ .../UnitTests/ParserBackup/test_restoreBackup.py | 12 ++++++------ .../commands/BaseBackupCommand/BaseBackupCommand.py | 11 ++++++----- .../BaseBackupCommand/CreateBackupCommand.py | 6 ++++-- .../BaseBackupCommand/RestoreBackupCommand.py | 4 ++-- .../parsers/ParserBackup/BackupArguments.py | 11 ----------- .../parsers/ParserBackup/ParserBackupBase.py | 9 +++------ scripts/TouchinBuild/run_manual_tests.py | 4 ++-- 13 files changed, 42 insertions(+), 53 deletions(-) delete mode 100644 scripts/TouchinBuild/parsers/ParserBackup/BackupArguments.py diff --git a/scripts/TouchinBuild/CommandBuilders/CreateBackupCommandBuilder.py b/scripts/TouchinBuild/CommandBuilders/CreateBackupCommandBuilder.py index a1de956..ddb1c34 100644 --- a/scripts/TouchinBuild/CommandBuilders/CreateBackupCommandBuilder.py +++ b/scripts/TouchinBuild/CommandBuilders/CreateBackupCommandBuilder.py @@ -16,7 +16,7 @@ class CreateBackupCommandBuilder: assert line is not None parser = CreateBackupParser() - backupArguments = parser.parseLine(line) + folderPath = parser.parseLine(line) - command = CreateBackupCommand(backupArguments) + command = CreateBackupCommand(folderPath) return command diff --git a/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py b/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py index 05d0720..5fd5b66 100644 --- a/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py +++ b/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py @@ -18,7 +18,7 @@ class DeleteBackupCommandBuilder: assert line is not None parser = DeleteBackupParser() - backupArguments = parser.parseLine(line) + folderPath = parser.parseLine(line) - command = DeleteBackupCommand(backupArguments) + command = DeleteBackupCommand(folderPath) return command diff --git a/scripts/TouchinBuild/CommandBuilders/RestoreBackupCommandBuilder.py b/scripts/TouchinBuild/CommandBuilders/RestoreBackupCommandBuilder.py index bef5c0c..00f328d 100644 --- a/scripts/TouchinBuild/CommandBuilders/RestoreBackupCommandBuilder.py +++ b/scripts/TouchinBuild/CommandBuilders/RestoreBackupCommandBuilder.py @@ -18,7 +18,7 @@ class RestoreBackupCommandBuilder: assert line is not None parser = RestoreBackupParser() - backupArguments = parser.parseLine(line) + folderPath = parser.parseLine(line) - command = RestoreBackupCommand(backupArguments) + command = RestoreBackupCommand(folderPath) return command diff --git a/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py b/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py index 48bc235..99303cc 100644 --- a/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py +++ b/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py @@ -1,6 +1,6 @@ from CommandBuilders.CreateBackupCommandBuilder import CreateBackupCommandBuilder -line = "create backup for 'BuildSample'" +line = "create backup for '.'" cmdBuilder = CreateBackupCommandBuilder() command = cmdBuilder.getCommandFor(line) diff --git a/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_create_backup.py b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_create_backup.py index 43af7bb..1f60683 100644 --- a/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_create_backup.py +++ b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_create_backup.py @@ -8,18 +8,18 @@ class TestCreateBackup(unittest.TestCase): def test_parseCurrentDir(self): line = "create backup for '.'" - backupArg = self.parser.parseLine(line) + folderPath = self.parser.parseLine(line) - self.assertEqual('.', backupArg.folderPath) + self.assertEqual('.', folderPath) def test_parseRelativePath(self): line = "create backup for '../Some/Path'" - backupArg = self.parser.parseLine(line) + folderPath = self.parser.parseLine(line) - self.assertEqual('../Some/Path', backupArg.folderPath) + self.assertEqual('../Some/Path', folderPath) def test_parseAbsPath(self): line = "create backup for '/Some/Abs/Path'" - backupArg = self.parser.parseLine(line) + folderPath = self.parser.parseLine(line) - self.assertEqual('/Some/Abs/Path', backupArg.folderPath) \ No newline at end of file + self.assertEqual('/Some/Abs/Path', folderPath) \ No newline at end of file diff --git a/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_deleteBackup.py b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_deleteBackup.py index 153da7b..c8dfbd5 100644 --- a/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_deleteBackup.py +++ b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_deleteBackup.py @@ -8,18 +8,18 @@ class TestDeleteBackup(unittest.TestCase): def test_parseCurrentDir(self): line = "delete backup '.'" - backupArg = self.parser.parseLine(line) + folderPath = self.parser.parseLine(line) - self.assertEqual('.', backupArg.folderPath) + self.assertEqual('.', folderPath) def test_parseRelativePath(self): line = "delete backup '../Some/Path'" - backupArg = self.parser.parseLine(line) + folderPath = self.parser.parseLine(line) - self.assertEqual('../Some/Path', backupArg.folderPath) + self.assertEqual('../Some/Path', folderPath) def test_parseAbsPath(self): line = "delete backup '/Some/Abs/Path'" - backupArg = self.parser.parseLine(line) + folderPath = self.parser.parseLine(line) - self.assertEqual('/Some/Abs/Path', backupArg.folderPath) \ No newline at end of file + self.assertEqual('/Some/Abs/Path', folderPath) \ No newline at end of file diff --git a/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_restoreBackup.py b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_restoreBackup.py index 589e897..6e9437e 100644 --- a/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_restoreBackup.py +++ b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_restoreBackup.py @@ -8,18 +8,18 @@ class TestRestoreBackup(unittest.TestCase): def test_parseCurrentDir(self): line = "restore from backup '.'" - backupArg = self.parser.parseLine(line) + folderPath = self.parser.parseLine(line) - self.assertEqual('.', backupArg.folderPath) + self.assertEqual('.', folderPath) def test_parseRelativePath(self): line = "restore from backup '../Some/Path'" - backupArg = self.parser.parseLine(line) + folderPath = self.parser.parseLine(line) - self.assertEqual('../Some/Path', backupArg.folderPath) + self.assertEqual('../Some/Path', folderPath) def test_parseAbsPath(self): line = "restore from backup '/Some/Abs/Path'" - backupArg = self.parser.parseLine(line) + folderPath = self.parser.parseLine(line) - self.assertEqual('/Some/Abs/Path', backupArg.folderPath) \ No newline at end of file + self.assertEqual('/Some/Abs/Path', folderPath) \ No newline at end of file diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py index 1ac6215..45acc23 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py @@ -2,16 +2,17 @@ import os class BaseBackupCommand: - def __init__(self, backupArguments): - assert backupArguments is not None + def __init__(self, folderPath): + assert folderPath is not None - self.backupArguments = backupArguments + self.folderPath = folderPath def getAbsSrc(self): - return self.getAbs(self.backupArguments.getSourceFolderName()) + return self.getAbs(self.folderPath) def getAbsDst(self): - return self.getAbs(self.backupArguments.getBackupFolderName()) + srcDirName = os.path.dirname(self.folderPath) + return self.getAbs('backup'.format(srcDirName)) def getAbs(self, path): return os.path.abspath(path) \ No newline at end of file diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py index f7ae199..516e12b 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py @@ -3,12 +3,14 @@ from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand class CreateBackupCommand(BaseBackupCommand): - def __init__(self, backupArguments): - BaseBackupCommand.__init__(self, backupArguments) + def __init__(self, folderPath): + BaseBackupCommand.__init__(self, folderPath) def execute(self): src = self.getAbsSrc() backupDir = self.getAbsDst() + print src, backupDir + shutil.rmtree(backupDir, ignore_errors=True) shutil.copytree(src, backupDir, symlinks=False) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py index 35ac176..c74085a 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py @@ -3,8 +3,8 @@ from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand class RestoreBackupCommand(BaseBackupCommand): - def __init__(self, backupArguments): - BaseBackupCommand.__init__(self, backupArguments) + def __init__(self, folderPath): + BaseBackupCommand.__init__(self, folderPath) def execute(self): src = self.getAbsSrc() diff --git a/scripts/TouchinBuild/parsers/ParserBackup/BackupArguments.py b/scripts/TouchinBuild/parsers/ParserBackup/BackupArguments.py deleted file mode 100644 index fd8d84a..0000000 --- a/scripts/TouchinBuild/parsers/ParserBackup/BackupArguments.py +++ /dev/null @@ -1,11 +0,0 @@ -class BackupArguments: - def __init__(self): - self.folderPath = None - - def getSourceFolderName(self): - return self.folderPath - - def getBackupFolderName(self): - return "backup.{0}".format(self.folderPath) - - diff --git a/scripts/TouchinBuild/parsers/ParserBackup/ParserBackupBase.py b/scripts/TouchinBuild/parsers/ParserBackup/ParserBackupBase.py index 96ffba6..e80ba1b 100644 --- a/scripts/TouchinBuild/parsers/ParserBackup/ParserBackupBase.py +++ b/scripts/TouchinBuild/parsers/ParserBackup/ParserBackupBase.py @@ -1,13 +1,10 @@ -import re - from parsers.LineParser import LineParser -from parsers.ParserBackup.BackupArguments import BackupArguments class ParserBackupBase(LineParser): def __init__(self): LineParser.__init__(self) - self.__backupArguments = BackupArguments() + self.folderName = None def parseLine(self, line): assert line is not None @@ -19,9 +16,9 @@ class ParserBackupBase(LineParser): self._guardMatch(match, line, regexpSource) folderName = match.group('folder') - self.__backupArguments.folderPath = folderName + self.folderName = folderName - return self.__backupArguments + return self.folderName def getMatchInfo(self, line): return None, None diff --git a/scripts/TouchinBuild/run_manual_tests.py b/scripts/TouchinBuild/run_manual_tests.py index 6ae322c..c0fff48 100644 --- a/scripts/TouchinBuild/run_manual_tests.py +++ b/scripts/TouchinBuild/run_manual_tests.py @@ -9,8 +9,8 @@ os.chdir(baseDir) #import Tests.ManualTests.csproj_test #import ManualTests.info_plist_test #import ManualTests.copy_test -#import Tests.ManualTests.create_backup_test -import Tests.ManualTests.delete_backup_test +import Tests.ManualTests.create_backup_test +#import Tests.ManualTests.delete_backup_test #import Tests.ManualTests.restore_backup_test #import ManualTests.csproj_test #import ManualTests.run_sh_command From f52c52575ba3b8887b389e4582e3a98e3d3a6934 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 12:08:46 +0400 Subject: [PATCH 04/17] =?UTF-8?q?=D0=9F=D0=BE=D1=84=D0=B8=D0=BA=D1=81?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=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 --- .../TouchinBuild/Tests/ManualTests/create_backup_test.py | 2 +- .../commands/BaseBackupCommand/BaseBackupCommand.py | 8 ++++++-- .../commands/BaseBackupCommand/CreateBackupCommand.py | 2 +- scripts/TouchinBuild/run_manual_tests.py | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py b/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py index 99303cc..48bc235 100644 --- a/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py +++ b/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py @@ -1,6 +1,6 @@ from CommandBuilders.CreateBackupCommandBuilder import CreateBackupCommandBuilder -line = "create backup for '.'" +line = "create backup for 'BuildSample'" cmdBuilder = CreateBackupCommandBuilder() command = cmdBuilder.getCommandFor(line) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py index 45acc23..a8f102d 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py @@ -11,8 +11,12 @@ class BaseBackupCommand: return self.getAbs(self.folderPath) def getAbsDst(self): - srcDirName = os.path.dirname(self.folderPath) - return self.getAbs('backup'.format(srcDirName)) + absFolderPath = self.getAbs(self.folderPath) + srcDirName = os.path.basename(absFolderPath) + absParentDir = os.path.dirname(absFolderPath) + dstAbs = self.getAbs(os.path.join(absParentDir, 'backup.{0}'.format(srcDirName))) + + return dstAbs def getAbs(self, path): return os.path.abspath(path) \ No newline at end of file diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py index 516e12b..6658758 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py @@ -13,4 +13,4 @@ class CreateBackupCommand(BaseBackupCommand): print src, backupDir shutil.rmtree(backupDir, ignore_errors=True) - shutil.copytree(src, backupDir, symlinks=False) + shutil.copytree(src, backupDir, symlinks=False) \ No newline at end of file diff --git a/scripts/TouchinBuild/run_manual_tests.py b/scripts/TouchinBuild/run_manual_tests.py index c0fff48..6ae322c 100644 --- a/scripts/TouchinBuild/run_manual_tests.py +++ b/scripts/TouchinBuild/run_manual_tests.py @@ -9,8 +9,8 @@ os.chdir(baseDir) #import Tests.ManualTests.csproj_test #import ManualTests.info_plist_test #import ManualTests.copy_test -import Tests.ManualTests.create_backup_test -#import Tests.ManualTests.delete_backup_test +#import Tests.ManualTests.create_backup_test +import Tests.ManualTests.delete_backup_test #import Tests.ManualTests.restore_backup_test #import ManualTests.csproj_test #import ManualTests.run_sh_command From ab42433c32a025d57e69e74e6bd410d5840577f2 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 12:18:53 +0400 Subject: [PATCH 05/17] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=B1=D0=B0=D0=B3=20=D0=B2=20=D0=BA=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD=D0=B4=D0=B5=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=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 --- scripts/IosSetupSteps.txt | 2 +- .../commands/BaseBackupCommand/RestoreBackupCommand.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/IosSetupSteps.txt b/scripts/IosSetupSteps.txt index 307f904..441a651 100644 --- a/scripts/IosSetupSteps.txt +++ b/scripts/IosSetupSteps.txt @@ -1,4 +1,4 @@ -restore from backup # восстанавливаем из бэкапа (исходники от сборки предыдущей конфигурации могут быть модифицированными) +restore from backup 'BuildSample' # восстанавливаем из бэкапа (исходники от сборки предыдущей конфигурации могут быть модифицированными) create backup for 'BuildSample' inside 'BuildSample/BuildSample.sln' remove NotCompileApp project diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py index c74085a..61b6747 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py @@ -1,3 +1,4 @@ +import os import shutil from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand @@ -10,5 +11,6 @@ class RestoreBackupCommand(BaseBackupCommand): src = self.getAbsSrc() backupDir = self.getAbsDst() - shutil.rmtree(src, ignore_errors=True) - shutil.copytree(backupDir, src, symlinks=False) + if os.path.exists(backupDir): + shutil.rmtree(src, ignore_errors=True) + shutil.copytree(backupDir, src, symlinks=False) From 42863417cbed350baaa99adcc1b0bd98577f42ff Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 12:41:32 +0400 Subject: [PATCH 06/17] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BB=20=D1=80=D0=B5=D0=BA=D0=BA=D1=83=D1=80?= =?UTF-8?q?=D1=81=D0=B8=D0=B2=D0=BD=D1=83=D1=8E=20=D0=BE=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=BA=D1=83=20include/macro=20resolve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/IosSteps.txt | 4 ++-- .../TouchinBuild/Core/DependencyResolver/SettingsResolver.py | 2 +- scripts/TouchinBuild/Core/LineConveyor/CommentRemover.py | 2 +- scripts/TouchinBuild/Core/LineConveyor/MacroResolver.py | 2 +- scripts/TouchinBuild/Core/LineConveyor/Stripper.py | 2 +- .../Core/LineConveyor/TextConveyorPreprocessor.py | 4 ++-- scripts/TouchinBuild/Core/LineConveyor/TextInclude.py | 4 +++- scripts/TouchinBuild/Core/StepsRunner.py | 2 +- scripts/TouchinBuild/taskRunner.py | 2 +- 9 files changed, 13 insertions(+), 11 deletions(-) diff --git a/scripts/IosSteps.txt b/scripts/IosSteps.txt index d9259d9..b3a3f4b 100644 --- a/scripts/IosSteps.txt +++ b/scripts/IosSteps.txt @@ -12,5 +12,5 @@ sh cp -a BuildSample/BuildSample/Output/ Output/Appstore/ publish 'Output/Appstore/Artifacts/BuildSample-{@version}.ipa' to testflight notes = 'Hello' api_token = '{@tf_api_token}' team_token = '{@tf_team_token}' -restore from backup -delete backup \ No newline at end of file +restore from backup 'BuildSample' +delete backup 'BuildSample' \ No newline at end of file diff --git a/scripts/TouchinBuild/Core/DependencyResolver/SettingsResolver.py b/scripts/TouchinBuild/Core/DependencyResolver/SettingsResolver.py index 3b3c50f..901f3d7 100644 --- a/scripts/TouchinBuild/Core/DependencyResolver/SettingsResolver.py +++ b/scripts/TouchinBuild/Core/DependencyResolver/SettingsResolver.py @@ -55,6 +55,6 @@ class SettingsResolver: for node in resolvedDependencies: unresolvedSettingValue = self.settings[node.name] - resolvedSettingValue = macroResolver.processText(unresolvedSettingValue) + resolvedSettingValue = macroResolver.processText(unresolvedSettingValue, None) self.settings[node.name] = resolvedSettingValue \ No newline at end of file diff --git a/scripts/TouchinBuild/Core/LineConveyor/CommentRemover.py b/scripts/TouchinBuild/Core/LineConveyor/CommentRemover.py index 568d46b..7dcb8c1 100644 --- a/scripts/TouchinBuild/Core/LineConveyor/CommentRemover.py +++ b/scripts/TouchinBuild/Core/LineConveyor/CommentRemover.py @@ -2,7 +2,7 @@ class CommentRemover: def __init__(self): pass - def processText(self, line): + def processText(self, line, conveyorProcessor): assert line is not None newLine = line diff --git a/scripts/TouchinBuild/Core/LineConveyor/MacroResolver.py b/scripts/TouchinBuild/Core/LineConveyor/MacroResolver.py index eeeb8bc..0012c09 100644 --- a/scripts/TouchinBuild/Core/LineConveyor/MacroResolver.py +++ b/scripts/TouchinBuild/Core/LineConveyor/MacroResolver.py @@ -6,7 +6,7 @@ class MacroResolver: self.macroProcessor = macroProcessor self.valueProvider = valueProvider - def processText(self, line): + def processText(self, line, conveyorProcessor): assert line is not None symbols = self.macroProcessor.getSymbols(line) diff --git a/scripts/TouchinBuild/Core/LineConveyor/Stripper.py b/scripts/TouchinBuild/Core/LineConveyor/Stripper.py index 22c6d5c..8aff211 100644 --- a/scripts/TouchinBuild/Core/LineConveyor/Stripper.py +++ b/scripts/TouchinBuild/Core/LineConveyor/Stripper.py @@ -2,7 +2,7 @@ class Stripper: def __init__(self): pass - def processText(self, line): + def processText(self, line, conveyorProcessor): assert line is not None return line.strip(' \t\n\r') diff --git a/scripts/TouchinBuild/Core/LineConveyor/TextConveyorPreprocessor.py b/scripts/TouchinBuild/Core/LineConveyor/TextConveyorPreprocessor.py index a474a80..9f789b4 100644 --- a/scripts/TouchinBuild/Core/LineConveyor/TextConveyorPreprocessor.py +++ b/scripts/TouchinBuild/Core/LineConveyor/TextConveyorPreprocessor.py @@ -7,10 +7,10 @@ class TextConveyorPreprocessor: self.processors.append(processor) - def processText(self, text): + def processText(self, text, conveyorProcessor): assert text is not None for processor in self.processors: - text = processor.processText(text) + text = processor.processText(text, conveyorProcessor) return text diff --git a/scripts/TouchinBuild/Core/LineConveyor/TextInclude.py b/scripts/TouchinBuild/Core/LineConveyor/TextInclude.py index b45446d..144eea8 100644 --- a/scripts/TouchinBuild/Core/LineConveyor/TextInclude.py +++ b/scripts/TouchinBuild/Core/LineConveyor/TextInclude.py @@ -6,7 +6,7 @@ class TextInclude: self.includeProcessor = includeProcessor self.contentProvider = contentProvider - def processText(self, text): + def processText(self, text, conveyorProcessor): assert text is not None includesInfo = self.includeProcessor.getIncludesInfo(text) @@ -15,6 +15,8 @@ class TextInclude: path = info[1] content = self.contentProvider.fetchContent(path) + content = conveyorProcessor.processText(content, conveyorProcessor) + text = text.replace(includeStatement, content) return text \ No newline at end of file diff --git a/scripts/TouchinBuild/Core/StepsRunner.py b/scripts/TouchinBuild/Core/StepsRunner.py index 4883959..39ae070 100644 --- a/scripts/TouchinBuild/Core/StepsRunner.py +++ b/scripts/TouchinBuild/Core/StepsRunner.py @@ -42,7 +42,7 @@ class StepsRunner: lines = content.splitlines() for line in lines: - processedLine = self.lineConveyor.processText(line) + processedLine = self.lineConveyor.processText(line, self.lineConveyor) if len(processedLine) == 0: continue diff --git a/scripts/TouchinBuild/taskRunner.py b/scripts/TouchinBuild/taskRunner.py index 8fdbf27..5fcc12a 100755 --- a/scripts/TouchinBuild/taskRunner.py +++ b/scripts/TouchinBuild/taskRunner.py @@ -73,7 +73,7 @@ class TaskRunner: pathToSteps = config['steps'] content = self.fileContentProvider.fetchContent(pathToSteps) - content = self.textPreprocessor.processText(content) + content = self.textPreprocessor.processText(content, self.textPreprocessor) return content From e2601db9d59f3276fc929fc57b17a029b68b51d5 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 13:00:02 +0400 Subject: [PATCH 07/17] =?UTF-8?q?=D0=B2=D1=8B=D1=87=D0=B8=D1=81=D0=BB?= =?UTF-8?q?=D1=8F=D1=8E=20=D0=BF=D1=83=D1=82=D0=B8=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=B1=D1=8D=D0=BA=D0=B0=D0=BF=D0=B0=20=D0=BD=D0=B0=20=D1=8D?= =?UTF-8?q?=D1=82=D0=B0=D0=BF=D0=B5=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B0=D0=BD=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/IosSetupSteps.txt | 4 ++-- scripts/IosSteps.txt | 4 ++-- .../commands/BaseBackupCommand/BaseBackupCommand.py | 5 +++++ .../commands/BaseBackupCommand/CreateBackupCommand.py | 9 ++------- .../commands/BaseBackupCommand/DeleteBackupCommand.py | 4 +--- .../commands/BaseBackupCommand/RestoreBackupCommand.py | 9 +++------ 6 files changed, 15 insertions(+), 20 deletions(-) diff --git a/scripts/IosSetupSteps.txt b/scripts/IosSetupSteps.txt index 441a651..e788e1a 100644 --- a/scripts/IosSetupSteps.txt +++ b/scripts/IosSetupSteps.txt @@ -1,5 +1,5 @@ -restore from backup 'BuildSample' # восстанавливаем из бэкапа (исходники от сборки предыдущей конфигурации могут быть модифицированными) -create backup for 'BuildSample' +restore from backup '.' # восстанавливаем из бэкапа (исходники от сборки предыдущей конфигурации могут быть модифицированными) +create backup for '.' inside 'BuildSample/BuildSample.sln' remove NotCompileApp project diff --git a/scripts/IosSteps.txt b/scripts/IosSteps.txt index b3a3f4b..7a70b9b 100644 --- a/scripts/IosSteps.txt +++ b/scripts/IosSteps.txt @@ -12,5 +12,5 @@ sh cp -a BuildSample/BuildSample/Output/ Output/Appstore/ publish 'Output/Appstore/Artifacts/BuildSample-{@version}.ipa' to testflight notes = 'Hello' api_token = '{@tf_api_token}' team_token = '{@tf_team_token}' -restore from backup 'BuildSample' -delete backup 'BuildSample' \ No newline at end of file +restore from backup '.' +delete backup '.' \ No newline at end of file diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py index a8f102d..4a0540c 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py @@ -7,6 +7,11 @@ class BaseBackupCommand: self.folderPath = folderPath + # вычислять абсолютные пути надо на этапе создания комманды + # поскольку на этапе выполнения текущая директория может быть удалена + self.srcAbsPath = self.getAbsSrc() + self.backupAbsPath = self.getAbsDst() + def getAbsSrc(self): return self.getAbs(self.folderPath) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py index 6658758..adba2df 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py @@ -7,10 +7,5 @@ class CreateBackupCommand(BaseBackupCommand): BaseBackupCommand.__init__(self, folderPath) def execute(self): - src = self.getAbsSrc() - backupDir = self.getAbsDst() - - print src, backupDir - - shutil.rmtree(backupDir, ignore_errors=True) - shutil.copytree(src, backupDir, symlinks=False) \ No newline at end of file + shutil.rmtree(self.backupAbsPath, ignore_errors=True) + shutil.copytree(self.srcAbsPath, self.backupAbsPath, symlinks=False) \ No newline at end of file diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py index 1e0c319..ebdad25 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py @@ -7,6 +7,4 @@ class DeleteBackupCommand(BaseBackupCommand): BaseBackupCommand.__init__(self, backupArguments) def execute(self): - backupDir = self.getAbsDst() - - shutil.rmtree(backupDir, ignore_errors=True) + shutil.rmtree(self.backupAbsPath, ignore_errors=True) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py index 61b6747..e176153 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py @@ -8,9 +8,6 @@ class RestoreBackupCommand(BaseBackupCommand): BaseBackupCommand.__init__(self, folderPath) def execute(self): - src = self.getAbsSrc() - backupDir = self.getAbsDst() - - if os.path.exists(backupDir): - shutil.rmtree(src, ignore_errors=True) - shutil.copytree(backupDir, src, symlinks=False) + if os.path.exists(self.backupAbsPath): + shutil.rmtree(self.srcAbsPath, ignore_errors=True) + shutil.copytree(self.backupAbsPath, self.srcAbsPath, symlinks=False) From 1655b7f47a04078e364589fb197d578420d03714 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 13:05:11 +0400 Subject: [PATCH 08/17] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B7=D0=B0=D0=B1=D1=8B=D1=82=D1=83=D1=8E=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=B4=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D1=83=20=D1=84=D0=B0?= =?UTF-8?q?=D0=B9=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/BaseBackupCommand/BaseBackupCommand.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py index 4a0540c..a728846 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + import os From b02e7b9733acb5e1a9e42a053b64fe1acf5ff99d Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 15:09:46 +0400 Subject: [PATCH 09/17] =?UTF-8?q?=D0=9C=D0=BE=D0=B4=D0=B8=D1=84=D0=B8?= =?UTF-8?q?=D1=86=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=20=D0=BA=D0=BE=D0=BC?= =?UTF-8?q?=D0=BC=D0=B0=D0=BD=D0=B4=D1=83=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=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 --- scripts/IosSetupSteps.txt | 4 +-- .../CreateBackupCommandBuilder.py | 4 +-- .../Tests/ManualTests/create_backup_test.py | 2 +- .../ParserBackup/test_create_backup.py | 22 +++++--------- .../BaseBackupCommand/BaseBackupCommand.py | 18 ++++++------ .../BaseBackupCommand/CreateBackupCommand.py | 29 ++++++++++++++++--- .../BaseBackupCommand/DeleteBackupCommand.py | 6 ++-- .../BaseBackupCommand/RestoreBackupCommand.py | 10 +++---- .../ParserBackup/CreateBackupParser.py | 4 +-- 9 files changed, 56 insertions(+), 43 deletions(-) diff --git a/scripts/IosSetupSteps.txt b/scripts/IosSetupSteps.txt index e788e1a..beb656b 100644 --- a/scripts/IosSetupSteps.txt +++ b/scripts/IosSetupSteps.txt @@ -1,5 +1,5 @@ -restore from backup '.' # восстанавливаем из бэкапа (исходники от сборки предыдущей конфигурации могут быть модифицированными) -create backup for '.' +restore from backup # восстанавливаем из бэкапа (исходники от сборки предыдущей конфигурации могут быть модифицированными) +create backup inside 'BuildSample/BuildSample.sln' remove NotCompileApp project diff --git a/scripts/TouchinBuild/CommandBuilders/CreateBackupCommandBuilder.py b/scripts/TouchinBuild/CommandBuilders/CreateBackupCommandBuilder.py index ddb1c34..5bd0bd3 100644 --- a/scripts/TouchinBuild/CommandBuilders/CreateBackupCommandBuilder.py +++ b/scripts/TouchinBuild/CommandBuilders/CreateBackupCommandBuilder.py @@ -16,7 +16,7 @@ class CreateBackupCommandBuilder: assert line is not None parser = CreateBackupParser() - folderPath = parser.parseLine(line) + parser.parseLine(line) - command = CreateBackupCommand(folderPath) + command = CreateBackupCommand() return command diff --git a/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py b/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py index 48bc235..c770259 100644 --- a/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py +++ b/scripts/TouchinBuild/Tests/ManualTests/create_backup_test.py @@ -1,6 +1,6 @@ from CommandBuilders.CreateBackupCommandBuilder import CreateBackupCommandBuilder -line = "create backup for 'BuildSample'" +line = "create backup" cmdBuilder = CreateBackupCommandBuilder() command = cmdBuilder.getCommandFor(line) diff --git a/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_create_backup.py b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_create_backup.py index 1f60683..c415aff 100644 --- a/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_create_backup.py +++ b/scripts/TouchinBuild/Tests/UnitTests/ParserBackup/test_create_backup.py @@ -6,20 +6,14 @@ class TestCreateBackup(unittest.TestCase): def setUp(self): self.parser = CreateBackupParser() - def test_parseCurrentDir(self): - line = "create backup for '.'" - folderPath = self.parser.parseLine(line) + def test_isValid(self): + line = "create backup" + isValid = self.parser.isValidLine(line) - self.assertEqual('.', folderPath) + self.assertEqual(True, isValid) - def test_parseRelativePath(self): - line = "create backup for '../Some/Path'" - folderPath = self.parser.parseLine(line) + def test_isNotValid(self): + line = "create backup bla bla" + isValid = self.parser.isValidLine(line) - self.assertEqual('../Some/Path', folderPath) - - def test_parseAbsPath(self): - line = "create backup for '/Some/Abs/Path'" - folderPath = self.parser.parseLine(line) - - self.assertEqual('/Some/Abs/Path', folderPath) \ No newline at end of file + self.assertEqual(False, isValid) \ No newline at end of file diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py index a728846..74dcb22 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py @@ -4,26 +4,26 @@ import os class BaseBackupCommand: - def __init__(self, folderPath): - assert folderPath is not None - - self.folderPath = folderPath + def __init__(self): + self.folderPath = '.' # вычислять абсолютные пути надо на этапе создания комманды # поскольку на этапе выполнения текущая директория может быть удалена - self.srcAbsPath = self.getAbsSrc() - self.backupAbsPath = self.getAbsDst() + self.srcAbsDirPath = self.getAbsSrc() + self.backupDirAbsPath = self.getAbsDst() + + self.backupIgnore = ['.git', '.gitignore', '.DS_Store'] def getAbsSrc(self): return self.getAbs(self.folderPath) def getAbsDst(self): absFolderPath = self.getAbs(self.folderPath) - srcDirName = os.path.basename(absFolderPath) absParentDir = os.path.dirname(absFolderPath) - dstAbs = self.getAbs(os.path.join(absParentDir, 'backup.{0}'.format(srcDirName))) - return dstAbs + backupAbsPath = os.path.join(absParentDir, 'backup') + + return backupAbsPath def getAbs(self, path): return os.path.abspath(path) \ No newline at end of file diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py index adba2df..0498a0b 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py @@ -1,11 +1,32 @@ +import os import shutil from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand class CreateBackupCommand(BaseBackupCommand): - def __init__(self, folderPath): - BaseBackupCommand.__init__(self, folderPath) + def __init__(self): + BaseBackupCommand.__init__(self) def execute(self): - shutil.rmtree(self.backupAbsPath, ignore_errors=True) - shutil.copytree(self.srcAbsPath, self.backupAbsPath, symlinks=False) \ No newline at end of file + if os.path.exists(self.backupDirAbsPath): + raise Exception('folder: {0} already exists'.format(self.backupDirAbsPath)) + + os.mkdir(self.backupDirAbsPath) + + dirContent = os.listdir(self.srcAbsDirPath) + + for fileOrDir in dirContent: + if fileOrDir not in self.backupIgnore: + self.copyFileOrDirectoryToBackupFolder(fileOrDir) + + def copyFileOrDirectoryToBackupFolder(self, fileOrDirName): + assert fileOrDirName is not None + + srcAbsPath = os.path.join(self.srcAbsDirPath, fileOrDirName) + dstAbsPath = os.path.join(self.backupDirAbsPath, fileOrDirName) + + if os.path.isdir(srcAbsPath): + shutil.copytree(srcAbsPath, dstAbsPath) + else: + shutil.copy(srcAbsPath, dstAbsPath) + diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py index ebdad25..6cc0806 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py @@ -3,8 +3,8 @@ from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand class DeleteBackupCommand(BaseBackupCommand): - def __init__(self, backupArguments): - BaseBackupCommand.__init__(self, backupArguments) + def __init__(self): + BaseBackupCommand.__init__(self) def execute(self): - shutil.rmtree(self.backupAbsPath, ignore_errors=True) + shutil.rmtree(self.backupDirAbsPath, ignore_errors=True) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py index e176153..9ec126c 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py @@ -4,10 +4,10 @@ from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand class RestoreBackupCommand(BaseBackupCommand): - def __init__(self, folderPath): - BaseBackupCommand.__init__(self, folderPath) + def __init__(self): + BaseBackupCommand.__init__(self) def execute(self): - if os.path.exists(self.backupAbsPath): - shutil.rmtree(self.srcAbsPath, ignore_errors=True) - shutil.copytree(self.backupAbsPath, self.srcAbsPath, symlinks=False) + if os.path.exists(self.backupDirAbsPath): + shutil.rmtree(self.srcAbsDirPath, ignore_errors=True) + shutil.copytree(self.backupDirAbsPath, self.srcAbsDirPath, symlinks=False) diff --git a/scripts/TouchinBuild/parsers/ParserBackup/CreateBackupParser.py b/scripts/TouchinBuild/parsers/ParserBackup/CreateBackupParser.py index cd9462b..f42ccae 100644 --- a/scripts/TouchinBuild/parsers/ParserBackup/CreateBackupParser.py +++ b/scripts/TouchinBuild/parsers/ParserBackup/CreateBackupParser.py @@ -10,9 +10,7 @@ class CreateBackupParser(ParserBackupBase): def getMatchInfo(self, line): assert line is not None - folderNameRegexp = r"'(?P[^']+)'$" - - regexpSource = self.startsWith('create') + self.than('backup') + self.than('for') + folderNameRegexp + regexpSource = self.startsWith('create') + self.spaceEndsWith('backup') regexp = re.compile(regexpSource, re.UNICODE) match = regexp.match(line) From e51aa4990ca758fe0fbc8de0d6507551ee4cf4bc Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 15:36:58 +0400 Subject: [PATCH 10/17] =?UTF-8?q?=D0=9C=D0=BE=D0=B4=D0=B8=D1=84=D0=B8?= =?UTF-8?q?=D1=86=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=20=D0=BA=D0=BE=D0=BC?= =?UTF-8?q?=D0=BC=D0=B0=D0=BD=D0=B4=D1=83=20=D0=B2=D0=BE=D1=81=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B8?= =?UTF-8?q?=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 --- .../RestoreBackupCommandBuilder.py | 4 +-- .../BaseBackupCommand/BaseBackupCommand.py | 5 ++- .../BaseBackupCommand/CreateBackupCommand.py | 4 +-- .../BaseBackupCommand/RestoreBackupCommand.py | 34 +++++++++++++++++-- .../ParserBackup/CreateBackupParser.py | 2 +- .../parsers/ParserBackup/ParserBackupBase.py | 6 ---- .../ParserBackup/RestoreBackupParser.py | 3 +- 7 files changed, 39 insertions(+), 19 deletions(-) diff --git a/scripts/TouchinBuild/CommandBuilders/RestoreBackupCommandBuilder.py b/scripts/TouchinBuild/CommandBuilders/RestoreBackupCommandBuilder.py index 00f328d..0f391a1 100644 --- a/scripts/TouchinBuild/CommandBuilders/RestoreBackupCommandBuilder.py +++ b/scripts/TouchinBuild/CommandBuilders/RestoreBackupCommandBuilder.py @@ -18,7 +18,7 @@ class RestoreBackupCommandBuilder: assert line is not None parser = RestoreBackupParser() - folderPath = parser.parseLine(line) + parser.parseLine(line) - command = RestoreBackupCommand(folderPath) + command = RestoreBackupCommand() return command diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py index 74dcb22..95a4eb7 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/BaseBackupCommand.py @@ -12,16 +12,15 @@ class BaseBackupCommand: self.srcAbsDirPath = self.getAbsSrc() self.backupDirAbsPath = self.getAbsDst() - self.backupIgnore = ['.git', '.gitignore', '.DS_Store'] + self.backupIgnore = ['.git', '.gitignore', '.DS_Store', 'backup'] def getAbsSrc(self): return self.getAbs(self.folderPath) def getAbsDst(self): absFolderPath = self.getAbs(self.folderPath) - absParentDir = os.path.dirname(absFolderPath) - backupAbsPath = os.path.join(absParentDir, 'backup') + backupAbsPath = os.path.join(absFolderPath, 'backup') return backupAbsPath diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py index 0498a0b..32b76a9 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/CreateBackupCommand.py @@ -11,10 +11,10 @@ class CreateBackupCommand(BaseBackupCommand): if os.path.exists(self.backupDirAbsPath): raise Exception('folder: {0} already exists'.format(self.backupDirAbsPath)) - os.mkdir(self.backupDirAbsPath) - dirContent = os.listdir(self.srcAbsDirPath) + os.mkdir(self.backupDirAbsPath) + for fileOrDir in dirContent: if fileOrDir not in self.backupIgnore: self.copyFileOrDirectoryToBackupFolder(fileOrDir) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py index 9ec126c..08bddf5 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py @@ -8,6 +8,34 @@ class RestoreBackupCommand(BaseBackupCommand): BaseBackupCommand.__init__(self) def execute(self): - if os.path.exists(self.backupDirAbsPath): - shutil.rmtree(self.srcAbsDirPath, ignore_errors=True) - shutil.copytree(self.backupDirAbsPath, self.srcAbsDirPath, symlinks=False) + if not os.path.exists(self.backupDirAbsPath): + raise Exception('backup folder: {0} not exists'.format(self.backupDirAbsPath)) + + srcDirContent = os.listdir(self.srcAbsDirPath) + for fileOrDir in srcDirContent: + if fileOrDir not in self.backupIgnore: + self.removeFileOrDirectory(fileOrDir) + + backupDirContent = os.listdir(self.backupDirAbsPath) + for fileOrDir in backupDirContent: + self.copyFileOrDirectoryFromBackupFolder(fileOrDir) + + def removeFileOrDirectory(self, fileOrDirName): + + srcAbsPath = os.path.join(self.srcAbsDirPath, fileOrDirName) + + if os.path.isdir(srcAbsPath): + shutil.rmtree(srcAbsPath) + else: + os.remove(srcAbsPath) + + def copyFileOrDirectoryFromBackupFolder(self, fileOrDirName): + assert fileOrDirName is not None + + srcAbsPath = os.path.join(self.srcAbsDirPath, fileOrDirName) + fileInBackupFolderAbsPath = os.path.join(self.backupDirAbsPath, fileOrDirName) + + if os.path.isdir(srcAbsPath): + shutil.copytree(fileInBackupFolderAbsPath, srcAbsPath) + else: + shutil.copy(fileInBackupFolderAbsPath, srcAbsPath) diff --git a/scripts/TouchinBuild/parsers/ParserBackup/CreateBackupParser.py b/scripts/TouchinBuild/parsers/ParserBackup/CreateBackupParser.py index f42ccae..de31ee3 100644 --- a/scripts/TouchinBuild/parsers/ParserBackup/CreateBackupParser.py +++ b/scripts/TouchinBuild/parsers/ParserBackup/CreateBackupParser.py @@ -10,7 +10,7 @@ class CreateBackupParser(ParserBackupBase): def getMatchInfo(self, line): assert line is not None - regexpSource = self.startsWith('create') + self.spaceEndsWith('backup') + regexpSource = self.startsWith('create') + self.endsWith('backup') regexp = re.compile(regexpSource, re.UNICODE) match = regexp.match(line) diff --git a/scripts/TouchinBuild/parsers/ParserBackup/ParserBackupBase.py b/scripts/TouchinBuild/parsers/ParserBackup/ParserBackupBase.py index e80ba1b..05a560c 100644 --- a/scripts/TouchinBuild/parsers/ParserBackup/ParserBackupBase.py +++ b/scripts/TouchinBuild/parsers/ParserBackup/ParserBackupBase.py @@ -4,7 +4,6 @@ from parsers.LineParser import LineParser class ParserBackupBase(LineParser): def __init__(self): LineParser.__init__(self) - self.folderName = None def parseLine(self, line): assert line is not None @@ -15,11 +14,6 @@ class ParserBackupBase(LineParser): self._guardMatch(match, line, regexpSource) - folderName = match.group('folder') - self.folderName = folderName - - return self.folderName - def getMatchInfo(self, line): return None, None diff --git a/scripts/TouchinBuild/parsers/ParserBackup/RestoreBackupParser.py b/scripts/TouchinBuild/parsers/ParserBackup/RestoreBackupParser.py index 54285a6..3f1ca81 100644 --- a/scripts/TouchinBuild/parsers/ParserBackup/RestoreBackupParser.py +++ b/scripts/TouchinBuild/parsers/ParserBackup/RestoreBackupParser.py @@ -10,8 +10,7 @@ class RestoreBackupParser(ParserBackupBase): def getMatchInfo(self, line): assert line is not None - folderNameRegexp = r"'(?P[^']+)'$" - regexpSource = self.startsWith('restore') + self.than('from') + self.than('backup') + folderNameRegexp + regexpSource = self.startsWith('restore') + self.than('from') + self.endsWith('backup') regexp = re.compile(regexpSource, re.UNICODE) match = regexp.match(line) From e942ce40ecd039a0e30eaf83465f5bc764588c5a Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 15:39:20 +0400 Subject: [PATCH 11/17] =?UTF-8?q?=D0=9C=D0=BE=D0=B4=D0=B8=D1=84=D0=B8?= =?UTF-8?q?=D1=86=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=20=D1=80=D1=83=D1=87?= =?UTF-8?q?=D0=BD=D1=8B=D0=B5=20=D1=82=D0=B5=D1=81=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TouchinBuild/Tests/ManualTests/restore_backup_test.py | 2 +- scripts/TouchinBuild/run_manual_tests.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/TouchinBuild/Tests/ManualTests/restore_backup_test.py b/scripts/TouchinBuild/Tests/ManualTests/restore_backup_test.py index a966f43..a61e390 100644 --- a/scripts/TouchinBuild/Tests/ManualTests/restore_backup_test.py +++ b/scripts/TouchinBuild/Tests/ManualTests/restore_backup_test.py @@ -1,6 +1,6 @@ from CommandBuilders.RestoreBackupCommandBuilder import RestoreBackupCommandBuilder -line = "restore from backup 'BuildSample'" +line = "restore from backup" builder = RestoreBackupCommandBuilder() command = builder.getCommandFor(line) diff --git a/scripts/TouchinBuild/run_manual_tests.py b/scripts/TouchinBuild/run_manual_tests.py index 6ae322c..dd95dbe 100644 --- a/scripts/TouchinBuild/run_manual_tests.py +++ b/scripts/TouchinBuild/run_manual_tests.py @@ -4,14 +4,16 @@ scriptFilePath = os.path.abspath(__file__) scriptDir = os.path.dirname(scriptFilePath) baseDir = os.path.join(scriptDir, os.pardir, os.pardir) -os.chdir(baseDir) +baseDirAbsPath = os.path.abspath(baseDir) +os.chdir(baseDirAbsPath) +print 'current working dir: {0}'.format(baseDirAbsPath) #import Tests.ManualTests.csproj_test #import ManualTests.info_plist_test #import ManualTests.copy_test #import Tests.ManualTests.create_backup_test -import Tests.ManualTests.delete_backup_test -#import Tests.ManualTests.restore_backup_test +#import Tests.ManualTests.delete_backup_test +import Tests.ManualTests.restore_backup_test #import ManualTests.csproj_test #import ManualTests.run_sh_command #import ManualTests.make_dirs From 5270c5b8d03ca924de23b6b3780493f55dd9feac Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 15:49:26 +0400 Subject: [PATCH 12/17] =?UTF-8?q?=D0=B4=D0=B5=D0=B1=D0=B0=D0=B6=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=BF=D0=B5=D1=87=D0=B0=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/BaseBackupCommand/RestoreBackupCommand.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py index 08bddf5..a169020 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py @@ -35,6 +35,7 @@ class RestoreBackupCommand(BaseBackupCommand): srcAbsPath = os.path.join(self.srcAbsDirPath, fileOrDirName) fileInBackupFolderAbsPath = os.path.join(self.backupDirAbsPath, fileOrDirName) + print fileInBackupFolderAbsPath, srcAbsPath if os.path.isdir(srcAbsPath): shutil.copytree(fileInBackupFolderAbsPath, srcAbsPath) else: From b736419957d0e32c60ed38870c35f0736099ed98 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 15:54:46 +0400 Subject: [PATCH 13/17] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=20=D0=B2=D0=BE?= =?UTF-8?q?=D1=81=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B8=D0=B7=20=D0=B1=D1=8D=D0=BA=D0=B0=D0=BF?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/BaseBackupCommand/RestoreBackupCommand.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py index a169020..bcb0067 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py @@ -35,8 +35,7 @@ class RestoreBackupCommand(BaseBackupCommand): srcAbsPath = os.path.join(self.srcAbsDirPath, fileOrDirName) fileInBackupFolderAbsPath = os.path.join(self.backupDirAbsPath, fileOrDirName) - print fileInBackupFolderAbsPath, srcAbsPath - if os.path.isdir(srcAbsPath): + if os.path.isdir(fileInBackupFolderAbsPath): shutil.copytree(fileInBackupFolderAbsPath, srcAbsPath) else: shutil.copy(fileInBackupFolderAbsPath, srcAbsPath) From 2cf1510af9e5cc91c0359d2312d67ccf28bff9ea Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 16:04:14 +0400 Subject: [PATCH 14/17] =?UTF-8?q?=D0=9C=D0=BE=D0=B4=D0=B8=D1=84=D0=B8?= =?UTF-8?q?=D1=86=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=20=D0=BA=D0=BE=D0=BC?= =?UTF-8?q?=D0=BC=D0=B0=D0=BD=D0=B4=D1=83=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=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/DeleteBackupCommandBuilder.py | 4 ++-- scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py | 2 +- .../commands/BaseBackupCommand/DeleteBackupCommand.py | 4 ++++ .../TouchinBuild/parsers/ParserBackup/DeleteBackupParser.py | 3 +-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py b/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py index 5fd5b66..53e9238 100644 --- a/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py +++ b/scripts/TouchinBuild/CommandBuilders/DeleteBackupCommandBuilder.py @@ -18,7 +18,7 @@ class DeleteBackupCommandBuilder: assert line is not None parser = DeleteBackupParser() - folderPath = parser.parseLine(line) + parser.parseLine(line) - command = DeleteBackupCommand(folderPath) + command = DeleteBackupCommand() return command diff --git a/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py b/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py index 92f6b2e..4c312c4 100644 --- a/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py +++ b/scripts/TouchinBuild/Tests/ManualTests/delete_backup_test.py @@ -1,6 +1,6 @@ from CommandBuilders.DeleteBackupCommandBuilder import DeleteBackupCommandBuilder -line = "delete backup 'BuildSample'" +line = "delete backup" cmdBuilder = DeleteBackupCommandBuilder() command = cmdBuilder.getCommandFor(line) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py index 6cc0806..c29f5ce 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/DeleteBackupCommand.py @@ -1,3 +1,4 @@ +import os import shutil from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand @@ -7,4 +8,7 @@ class DeleteBackupCommand(BaseBackupCommand): BaseBackupCommand.__init__(self) def execute(self): + if not os.path.exists(self.backupDirAbsPath): + raise Exception('backup folder: {0} not exists'.format(self.backupDirAbsPath)) + shutil.rmtree(self.backupDirAbsPath, ignore_errors=True) diff --git a/scripts/TouchinBuild/parsers/ParserBackup/DeleteBackupParser.py b/scripts/TouchinBuild/parsers/ParserBackup/DeleteBackupParser.py index c210f32..936f4ec 100644 --- a/scripts/TouchinBuild/parsers/ParserBackup/DeleteBackupParser.py +++ b/scripts/TouchinBuild/parsers/ParserBackup/DeleteBackupParser.py @@ -10,8 +10,7 @@ class DeleteBackupParser(ParserBackupBase): def getMatchInfo(self, line): assert line is not None - folderNameRegexp = r"'(?P[^']+)'$" - regexpSource = self.startsWith('delete') + self.than('backup') + folderNameRegexp + regexpSource = self.startsWith('delete') + self.endsWith('backup') regexp = re.compile(regexpSource, re.UNICODE) match = regexp.match(line) From bfbc348d11e5554132c16582b45172da2d8ceb16 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 16:05:32 +0400 Subject: [PATCH 15/17] =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BE=D1=81=D0=BF?= =?UTF-8?q?=D0=BE=D1=81=D0=BE=D0=B1=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20=D1=83?= =?UTF-8?q?=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B1=D1=8D=D0=BA?= =?UTF-8?q?=D0=B0=D0=BF=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/TouchinBuild/run_manual_tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/TouchinBuild/run_manual_tests.py b/scripts/TouchinBuild/run_manual_tests.py index dd95dbe..2a4db75 100644 --- a/scripts/TouchinBuild/run_manual_tests.py +++ b/scripts/TouchinBuild/run_manual_tests.py @@ -12,8 +12,8 @@ print 'current working dir: {0}'.format(baseDirAbsPath) #import ManualTests.info_plist_test #import ManualTests.copy_test #import Tests.ManualTests.create_backup_test -#import Tests.ManualTests.delete_backup_test -import Tests.ManualTests.restore_backup_test +import Tests.ManualTests.delete_backup_test +#import Tests.ManualTests.restore_backup_test #import ManualTests.csproj_test #import ManualTests.run_sh_command #import ManualTests.make_dirs From 79aeb84055cda32f10df139b69754b0fcee2f550 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 16:06:56 +0400 Subject: [PATCH 16/17] =?UTF-8?q?=D0=B1=D1=8D=D0=BA=D0=B0=D0=BF=D0=B0=20?= =?UTF-8?q?=D0=BC=D0=BE=D0=B6=D0=B5=D1=82=20=D0=BD=D0=B5=20=D0=B1=D1=8B?= =?UTF-8?q?=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/BaseBackupCommand/RestoreBackupCommand.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py index bcb0067..403d5f7 100644 --- a/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py +++ b/scripts/TouchinBuild/commands/BaseBackupCommand/RestoreBackupCommand.py @@ -9,7 +9,7 @@ class RestoreBackupCommand(BaseBackupCommand): def execute(self): if not os.path.exists(self.backupDirAbsPath): - raise Exception('backup folder: {0} not exists'.format(self.backupDirAbsPath)) + return srcDirContent = os.listdir(self.srcAbsDirPath) for fileOrDir in srcDirContent: From 48da78e4237329fcae7aed1a49f55ddd38faedd5 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Tue, 12 Nov 2013 16:08:20 +0400 Subject: [PATCH 17/17] =?UTF-8?q?=D0=BC=D0=BE=D0=B4=D0=B8=D1=84=D0=B8?= =?UTF-8?q?=D1=86=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=20=D1=88=D0=B0=D0=B3?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/IosSteps.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/IosSteps.txt b/scripts/IosSteps.txt index 7a70b9b..d9259d9 100644 --- a/scripts/IosSteps.txt +++ b/scripts/IosSteps.txt @@ -12,5 +12,5 @@ sh cp -a BuildSample/BuildSample/Output/ Output/Appstore/ publish 'Output/Appstore/Artifacts/BuildSample-{@version}.ipa' to testflight notes = 'Hello' api_token = '{@tf_api_token}' team_token = '{@tf_team_token}' -restore from backup '.' -delete backup '.' \ No newline at end of file +restore from backup +delete backup \ No newline at end of file