From 5fe8fe3976f7d690b160bee6eb26e889548f8383 Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Thu, 2 Jan 2020 09:38:38 +0100 Subject: [PATCH] Update README about "from:" refspec --- README.md | 13 +------------ Sources/SPMPlayground/Dependency.swift | 2 +- Tests/SPMPlaygroundTests/SPMPlaygroundTests.swift | 4 ++++ 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 6e22ab0..cd063e5 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ In case you want to fetch a particular revision, range of revisions, or branch, - `-d https://github.com/johnsundell/plot@from:0.1.0` - → `.package(url: "https://github.com/johnsundell/plot", "0.1.0"..<"1.0.0")` + → `.package(url: "https://github.com/johnsundell/plot", from: "0.1.0")` - `-d "https://github.com/johnsundell/plot@0.1.0..<4.0.0"` @@ -77,17 +77,6 @@ In case you want to fetch a particular revision, range of revisions, or branch, Make sure to properly quote the URL if you are using the `..<` range operator. -## Importing multiple packages - -You can import multiple dependencies into your Playground: - -``` -spm-playground -d https://github.com/johnsundell/plot https://github.com/hartbit/Yaap.git@from:1.0.0 -🔧 resolving package dependencies -📔 libraries found: Plot, Yaap -✅ created project in folder 'SPM-Playground' -``` - ## How to build and install You can build and install `spm-playground` via the included `Makefile` by running: diff --git a/Sources/SPMPlayground/Dependency.swift b/Sources/SPMPlayground/Dependency.swift index bf80fe0..93a4c4c 100644 --- a/Sources/SPMPlayground/Dependency.swift +++ b/Sources/SPMPlayground/Dependency.swift @@ -57,7 +57,7 @@ public struct Dependency: Equatable { case .exact(let v): return #".package(url: "\#(url.absoluteString)", .exact("\#(v)"))"# case .from(let v): - return #".package(url: "\#(url.absoluteString)", from:"\#(v)")"# + return #".package(url: "\#(url.absoluteString)", from: "\#(v)")"# case .path: return #".package(path: "\#(url.path)")"# case .range(let r): diff --git a/Tests/SPMPlaygroundTests/SPMPlaygroundTests.swift b/Tests/SPMPlaygroundTests/SPMPlaygroundTests.swift index e1da19b..b58ebfd 100644 --- a/Tests/SPMPlaygroundTests/SPMPlaygroundTests.swift +++ b/Tests/SPMPlaygroundTests/SPMPlaygroundTests.swift @@ -164,6 +164,10 @@ final class SPMPlaygroundTests: XCTestCase { let dep = Dependency(url: URL(string: "https://github.com/foo/bar")!, requirement: .exact("1.2.3")) XCTAssertEqual(dep.packageClause, #".package(url: "https://github.com/foo/bar", .exact("1.2.3"))"#) } + do { + let dep = Dependency(url: URL(string: "https://github.com/foo/bar")!, requirement: .from("1.2.3")) + XCTAssertEqual(dep.packageClause, #".package(url: "https://github.com/foo/bar", from: "1.2.3")"#) + } do { let dep = Dependency(url: URL(string: "https://github.com/foo/bar")!, requirement: .range("1.2.3"..<"2.3.4")) XCTAssertEqual(dep.packageClause, #".package(url: "https://github.com/foo/bar", "1.2.3"..<"2.3.4")"#)