Skip to content

Commit

Permalink
Update README about "from:" refspec
Browse files Browse the repository at this point in the history
  • Loading branch information
finestructure committed Jan 2, 2020
1 parent a6fe1c4 commit 5fe8fe3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]..<4.0.0"`

Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Sources/SPMPlayground/Dependency.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions Tests/SPMPlaygroundTests/SPMPlaygroundTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")"#)
Expand Down

0 comments on commit 5fe8fe3

Please sign in to comment.