Нормализовал обработку комментариев в файле настроек

This commit is contained in:
rzaitov 2013-11-13 16:52:31 +04:00
parent ee6442ecd0
commit 94aea27f50
11 changed files with 67 additions and 22 deletions

View File

@ -5,14 +5,14 @@ sh echo '{@builder_path}'
sh echo hello from '{@author}'
sh echo version: '{@version}'
clean 'BuildSample/BuildSample.sln' for '{@sln_config}'
build 'BuildSample/BuildSample.sln' for '{@sln_config}'
#clean 'BuildSample/BuildSample.sln' for '{@sln_config}'
#build 'BuildSample/BuildSample.sln' for '{@sln_config}'
create dirs 'Output/Appstore/Artifacts'
copy 'BuildSample/BuildSample/Output/BuildSample-{@version}.ipa' to 'Output/Appstore/Artifacts'
sh cp -a BuildSample/BuildSample/Output/ Output/Appstore/
#create dirs 'Output/Appstore/Artifacts'
#copy 'BuildSample/BuildSample/Output/BuildSample-{@version}.ipa' to 'Output/Appstore/Artifacts'
#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}'
#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
#restore from backup
#delete backup

View File

@ -1,6 +1,9 @@
class CommentRemover:
from Core.LineConveyor.PreprocessorBase import PreprocessorBase
class CommentRemover(PreprocessorBase):
def __init__(self):
pass
PreprocessorBase.__init__(self)
def processText(self, line, conveyorProcessor):
assert line is not None

View File

@ -1,5 +1,10 @@
class MacroResolver:
from Core.LineConveyor.PreprocessorBase import PreprocessorBase
class MacroResolver(PreprocessorBase):
def __init__(self, macroProcessor, valueProvider):
PreprocessorBase.__init__(self)
assert macroProcessor is not None
assert valueProvider is not None

View File

@ -0,0 +1,9 @@
from Core.LineConveyor.PreprocessorBase import PreprocessorBase
class NullPreprocessor(PreprocessorBase):
def __init__(self):
PreprocessorBase.__init__(self)
def processText(self, text, conveyorProcessor):
return text

View File

@ -0,0 +1,12 @@
import abc
class PreprocessorBase:
__metaclass__ = abc.ABCMeta
def __init__(self):
pass
@abc.abstractmethod
def processText(self, line, conveyorProcessor):
pass

View File

@ -1,6 +1,9 @@
class Stripper:
from Core.LineConveyor.PreprocessorBase import PreprocessorBase
class Stripper(PreprocessorBase):
def __init__(self):
pass
PreprocessorBase.__init__(self)
def processText(self, line, conveyorProcessor):
assert line is not None

View File

@ -1,5 +1,9 @@
class TextConveyorPreprocessor:
from Core.LineConveyor.PreprocessorBase import PreprocessorBase
class TextConveyorPreprocessor(PreprocessorBase):
def __init__(self):
PreprocessorBase.__init__(self)
self.processors = []
def addProcessor(self, processor):

View File

@ -1,5 +1,10 @@
class TextInclude:
from Core.LineConveyor.PreprocessorBase import PreprocessorBase
class TextInclude(PreprocessorBase):
def __init__(self, includeProcessor, contentProvider):
PreprocessorBase.__init__(self)
assert includeProcessor is not None
assert contentProvider is not None

View File

@ -1,11 +1,13 @@
import unittest
from Core.LineConveyor.NullPreprocessor import NullPreprocessor
from parsers.SettingsParser.SettingsParser import SettingsParser
class TestSettingsParser(unittest.TestCase):
def setUp(self):
self.parser = SettingsParser()
self.preprocessor = NullPreprocessor()
self.parser = SettingsParser(self.preprocessor)
def test_processLine(self):
line1 = "x.y.name1 = 'value1'"
@ -38,15 +40,17 @@ class TestSettingsParser(unittest.TestCase):
self.assertEqual('value8', self.parser.settings['a']['z']['name2'])
def test_emptyLinesAndComments(self):
class PartialSettingsParser(SettingsParser):
def __init__(self):
SettingsParser.__init__(self)
def __init__(self, textPreprocessor):
SettingsParser.__init__(self, textPreprocessor)
self.processLineCall = 0
def processLine(self, line):
self.processLineCall += 1
print '{0} {1}'.format(self.processLineCall, line)
self.parser = PartialSettingsParser()
self.parser = PartialSettingsParser(self.preprocessor)
content = """
valid.line.with.setting = 'some value'
# this is comment
@ -56,6 +60,8 @@ valid.line.with.setting = 'some value'
self.parser.parse(content)
# всего 6 строк, 2 из которых пустые
# NullPreprocessor не уберет комментарии, поэтому будет 4 вызова processLine
self.assertEqual(2, self.parser.processLineCall)

View File

@ -24,8 +24,6 @@ class SettingsParser:
else:
self.processLine(processedLine)
self.processLine(processedLine)
def processLine(self, line):
assert line is not None

View File

@ -1,6 +1,6 @@
# global settings
build_tool = '/Applications/Xamarin\ Studio.app/Contents/MacOS/mdtool'
version = '0.0.0'
version = '0.0.0' # комментарий в тойже строке
configs = 'appstore, staging'
# ios platform settings