Merge branch 'BS-45'
This commit is contained in:
commit
6953034312
|
|
@ -1,4 +1,4 @@
|
|||
from commands.ShCommand import ShCommand
|
||||
from commands.ShTextCommand import ShTextCommand
|
||||
from parsers.ShParser import ShParser
|
||||
|
||||
|
||||
|
|
@ -19,5 +19,5 @@ class ShCommandBuilder:
|
|||
|
||||
cmdText = parser.parseLine(line)
|
||||
|
||||
command = ShCommand(cmdText)
|
||||
command = ShTextCommand(cmdText)
|
||||
return command
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import abc
|
||||
|
||||
|
||||
class PreprocessorBase:
|
||||
class PreprocessorBase(object):
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
def __init__(self):
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from Core.LineConveyor.NullPreprocessor import NullPreprocessor
|
||||
from Core.SettingsProviderBase import SettingsProviderBase
|
||||
from parsers.SettingsParser.SettingsParser import SettingsParser
|
||||
|
||||
|
|
@ -10,7 +11,9 @@ class SettingsProviderStub(SettingsProviderBase):
|
|||
self.settingsText = settingsText
|
||||
|
||||
def fetchSettings(self):
|
||||
parser = SettingsParser()
|
||||
preprocessor = NullPreprocessor()
|
||||
|
||||
parser = SettingsParser(preprocessor, None)
|
||||
parser.parse(self.settingsText)
|
||||
|
||||
return parser.settings
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
from Core.ContentProviderBase import ContentProviderBase
|
||||
from Core.LineConveyor.NullPreprocessor import NullPreprocessor
|
||||
from Tests.Common.SettingsProviderStub import SettingsProviderStub
|
||||
from taskRunner import TaskRunner
|
||||
from utils.BuildConfigProvider.BuildConfigProvider import BuildConfigProvider
|
||||
|
||||
settingsText = """
|
||||
build_tool = '/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool'
|
||||
|
|
@ -42,6 +44,9 @@ class ContentProviderMock(ContentProviderBase):
|
|||
settingsProvider = SettingsProviderStub(settingsText)
|
||||
contentProvider = ContentProviderMock()
|
||||
|
||||
taskRunner = TaskRunner(settingsProvider, contentProvider)
|
||||
buildConfigProvider = BuildConfigProvider()
|
||||
preprocessor = NullPreprocessor()
|
||||
|
||||
taskRunner = TaskRunner(settingsProvider, contentProvider, buildConfigProvider, preprocessor)
|
||||
|
||||
taskRunner.run()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from Core.ContentProviderBase import ContentProviderBase
|
||||
from Core.LineConveyor.NullPreprocessor import NullPreprocessor
|
||||
from Tests.Common.SettingsProviderStub import SettingsProviderStub
|
||||
from taskRunner import TaskRunner
|
||||
from utils.BuildConfigProvider.BuildConfigProvider import BuildConfigProvider
|
||||
|
|
@ -37,8 +38,9 @@ buildConfigProvider = BuildConfigProvider()
|
|||
resolvedBuildConfigProvider = ResolvedBuildConfigProvider(buildConfigProvider)
|
||||
|
||||
contentProvider = ContentProviderMock()
|
||||
preprocessor = NullPreprocessor()
|
||||
|
||||
taskRunner = TaskRunner(settingsProvider, contentProvider, resolvedBuildConfigProvider)
|
||||
taskRunner = TaskRunner(settingsProvider, contentProvider, resolvedBuildConfigProvider, preprocessor)
|
||||
|
||||
taskRunner.run()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from commands.ShCommand import ShCommand
|
||||
from commands.ShTextCommand import ShTextCommand
|
||||
|
||||
calendarCommand = ShCommand('cal 12 2013')
|
||||
calendarCommand = ShTextCommand('cal 12 2013')
|
||||
calendarCommand.execute()
|
||||
|
||||
touchCommand = ShCommand('touch ../tmp.txt')
|
||||
touchCommand = ShTextCommand('touch ../tmp.txt')
|
||||
touchCommand.execute()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import unittest
|
||||
from Tests.UnitTests.LineParserTestCaseBase import LineParserTestCaseBase
|
||||
from parsers.InsideParser.InsideSetArrayParser import InsideSetArrayParser
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
__author__ = 'rzaitov'
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
import unittest
|
||||
from commands.ShellCommandBase import ShellCommandBase
|
||||
|
||||
|
||||
class MyShellCommand(ShellCommandBase):
|
||||
def __init__(self, execWithError=False):
|
||||
ShellCommandBase.__init__(self)
|
||||
self.execWithError = execWithError
|
||||
|
||||
def execute(self):
|
||||
cmdText = 'exit 1' if self.execWithError else 'exit 0'
|
||||
self.executeShell(cmdText)
|
||||
|
||||
|
||||
class TestShellCommand(unittest.TestCase):
|
||||
def test_noError(self):
|
||||
cmd = MyShellCommand(execWithError=False)
|
||||
cmd.execute()
|
||||
|
||||
def test_withError(self):
|
||||
cmd = MyShellCommand(execWithError=True)
|
||||
|
||||
with self.assertRaises(Exception):
|
||||
cmd.execute()
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from commands.CommandBase import CommandBase
|
||||
|
||||
|
||||
class BaseBackupCommand:
|
||||
class BaseBackupCommand(CommandBase):
|
||||
def __init__(self):
|
||||
CommandBase.__init__(self)
|
||||
self.folderPath = '.'
|
||||
|
||||
# вычислять абсолютные пути надо на этапе создания комманды
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
from subprocess import call
|
||||
from commands.ShellCommandBase import ShellCommandBase
|
||||
|
||||
|
||||
class CleanBuildCommandBase:
|
||||
class CleanBuildCommandBase(ShellCommandBase):
|
||||
def __init__(self, commandPattern, pathToBuildUtil, slnPath, slnConfig):
|
||||
ShellCommandBase.__init__(self)
|
||||
|
||||
assert commandPattern is not None
|
||||
assert pathToBuildUtil is not None
|
||||
assert slnPath is not None
|
||||
|
|
@ -15,4 +17,5 @@ class CleanBuildCommandBase:
|
|||
|
||||
def execute(self):
|
||||
cmdText = self.__commandPattern.format(self.__pathToBuildUtil, self.__slnConfig, self.__slnPath)
|
||||
call(cmdText, shell=True)
|
||||
|
||||
self.executeShell(cmdText)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
import abc
|
||||
|
||||
|
||||
class CommandBase(object):
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def execute(self):
|
||||
pass
|
||||
|
|
@ -1,8 +1,12 @@
|
|||
import shutil
|
||||
import os
|
||||
from commands.CommandBase import CommandBase
|
||||
|
||||
class CopyCommand:
|
||||
|
||||
class CopyCommand(CommandBase):
|
||||
def __init__(self, copyArguments):
|
||||
CommandBase.__init__(self)
|
||||
|
||||
assert copyArguments is not None
|
||||
|
||||
self.__copyArguments = copyArguments
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
from commands.ShCommand import ShCommand
|
||||
from commands.ShTextCommand import ShTextCommand
|
||||
|
||||
|
||||
class MakeDirsCommand:
|
||||
class MakeDirsCommand(ShTextCommand):
|
||||
def __init__(self, path):
|
||||
assert path is not None
|
||||
self.path = path
|
||||
|
||||
self.__path = path
|
||||
|
||||
def execute(self):
|
||||
cmdText = "mkdir -p '{0}'".format(self.__path)
|
||||
innerCommand = ShCommand(cmdText)
|
||||
innerCommand.execute()
|
||||
cmdText = "mkdir -p '{0}'".format(self.path)
|
||||
ShTextCommand.__init__(self, cmdText)
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
from commands.CommandBase import CommandBase
|
||||
import utils.CsprojPatcher as csproj
|
||||
|
||||
class PatchCsprojCommand():
|
||||
class PatchCsprojCommand(CommandBase):
|
||||
def __init__(self, csprojAbsPath, key, value, slnConfig):
|
||||
CommandBase.__init__(self)
|
||||
|
||||
assert csprojAbsPath is not None
|
||||
assert key is not None
|
||||
assert value is not None
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
from commands.CommandBase import CommandBase
|
||||
from utils.InfoPlistPatcher import InfoPlistPatcher
|
||||
|
||||
|
||||
class PatchInfoPlistCommand():
|
||||
class PatchInfoPlistCommand(CommandBase):
|
||||
def __init__(self, pathToPlist, key, value):
|
||||
CommandBase.__init__(self)
|
||||
|
||||
assert pathToPlist is not None
|
||||
assert key is not None
|
||||
assert value is not None
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
from commands.CommandBase import CommandBase
|
||||
from utils.SlnPatcher import SlnPatcher
|
||||
|
||||
|
||||
class RemoveProjectCommand:
|
||||
class RemoveProjectCommand(CommandBase):
|
||||
def __init__(self, slnPath, projectName):
|
||||
CommandBase.__init__(self)
|
||||
|
||||
assert slnPath is not None
|
||||
assert projectName is not None
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
from subprocess import call
|
||||
|
||||
|
||||
class ShCommand:
|
||||
def __init__(self, commandText):
|
||||
assert commandText is not None
|
||||
|
||||
self.__commandText = commandText
|
||||
|
||||
def execute(self):
|
||||
call(self.__commandText, shell=True)
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
from commands.ShellCommandBase import ShellCommandBase
|
||||
|
||||
|
||||
class ShTextCommand(ShellCommandBase):
|
||||
def __init__(self, commandText):
|
||||
ShellCommandBase.__init__(self)
|
||||
assert commandText is not None
|
||||
|
||||
self.commandText = commandText
|
||||
|
||||
def execute(self):
|
||||
self.executeShell(self.commandText)
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
from commands.CommandBase import CommandBase
|
||||
from subprocess import call
|
||||
|
||||
|
||||
class ShellCommandBase(CommandBase):
|
||||
def __init__(self):
|
||||
CommandBase.__init__(self)
|
||||
|
||||
def executeShell(self, commandText):
|
||||
assert commandText is not None
|
||||
|
||||
retCode = call(commandText, shell=True)
|
||||
|
||||
if retCode != 0:
|
||||
msg = 'problem with shell command: {0}'.format(commandText)
|
||||
raise Exception(msg)
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
from commands.CommandBase import CommandBase
|
||||
from utils.TestflightPublisher import TestFlightPublisher
|
||||
|
||||
|
||||
class TestflightCommand:
|
||||
class TestflightCommand(CommandBase):
|
||||
def __init__(self, pathToFile, api_token, team_token, notes):
|
||||
CommandBase.__init__(self)
|
||||
|
||||
assert pathToFile is not None
|
||||
|
||||
self.__pathToFile = pathToFile
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class InsideParserBase(object, LineParser):
|
|||
|
||||
@abc.abstractmethod
|
||||
def getMatchInfo(self, line):
|
||||
"Not implemented"
|
||||
# "Not implemented"
|
||||
return None, None
|
||||
|
||||
def fetchMatchFor(self, text):
|
||||
|
|
|
|||
Loading…
Reference in New Issue