Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e915bc0cfb | ||
|
|
f4c2c75aa1 | ||
|
|
dc7affa28c | ||
|
|
476cdc1461 | ||
|
|
a644208c62 | ||
|
|
d7a9819350 | ||
|
|
24a54c2ee0 | ||
|
|
3735ed4476 |
16
.github/deploy
vendored
16
.github/deploy
vendored
@@ -5,7 +5,7 @@ import PMKFoundation // PromiseKit/Foundation ~> 3.3
|
|||||||
import LegibleError // @mxcl ~> 1.0
|
import LegibleError // @mxcl ~> 1.0
|
||||||
import Foundation
|
import Foundation
|
||||||
import PromiseKit // @mxcl ~> 6.8
|
import PromiseKit // @mxcl ~> 6.8
|
||||||
import Path // mxcl/Path.swift == master
|
import Path // mxcl/Path.swift ~> 0.15
|
||||||
|
|
||||||
let env = ProcessInfo.processInfo.environment
|
let env = ProcessInfo.processInfo.environment
|
||||||
let token = env["GITHUB_TOKEN"] ?? env["GITHUB_ACCESS_TOKEN"]!
|
let token = env["GITHUB_TOKEN"] ?? env["GITHUB_ACCESS_TOKEN"]!
|
||||||
@@ -17,13 +17,7 @@ func fatal(message: String) -> Never {
|
|||||||
exit(1)
|
exit(1)
|
||||||
}
|
}
|
||||||
func fatal(error: Error) -> Never {
|
func fatal(error: Error) -> Never {
|
||||||
fatal(message: error.legibleLocalizedDescription)
|
fatal(message: "\(error.legibleLocalizedDescription)\n\n\(error.legibleDescription)")
|
||||||
}
|
|
||||||
|
|
||||||
guard let licenseFile = try Path.cwd.ls().files.first(where: {
|
|
||||||
$0.basename().hasPrefix("LICENSE")
|
|
||||||
})?.basename() else {
|
|
||||||
fatal(message: "no LICENSE file found")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Repo: Decodable {
|
struct Repo: Decodable {
|
||||||
@@ -124,7 +118,7 @@ func podspec(repo: Repo, user: User, pkg: Package) -> (Substring, String) {
|
|||||||
s.version = '\(tag)'
|
s.version = '\(tag)'
|
||||||
s.summary = '\(repo.description)'
|
s.summary = '\(repo.description)'
|
||||||
s.homepage = "https://github.com/\(slug)"
|
s.homepage = "https://github.com/\(slug)"
|
||||||
s.license = { type: '\(repo.license.spdx_id)', file: '\(licenseFile)' }
|
s.license = '\(repo.license.spdx_id)'
|
||||||
s.author = { '\(user.name)': '\(user.email)' }
|
s.author = { '\(user.name)': '\(user.email)' }
|
||||||
s.source = { git: "https://github.com/\(slug).git", tag: '\(tag)' }
|
s.source = { git: "https://github.com/\(slug).git", tag: '\(tag)' }
|
||||||
s.social_media_url = 'https://twitter.com/\(owner)'
|
s.social_media_url = 'https://twitter.com/\(owner)'
|
||||||
@@ -140,8 +134,8 @@ func podspec(repo: Repo, user: User, pkg: Package) -> (Substring, String) {
|
|||||||
|
|
||||||
func publishRelease() throws -> Promise<Void> {
|
func publishRelease() throws -> Promise<Void> {
|
||||||
struct Input: Encodable {
|
struct Input: Encodable {
|
||||||
var tag_name: String { return tag }
|
let tag_name = tag
|
||||||
var name: String { return tag }
|
let name = tag
|
||||||
let body = ""
|
let body = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,12 @@ xcode_scheme: Path.swift-Package
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
|
- name: macOS / Swift 4.0.3
|
||||||
|
script: swift test --parallel -Xswiftc -swift-version -Xswiftc 4
|
||||||
|
|
||||||
- name: macOS / Swift 4.2.1
|
- name: macOS / Swift 4.2.1
|
||||||
script: swift test --parallel
|
script: swift test --parallel
|
||||||
|
|
||||||
- name: macOS / Swift 5.0
|
- name: macOS / Swift 5.0
|
||||||
osx_image: xcode10.2
|
osx_image: xcode10.2
|
||||||
script: swift test --parallel
|
script: swift test --parallel
|
||||||
@@ -26,9 +30,11 @@ jobs:
|
|||||||
xcode_destination: platform=iOS Simulator,OS=latest,name=iPhone XS
|
xcode_destination: platform=iOS Simulator,OS=latest,name=iPhone XS
|
||||||
name: iOS / Swift 4.2.1
|
name: iOS / Swift 4.2.1
|
||||||
after_success: bash <(curl -s https://codecov.io/bash)
|
after_success: bash <(curl -s https://codecov.io/bash)
|
||||||
|
|
||||||
- <<: *xcodebuild
|
- <<: *xcodebuild
|
||||||
xcode_destination: platform=tvOS Simulator,OS=latest,name=Apple TV
|
xcode_destination: platform=tvOS Simulator,OS=latest,name=Apple TV
|
||||||
name: tvOS / Swift 4.2.1
|
name: tvOS / Swift 4.2.1
|
||||||
|
|
||||||
- <<: *xcodebuild
|
- <<: *xcodebuild
|
||||||
name: watchOS / Swift 4.2.1
|
name: watchOS / Swift 4.2.1
|
||||||
script: |
|
script: |
|
||||||
@@ -52,7 +58,7 @@ jobs:
|
|||||||
|
|
||||||
- <<: *linux
|
- <<: *linux
|
||||||
env: SWIFT_VERSION='5.0-DEVELOPMENT-SNAPSHOT-2019-01-22-a'
|
env: SWIFT_VERSION='5.0-DEVELOPMENT-SNAPSHOT-2019-01-22-a'
|
||||||
name: Linux / Swift 5.0.0-dev+2019-01-22
|
name: Linux / Swift 5.0.0-dev+2019.01.22
|
||||||
|
|
||||||
- stage: pretest
|
- stage: pretest
|
||||||
name: Check Linux tests are sync’d
|
name: Check Linux tests are sync’d
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ let pkg = Package(
|
|||||||
.target(name: "Path", path: "Sources"),
|
.target(name: "Path", path: "Sources"),
|
||||||
.testTarget(name: "PathTests", dependencies: ["Path"]),
|
.testTarget(name: "PathTests", dependencies: ["Path"]),
|
||||||
],
|
],
|
||||||
swiftLanguageVersions: [.v4, .v4_2]
|
swiftLanguageVersions: [.v4, .v4_2, .version("5")]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
// swift-tools-version:5.0
|
|
||||||
import PackageDescription
|
|
||||||
|
|
||||||
let pkg = Package(
|
|
||||||
name: "Path.swift",
|
|
||||||
products: [
|
|
||||||
.library(name: "Path", targets: ["Path"]),
|
|
||||||
],
|
|
||||||
targets: [
|
|
||||||
.target(name: "Path", path: "Sources"),
|
|
||||||
.testTarget(name: "PathTests", dependencies: ["Path"]),
|
|
||||||
],
|
|
||||||
swiftLanguageVersions: [.v4, .v4_2, .v5]
|
|
||||||
)
|
|
||||||
@@ -34,6 +34,11 @@ public extension Bundle {
|
|||||||
var path: Path {
|
var path: Path {
|
||||||
return Path(string: bundlePath)
|
return Path(string: bundlePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the executable for this bundle, if there is one, not all bundles have one hence `Optional`.
|
||||||
|
var executable: Path? {
|
||||||
|
return executablePath.flatMap(Path.init)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extensions on `String` that work with `Path` rather than `String` or `URL`
|
/// Extensions on `String` that work with `Path` rather than `String` or `URL`
|
||||||
|
|||||||
@@ -200,6 +200,15 @@ public struct Path: Equatable, Hashable, Comparable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Splits the string representation on the directory separator.
|
||||||
|
- Important: The first element is always "/" to be consistent with `NSString.pathComponents`.
|
||||||
|
*/
|
||||||
|
@inlinable
|
||||||
|
public var components: [String] {
|
||||||
|
return ["/"] + string.split(separator: "/").map(String.init)
|
||||||
|
}
|
||||||
|
|
||||||
//MARK: Pathing
|
//MARK: Pathing
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -403,6 +403,7 @@ class PathTests: XCTestCase {
|
|||||||
XCTAssertEqual(bndl.privateFrameworks, tmpdir.Frameworks)
|
XCTAssertEqual(bndl.privateFrameworks, tmpdir.Frameworks)
|
||||||
XCTAssertEqual(bndl.resources, tmpdir)
|
XCTAssertEqual(bndl.resources, tmpdir)
|
||||||
XCTAssertNil(bndl.path(forResource: "foo", ofType: "bar"))
|
XCTAssertNil(bndl.path(forResource: "foo", ofType: "bar"))
|
||||||
|
XCTAssertNil(bndl.executable)
|
||||||
|
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
XCTAssertEqual(bndl.defaultSharedFrameworksPath, tmpdir.Contents.Frameworks)
|
XCTAssertEqual(bndl.defaultSharedFrameworksPath, tmpdir.Contents.Frameworks)
|
||||||
@@ -588,4 +589,9 @@ class PathTests: XCTestCase {
|
|||||||
XCTAssertNil(Path("../foo"))
|
XCTAssertNil(Path("../foo"))
|
||||||
XCTAssertNil(Path("./foo"))
|
XCTAssertNil(Path("./foo"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testPathComponents() throws {
|
||||||
|
XCTAssertEqual(Path.root.foo.bar.components, ["/", "foo", "bar"])
|
||||||
|
XCTAssertEqual(Path.root.components, ["/"])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ extension PathTests {
|
|||||||
("testMoveInto", testMoveInto),
|
("testMoveInto", testMoveInto),
|
||||||
("testMoveTo", testMoveTo),
|
("testMoveTo", testMoveTo),
|
||||||
("testNoUndesiredSymlinkResolution", testNoUndesiredSymlinkResolution),
|
("testNoUndesiredSymlinkResolution", testNoUndesiredSymlinkResolution),
|
||||||
|
("testPathComponents", testPathComponents),
|
||||||
("testReadlinkOnFileReturnsSelf", testReadlinkOnFileReturnsSelf),
|
("testReadlinkOnFileReturnsSelf", testReadlinkOnFileReturnsSelf),
|
||||||
("testReadlinkOnNonExistantFileThrows", testReadlinkOnNonExistantFileThrows),
|
("testReadlinkOnNonExistantFileThrows", testReadlinkOnNonExistantFileThrows),
|
||||||
("testReadlinkOnRelativeSymlink", testReadlinkOnRelativeSymlink),
|
("testReadlinkOnRelativeSymlink", testReadlinkOnRelativeSymlink),
|
||||||
|
|||||||
Reference in New Issue
Block a user