mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2026-03-18 20:02:25 +00:00
Fix review suggestions
This commit is contained in:
@@ -82,9 +82,9 @@ public struct SpecFile {
|
||||
}
|
||||
}
|
||||
|
||||
public func resolvedDictionary(environmentVariables: [String: String] = ProcessInfo.processInfo.environment) -> JSONDictionary {
|
||||
public func resolvedDictionary(variables: [String: String] = [:]) -> JSONDictionary {
|
||||
var resolvedSpec = resolvingPaths().mergedDictionary()
|
||||
for (key, value) in environmentVariables {
|
||||
for (key, value) in variables {
|
||||
resolvedSpec = resolvedSpec.replaceString("${\(key)}", with: value)
|
||||
}
|
||||
return resolvedSpec
|
||||
|
||||
@@ -58,7 +58,7 @@ class GenerateCommand: Command {
|
||||
|
||||
// load project spec
|
||||
do {
|
||||
project = try specLoader.loadProject(path: projectSpecPath)
|
||||
project = try specLoader.loadProject(path: projectSpecPath, variables: ProcessInfo.processInfo.environment)
|
||||
info("Loaded project:\n \(project.debugDescription.replacingOccurrences(of: "\n", with: "\n "))")
|
||||
} catch {
|
||||
throw GenerationError.projectSpecParsingError(error)
|
||||
|
||||
@@ -15,9 +15,9 @@ public class SpecLoader {
|
||||
self.version = version
|
||||
}
|
||||
|
||||
public func loadProject(path: Path, environmentVariables: [String: String] = ProcessInfo.processInfo.environment) throws -> Project {
|
||||
public func loadProject(path: Path, variables: [String: String] = [:]) throws -> Project {
|
||||
let spec = try SpecFile(path: path)
|
||||
let resolvedDictionary = spec.resolvedDictionary(environmentVariables: environmentVariables)
|
||||
let resolvedDictionary = spec.resolvedDictionary(variables: variables)
|
||||
let project = try Project(basePath: spec.basePath, jsonDictionary: resolvedDictionary)
|
||||
|
||||
self.project = project
|
||||
|
||||
Reference in New Issue
Block a user