Исправил предупреждения студии разработки

This commit is contained in:
rzaitov 2013-11-01 18:46:35 +04:00
parent 131c8abe7b
commit e18212094d
37 changed files with 89 additions and 39 deletions

View File

@ -1,6 +1,6 @@
from commands.CleanBuildCommands.BuildCommand import BuildCommand
from commands.CleanBuildCommands.CleanCommand import CleanCommand
from parser import CleanBuildParser
from parser.CleanBuildParser import CleanBuildParser
class CleanBuildCommandBuilder:

View File

@ -3,6 +3,9 @@ from parser.CopyParser.CopyLineParser import CopyLineParser
class CopyCommandBuilder:
def __init__(self):
pass
def isCopy(self, line):
assert line is not None

View File

@ -3,6 +3,9 @@ from parser.BackupParser.CreateBackupParser import CreateBackupParser
class CreateBackupCommandBuilder:
def __init__(self):
pass
def isCreateBackup(self, line):
assert line is not None

View File

@ -3,6 +3,9 @@ from parser.BackupParser.DeleteBackupParser import DeleteBackupParser
class DeleteBackupCommandBuilder:
def __init__(self):
pass
def isDeleteBackup(self, line):
assert line is not None

View File

@ -3,6 +3,9 @@ from parser.MakeDirsParser import MakeDirsParser
class MakeDirsCommandBuilder:
def __init__(self):
pass
def isMakeDirsCommand(self, line):
assert line is not None

View File

@ -3,6 +3,9 @@ from parser.InsideParser.InsideRemoveParser import InsideRemoveParser
class RemoveProjectCommandBuilder:
def __init__(self):
pass
def isRemoveProject(self, line):
assert line is not None

View File

@ -3,6 +3,9 @@ from parser.BackupParser.RestoreBackupParser import RestoreBackupParser
class RestoreBackupCommandBuilder:
def __init__(self):
pass
def isRestoreBackup(self, line):
assert line is not None

View File

@ -3,6 +3,9 @@ from parser.ShParser import ShParser
class ShCommandBuilder:
def __init__(self):
pass
def isShCommand(self, line):
assert line is not None

View File

@ -1,13 +1,9 @@
from CommandBuilders.CopyCommandBuilder import CopyCommandBuilder
from Tests.ManualTests.path_provider import PathProvider
line1 = "copy 'BuildSample/BuildSample.sln' to 'BuildSample/BuildSample.txt'"
line2 = "copy 'BuildSample/BuildSample/Profiles/8F606DAE-F9C9-4A19-8EFF-34B990D76C28.mobileprovision' to '~/Library/MobileDevice/Provisioning Profiles/BuildScript.mobileprovision'"
baseDir = '../'
path_provider = PathProvider(baseDir)
copyCmdBuilder = CopyCommandBuilder(path_provider)
copyCmdBuilder = CopyCommandBuilder()
#copyCmdToRel = copyCmdBuilder.getCommandFor(line1)
#copyCmdToRel.execute()

View File

@ -1,12 +1,8 @@
from CommandBuilders.CreateBackupCommandBuilder import CreateBackupCommandBuilder
from Tests.ManualTests.path_provider import PathProvider
line = "create backup for 'BuildSample'"
baseDir = '../'
path_provider = PathProvider(baseDir)
cmdBuilder = CreateBackupCommandBuilder(path_provider)
cmdBuilder = CreateBackupCommandBuilder()
command = cmdBuilder.getCommandFor(line)
command.execute()

View File

@ -1,14 +1,11 @@
from CommandBuilders.PatchCsprojCommandBuilder import PatchCsprojCommandBuilder
from Tests.ManualTests.path_provider import PathProvider
from commands.ValueProvider import ValueProvider
config = {'sln_config' : 'Release|iPhone'}
line = "inside 'BuildSample/BuildSample/CoolApp.csproj' set OutputPath to 'Output'"
base_dir = '../'
path_provider = PathProvider(base_dir)
value_provider = ValueProvider(config)
builder = PatchCsprojCommandBuilder(config, path_provider, value_provider)
builder = PatchCsprojCommandBuilder(config, value_provider)
command = builder.getCommandFor(line)
command.execute()

View File

