     }
 
     public static func findDependenciesInsertLocation(in manifest: String) throws -> (line: Int, indentation: Int) {
-        let previousPackagesRegex = Regex("url: \"(\\S+)\",(.+)\\)")
-        let dependenciesRegex = Regex("dependencies:\\s?\\[")
-        let targetsRegex = Regex("target\\(", options: .ignoreCase)
-
         let previousPackages = previousPackagesRegex.allMatches(in: manifest)
         if previousPackages.count > 0 {
             guard let lastPackageLocation = previousPackagesRegex.lineNumbersOfMatches(in: manifest).last else {

    }

    public static func insert(package: Repository, requirement: Requirement, into manifest: String) throws -> String {
        guard !manifest.contains(package.nameWithOwner) else { throw Error.packageAlreadyExists }

        let swiftVersion = SwiftVersion.guessVersion(fromPackageContents: manifest)
        let (line, indentation) = try findDependenciesInsertLocation(in: manifest)

import Regex

public enum Manifest {

    static let previousPackagesRegex = Regex("url: \"(\\S+)\",(.+)\\)")
    static let dependenciesRegex = Regex("dependencies:\\s?\\[")
    static let singleLineDependenciesRegex = Regex("dependencies:\\s?\\[ *\\]")
    static let targetsRegex = Regex("target\\(", options: .ignoreCase)

    public enum Error: Swift.Error {
        case unsupportedLayout(reason: String)
