Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Master

## 0.14.0

#### Fixed
- Fixed a bug that prevented the `Mintfile` from resolving a GitHub repository where the name contains a period [#153](https://github.com/yonaskolb/Mint/pull/153) @liamnichols

[Commits](https://github.com/yonaskolb/Mint/compare/0.13.0...0.14.0)

## 0.13.0

#### Added
Expand Down
4 changes: 2 additions & 2 deletions Sources/MintKit/PackageReference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class PackageReference {
}

public var name: String {
return repo.components(separatedBy: "/").last!.components(separatedBy: ".").first!
return repo.components(separatedBy: "/").last!.replacingOccurrences(of: ".git", with: "")
}

public var gitPath: String {
Expand All @@ -53,7 +53,7 @@ public class PackageReference {
return repo
} else if repo.contains("github.com") {
return "https://\(repo).git"
} else if repo.contains(".") {
} else if repo.components(separatedBy: "/").first!.contains(".") {
return "https://\(repo)"
} else {
return "https://github.com/\(repo).git"
Expand Down
24 changes: 24 additions & 0 deletions Tests/MintTests/PackageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,37 @@ class PackageTests: XCTestCase {
"https://mycustomdomain.com/package": "https://mycustomdomain.com/package",
"https://mycustomdomain.com/package.git": "https://mycustomdomain.com/package.git",
"[email protected]:yonaskolb/Mint.git": "[email protected]:yonaskolb/Mint.git",
"mac-cain13/R.swift": "https://github.com/mac-cain13/R.swift.git",
]

for (url, expected) in urls {
XCTAssertEqual(PackageReference(repo: url).gitPath, expected)
}
}

func testPackageNames() {

let urls: [String: String] = [
"yonaskolb/mint": "mint",
"github.com/yonaskolb/mint": "mint",
"https://github.com/yonaskolb/mint": "mint",
"https://github.com/yonaskolb/mint.git": "mint",
"mycustomdomain.com/package": "package",
"mycustomdomain.com/package.git": "package",
"https://mycustomdomain.com/package": "package",
"https://mycustomdomain.com/package.git": "package",
"[email protected]:yonaskolb/Mint.git": "Mint",
"mac-cain13/R.swift": "R.swift",
"github.com/mac-cain13/R.swift": "R.swift",
"https://github.com/mac-cain13/R.swift.git": "R.swift",
"[email protected]:mac-cain13/R.swift.git": "R.swift",
]

for (url, expected) in urls {
XCTAssertEqual(PackageReference(repo: url).name, expected)
}
}

func testPackageReferenceInfo() {

XCTAssertEqual(PackageReference(package: "yonaskolb/mint"), PackageReference(repo: "yonaskolb/mint"))
Expand Down