Skip to content

Commit

Permalink
Merge pull request Moya#1992 from Moya/release/14.0.0
Browse files Browse the repository at this point in the history
[Release] 14.0.0 🚀
  • Loading branch information
sunshinejr authored Feb 15, 2020
2 parents e927fb1 + d427698 commit 4580a5c
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 77 deletions.
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "Alamofire/Alamofire" "5.0.0-rc.3"
github "Alamofire/Alamofire" ~> 5.0
github "ReactiveCocoa/ReactiveSwift" ~> 6.0
github "ReactiveX/RxSwift" ~> 5.0
2 changes: 1 addition & 1 deletion Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "AliSoftware/OHHTTPStubs" ~> 8.0.0
github "AliSoftware/OHHTTPStubs" ~> 9.0.0
github "Quick/Quick" ~> 2.0.0
github "Quick/Nimble" ~> 8.0.0
8 changes: 4 additions & 4 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github "Alamofire/Alamofire" "5.0.0-rc.3"
github "AliSoftware/OHHTTPStubs" "8.0.0"
github "Quick/Nimble" "v8.0.4"
github "Alamofire/Alamofire" "5.0.0"
github "AliSoftware/OHHTTPStubs" "9.0.0"
github "Quick/Nimble" "v8.0.5"
github "Quick/Quick" "v2.2.0"
github "ReactiveCocoa/ReactiveSwift" "6.1.0"
github "ReactiveCocoa/ReactiveSwift" "6.2.0"
github "ReactiveX/RxSwift" "5.0.1"
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Next

