реализовал комманду удаления проекта из решения и протестировал
This commit is contained in:
parent
4318a70207
commit
c52582ed29
|
|
@ -1,6 +1,6 @@
|
|||
from CommandBuilders.RemoveProjectCommandBuilder import RemoveProjectCommandBuilder
|
||||
|
||||
line = "inside 'BuildSample/BuildSample.sln' remove NotCompile project"
|
||||
line = "inside 'BuildSample/BuildSample.sln' remove NotCompileApp project"
|
||||
|
||||
builder = RemoveProjectCommandBuilder()
|
||||
command = builder.getCommandFor(line)
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
from parser.LineParser import LineParser
|
||||
import re
|
||||
|
||||
class InsideParser(LineParser):
|
||||
def __init__(self, value_provider, fileExt):
|
||||
assert value_provider is not None
|
||||
|
||||
self.__value_provider = value_provider
|
||||
self.__extension = fileExt
|
||||
|
||||
def parseLine(self, line):
|
||||
assert line is not None
|
||||
|
||||
filePathRegexp = r"'(?P<file>[./ a-zA-Z]+\.{0})'".format(self.__extension)
|
||||
keyRegexp = r'(?P<key>[a-zA-Z]+)'
|
||||
valueRegexp = r"'(?P<value>[^']+)'"
|
||||
|
||||
regexpSource = self.startsWithKeywordToken('inside') + filePathRegexp + self.keywordToken('set') + keyRegexp + self.keywordToken('to') + valueRegexp
|
||||
regexp = re.compile(regexpSource, re.UNICODE)
|
||||
|
||||
match = regexp.match(line)
|
||||
self._guardMatch(match, line, regexpSource)
|
||||
|
||||
filePath = match.group('file')
|
||||
key = match.group('key')
|
||||
value = match.group('value')
|
||||
|
||||
return (filePath, key, value)
|
||||
|
||||
def isValidLine(self, line):
|
||||
regexpSrc = r"inside\s+'[./ a-zA-Z]+\.{0}'\s+set".format(self.__extension)
|
||||
print regexpSrc
|
||||
regexp = re.compile(regexpSrc, re.UNICODE)
|
||||
|
||||
match = regexp.match(line)
|
||||
return match is not None
|
||||
|
|
@ -14,7 +14,7 @@ class InsideRemoveParser(LineParser):
|
|||
filePathRegexp = r"'(?P<file>[./ a-zA-Z]+\.{0})'".format(self.__extension)
|
||||
projectNameRegexp = r'(?P<project>[.a-zA-Z]+)'
|
||||
|
||||
regexpSource = self.startsWithKeywordToken('inside') + filePathRegexp + self.keywordToken('remove') + projectNameRegexp + self.keywordToken('project')
|
||||
regexpSource = self.startsWithKeywordToken('inside') + filePathRegexp + self.keywordToken('remove') + projectNameRegexp + self.endsWithKeywordToken('project')
|
||||
regexp = re.compile(regexpSource, re.UNICODE)
|
||||
|
||||
match = regexp.match(line)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@ class LineParser:
|
|||
assert keyword is not None
|
||||
return r'^' + keyword + r'\s+'
|
||||
|
||||
def endsWithKeywordToken(self, keyword):
|
||||
assert keyword is not None
|
||||
return r'\s+' + keyword + '$'
|
||||
|
||||
def _guardMatch(self, match_object, source, regexpSource = None):
|
||||
if match_object is None:
|
||||
msg = 'Recognition exception: "{0}" for "{1}"'.format(source, regexpSource)
|
||||
|
|
|
|||
Loading…
Reference in New Issue