Fix that input files cannot be specified directly in Run script in Input Files form.

This commit is contained in:
Filip Dolník 2016-09-22 09:25:10 +02:00
parent a4dfb0e301
commit 6d60a13415
2 changed files with 9 additions and 3 deletions

View File

@ -23,7 +23,8 @@ public struct GenerateMocksCommand: CommandType {
public let function = "Generates mock files"
public func run(_ options: Options) -> Result<Void, CuckooGeneratorError> {
let tokens = options.files.map { File(path: $0) }.flatMap { $0 }.map { Tokenizer(sourceFile: $0).tokenize() }
let inputPaths = Set(options.files.map { Path($0).absolute.standardRawValue })
let tokens = inputPaths.flatMap { File(path: $0) }.map { Tokenizer(sourceFile: $0).tokenize() }
let parsedFiles = options.noClassMocking ? removeClasses(tokens) : tokens
let headers = parsedFiles.map { options.noHeader ? "" : FileHeaderHandler.getHeader($0, withTimestamp: !options.noTimestamp) }

9
run
View File

@ -9,5 +9,10 @@ if [ ! -e $FILE_PATH ]; then
./build_generator
cd $CURRENT_PWD
fi
$FILE_PATH/Contents/MacOS/cuckoo_generator "$@"
INPUT_FILES=""
for (( i=0; i<SCRIPT_INPUT_FILE_COUNT; i++ ))
do
VARIABLE=SCRIPT_INPUT_FILE_${i}
INPUT_FILES+=" "${!VARIABLE}
done
$FILE_PATH/Contents/MacOS/cuckoo_generator "$@" ${INPUT_FILES}