Fix issues in Sources

Sources

sources
This commit is contained in:
David Jennes
2018-09-20 05:10:18 +02:00
parent 799490198f
commit 3f4622f54f
21 changed files with 346 additions and 350 deletions

View File

@@ -1,13 +1,11 @@
import Foundation
import PathKit
public protocol Loader {
func loadTemplate(name: String, environment: Environment) throws -> Template
func loadTemplate(names: [String], environment: Environment) throws -> Template
}
extension Loader {
public func loadTemplate(names: [String], environment: Environment) throws -> Template {
for name in names {
@@ -24,7 +22,6 @@ extension Loader {
}
}
// A class for loading a template from disk
public class FileSystemLoader: Loader, CustomStringConvertible {
public let paths: [Path]
@@ -35,7 +32,7 @@ public class FileSystemLoader: Loader, CustomStringConvertible {
public init(bundle: [Bundle]) {
self.paths = bundle.map {
return Path($0.bundlePath)
Path($0.bundlePath)
}
}
@@ -74,7 +71,6 @@ public class FileSystemLoader: Loader, CustomStringConvertible {
}
}
public class DictionaryLoader: Loader {
public let templates: [String: String]
@@ -101,7 +97,6 @@ public class DictionaryLoader: Loader {
}
}
extension Path {
func safeJoin(path: Path) throws -> Path {
let newPath = self + path
@@ -114,7 +109,6 @@ extension Path {
}
}
class SuspiciousFileOperation: Error {
let basePath: Path
let path: Path