@ -1,12 +1,8 @@
from CommandBuilders.DeleteBackupCommandBuilder import DeleteBackupCommandBuilder
from Tests.ManualTests.path_provider import PathProvider
line = "delete backup"
baseDir = '../'
path_provider = PathProvider(baseDir)
cmdBuilder = DeleteBackupCommandBuilder(path_provider)
cmdBuilder = DeleteBackupCommandBuilder()
command = cmdBuilder.getCommandFor(line)
command.execute()

View File

@ -1,12 +1,8 @@
from CommandBuilders.RestoreBackupCommandBuilder import RestoreBackupCommandBuilder
from Tests.ManualTests.path_provider import PathProvider
line = "restore from backup"
baseDir = '../'
path_provider = PathProvider(baseDir)
builder = RestoreBackupCommandBuilder(path_provider)
builder = RestoreBackupCommandBuilder()
command = builder.getCommandFor(line)
command.execute()

View File

@ -1,5 +1,4 @@
import unittest
from utils import BuildConfigProvider
from utils.BuildConfigProvider import BuildConfigProvider

View File

@ -40,6 +40,7 @@ class TestSettingsParser(unittest.TestCase):
def test_emptyLinesAndComments(self):
class PartialSettingsParser(SettingsParser):
def __init__(self):
SettingsParser.__init__(self)
self.processLineCall = 0
def processLine(self, line):

View File

@ -15,4 +15,4 @@ class CleanBuildCommandBase:
def execute(self):
cmdText = self.__commandPattern.format(self.__pathToBuildUtil, self.__slnConfig, self.__slnPath)
returnCode = call(cmdText, shell=True)
call(cmdText, shell=True)

View File

@ -2,6 +2,9 @@ import os
import shutil
class DeleteBackupCommand:
def __init__(self):
pass
def execute(self):
dirs = [name for name in os.listdir('.') if os.path.isdir(os.path.join('.', name)) & name.startswith('backup.')]
for d in dirs:

View File

@ -1,4 +1,4 @@
from utils import InfoPlistPatcher
from utils.InfoPlistPatcher import InfoPlistPatcher
class PatchInfoPlistCommand():

View File

@ -1,4 +1,4 @@
from utils import SlnPatcher
from utils.SlnPatcher import SlnPatcher
class RemoveProjectCommand:

View File

@ -3,6 +3,9 @@ import shutil
class RestoreBackupCommand:
def __init__(self):
pass
def execute(self):
dirPairs = [(name, "backup.{0}".format(name)) for name in os.listdir('.') if os.path.isdir(name) and not name.startswith('backup.')]

View File

@ -2,8 +2,11 @@ from utils.TestflightPublisher import TestFlightPublisher
class PublishToTestFlightCommand:
def __init__(self, api_token, team_token, notes):
self._publisher = TestFlightPublisher(api_token, team_token, notes)
def __init__(self, pathToFile, api_token, team_token, notes):
assert pathToFile is not None
self.__pathToFile = pathToFile
self.__publisher = TestFlightPublisher(api_token, team_token, notes)
def execute(self):
self._publisher.Publish()
self.__publisher.Publish(self.__pathToFile)

View File

@ -6,6 +6,7 @@ from parser.LineParser import LineParser
class CreateBackupParser(LineParser):
def __init__(self):
LineParser.__init__(self)
self.__createBackupArguments = CreateBackupArguments()
def parseLine(self, line):

View File

@ -4,6 +4,9 @@ from parser.LineParser import LineParser
class DeleteBackupParser(LineParser):
def __init__(self):
LineParser.__init__(self)
def parseLine(self, line):
assert line is not None

View File

@ -4,6 +4,9 @@ from parser.LineParser import LineParser
class RestoreBackupParser(LineParser):
def __init__(self):
LineParser.__init__(self)
def parseLine(self, line):
assert line is not None

View File

@ -5,6 +5,7 @@ from parser.LineParser import LineParser
class CleanBuildParser(LineParser):
def __init__(self, commandToken):
LineParser.__init__(self)
assert commandToken is not None
self.__commandToken = commandToken
@ -24,7 +25,7 @@ class CleanBuildParser(LineParser):
path = match.group('path')
slnConfig = match.group('config')
return (path, slnConfig)
return path, slnConfig
def isValidLine(self, line):
assert line is not None

View File

