вычисляю пути для бэкапа на этапе создания комманд

This commit is contained in:
rzaitov 2013-11-12 13:00:02 +04:00
parent 42863417cb
commit e2601db9d5
6 changed files with 15 additions and 20 deletions

View File

@ -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

View File

@ -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'
restore from backup '.'
delete backup '.'

View File

@ -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)

View File

@ -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)
shutil.rmtree(self.backupAbsPath, ignore_errors=True)
shutil.copytree(self.srcAbsPath, self.backupAbsPath, symlinks=False)

View File

@ -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)

View File

@ -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)