переименовал папку backupParser ParserBackup потому что все что начинается с backup попадает в глобальный гит игнор

This commit is contained in:
rzaitov 2013-11-07 19:23:26 +04:00
parent 2ff6cce555
commit 225c9dea08
8 changed files with 94 additions and 3 deletions

View File

@ -1,5 +1,5 @@
from commands.CreateBackupCommand import CreateBackupCommand
from parsers.BackupParser.CreateBackupParser import CreateBackupParser
from parsers.ParserBackup.CreateBackupParser import CreateBackupParser
class CreateBackupCommandBuilder:

View File

@ -1,5 +1,5 @@
from commands.DeleteBackupCommand import DeleteBackupCommand
from parsers.BackupParser.DeleteBackupParser import DeleteBackupParser
from parsers.ParserBackup.DeleteBackupParser import DeleteBackupParser
class DeleteBackupCommandBuilder:

View File

@ -1,5 +1,5 @@
from commands.RestoreBackupCommand import RestoreBackupCommand
from parsers.BackupParser.RestoreBackupParser import RestoreBackupParser
from parsers.ParserBackup.RestoreBackupParser import RestoreBackupParser
class RestoreBackupCommandBuilder:

View File

@ -0,0 +1,11 @@
class CreateBackupArguments:
def __init__(self):
self.folderName = None
def getSourceFolderName(self):
return self.folderName
def getBackupFolderName(self):
return "backup.{0}".format(self.folderName)

View File

@ -0,0 +1,32 @@
import re
from parsers.ParserBackup.CreateBackupArguments import CreateBackupArguments
from parsers.LineParser import LineParser
class CreateBackupParser(LineParser):
def __init__(self):
LineParser.__init__(self)
self.__createBackupArguments = CreateBackupArguments()
def parseLine(self, line):
assert line is not None
folderNameRegexp = r"'(?P<folder>[^']+)'$"
regexpSource = self.startsWith('create backup 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

View File

@ -0,0 +1,23 @@
import re
from parsers.LineParser import LineParser
class DeleteBackupParser(LineParser):
def __init__(self):
LineParser.__init__(self)
def parseLine(self, line):
assert line is not None
regexpSource = r'delete backup\s*'
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

View File

@ -0,0 +1,24 @@
import re
from parsers.LineParser import LineParser
class RestoreBackupParser(LineParser):
def __init__(self):
LineParser.__init__(self)
def parseLine(self, line):
assert line is not None
regexpSource = r'restore from backup\s*'
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

View File

@ -0,0 +1 @@
__author__ = 'rzaitov'