From 8c4690188ff8ac90bf454db184184786f34b2950 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Thu, 31 Oct 2013 14:19:25 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BB=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=80=D0=BE=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B=20=D0=BE=D1=87=D0=B8?= =?UTF-8?q?=D1=81=D1=82=D0=BA=D0=B8=20=D0=B8=20=D1=81=D0=B1=D0=BE=D1=80?= =?UTF-8?q?=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CleanBuildCommandBuilder.py | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 scripts/CommandBuilders/CleanBuildCommandBuilder.py diff --git a/scripts/CommandBuilders/CleanBuildCommandBuilder.py b/scripts/CommandBuilders/CleanBuildCommandBuilder.py new file mode 100644 index 0000000..e7cbd80 --- /dev/null +++ b/scripts/CommandBuilders/CleanBuildCommandBuilder.py @@ -0,0 +1,44 @@ +from commands.CleanBuildCommands.BuildCommand import BuildCommand +from commands.CleanBuildCommands.CleanCommand import CleanCommand +from parser.CleanBuildParser.CleanBuildParser import CleanBuildParser + + +class CleanBuildCommandBuilder: + def __init__(self, pathToBuildUtil, commandToken): + assert pathToBuildUtil is not None + assert commandToken is not None + + self.__pathToBuildUtil = pathToBuildUtil + self.__commandToken = commandToken + + def isCleanBuild(self, line): + assert line is not None + + parser = CleanBuildParser(self.__commandToken) + isValid = parser.isValidLine(line) + + return isValid + + def getCommandFor(self, line): + assert line is not None + + parser = CleanBuildParser(self.__commandToken) + result = parser.parseLine(line) + + slnPath = result[0] + slnConf = result[1] + + command = self.__getCommandByToken(slnPath, slnConf) + return command + + def __getCommandByToken(self, slnPath, slnConfig): + command = None + + if self.__commandToken == 'clean': + command = CleanCommand(self.__pathToBuildUtil, slnPath, slnConfig) + elif self.__commandToken == 'build': + command = BuildCommand(self.__pathToBuildUtil, slnConfig, slnConfig) + else: + raise Exception('unrecognised command token {0}'.format(self.__commandToken)) + + return command \ No newline at end of file