Skip to content

Commit

Permalink
Accept packages with hyphens in their names
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Nov 20, 2015
1 parent 240f9dd commit 0885f9d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions Sources/dep/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,16 @@ public struct Package {
- Note: Throws if the Package manifest will not parse.
*/
public init?(path: String) throws {
let parts = path.basename.characters.split("-")

// Packages are git clones
guard let repo = Git.Repo(root: path) else { return nil }

// Packages have origins
guard let origin = repo.origin else { return nil }

// Packages have dirnames of the form foo-X.Y.Z
guard parts.count == 2 else { return nil }
guard let version = Version(parts[1]) else { return nil }
let parts = path.basename.characters.split("-")
guard parts.count >= 2 else { return nil }
guard let version = Version(parts.last!) else { return nil }

self.version = version
self.manifest = try Manifest(path: Path.join(path, Manifest.filename), baseURL: origin)
Expand Down
2 changes: 1 addition & 1 deletion Tests/dep/Fixtures/103-mattts-dealer/app/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PackageDescription
let package = Package(
name: "Dealer",
dependencies: [
.Package(url: "../DeckOfPlayingCards", versions: Version(1,1,0)..<Version(2,0,0)),
.Package(url: "../deck-of-playing-cards", versions: Version(1,1,0)..<Version(2,0,0)),
.Package(url: "../PlayingCard", versions: Version(1,1,0)..<Version(2,0,0)),
.Package(url: "../FisherYates", versions: Version(1,2,0)..<Version(2,0,0))
]
Expand Down

0 comments on commit 0885f9d

Please sign in to comment.