Merge pull request #602 from tomquist/add-support-for-env-vars

Add additional spec for variable expension in combination with template attributes
This commit is contained in:
Yonas Kolb
2019-06-22 00:53:41 +10:00
committed by GitHub
3 changed files with 29 additions and 9 deletions
-5
View File
@@ -1,5 +0,0 @@
include: [included.yml]
name: NewName
settingGroups:
test:
MY_SETTING1: ${SETTING1}
+20
View File
@@ -0,0 +1,20 @@
include: [included.yml]
name: NewName
settingGroups:
test:
MY_SETTING1: ${SETTING1}
targets:
SomeTarget:
type: framework
platform: iOS
templates:
- Variables
templateAttributes:
templateVariable: templateVariable
variable: doesNotWin
targetTemplates:
Variables:
sources:
- ${target_name}
- ${variable}
- ${templateVariable}
@@ -187,15 +187,20 @@ class SpecLoadingTests: XCTestCase {
}
}
$0.it("expands environment variables") {
let path = fixturePath + "env_test.yml"
let project = try loadSpec(path: path, variables: ["SETTING1": "ENV VALUE1", "SETTING4": "ENV VALUE4"])
$0.it("expands variables") {
let path = fixturePath + "variables_test.yml"
let project = try loadSpec(path: path, variables: [
"SETTING1": "ENV VALUE1",
"SETTING4": "ENV VALUE4",
"variable": "doesWin"
])
try expect(project.name) == "NewName"
try expect(project.settingGroups) == [
"test": Settings(dictionary: ["MY_SETTING1": "ENV VALUE1", "MY_SETTING2": "VALUE2", "MY_SETTING4": "ENV VALUE4"]),
"test": Settings(dictionary: ["MY_SETTING1": "ENV VALUE1", "MY_SETTING2": "VALUE2", "MY_SETTING4": "ENV VALUE4"]),
"toReplace": Settings(dictionary: ["MY_SETTING1": "VALUE1"]),
]
try expect(project.targets.last?.sources) == ["SomeTarget", "doesWin", "templateVariable"]
}
}
}