mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
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:
@@ -1,5 +0,0 @@
|
||||
include: [included.yml]
|
||||
name: NewName
|
||||
settingGroups:
|
||||
test:
|
||||
MY_SETTING1: ${SETTING1}
|
||||
@@ -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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user