diff --git a/.gitignore b/.gitignore index 46d8d39..de2824b 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,6 @@ playground.xcworkspace # Carthage # # Add this line if you want to avoid checking in source code from Carthage dependencies. -# Carthage/Checkouts +Carthage/Checkouts Carthage/Build diff --git a/.gitmodules b/.gitmodules index cd4bff8..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +0,0 @@ -[submodule "Carthage/Checkouts/Nimble"] - path = Carthage/Checkouts/Nimble - url = https://github.com/Quick/Nimble.git -[submodule "Carthage/Checkouts/Quick"] - path = Carthage/Checkouts/Quick - url = https://github.com/Quick/Quick.git -[submodule "Carthage/Checkouts/xcconfigs"] - path = Carthage/Checkouts/xcconfigs - url = https://github.com/jspahrsummers/xcconfigs.git -[submodule "Carthage/Checkouts/ReactiveSwift"] - path = Carthage/Checkouts/ReactiveSwift - url = https://github.com/ReactiveCocoa/ReactiveSwift.git diff --git a/Cartfile.private b/Cartfile.private index a91b4bd..041bc60 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,3 +1,3 @@ github "jspahrsummers/xcconfigs" "3d9d996" -github "Quick/Quick" ~> 2.0 -github "Quick/Nimble" ~> 8.0 +github "Quick/Quick" ~> 4.0 +github "Quick/Nimble" ~> 9.0 diff --git a/Cartfile.resolved b/Cartfile.resolved index d7c9a33..c5ae3ea 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ -github "Quick/Nimble" "v8.0.1" -github "Quick/Quick" "v2.1.0" -github "ReactiveCocoa/ReactiveSwift" "6.0.0" +github "Quick/Nimble" "v9.2.0" +github "Quick/Quick" "v4.0.0" +github "ReactiveCocoa/ReactiveSwift" "6.6.0" github "jspahrsummers/xcconfigs" "3d9d99634cae6d586e272543d527681283b33eb0" diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble deleted file mode 160000 index 43304bf..0000000 --- a/Carthage/Checkouts/Nimble +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 43304bf2b1579fd555f2fdd51742771c1e4f2b98 diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick deleted file mode 160000 index 94df9b4..0000000 --- a/Carthage/Checkouts/Quick +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 94df9b449508344667e5afc7e80f8bcbff1e4c37 diff --git a/Carthage/Checkouts/ReactiveSwift b/Carthage/Checkouts/ReactiveSwift deleted file mode 160000 index 3eba2b4..0000000 --- a/Carthage/Checkouts/ReactiveSwift +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3eba2b48ee80f87058de5ae8bb41e585bde5c997 diff --git a/Carthage/Checkouts/xcconfigs b/Carthage/Checkouts/xcconfigs deleted file mode 160000 index 3d9d996..0000000 --- a/Carthage/Checkouts/xcconfigs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3d9d99634cae6d586e272543d527681283b33eb0 diff --git a/Package.resolved b/Package.resolved index 30e9c47..e1f6e89 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,13 +1,31 @@ { "object": { "pins": [ + { + "package": "CwlCatchException", + "repositoryURL": "https://github.com/mattgallagher/CwlCatchException.git", + "state": { + "branch": null, + "revision": "682841464136f8c66e04afe5dbd01ab51a3a56f2", + "version": "2.1.0" + } + }, + { + "package": "CwlPreconditionTesting", + "repositoryURL": "https://github.com/mattgallagher/CwlPreconditionTesting.git", + "state": { + "branch": null, + "revision": "02b7a39a99c4da27abe03cab2053a9034379639f", + "version": "2.0.0" + } + }, { "package": "Nimble", "repositoryURL": "https://github.com/Quick/Nimble.git", "state": { "branch": null, - "revision": "43304bf2b1579fd555f2fdd51742771c1e4f2b98", - "version": "8.0.1" + "revision": "af1730dde4e6c0d45bf01b99f8a41713ce536790", + "version": "9.2.0" } }, { @@ -15,8 +33,8 @@ "repositoryURL": "https://github.com/Quick/Quick.git", "state": { "branch": null, - "revision": "0b4ed6c706dd0cce923b5019a605a9bcc6b1b600", - "version": "2.0.0" + "revision": "bd86ca0141e3cfb333546de5a11ede63f0c4a0e6", + "version": "4.0.0" } }, { @@ -24,8 +42,8 @@ "repositoryURL": "https://github.com/ReactiveCocoa/ReactiveSwift.git", "state": { "branch": null, - "revision": "3eba2b48ee80f87058de5ae8bb41e585bde5c997", - "version": "6.0.0" + "revision": "4a8e1e4a683e96daf658f68132dae781738bc862", + "version": "6.6.0" } } ] diff --git a/Package.swift b/Package.swift index 5fa5834..19e457e 100644 --- a/Package.swift +++ b/Package.swift @@ -8,8 +8,8 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/ReactiveCocoa/ReactiveSwift.git", from: "6.0.0"), - .package(url: "https://github.com/Quick/Quick.git", from: "2.0.0"), - .package(url: "https://github.com/Quick/Nimble.git", from: "8.0.1") + .package(url: "https://github.com/Quick/Quick.git", from: "4.0.0"), + .package(url: "https://github.com/Quick/Nimble.git", from: "9.2.0") ], targets: [ .target(name: "ReactiveTask", dependencies: ["ReactiveSwift"], path: "Sources"), diff --git a/Sources/Task.swift b/Sources/Task.swift index cbc2729..1117033 100644 --- a/Sources/Task.swift +++ b/Sources/Task.swift @@ -375,7 +375,7 @@ extension Signal where Value: TaskEventType { /// Ignores incremental standard output and standard error data from the given /// task, sending only a single value with the final, aggregated result. public func ignoreTaskData() -> Signal { - return self.filterMap { $0.value } + return self.compactMap { $0.value } } } diff --git a/Tests/ReactiveTaskTests/TaskSpec.swift b/Tests/ReactiveTaskTests/TaskSpec.swift index 3ce2d50..7e55485 100644 --- a/Tests/ReactiveTaskTests/TaskSpec.swift +++ b/Tests/ReactiveTaskTests/TaskSpec.swift @@ -29,7 +29,7 @@ class TaskSpec: QuickSpec { }) .wait() - expect(result.error).to(beNil()) + expect(try result.get()).notTo(throwError()) expect(isLaunched) == true } @@ -46,7 +46,7 @@ class TaskSpec: QuickSpec { .single() expect(result).notTo(beNil()) - if let data = result?.value { + if case let .success(data) = result { expect(String(data: data, encoding: .utf8)).to(equal("foobar\n")) } } @@ -63,7 +63,7 @@ class TaskSpec: QuickSpec { .single() expect(result).notTo(beNil()) - expect(result?.error).notTo(beNil()) + expect(try result?.get()).to(throwError()) expect(String(data: aggregated, encoding: .utf8)).to(equal("stat: not-a-real-file: stat: No such file or directory\n")) } @@ -72,11 +72,11 @@ class TaskSpec: QuickSpec { let data = strings.map { $0.data(using: .utf8)! } let result = Task("/usr/bin/sort").launch(standardInput: SignalProducer(data)) - .filterMap { event in event.value } + .compactMap { event in event.value } .single() expect(result).notTo(beNil()) - if let data = result?.value { + if case let .success(data) = result { expect(String(data: data, encoding: .utf8)).to(equal("bar\nbuzz\nfoo\nfuzz\n")) } } @@ -87,11 +87,13 @@ class TaskSpec: QuickSpec { .wait() expect(result).notTo(beNil()) - expect(result.error).notTo(beNil()) - expect(result.error) == TaskError.shellTaskFailed(task, exitCode: 1, standardError: "stat: not-a-real-file: stat: No such file or directory\n") - if let error = result.error { - expect(error.description) == "A shell task (/usr/bin/stat not-a-real-file) failed with exit code 1:\nstat: not-a-real-file: stat: No such file or directory\n" - } + switch result { + case let .failure(error): + expect(error) == TaskError.shellTaskFailed(task, exitCode: 1, standardError: "stat: not-a-real-file: stat: No such file or directory\n") + expect(error.description) == "A shell task (/usr/bin/stat not-a-real-file) failed with exit code 1:\nstat: not-a-real-file: stat: No such file or directory\n" + case .success: + fail("Error expected") + } } } }