### Changed
- **Breaking Change** Minimum version of `Alamofire` is now 5.0. [#1992](https://github.com/Moya/Moya/pull/1992) by [@sunshinejr](https://github.com/sunshinejr).
- **Breaking Change** `MultiTarget` now implements `AccessTokenAuthorizable` so that the inner target's `authorizationType` is correctly returned to the `AccessTokenPlugin` when requested. [#1979](https://github.com/Moya/Moya/pull/1979) by [@amaurydavid](https://github.com/amaurydavid).


Expand Down
4 changes: 2 additions & 2 deletions Examples/_shared/GitHubAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ private func JSONResponseDataFormatter(_ data: Data) -> String {
do {
let dataAsJSON = try JSONSerialization.jsonObject(with: data)
let prettyData = try JSONSerialization.data(withJSONObject: dataAsJSON, options: .prettyPrinted)
return String(data: prettyData, encoding: .utf8) ?? String()
return String(data: prettyData, encoding: .utf8) ?? String(data: data, encoding: .utf8) ?? ""
} catch {
return String()
return String(data: data, encoding: .utf8) ?? ""
}
}

Expand Down
2 changes: 1 addition & 1 deletion Moya.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Pod::Spec.new do |s|

s.subspec "Core" do |ss|
ss.source_files = "Sources/Moya/", "Sources/Moya/Plugins/"
ss.dependency "Alamofire", "5.0.0-rc.3"
ss.dependency "Alamofire", "~> 5.0"
ss.framework = "Foundation"
end

Expand Down
10 changes: 5 additions & 5 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/Alamofire/Alamofire.git",
"state": {
"branch": null,
"revision": "2cbf59935fbb1f26e352ce4db53f1cf9408d5313",
"version": "5.0.0-rc.3"
"revision": "0c8cb78d05b6d067ee331c05058ff4dedcb45ffa",
"version": "5.0.0"
}
},
{
Expand Down Expand Up @@ -50,9 +50,9 @@
"package": "OHHTTPStubs",
"repositoryURL": "https://github.com/AliSoftware/OHHTTPStubs.git",
"state": {
"branch": "feature/spm-support",
"revision": "4726e07728b8bff3152a8c31c34a0bb7cc2aef19",
"version": null
"branch": null,
"revision": "e92b5a5746ef16add2a1424f1fc19529d9a75cde",
"version": "9.0.0"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ let package = Package(
.library(name: "RxMoya", targets: ["RxMoya"])
],
dependencies: [
.package(url: "https://github.com/Alamofire/Alamofire.git", .exact("5.0.0-rc.3")),
.package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.0.0")),
.package(url: "https://github.com/Moya/ReactiveSwift.git", .upToNextMajor(from: "6.1.0")),
.package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "5.0.0")),
.package(url: "https://github.com/Quick/Quick.git", .upToNextMajor(from: "2.0.0")), // dev
.package(url: "https://github.com/Quick/Nimble.git", .upToNextMajor(from: "8.0.0")), // dev
.package(url: "https://github.com/AliSoftware/OHHTTPStubs.git", .branch("feature/spm-support")), // dev
.package(url: "https://github.com/AliSoftware/OHHTTPStubs.git", .upToNextMajor(from: "9.0.0")), // dev
.package(url: "https://github.com/shibapm/Rocket", .upToNextMajor(from: "1.0.0")) // dev
],
targets: [
Expand Down
14 changes: 7 additions & 7 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img height="160" src="web/logo_github.png" />
</p>

# Moya 14.0.0-beta.6
# Moya 14.0.0

[![CircleCI](https://img.shields.io/circleci/project/github/Moya/Moya/master.svg)](https://circleci.com/gh/Moya/Moya/tree/master)
[![codecov.io](https://codecov.io/github/Moya/Moya/coverage.svg?branch=master)](https://codecov.io/github/Moya/Moya?branch=master)
Expand Down Expand Up @@ -76,7 +76,7 @@ _Note: If you are using Swift 4.2 in your project, but you are using Xcode 10.2,
To integrate using Apple's Swift package manager, add the following as a dependency to your `Package.swift`:

```swift
.package(url: "https://github.com/Moya/Moya.git", .exact("14.0.0-beta.6"))
.package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "14.0.0"))
```

and then specify `"Moya"` as a dependency of the Target in which you wish to use Moya.
Expand All @@ -95,7 +95,7 @@ let package = Package(
targets: ["MyPackage"]),
],
dependencies: [
.package(url: "https://github.com/Moya/Moya.git", .exact("14.0.0-beta.6"))
.package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "14.0.0"))
],
targets: [
.target(
Expand All @@ -116,15 +116,15 @@ Note: If you are using **ReactiveMoya**, we are using [our own fork of ReactiveS
For Moya, use the following entry in your Podfile:

```rb
pod 'Moya', '14.0.0-beta.6'
pod 'Moya', '~> 14.0'

# or

pod 'Moya/RxSwift', '14.0.0-beta.6'
pod 'Moya/RxSwift', '~> 14.0'

# or

pod 'Moya/ReactiveSwift', '14.0.0-beta.6'
pod 'Moya/ReactiveSwift', '~> 14.0'
```

Then run `pod install`.
Expand All @@ -140,7 +140,7 @@ generated framework they'd like, `Moya`, `RxMoya`, or `ReactiveMoya`.
Make the following entry in your Cartfile:

```
github "Moya/Moya" "14.0.0-beta.6"
github "Moya/Moya" ~> 14.0
```

Then run `carthage update`.
Expand Down
14 changes: 7 additions & 7 deletions Readme_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img height="160" src="web/logo_github.png" />
</p>

# Moya 14.0.0-beta.6
# Moya 14.0.0

[![CircleCI](https://img.shields.io/circleci/project/github/Moya/Moya/master.svg)](https://circleci.com/gh/Moya/Moya/tree/master)
[![codecov.io](https://codecov.io/github/Moya/Moya/coverage.svg?branch=master)](https://codecov.io/github/Moya/Moya?branch=master)
Expand Down Expand Up @@ -61,7 +61,7 @@ Moya 的一些特色功能:
要使用苹果的 Swift Package Manager 集成,将以下内容作为依赖添加到你的 `Package.swift`

```swift
.package(url: "https://github.com/Moya/Moya.git", .exact("14.0.0-beta.6"))
.package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "14.0.0"))
```

然后指定 `"Moya"` 为你想要使用 Moya 的 Target 的依赖。如果你想要使用响应式扩展,将 `"ReactiveMoya"``"RxMoya"` 也也作为依赖加入进来。这里是一个 `PackageDescription` 实例:
Expand All @@ -78,7 +78,7 @@ let package = Package(
targets: ["MyPackage"]),
],
dependencies: [
.package(url: "https://github.com/Moya/Moya.git", .exact("14.0.0-beta.6"))
.package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "14.0.0"))
],
targets: [
.target(
Expand All @@ -95,15 +95,15 @@ let package = Package(
在你的 Podfile 文件中添加 Moya:

```rb
pod 'Moya', '14.0.0-beta.6'
pod 'Moya', '~> 14.0'

# or

pod 'Moya/RxSwift', '14.0.0-beta.6'
pod 'Moya/RxSwift', '~> 14.0'

# or

pod 'Moya/ReactiveSwift', '14.0.0-beta.6'
pod 'Moya/ReactiveSwift', '~> 14.0'
```

然后运行 `pod install`
Expand All @@ -117,7 +117,7 @@ Carthage 用户可以指向这个仓库并使用他们喜欢的生成框架,`M
在你的 Cartfile 中添加下面的代码:

```
github "Moya/Moya" ~> "14.0.0-beta.6"
github "Moya/Moya" ~> 14.0
```

然后运行 `carthage update`
Expand Down
14 changes: 6 additions & 8 deletions Tests/MoyaTests/MoyaProvider+ReactiveSpec.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import Quick
import Nimble
import ReactiveSwift

#if canImport(OHHTTPStubs)
import OHHTTPStubs
#elseif canImport(OHHTTPStubsSwift)
import OHHTTPStubsCore

#if canImport(OHHTTPStubsSwift)
import OHHTTPStubsSwift
#endif

Expand Down Expand Up @@ -103,8 +101,8 @@ final class MoyaProviderReactiveSpec: QuickSpec {
describe("provider with inflight tracking") {
var provider: MoyaProvider<GitHub>!
beforeEach {
OHHTTPStubs.stubRequests(passingTest: {$0.url!.path == "/zen"}, withStubResponse: { _ in
return OHHTTPStubsResponse(data: GitHub.zen.sampleData, statusCode: 200, headers: nil)
HTTPStubs.stubRequests(passingTest: {$0.url!.path == "/zen"}, withStubResponse: { _ in
return HTTPStubsResponse(data: GitHub.zen.sampleData, statusCode: 200, headers: nil)
})
provider = MoyaProvider<GitHub>(trackInflights: true)
}
Expand Down Expand Up @@ -148,8 +146,8 @@ final class MoyaProviderReactiveSpec: QuickSpec {
try? FileManager.default.removeItem(at: file)

//`responseTime(-4)` equals to 1000 bytes at a time. The sample data is 4000 bytes.
OHHTTPStubs.stubRequests(passingTest: {$0.url!.path.hasSuffix("logo_github.png")}, withStubResponse: { _ in
return OHHTTPStubsResponse(data: GitHubUserContent.downloadMoyaWebContent("logo_github.png").sampleData, statusCode: 200, headers: nil).responseTime(-4)
HTTPStubs.stubRequests(passingTest: {$0.url!.path.hasSuffix("logo_github.png")}, withStubResponse: { _ in
return HTTPStubsResponse(data: GitHubUserContent.downloadMoyaWebContent("logo_github.png").sampleData, statusCode: 200, headers: nil).responseTime(-4)
})
provider = MoyaProvider<GitHubUserContent>()
}
Expand Down
22 changes: 10 additions & 12 deletions Tests/MoyaTests/MoyaProvider+RxSpec.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import Quick
import Nimble
import RxSwift

#if canImport(OHHTTPStubs)
import OHHTTPStubs
#elseif canImport(OHHTTPStubsSwift)
import OHHTTPStubsCore

#if canImport(OHHTTPStubsSwift)
import OHHTTPStubsSwift
#endif

Expand Down Expand Up @@ -104,8 +102,8 @@ final class MoyaProviderRxSpec: QuickSpec {
var provider: MoyaProvider<GitHub>!

beforeEach {
OHHTTPStubs.stubRequests(passingTest: {$0.url!.path == "/zen"}, withStubResponse: { _ in
return OHHTTPStubsResponse(data: GitHub.zen.sampleData, statusCode: 200, headers: nil)
HTTPStubs.stubRequests(passingTest: {$0.url!.path == "/zen"}, withStubResponse: { _ in
return HTTPStubsResponse(data: GitHub.zen.sampleData, statusCode: 200, headers: nil)
})
provider = MoyaProvider<GitHub>(trackInflights: true)
}
Expand Down Expand Up @@ -156,8 +154,8 @@ final class MoyaProviderRxSpec: QuickSpec {
try? FileManager.default.removeItem(at: file)

//`responseTime(-4)` equals to 1000 bytes at a time. The sample data is 4000 bytes.
OHHTTPStubs.stubRequests(passingTest: {$0.url!.path.hasSuffix("logo_github.png")}, withStubResponse: { _ in
return OHHTTPStubsResponse(data: GitHubUserContent.downloadMoyaWebContent("logo_github.png").sampleData, statusCode: 200, headers: nil).responseTime(-4)
HTTPStubs.stubRequests(passingTest: {$0.url!.path.hasSuffix("logo_github.png")}, withStubResponse: { _ in
return HTTPStubsResponse(data: GitHubUserContent.downloadMoyaWebContent("logo_github.png").sampleData, statusCode: 200, headers: nil).responseTime(-4)
})
provider = MoyaProvider<GitHubUserContent>()
}
Expand Down Expand Up @@ -195,16 +193,16 @@ final class MoyaProviderRxSpec: QuickSpec {
}

describe("a custom callback queue") {
var stubDescriptor: OHHTTPStubsDescriptor!
var stubDescriptor: HTTPStubsDescriptor!

beforeEach {
stubDescriptor = OHHTTPStubs.stubRequests(passingTest: {$0.url!.path == "/zen"}, withStubResponse: { _ in
return OHHTTPStubsResponse(data: GitHub.zen.sampleData, statusCode: 200, headers: nil)
stubDescriptor = HTTPStubs.stubRequests(passingTest: {$0.url!.path == "/zen"}, withStubResponse: { _ in
return HTTPStubsResponse(data: GitHub.zen.sampleData, statusCode: 200, headers: nil)
})
}

afterEach {
OHHTTPStubs.removeStub(stubDescriptor)
HTTPStubs.removeStub(stubDescriptor)
}

describe("a provider with a predefined callback queue") {
Expand Down
24 changes: 11 additions & 13 deletions Tests/MoyaTests/MoyaProviderIntegrationTests.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import Quick
import Nimble
import Foundation

#if canImport(OHHTTPStubs)
import OHHTTPStubs
#elseif canImport(OHHTTPStubsSwift)
import OHHTTPStubsCore

#if canImport(OHHTTPStubsSwift)
import OHHTTPStubsSwift
#endif

Expand All @@ -31,26 +29,26 @@ final class MoyaProviderIntegrationTests: QuickSpec {
let zenMessage = String(data: GitHub.zen.sampleData, encoding: .utf8)

beforeEach {
OHHTTPStubs.stubRequests(passingTest: {$0.url!.path == "/zen"}, withStubResponse: { _ in
return OHHTTPStubsResponse(data: GitHub.zen.sampleData, statusCode: 200, headers: nil)
HTTPStubs.stubRequests(passingTest: {$0.url!.path == "/zen"}, withStubResponse: { _ in
return HTTPStubsResponse(data: GitHub.zen.sampleData, statusCode: 200, headers: nil)
})

OHHTTPStubs.stubRequests(passingTest: {$0.url!.path == "/users/ashfurrow"}, withStubResponse: { _ in
return OHHTTPStubsResponse(data: GitHub.userProfile("ashfurrow").sampleData, statusCode: 200, headers: nil)
HTTPStubs.stubRequests(passingTest: {$0.url!.path == "/users/ashfurrow"}, withStubResponse: { _ in
return HTTPStubsResponse(data: GitHub.userProfile("ashfurrow").sampleData, statusCode: 200, headers: nil)
})

OHHTTPStubs.stubRequests(passingTest: {$0.url!.path == "/users/invalid"}, withStubResponse: { _ in
return OHHTTPStubsResponse(data: GitHub.userProfile("invalid").sampleData, statusCode: 400, headers: nil)
HTTPStubs.stubRequests(passingTest: {$0.url!.path == "/users/invalid"}, withStubResponse: { _ in
return HTTPStubsResponse(data: GitHub.userProfile("invalid").sampleData, statusCode: 400, headers: nil)
})

OHHTTPStubs.stubRequests(passingTest: {$0.url!.path == "/basic-auth/user/passwd"}, withStubResponse: { _ in
return OHHTTPStubsResponse(data: HTTPBin.basicAuth.sampleData, statusCode: 200, headers: nil)
HTTPStubs.stubRequests(passingTest: {$0.url!.path == "/basic-auth/user/passwd"}, withStubResponse: { _ in
return HTTPStubsResponse(data: HTTPBin.basicAuth.sampleData, statusCode: 200, headers: nil)
})

}

afterEach {
OHHTTPStubs.removeAllStubs()
HTTPStubs.removeAllStubs()
}

describe("valid endpoints") {
Expand Down
Loading

0 comments on commit 4580a5c

Please sign in to comment.