@ -6,6 +6,7 @@ from parser.LineParser import LineParser
class CopyLineParser(LineParser):
def __init__(self):
LineParser.__init__(self)
self.__copyArguments = CopyArguments()
def parseLine(self, line):
@ -29,5 +30,5 @@ class CopyLineParser(LineParser):
def isValidLine(self, line):
assert line is not None
isValid = line.startswith("copy");
isValid = line.startswith("copy")
return isValid

View File

@ -5,6 +5,7 @@ from parser.LineParser import LineParser
class InsideRemoveParser(LineParser):
def __init__(self, fileExt):
LineParser.__init__(self)
assert fileExt is not None
self.__extension = fileExt
@ -24,7 +25,7 @@ class InsideRemoveParser(LineParser):
filePath = match.group('file')
projectName = match.group('project')
return (filePath, projectName)
return filePath, projectName
def isValidLine(self, line):
regexpSrc = r"inside\s+'[./ a-zA-Z]+\.{0}'\s+remove".format(self.__extension)

View File

@ -5,6 +5,7 @@ from parser.LineParser import LineParser
class InsideSetParser(LineParser):
def __init__(self, value_provider, fileExt):
LineParser.__init__(self)
assert value_provider is not None
self.__value_provider = value_provider
@ -27,7 +28,7 @@ class InsideSetParser(LineParser):
key = match.group('key')
value = match.group('value')
return (filePath, key, value)
return filePath, key, value
def isValidLine(self, line):
regexpSrc = r"inside\s+'[./ a-zA-Z]+\.{0}'\s+set".format(self.__extension)

View File

@ -1,4 +1,7 @@
class LineParser:
def __init__(self):
pass
def parseLine(self, line):
assert line is not None
pass

View File

@ -4,6 +4,9 @@ from parser.LineParser import LineParser
class MakeDirsParser(LineParser):
def __init__(self):
LineParser.__init__(self)
def parseLine(self, line):
pathRegexp = r"'(?P<path>[^']+)'$"

View File

@ -1,4 +1,7 @@
class PathParser:
def __init__(self):
pass
def parse(self, line):
assert line is not None

View File

@ -5,6 +5,9 @@ from parser.SettingsParser.PathParser import PathParser
class SettingsLineParser(LineParser):
def __init__(self):
LineParser.__init__(self)
def parseLine(self, line):
assert line is not None
@ -37,4 +40,4 @@ class SettingsLineParser(LineParser):
propPath = match.group('prop_path')
value = match.group('value')
return (propPath, value)
return propPath, value

View File

@ -1,4 +1,7 @@
class SettingsMerger:
def __init__(self):
pass
def merge(self, globalSettings, settingDescription):
value = settingDescription['value']
segments = settingDescription['segments']
@ -25,7 +28,7 @@ class SettingsMerger:
def overrideGuard(self, dictionary, key, path):
if key in dictionary:
pathStr = '.'.joun(path)
pathStr = '.'.join(path)
msg = 'settings with name {0} by path {1} already exists with value {3}'.format(key, dictionary[key], pathStr)
raise Exception(msg)

View File

@ -4,6 +4,9 @@ from parser.LineParser import LineParser
class ShParser(LineParser):
def __init__(self):
LineParser.__init__(self)
def parseLine(self, line):
assert line

View File

@ -1,5 +1,6 @@
import os
from utils import BuildConfigProvider, FromFileSettingsProvider
from utils.BuildConfigProvider import BuildConfigProvider
from utils.FromFileSettingsProvider import FromFileSettingsProvider
scriptFilePath = os.path.abspath(__file__)
@ -12,6 +13,9 @@ from StepRunner.StepsRunner import StepsRunner
class TaskRunner:
def __init__(self):
pass
def run(self):
settingsProvider = FromFileSettingsProvider()
settings = settingsProvider.fetchSettings()

View File

@ -1,4 +1,7 @@
class BuildConfigProvider:
def __init__(self):
pass
def getConfigs(self, rootConfig):
leafs = []
self.traverseDict(None, rootConfig, leafs)

View File

@ -2,6 +2,9 @@ from parser.SettingsParser.SettingsParser import SettingsParser
class FromFileSettingsProvider:
def __init__(self):
pass
def fetchSettings(self):
settingsFile = open('scripts/settings.txt')
content = settingsFile.read()