From f6e3a604a6330026b2234c56d7ddc0c8296e203d Mon Sep 17 00:00:00 2001 From: Liam Nichols Date: Tue, 24 Dec 2019 11:44:56 +0000 Subject: [PATCH 1/3] Update PackageReference.gitPath computation to support Git Repository names containing a period --- Sources/MintKit/PackageReference.swift | 2 +- Tests/MintTests/PackageTests.swift | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/MintKit/PackageReference.swift b/Sources/MintKit/PackageReference.swift index 6370896..4c051fc 100644 --- a/Sources/MintKit/PackageReference.swift +++ b/Sources/MintKit/PackageReference.swift @@ -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" diff --git a/Tests/MintTests/PackageTests.swift b/Tests/MintTests/PackageTests.swift index f1eb5b4..5c4acae 100644 --- a/Tests/MintTests/PackageTests.swift +++ b/Tests/MintTests/PackageTests.swift @@ -33,6 +33,7 @@ class PackageTests: XCTestCase { "https://mycustomdomain.com/package": "https://mycustomdomain.com/package", "https://mycustomdomain.com/package.git": "https://mycustomdomain.com/package.git", "git@github.com:yonaskolb/Mint.git": "git@github.com:yonaskolb/Mint.git", + "mac-cain13/R.swift": "https://github.com/mac-cain13/R.swift.git", ] for (url, expected) in urls { From 9f4e2a60ed805129c39c230bea8e072e61cf6685 Mon Sep 17 00:00:00 2001 From: Liam Nichols Date: Tue, 24 Dec 2019 11:58:28 +0000 Subject: [PATCH 2/3] Add tests to verify bug with PackageReference.name property and resolve --- Sources/MintKit/PackageReference.swift | 2 +- Tests/MintTests/PackageTests.swift | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Sources/MintKit/PackageReference.swift b/Sources/MintKit/PackageReference.swift index 4c051fc..074b389 100644 --- a/Sources/MintKit/PackageReference.swift +++ b/Sources/MintKit/PackageReference.swift @@ -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 { diff --git a/Tests/MintTests/PackageTests.swift b/Tests/MintTests/PackageTests.swift index 5c4acae..5aa5333 100644 --- a/Tests/MintTests/PackageTests.swift +++ b/Tests/MintTests/PackageTests.swift @@ -41,6 +41,29 @@ class PackageTests: XCTestCase { } } + 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", + "git@github.com: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", + "git@github.com: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")) From bd16976d9c7611b3decf8d15d651af8d84721483 Mon Sep 17 00:00:00 2001 From: Liam Nichols Date: Sun, 5 Jan 2020 13:46:13 +0000 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e082f26..392f4ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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