Skip to content

Commit

Permalink
Merge pull request Carthage#2140 from Carthage/binaryproject-file-scheme
Browse files Browse the repository at this point in the history
[BinaryProject] Add `file` scheme support
  • Loading branch information
mdiep committed Sep 1, 2017
2 parents 708ca93 + 6d3d619 commit e2af187
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/CarthageKit/BinaryProject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public struct BinaryProject {
guard let binaryURL = URL(string: value) else {
return .failure(BinaryJSONError.invalidURL(value))
}
guard binaryURL.scheme == "https" else {
guard binaryURL.scheme == "file" || binaryURL.scheme == "https" else {
return .failure(BinaryJSONError.nonHTTPSURL(binaryURL))
}

Expand Down
11 changes: 11 additions & 0 deletions Tests/CarthageKitTests/BinaryProjectSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ class BinaryProjectSpec: QuickSpec {

expect(actualError) == .nonHTTPSURL(URL(string: "http://my.domain.com/framework.zip")!)
}

it("should parse with a file url") {
let jsonData = "{ \"1.0\": \"file:///my/domain/com/framework.zip\" }".data(using: .utf8)!
let actualBinaryProject = BinaryProject.from(jsonData: jsonData).value

let expectedBinaryProject = BinaryProject(versions: [
PinnedVersion("1.0"): URL(string: "file:///my/domain/com/framework.zip")!,
])

expect(actualBinaryProject) == expectedBinaryProject
}
}
}
}

0 comments on commit e2af187

Please sign in to comment.