From 52054185ce92d37480ac8feb4ebf0944e9d8fdba Mon Sep 17 00:00:00 2001 From: Kim de Vos Date: Tue, 6 Feb 2018 22:21:06 +0100 Subject: [PATCH 01/32] Updated changeling to match new style --- Changelog.md | 354 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 210 insertions(+), 144 deletions(-) diff --git a/Changelog.md b/Changelog.md index 092d23543..434fbc5b2 100644 --- a/Changelog.md +++ b/Changelog.md @@ -36,25 +36,30 @@ ### Fixed - Fixed a `MoyaProvider+Rx` self-retaining bug in `requestWithProgress`. [#1311](https://github.com/Moya/Moya/pull/1311) by [@AndrewSB](https://github.com/AndrewSB). -# 9.0.0 +# [9.0.0] - 2017-09-04 - Removed default value for task from `Endpoint` initializer -# 9.0.0-beta.1 +# [9.0.0-beta.1] - 2017-08-26 +### Changed - **Breaking Change** Replaced `parameters` & `parameterEncoding` in `TargetType` with extended `Task` cases. - **Breaking Change** Flattened `UploadType` and `DownloadType` into `Task` cases. - **Breaking Change** Replaced `shouldAuthorize: Bool` in `AccessTokenAuthorizable` with `authorizationType: AuthorizationType`. - **Breaking Change** Replaced `token` in `AccessTokenPlugin` with `tokenClosure`. - **Breaking Change** `TargetTypes` no longer receive the `Authorization: Bearer ` header by default when using `AccessTokenPlugin`. + +### Added - Added Swift 4.0 support for Moya core (without RxSwift/ReactiveSwift extensions for now). - Added all the `filter`/`map` operators that were available for `Observable` to `Single` as well. - Added `AuthorizationType` to `AccessTokenAuthorizable` representing request headers of `.none`, `.basic`, and `.bearer`. - Added tests for `Single` operators. - Added `Progress` object into the response when calling progress callback on completion. - Added tests for creating `URLRequest` from `Task`. -- Fixed a bug where you weren't notified on progress callback for data request. -# 9.0.0-alpha.1 +### Fixed +- Fixed a bug where you weren't notified on progress callback for data request. +# [9.0.0-alpha.1] - 2017-0729 +### Changed - **Breaking Change** Added support to get the response (if any) from `MoyaError`. - **Breaking Change** Added `headers` to `TargetType`. - **Breaking Change** Updated `RxMoyaProvider.request` to return a [`Single`](https://github.com/ReactiveX/RxSwift/pull/1123). @@ -63,57 +68,69 @@ - **Breaking Change** Deprecated `ReactiveSwiftMoyaProvider` and `RxSwiftMoyaProvider`. Use `MoyaProvider` with reactive properties now: `provider.reactive._`, `provider.rx._`. In case you were subclassing reactive providers, please take a look at [this PR from Eidolon](https://github.com/artsy/eidolon/pull/669). It covers migration from subclassing given providers, to usage by composition. - **Breaking Change** Removed parameter name in `requestWithProgress` for `ReactiveSwiftMoyaProvider`. - **Breaking Change** Removed deprecated in Moya 8.0.0: `Moya.Error`, `endpointByAddingParameters(parameters:)`, `endpointByAddingHttpHeaderFields(httpHeaderFields:)`, `endpointByAddingParameterEncoding(newParameterEncoding:)`, `endpointByAdding(parameters:httpHeaderFields:parameterEncoding)`, `StructTarget`, `filterStatusCodes(range:)`, `filterStatusCode(code:)`, `willSendRequest(request:target:)`, `didReceiveResponse(result:target:)`, `ReactiveCocoaMoyaProvider`, `ReactiveSwiftMoyaProvider.request(token:)`. + +### Added - Added optional callback queue parameter to reactive providers. - Added public `URL(target:)` initializator that creates url from `TargetType`. - Added an optional `requestDataFormatter`in `NetworkLoggerPlugin` to allow the client to interact with the request data before logging it. -- Updated minimum version of `RxSwift` to `3.3`. -- Updated minimum version of `ReactiveSwift` to 2.0. + +### Fixed - Fixed a bug where you would have two response events in `requestWithProgress` method on `ReactiveSwift` module. - Enabled the "Allow app extension API only" flag. -# 8.0.5 +- Updated minimum version of `RxSwift` to `3.3`. +- Updated minimum version of `ReactiveSwift` to 2.0. +# [8.0.5] - 2017-05-26 +### Fixed - Fixed a bug where you would have two response events in `requestWithProgress` method on RxMoya module. -# 8.0.4 +# [8.0.4] - 2017-05-09 +###Changed - Bumped minimum version of ReactiveSwift to 1.1. - Changed use of deprecated `DateSchedulerProtocol` to `DateScheduler`. - Move project to using a single target for all platforms. - Changed default endpoint creation to only append `path` to `baseURL` when `path` is not empty. -# 8.0.3 - +# [8.0.3] - 2017-03-13 +### Fixed - Fixed `reversedPrint` arguments for output. - Fixed memory leak when request with stub. -- Changed `Moya.Error` to `MoyaError` in `MoyaAvailablity` for Swift 3.1 compatibility. -# 8.0.2 +### Changed +- Changed `Moya.Error` to `MoyaError` in `MoyaAvailablity` for Swift 3.1 compatibility. +# [8.0.2] - 2017-02-01 +### Changes - Changed dependency pinning to rely only on major versions. -# 8.0.1 - +# [8.0.1] - 2017-01-21 +### Fixed - Fixed an issue where `RxMoyaProvider` never sends `next` or errors if it's disposed before a subscription is made. -# 8.0.0 - +# [8.0.0] - 2017-01-04 +### Changed - **Breaking Change** Renamed `Moya.Error` to `MoyaError`. - **Breaking Change** Renamed `verbose` in the NetworkLoggerPlugin to `isVerbose`. - **Breaking Change** `TargetType` now specifies its `ParameterEncoding`. - **Breaking Change** Removed unused `Moya.Error.data`. - **Breaking Change** Renamed `adding(newHttpHeaderFields:)` to `adding(newHTTPHeaderFields:)`. -- `Moya.Error` now conforms to `LocalizedError` protocol. -- Added documentation for `TargetType` and associated data structures. -- Re-add `MultiTarget` to project. -- Adopted an SPM-compatible project structure. -- Moved tests to Moya.xcodeproj. + +### Added - Supported the Swift package manager - Added `AccessTokenPlugin` for easier authorization. - Added `AccessTokenAuthorizable` protocol for optionally controlling the authorization behavior of `TargetType`s when using `AccessTokenPlugin`. - Added availability tags for renamed functions included in the Swift 3 migration. -# 8.0.0-beta.6 +### +- `Moya.Error` now conforms to `LocalizedError` protocol. +- Added documentation for `TargetType` and associated data structures. +- Re-add `MultiTarget` to project. +- Adopted an SPM-compatible project structure. +- Moved tests to Moya.xcodeproj. +# [8.0.0-beta.6] - 2016-12-14 +### Changed - **Breaking Change** Renamed `ReactiveCocoaMoyaProvider` to `ReactiveSwiftMoyaProvider`. - **Breaking Change** Renamed `PluginType` functions to comply with Swift 3 design guideline: - `willSendRequest` renamed to `willSend`. @@ -124,26 +141,30 @@ - Renamed the `ReactiveCocoa` subspec to `ReactiveSwift`. - `PluginType` can now modify requests and responses through `prepare` and `process` -# 8.0.0-beta.5 - +# [8.0.0-beta.5] - 2016-11-29 +### Changed - **Breaking Change** Renamed `cancelled` in the `Cancellable` protocol to `isCancelled`. - **Breaking Change** Renamed `URL` in `Endpoint` to `url`. - **Breaking Change** Renamed `StructTarget` to `MultiTarget`. - Demo project has been updated with new DemoMultiTarget target, new project structure and more. + +### Added - Readded support for iOS 8 and macOS 10.10. - Added _validate_ option in `TargetType`, to allow enabling Alamofire automatic validation on requests. - Added `mapString(atKeyPath:)` to `Response`, `SignalProducerProtocol`, and `ObservableType` -# 8.0.0-beta.4 - +# [8.0.0-beta.4] - 2016-11-08 +### Changed - **Breaking Change** Made some `class func`s [mimicking enum cases](https://github.com/Moya/Moya/blob/master/Source/Moya.swift#L117-L133) lowercased. - Updates for RxSwift 3.0 final release. + +### Added - Added default empty implementation for `willSendRequest` and `didReceiveResponse` in `PluginType`. - Use `String(data:encoding:)` instead of `NSString(data:encoding:)` while converting `Data` to `String`. -# 8.0.0-beta.3 - +# [8.0.0-beta.3] - 2016-10-17 +### Changed - **Breaking Change** Throw dedicated `Error.jsonMapping` when `mapJSON` fails to parse JSON. - **Breaking Change** Renamed `endpointByAddingHTTPHeaders` to `adding(newHttpHeaderFields:)`. - **Breaking Change** Renamed `endpointByAddingParameters` to `adding(newParameters:)`. @@ -153,44 +174,58 @@ structure and more. - `urlRequest` property of `Endpoint` is now truly optional. The request will fail if the `urlRequest` turns out to be nil and a `requestMapping` error will be returned together with the problematic url. - **Breaking Change** Made RxMoya & ReactiveMoya frameworks dependant on Moya framework, making them slimmer and not re-including Moya source in the Reactive extensions. ([PR](https://github.com/Moya/Moya/pull/563)) - Removed the unused `StreamRequest` typealias that was causing watchOS failures. + +### Fixed - Fixes download requests never calling the completion block. + +### Added - Added a new internal Requestable protocol. - Added a new case to `SampleResponseClosure` which allows mocking of the whole `URLResponse`. - Added a test for new `SampleResponseClosure` case. -# 8.0.0-beta.2 - +# [8.0.0-beta.2] - 2016-09-22 +### Changed - **Breaking Change** Transition from ReactiveCocoa to ReactiveSwift. ([PR](https://github.com/Moya/Moya/pull/661)) -# 8.0.0-beta.1 - +# [8.0.0-beta.1] - 201609-19 +### Changed - **Breaking Change** Support for `Swift 3` in favor of `Swift 2.x`. - **Breaking Change** `fileName` and `mimeType` are now optional properties on a MultipartFormData object. - Correct Alamofire `appendBodyPart` method id called in MultipartFormData. - **Breaking Change** Removes `multipartBody` from TargetType protocol and adds a `task` instead. - **Breaking Change** Successful Response instances that have no data with them are now being converted to `.Success` `Result`s. + +### Added - Adds Download and Upload Task type support to Moya. -- Corrects SwiftLint warnings. -- Separates `Moya.swift` into multiple files. -- Updated `mapJSON` API to include an optional named parameter `failsOnEmptyData:` that when overridden returns an empty `NSNull()` result instead of throwing an error when the response data is empty. - Added `supportsMultipart` to the `Method` type, which helps determine whether to use `multipart/form-data` encoding. - Added `PATCH` and `CONNECT` to the `Method` cases which support multipart encoding. - Added `request` for `Response`. -# 7.0.3 +### Fixed +- Corrects SwiftLint warnings. +- Separates `Moya.swift` into multiple files. +- Updated `mapJSON` API to include an optional named parameter `failsOnEmptyData:` that when overridden returns an empty `NSNull()` result instead of throwing an error when the response data is empty. + -- Carthage support for Swift 2.3. +# [7.0.4] - 2016-12-07 +### Fixed +- Fixes bug for MultipartFormData constructor in Swift 2.3 where fields and files were given a mimetype, forcing them both to be added to the 'files' section. +- Multipart form constructor contains optional Strings -# 7.0.2 +# [7.0.3] - 2016-09-15 +### Added +- Carthage support for Swift 2.3. +# [7.0.2] - 2016-09-14 +### Added - Swift 2.3 support. -# 7.0.1 +# [7.0.1] - 2016-09-13 - Identical to 7.0.0, see [#594](https://github.com/Moya/Moya/pull/594) for an explanation. -# 7.0.0 - +# [7.0.0] - 2016-07-14 +### Changed - **Breaking Change** Drops support for `RACSignal`. - **Breaking Change** Changes `Moya.Error.Underlying` to have `NSError` instead of `ErrorType`. - **Breaking Change** Implements inflights tracking by adding `trackInflights = true` to your provider. @@ -199,83 +234,95 @@ structure and more. - New multipart file upload. - New cURL-based logging plugin. - Moves from OSSpinLock to `dispatch_semaphor` to avoid deadlocks. + +### Added - Integrates Danger into the repo. + +### Fixed - Fixes a xcodeproj referencing bug introduced by the new cURL-based logging plugin. - Calls completion even when cancellable token is canceled -# 6.5.0 - +# [6.5.0] - 2016-05-26 +### Added - Added `queue` parameter to `request` and `sendRequest`. This open up option to use other queue instead of main queue for response callback. -# 6.4.0 +# [6.4.0] - 2016-04-02 - Makes `convertResponseToResult` public to make use of this method when dealing with Alamofire directly - Updates to ReactiveCocoa 4.1 - Updates to Result 2.0 -# 6.3.1 - +# [6.3.1] - 2016-03-25 +### Changed - Updates for Swift 2.2 / Xcode 7.3 compatibility. -# 6.3.0 - +# [6.3.0] - 2016-03-16 +### Fixed - Fixed endpoint setup when adding `parameters` or `headers` when `parameters` or `headers` or nil. -- Adds StructTarget for using Moya with structs. -# 6.2.0 +### Added +- Adds StructTarget for using Moya with structs. +# [6.2.0] - 2016-02-26 +### Added - Adds `response` computed property to `Error` type, which yields a Response object if available. - Added URLEncodedInURL to ParameterEncoding. - Adds convenience `endpointByAdding` method. -- Remove our own implementation of `ParameterEncoding` and make it a `public typealias` of `Alamofire.ParameterEncoding`. -# 6.1.3 +### Changed +- Remove our own implementation of `ParameterEncoding` and make it a `public typealias` of `Alamofire.ParameterEncoding`. +# [6.1.3] - 2016-02-01 +### Changed - Updated to ReactiveCocoa 4.0 final. -- Added formatter parameter to plugin for pretty-printing response data. See #392. -# 6.1.2 +### Added +- Added formatter parameter to plugin for pretty-printing response data. See #392. +# [6.1.2] - 2016-01-28 +### Added - Compatibility with RxSwift 2.x. -# 6.1.1 - +# [6.1.1] - 2016-01-17 +### Added - Compatibility with RxSwift 2.1.x. -# 6.1.0 - +# [6.1.0] - 2016-01-26 +### - The built-in `DefaultAlamofireManager` as parameter's default value instead of the singleton `Alamofire.Manager.sharedinstance` is now used when instantiating `ReactiveCocoaMoyaProvider` and `RxMoyaProvider` as well. -# 6.0.1 - +# [6.0.1] - 2016-01-26 +### Changed - Updates to ReactiveCocoa 4 RC 2. -# 6.0.0 - +# [6.0.0] - 2016-01-05 +### Changed - **Breaking Change** pass a built-in `DefaultAlamofireManager` as parameter's default value instead of passing the singleton `Alamofire.Manager.sharedinstance` when initialize a `provider` - Fixes issue that stubbed responses still call the network. -# 5.3.0 - +# [5.3.0] - 2016-01-02 +### Changed - Updates to RXSwift 2.0.0 - Moves to use Antitypical/Result -# 5.2.1 - +# [5.2.1] - 2015-12-21 +### Changed - Update to ReactiveCocoa v4.0.0-RC.1 -- Fixes cases where underlying network errors were not properly propagated. - Moves to antitypical Result type -# 5.2.0 +### Fixed +- Fixes cases where underlying network errors were not properly propagated. -- Updated to RxSwift 2.0.0-beta.4 +# [5.2.0] - 2015-12-xx -# 5.1.0 +- Updated to RxSwift 2.0.0-beta.4 +# [5.1.0] - 2014-12-08 +### Changed - Update to ReactiveCocoa v4.0.0-alpha.4 -# 5.0.0 - +# [5.0.0] - 2015-11-30 +### Changed - **Breaking Change** rename `MoyaTarget` protocol to `TargetType` - **Breaking Change** rename `MoyaRequest` protocol to `RequestType` - **Breaking Change** rename `Plugin` protocol to `PluginType` @@ -290,58 +337,62 @@ structure and more. - **Breaking Change** Introduce `Error` type for use with reactive extensions - [@tomburns](http://github.com/tomburns) - **Breaking Change** Deprecate ReactiveCocoa 2 support -# 4.5.0 - +# [4.5.0] - 2015-11-11 +### Added - Adds mapping methods to `MoyaResponse` -# 4.4.0 - +# [4.4.0] - 2015-11-06 +### Added - Adds tvOS and watchOS support + +### Fixed - Fixes carthage OS X target not having source files -- Makes base OS X target 10.9 instead of 10.10 -# 4.3.1 +### Changed +- Makes base OS X target 10.9 instead of 10.10 +# [4.3.1] - 2015-11-02 +### Changed - Updates to latest ReactiveCocoa alpha. Again. -# 4.3.0 - +# [4.3.0] - 2015-11-02 +### Changed - Updates to latest ReactiveCocoa alpha. -# 4.2.0 - +# [4.2.0] - 2015-11-02 +### Changed - Removed extraneous `SignalProducer` from ReactiveCocoa extension – @JRHeaton - Removed extraneous `deferred()` from RxSwift extension - Moved to new RxSwift syntax – @wouterw - Updated RxSwift to latest beta – @wouterw -# 4.1.0 - +# [4.1.0] - 2015-10-27 +### Added - OS X support. -# 4.0.3 - +# [4.0.3] - 2015-10-23 +### Fixed - Fixes Carthage integration problem. -# 4.0.2 - +# [4.0.2] - 2015-10-23 +### Added - CancellableTokens can now debug print the requests cURL. -# 4.0.1 - +# [4.0.1] - 2015-10-13 +### Changed - Plugins now subclasses NSObject for custom subclasses. - Plugins' methods are now public, allowing custom subclasses to override. -# 4.0.0 - +# [4.0.0] - 2015-10-12 +### Changed - Updates Alamofire dependency to `~> 3.0` -# 3.0.1 - +# [3.0.1] - 2015-10-08 +### Changed - Changes `mapImage()` RxSwift function to use `UIImage!` instead of `UIImage`. -# 3.0.0 - +# [3.0.0] - 2015-10-05 +### Changed - Makes `parameters` on `MoyaTarget` an optional `[String: AnyObject]` dictionary. - Makes `parameters` and `httpHeaderFields` on `Endpoint` to be optionals. - Renamed stubbing identifiers: **Breaking Change** @@ -364,7 +415,6 @@ structure and more. - Removed errantly named `DefaultEndpointResolution` - Changes the closure to map `Endpoint`s to `NSURLRequest`s asynchonous. - Removes inflight request tracking for ReactiveCocoa and RxSwift providers. **Breaking Change** -- Adds support for ReactiveCocoa 4 by moving `ReactiveCocoaMoyaProvider` to use `SignalProducer` instead of `RACSignal` - Renamed `EndpointSampleResponse` cases: **Breaking Change** - `Success` to `NetworkResponse`, now contains `NSData` instead of `() -> NSData`. - `Error` to `NetworkError` @@ -376,113 +426,129 @@ structure and more. - ReactiveCocoa provider no longer replaces errors that contain status codes (an unlikely situation) with its own errors. It passes all errors directly through. - Renames `token` to `target` (it was usually `target` anyway, just made it consistent). -# 2.4.1 +### Added +- Adds support for ReactiveCocoa 4 by moving `ReactiveCocoaMoyaProvider` to use `SignalProducer` instead of `RACSignal` +# [2.4.1] - 2015-09-22 +### Fixed - Corrects problem with ignoring the specified Alamofire manager -# 2.4.0 - +# [2.4.0] - 2015-09-22 +### Added - Adds HTTP basic auth support. -# 2.3.0 - +# [2.3.0] - 2015-09-22 +### Added - Adds data processing functions for use with `RxMoyaProvider` -# 2.2.2 - +# [2.2.2] - 2015-09-16 +### Added - Adds convenience `endpointByAddingParameterEncoding` method. -# 2.2.1 - +# [2.2.1] - 2015-09-14 +### Added - Adds Moya files as members of RxMoya and ReactiveMoya frameworks. -# 2.2.0 - +# [2.2.0] - 2015-09-14 +### Added - Add backward-compatible call from `DefaultEnpointResolution` to `DefaultEndpointResolution` on `MoyaProvider` class. `DefaultEndpointResolution` is now used internally as the default resolver. `DefaultEnpointResolution` can be removed in a future major release. - Carthage support. -# 2.1.0 - +# [2.1.0] - 2015-08-11 +### Added - Add option to pass an `Alamofire.Manager` to `MoyaProvider` initializer -# 2.0.2 - +# [2.0.2] - 2015-08-11 +### Changed - Updates Demo directory's RxSwift version. -# 2.0.1 - +# [2.0.1] - 2015-08-06 +### Changed - Updates Demo directory's Moya version for `pod try` compatbility. -# 2.0.0 - +# [2.0.0] - 2015-08-04 +### Changed - **Breaking change** Combines `MoyaPath` and `MoyaTarget` protocols. - **Breaking change** Renames `Moya/Reactive` subspec to `Moya/ReactiveCocoa`. - **Breaking change** Removes `stubResponses` from initializer; replaced with new stubbing behavior `.NoStubbing`. Added class methods to `MoyaProvider` to provide defaults, while allowing users to still change stubbing behavior on a per-request basis. - **Breaking change** Redefines types of `DefaultEndpointMapping` and `DefaultEnpointResolution` class functions on `MoyaProvider`. You no longer invoke these functions to return a closure, rather, you reference the functions themselves _as_ closures. - **Breaking change** Renames `endpointsClosure` parameter and property of `MoyaProvider` to `endpointClosure`. - **Breaking change** Renames `ReactiveMoyaProvider` to `ReactiveCocoaMoyaProvider` for consistency. -- Fixes problem that the `ReactiveMoyaProvider` initializer would not respect the stubbing behavior it was passed. -- Adds official Carthage support – [@neonichu](http://github.com/neonichu) - Relaxes version dependency on RxSwift - [@alcarvalho](http://github.com/alcarvalho) -- Fixes possible concurrency bugs with reactive providers - [@alcarvalho](http://github.com/alcarvalho) -# 1.1.1 +### Added +- Adds official Carthage support – [@neonichu](http://github.com/neonichu) + +### Fixed +- Fixes problem that the `ReactiveMoyaProvider` initializer would not respect the stubbing behavior it was passed. +- Fixes possible concurrency bugs with reactive providers - [@alcarvalho](http://github.com/alcarvalho) +# [1.1.1] - 2015-06-12 +### Fixed - Fixes problem where `RxMoyaProvider` would not respect customized stubbing behavior (delays). -# 1.1.0 - +# [1.1.0] - 2015-06-08 +### Added - Adds support for RxSwift – [@alcarvalho](http://github.com/alcarvalho) -# 1.0.0 - +# [1.0.0] - 2015-05-27 +### Changed - **Breaking change** Changes `EndpointSampleResponse` to require closures that return `NSData`, not `NSData` instances themselves. This prevents sample data from being loaded during the normal, non-unit test app lifecycle. - **Breaking change** Adds `method` to `MoyaTarget` protocol and removes `method` parameter from `request()` functions. Targets now specify GET, POST, etc on a per-target level, instead of per-request. - **Breaking change** Adds `parameters` to `MoyaTarget` protocol and removes ability to pass parameters into `request()` functions. Targets now specify the parameters directly on a per-target level, instead of per-request. - Adds a sane default implementation of the `MoyaProvider` initializer's `endpointsClosure` parameter. -# 0.8.0 - +# [0.8.0] - 2015-05-25 +### Changed - Updates to Swift 1.2. -# 0.7.1 - +# [0.7.1] - 2015-05-27 +### Added - Adds cancellable requests -[@MichaelMcGuire](http://github.com/MichaelMcGuire) -# 0.7.0 - +# [0.7.0] - 2015-04-27 +### Added - Adds network activity closure to provider. -# 0.6.1 - +# [0.6.1] - 2017-01-13 +### Changed - Updates podspec to refer to `3.0.0-aplha.1` of ReactiveCocoa. -[@ashfurrow](http://github.com/ashfurrow) -# 0.6 - +# [0.6] - 2015-01-11 +### Added - First release on CocoaPods trunk. - Add data support for [stubbed error responses](https://github.com/ashfurrow/Moya/pull/92). – [@steam](http://github.com.steam) + +### Fixed - Fixes [#66](https://github.com/AshFurrow/Moya/issues/66), a problem with outdated Alamofire dependency and it's serializer type signature. -[@garnett](http://github.com/garnett) -- Delete note about ReactiveCocoa installation -[@garnett](http://github.com/garnett) -# 0.5 +### Changed +- Delete note about ReactiveCocoa installation -[@garnett](http://github.com/garnett) +# [0.5] - 2014-10-09 +### Fixed - Fixes [#52](https://github.com/AshFurrow/Moya/issues/52) to change submodules to use http instead of ssh. -[@ashfurrow)](http://github.com/AshFurrow) -- Migrate to support Xcode beta 6.1 -[@orta)](http://github.com/orta) -- Adds the original NSURLResponse to a MoyaResponse -[@orta)](http://github.com/orta) - Fixes [#63](https://github.com/AshFurrow/Moya/issues/63), a problem where stale inflight requests were kept around if they error'd down the pipline (discussed [here](https://github.com/ReactiveCocoa/ReactiveCocoa/issues/1525#issuecomment-58559734)) -[@ashfurrow](http://github.com/AshFurrow) -# 0.4 +### Added +- Adds the original NSURLResponse to a MoyaResponse -[@orta)](http://github.com/orta) -- Implements [#46](https://github.com/AshFurrow/Moya/issues/46), the code property of the NSError sent through by ReactiveMoyaProvider will now match the failing http status code. -[@powerje](http://github.com/powerje) +### Changed +- Migrate to support Xcode beta 6.1 -[@orta)](http://github.com/orta) -# 0.3 -- Fixes [#48](https://github.com/AshFurrow/Moya/issues/48) that modifies Moya to execute completion blocks of stubbed responses *immediately*, instead of using `dispatch_async` to defer it to the next invocation of the run loop. **This is a breaking change**. Because of this change, the ReactiveCocoa extensions had to be modified slightly to deduplicate inflight stubbed requests. Reactive providers now vend `RACSignal` instances that start the network request *when subscribed to*. -[@ashfurrow](http://github.com/AshFurrow) +# [0.4] -2014-09-22 +### Added +- Implements [#46](https://github.com/AshFurrow/Moya/issues/46), the code property of the NSError sent through by ReactiveMoyaProvider will now match the failing http status code. -[@powerje](http://github.com/powerje) -# 0.2 +# [0.3] - 2014-09-12 +### Fixed +- Fixes [#48](https://github.com/AshFurrow/Moya/issues/48) that modifies Moya to execute completion blocks of stubbed responses *immediately*, instead of using `dispatch_async` to defer it to the next invocation of the run loop. **This is a breaking change**. Because of this change, the ReactiveCocoa extensions had to be modified slightly to deduplicate inflight stubbed requests. Reactive providers now vend `RACSignal` instances that start the network request *when subscribed to*. -[@ashfurrow](http://github.com/AshFurrow) +# [0.2] - 2014-09-15 +### Fixed - Fixes [#44](https://github.com/AshFurrow/Moya/issues/44) where status codes weren't being passed through to completion blocks. This also modified the behavior of the ReactiveCocoa extensions significantly but sending MoyaResponse objects instead of just NSData ones. —[@ashfurrow](http://github.com/AshFurrow) -# 0.1 +# [0.1] - 2014-09-07 - Initial release. From 0b90f7ee8dcc378fe48db18c8b281e8792244de9 Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Wed, 7 Feb 2018 22:16:07 -0600 Subject: [PATCH 02/32] Releasing version 11.0.0. --- Changelog.md | 2 ++ Moya.podspec | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 11804290d..ea3b52df0 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,7 @@ # Next +# [11.0.0] - 2018-02-07 + # [11.0.0-beta.2] - 2018-01-27 ## Changed - **Breaking Change** Removed generic from `Endpoint`. See #1524 for discussion. [#1529](https://github.com/Moya/Moya/pull/1529) by @[zhongwuzw](https://github.com/zhongwuzw). diff --git a/Moya.podspec b/Moya.podspec index ccc362e12..3744edf20 100644 --- a/Moya.podspec +++ b/Moya.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Moya" - s.version = "11.0.0-beta.2" + s.version = "11.0.0" s.summary = "Network abstraction layer written in Swift" s.description = <<-EOS Moya abstracts network commands using Swift Generics to provide developers From cada23ac72cf8bcc142b382f85aa8258d488c638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mro=CC=81z?= Date: Thu, 8 Feb 2018 09:41:39 +0100 Subject: [PATCH 03/32] Add MoyaProvider migration in Moya 11 guide --- docs/MigrationGuides/migration_10_to_11.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/MigrationGuides/migration_10_to_11.md b/docs/MigrationGuides/migration_10_to_11.md index 021f92a44..2f35b7f88 100644 --- a/docs/MigrationGuides/migration_10_to_11.md +++ b/docs/MigrationGuides/migration_10_to_11.md @@ -8,6 +8,9 @@ This project follows [Semantic Versioning](http://semver.org). ### Endpoint Migration - Remove the generic constraint from the `Endpoint` type. Existing code should "just work" after the removal of the generic constraint. +### MoyaProvider Migration +- Replace usage of `MoyaProvider.defaultEndpointMapping` with `MoyaProvider.defaultEndpointMapping`, `MoyaProvider.defaultRequestMapping` with `MoyaProvider.defaultRequestMapping` and `MoyaProvider.defaultAlamofireManager` with `MoyaProvider.defaultAlamofireManager`. + ### Task Migration - Add `.requestCustomJSONEncodable` case to `Task` or default case to achieve exhaustiveness. From 90d041613dd25d38c3c5f71465838f4825142e1f Mon Sep 17 00:00:00 2001 From: Kim de Vos Date: Thu, 8 Feb 2018 09:42:29 +0100 Subject: [PATCH 04/32] Added feedback --- Changelog.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Changelog.md b/Changelog.md index 434fbc5b2..37d782a71 100644 --- a/Changelog.md +++ b/Changelog.md @@ -86,7 +86,7 @@ - Fixed a bug where you would have two response events in `requestWithProgress` method on RxMoya module. # [8.0.4] - 2017-05-09 -###Changed +### Changed - Bumped minimum version of ReactiveSwift to 1.1. - Changed use of deprecated `DateSchedulerProtocol` to `DateScheduler`. - Move project to using a single target for all platforms. @@ -101,7 +101,7 @@ - Changed `Moya.Error` to `MoyaError` in `MoyaAvailablity` for Swift 3.1 compatibility. # [8.0.2] - 2017-02-01 -### Changes +### Changed - Changed dependency pinning to rely only on major versions. # [8.0.1] - 2017-01-21 @@ -121,11 +121,11 @@ - Added `AccessTokenPlugin` for easier authorization. - Added `AccessTokenAuthorizable` protocol for optionally controlling the authorization behavior of `TargetType`s when using `AccessTokenPlugin`. - Added availability tags for renamed functions included in the Swift 3 migration. - -### - `Moya.Error` now conforms to `LocalizedError` protocol. - Added documentation for `TargetType` and associated data structures. - Re-add `MultiTarget` to project. + +### Changed - Adopted an SPM-compatible project structure. - Moved tests to Moya.xcodeproj. @@ -247,7 +247,7 @@ structure and more. - Added `queue` parameter to `request` and `sendRequest`. This open up option to use other queue instead of main queue for response callback. # [6.4.0] - 2016-04-02 - +### Changed - Makes `convertResponseToResult` public to make use of this method when dealing with Alamofire directly - Updates to ReactiveCocoa 4.1 - Updates to Result 2.0 @@ -288,7 +288,7 @@ structure and more. - Compatibility with RxSwift 2.1.x. # [6.1.0] - 2016-01-26 -### +### Changed - The built-in `DefaultAlamofireManager` as parameter's default value instead of the singleton `Alamofire.Manager.sharedinstance` is now used when instantiating `ReactiveCocoaMoyaProvider` and `RxMoyaProvider` as well. # [6.0.1] - 2016-01-26 @@ -314,7 +314,7 @@ structure and more. - Fixes cases where underlying network errors were not properly propagated. # [5.2.0] - 2015-12-xx - +### Changed - Updated to RxSwift 2.0.0-beta.4 # [5.1.0] - 2014-12-08 From 800a5a98aee0b93edb3a376f7a8e22b712a8967f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mro=CC=81z?= Date: Thu, 8 Feb 2018 09:47:15 +0100 Subject: [PATCH 05/32] Update Moya version in Readme --- Readme.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Readme.md b/Readme.md index 8971526e7..68a76cd59 100644 --- a/Readme.md +++ b/Readme.md @@ -72,7 +72,7 @@ your Swift version. 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", .upToNextMajor(from: "10.0.0")) +.package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "11.0.0")) ``` and then specify `"Moya"` as a dependency of the Target in which you wish to use Moya. @@ -91,7 +91,7 @@ let package = Package( targets: ["MyPackage"]), ], dependencies: [ - .package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "10.0.0")) + .package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "11.0.0")) ], targets: [ .target( @@ -108,15 +108,15 @@ Note that as of Moya 10, SPM only works with Swift 4 toolchain and greater. For Moya, use the following entry in your Podfile: ```rb -pod 'Moya', '~> 10.0' +pod 'Moya', '~> 11.0' # or -pod 'Moya/RxSwift', '~> 10.0' +pod 'Moya/RxSwift', '~> 11.0' # or -pod 'Moya/ReactiveSwift', '~> 10.0' +pod 'Moya/ReactiveSwift', '~> 11.0' ``` Then run `pod install`. From cac2a259ceba3beaae861f96cf872c7d667fa427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mro=CC=81z?= Date: Thu, 8 Feb 2018 09:48:00 +0100 Subject: [PATCH 06/32] Update Moya version in Readme_CN --- Readme_CN.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Readme_CN.md b/Readme_CN.md index 4b936de02..90e4c95b4 100644 --- a/Readme_CN.md +++ b/Readme_CN.md @@ -63,7 +63,7 @@ new auction app](https://github.com/Artsy/eidolon). 我们认为它已经可以 要集成使用苹果的Swift包管理器,请将以下内容作为依赖项添加到`Package.swift`: ```swift -.package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "10.0.0")) +.package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "11.0.0")) ``` 然后指定 `.Target(name: "Moya")` 使用Moya的依赖项. @@ -75,7 +75,7 @@ import PackageDescription let package = Package( name: "MyApp", dependencies: [ - .package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "10.0.0")) + .package(url: "https://github.com/Moya/Moya.git", .upToNextMajor(from: "11.0.0")) ] ) ``` @@ -85,15 +85,15 @@ let package = Package( 在您的Podfile文件中使用Moya: ```rb -pod 'Moya', '~> 10.0' +pod 'Moya', '~> 11.0' # or -pod 'Moya/RxSwift', '~> 10.0' +pod 'Moya/RxSwift', '~> 11.0' # or -pod 'Moya/ReactiveSwift', '~> 10.0' +pod 'Moya/ReactiveSwift', '~> 11.0' ``` 然后运行 `pod install`. From 062e5e648358d483eeaf35cbbeb931e2ab4ba48b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mro=CC=81z?= Date: Thu, 8 Feb 2018 12:10:37 +0100 Subject: [PATCH 07/32] Update Cartfile.lock --- Cartfile.resolved | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cartfile.resolved b/Cartfile.resolved index e6d6cb516..b46a8eb0a 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -3,5 +3,5 @@ github "AliSoftware/OHHTTPStubs" "f90c2bb0fb882e43761ab963ca8869d349d2c6e3" github "Quick/Nimble" "v7.0.3" github "Quick/Quick" "v1.2.0" github "ReactiveCocoa/ReactiveSwift" "3.1.0" -github "ReactiveX/RxSwift" "4.1.1" +github "ReactiveX/RxSwift" "4.1.2" github "antitypical/Result" "3.2.4" From b56d5acb7a3c62b512b740975afc801e82af96ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mro=CC=81z?= Date: Thu, 8 Feb 2018 12:37:00 +0100 Subject: [PATCH 08/32] Update Readme with current steps to open sample projects --- Readme.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 68a76cd59..c3c464e93 100644 --- a/Readme.md +++ b/Readme.md @@ -41,7 +41,9 @@ Some awesome features of Moya: You can check out more about the project direction in the [vision document](Vision.md). -## Sample Project +## Sample Projects + +We have provided two sample projects in the repository. To use it download the repo, run `carthage update` to download the required libraries and open [Moya.xcodeproj](https://github.com/Moya/Moya/tree/master/Moya.xcodeproj). You'll see two schemes: `Basic` and `Multi-Target` - select one and then build & run! Source files for these are in the `Examples` directory in project navigator. Have fun! There's a sample project in the Demo directory. To use it, run `carthage update` to download the required libraries. Have fun! From bd44daa7f691708cb0fe4bdba69cdacdfc040991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mro=CC=81z?= Date: Thu, 8 Feb 2018 12:41:09 +0100 Subject: [PATCH 09/32] Rephrase MultiTarget sample project info. --- docs/Examples/MultiTarget.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/Examples/MultiTarget.md b/docs/Examples/MultiTarget.md index 78f80573b..5e615bc74 100644 --- a/docs/Examples/MultiTarget.md +++ b/docs/Examples/MultiTarget.md @@ -30,10 +30,8 @@ provider.request(MultiTarget(GitHub.zen)) { result in and that's it! Really simple to introduce it in your app and if you have many endpoints that you want to split - this is the perfect solution for you. If you want to see this API in action, check out our -[Demo](https://github.com/Moya/Moya/tree/master/Demo) project, which has 2 -targets: one of them is `Demo`, which uses the basic form of Moya, and the -second one is `DemoMultiTarget`, which uses the modified version with usage of -`MultiTarget`. +[Multi-Target sample projects](https://github.com/Moya/Moya#sample-project), +which uses the modified version with usage of `MultiTarget`. ## Multiple targets when using `associatedtype` From 53d2fab7bba9fdbed8eb7256d793975159730d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mro=CC=81z?= Date: Thu, 8 Feb 2018 12:43:51 +0100 Subject: [PATCH 10/32] Fix broken links for Demo in Plugins.md --- Readme.md | 2 -- docs/Plugins.md | 2 +- docs_CN/Plugins.md | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Readme.md b/Readme.md index c3c464e93..383d70081 100644 --- a/Readme.md +++ b/Readme.md @@ -45,8 +45,6 @@ You can check out more about the project direction in the [vision document](Visi We have provided two sample projects in the repository. To use it download the repo, run `carthage update` to download the required libraries and open [Moya.xcodeproj](https://github.com/Moya/Moya/tree/master/Moya.xcodeproj). You'll see two schemes: `Basic` and `Multi-Target` - select one and then build & run! Source files for these are in the `Examples` directory in project navigator. Have fun! -There's a sample project in the Demo directory. To use it, run `carthage update` to download the required libraries. Have fun! - ## Project Status This project is actively under development, and is being used in [Artsy's diff --git a/docs/Plugins.md b/docs/Plugins.md index 358eb1e1f..6c681c292 100644 --- a/docs/Plugins.md +++ b/docs/Plugins.md @@ -33,7 +33,7 @@ The plugin can be found at [`Sources/Moya/Plugins/NetworkActivityPlugin.swift`]( ### Logging During development it can be very useful to log network activity to the console. This can be anything from the URL of a request as sent and received, to logging full headers, method, request body on each request and response. -The provided plugin for logging is the most complex of the provided plugins, and can be configured to suit the amount of logging your app (and build type) require. When initializing the plugin, you can choose options for verbosity, whether to log curl commands, and provide functions for outputting data (useful if you are using your own log framework instead of `print`) and formatting data before printing (by default the response will be converted to a String using `String.Encoding.utf8` but if you'd like to convert to pretty-printed JSON for your responses you can pass in a formatter function, see the function `JSONResponseDataFormatter` in [`Demo/Shared/GitHubAPI.swift`](../Demo/Shared/GitHubAPI.swift) for an example that does exactly that) +The provided plugin for logging is the most complex of the provided plugins, and can be configured to suit the amount of logging your app (and build type) require. When initializing the plugin, you can choose options for verbosity, whether to log curl commands, and provide functions for outputting data (useful if you are using your own log framework instead of `print`) and formatting data before printing (by default the response will be converted to a String using `String.Encoding.utf8` but if you'd like to convert to pretty-printed JSON for your responses you can pass in a formatter function, see the function `JSONResponseDataFormatter` in [`Examples/_shared/GitHubAPI.swift`](../Examples/_shared/GitHubAPI.swift) for an example that does exactly that) The plugin can be found at [`Sources/Moya/Plugins/NetworkLoggerPlugin.swift`](../Sources/Moya/Plugins/NetworkLoggerPlugin.swift) diff --git a/docs_CN/Plugins.md b/docs_CN/Plugins.md index a0f4a5458..379a08224 100644 --- a/docs_CN/Plugins.md +++ b/docs_CN/Plugins.md @@ -30,7 +30,7 @@ let provider = MoyaProvider(plugins: [NetworkLoggerPlugin(verbose: true) ### 日志记录 在开发期间,将网络活动记录到控制台是非常有用的。这可以是任何来自发送和接收请求URL的内容,来记录每个请求和响应的完整的header,方法,请求体。 -The provided plugin for logging is the most complex of the provided plugins, and can be configured to suit the amount of logging your app (and build type) require. When initializing the plugin, you can choose options for verbosity, whether to log curl commands, and provide functions for outputting data (useful if you are using your own log framework instead of `print`) and formatting data before printing (by default the response will be converted to a String using `String.Encoding.utf8` but if you'd like to convert to pretty-printed JSON for your responses you can pass in a formatter function, see the function `JSONResponseDataFormatter` in [`Demo/Shared/GitHubAPI.swift`](../Demo/Shared/GitHubAPI.swift) for an example that does exactly that) +The provided plugin for logging is the most complex of the provided plugins, and can be configured to suit the amount of logging your app (and build type) require. When initializing the plugin, you can choose options for verbosity, whether to log curl commands, and provide functions for outputting data (useful if you are using your own log framework instead of `print`) and formatting data before printing (by default the response will be converted to a String using `String.Encoding.utf8` but if you'd like to convert to pretty-printed JSON for your responses you can pass in a formatter function, see the function `JSONResponseDataFormatter` in [`Examples/_shared/GitHubAPI.swift`](../Examples/_shared/GitHubAPI.swift) for an example that does exactly that) 这个插件可以在 [`Sources/Moya/Plugins/NetworkLoggerPlugin.swift`](../Sources/Moya/Plugins/NetworkLoggerPlugin.swift)中找到 From 45214614f53da01e2eb1d1c68a02cb328cf3b046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mro=CC=81z?= Date: Fri, 9 Feb 2018 11:57:55 +0100 Subject: [PATCH 11/32] Add discussion to exemptLabels for StaleBot --- .github/stale.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/stale.yml b/.github/stale.yml index 49df4cf64..3949b2c0e 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -11,6 +11,7 @@ exemptLabels: - "enhancement" - "confirmed bug" - "chore" + - "discussion" # Label to use when marking as stale staleLabel: stale From d26f358e3bad6d5faaca00a8a16549af2847c8ba Mon Sep 17 00:00:00 2001 From: Kim de Vos Date: Sun, 11 Feb 2018 00:11:36 +0100 Subject: [PATCH 12/32] Updated Dangerfile (#1579) * Updated Dangerfile. It should now warn when changing Readme.md and not Readme_cn.md and vice-versa * Updated feedback --- Dangerfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Dangerfile b/Dangerfile index ed3b9e50c..4fcfa40c6 100644 --- a/Dangerfile +++ b/Dangerfile @@ -13,6 +13,13 @@ if en_docs_modified ^ cn_docs_modified warn("Consider **also** updating the #{ en_docs_modified ? "English" : "Chinese" } docs. For Chinese translations, request the modified file(s) to be added to the list [here](https://github.com/Moya/Moya/issues/1357) for someone else to translate, if you can't do so yourself.") end +# Warn, asking to update Chinese README if only English README are updated and vice-versa +en_readme_modified = !git.modified_files.grep(%r{Readme.md}).empty? +cn_readme_modified = !git.modified_files.grep(%r{Readme_CN.md}).empty? +if en_readme_modified ^ cn_readme_modified + warn("Consider **also** updating the #{ en_readme_modified ? "Chinese" : "English" } README. For Chinese translations, request the modified file(s) to be added to the list [here](https://github.com/Moya/Moya/issues/1357) for someone else to translate, if you can't do so yourself.") +end + # Warn when there is a big PR warn("Big PR, try to keep changes smaller if you can") if git.lines_of_code > 500 From 68acaab52575785edf8b730561bddfa72c445187 Mon Sep 17 00:00:00 2001 From: Galvin Li Date: Thu, 15 Feb 2018 08:45:44 +0800 Subject: [PATCH 13/32] Moya 10 to 11 migration guide Chinese document. --- docs_CN/MigrationGuides/migration_10_to_11.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 docs_CN/MigrationGuides/migration_10_to_11.md diff --git a/docs_CN/MigrationGuides/migration_10_to_11.md b/docs_CN/MigrationGuides/migration_10_to_11.md new file mode 100644 index 000000000..32ba8e386 --- /dev/null +++ b/docs_CN/MigrationGuides/migration_10_to_11.md @@ -0,0 +1,19 @@ +# 从版本 10.x 迁移到 11.x + +此项目遵循 [语义化版本控制规范](http://semver.org)。 + +### ReactiveSwift 迁移 +- ReactiveSwift的变化内容请查询[ReactiveSwift 3.0.0 发布版本说明](https://github.com/ReactiveCocoa/ReactiveSwift/releases/tag/3.0.0)。 + +### Endpoint 迁移 +- 移除 `Endpoint` 类型的泛型约束,原有的代码“应该”能直接正常运行。 + +### MoyaProvider 迁移 +- 把原有的 `MoyaProvider.defaultEndpointMapping` 更改为 `MoyaProvider.defaultEndpointMapping`, `MoyaProvider.defaultRequestMapping` 更改为 `MoyaProvider.defaultRequestMapping`, `MoyaProvider.defaultAlamofireManager` 更改为 `MoyaProvider.defaultAlamofireManager`. + +### Task 迁移 +- 添加 `.requestCustomJSONEncodable` case 到 `Task` 或者 默认case 以满足更多场景. + +### TargetType 迁移 +- 把 `TargetType` 原有的属性 `validate` 更改为新属性 `validationType`。 +如果原有的 `validate` 值是 `false`,则使用 `ValidationType.none` 代替。如果值是 `true` 则使用 `ValidationType.successCodes` 代替。此属性默认值为 `ValidationType.none`。 From ac086656709df301eeef4b0b72c2b4ca89ecc1c5 Mon Sep 17 00:00:00 2001 From: Galvin Li Date: Thu, 15 Feb 2018 09:06:49 +0800 Subject: [PATCH 14/32] AlamofireValidation Chinese document update --- docs_CN/Examples/AlamofireValidation.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/docs_CN/Examples/AlamofireValidation.md b/docs_CN/Examples/AlamofireValidation.md index 121fb4f82..36d247fd9 100644 --- a/docs_CN/Examples/AlamofireValidation.md +++ b/docs_CN/Examples/AlamofireValidation.md @@ -1,8 +1,7 @@ # Alamofire 自动验证 -有时候, 您希望为某些请求使用 [Alamofire automatic validation](https://github.com/Alamofire/Alamofire#automatic-validation) . -当请求被配置了Alamofire 验证, Moya会在相关联的`DataRequest`上,内部调用Alamofire的 `validate()` 方法。 - +有时候, 您希望为某些请求使用 [Alamofire自动化验证](https://github.com/Alamofire/Alamofire#automatic-validation) . +当你对请求配置了Alamofire 验证的时候, Moya会在相关联的`DataRequest`上,内部调用Alamofire的 `validate()` 方法。 ```swift // MARK: - TargetType Protocol Implementation @@ -36,9 +35,19 @@ extension MyService: TargetType { } } ``` -Alamofire 非常有用, 例如,如果你想使用 [Alamofire's `RequestRetrier` 和 `RequestAdapter`](https://github.com/Alamofire/Alamofire#requestretrier)——为OAuth2 准备的Moya客户端. +Moya允许你通过`ValidationType`枚举配置Alamofire验证功能。 + +你可以使用以下四个枚举项: +- `.none` 不会进行任何验证 +- `.successCodes` 会对状态码 200 - 299 的请求进行验证. +- `.successAndRedirectCodes` 会对状态码 200 - 399 的请求进行验证. +- `.customCodes([Int])` 只会对配置的状态码相匹配的请求进行验证. + +所有请求的默认配置都是`ValidationType.none`。 + +如果你想在一个支持OAuth 2的Moya客户端中使用 [Alamofire的 `RequestRetrier` 和 `RequestAdapter`](https://github.com/Alamofire/Alamofire#requestretrier),Alamofire自动化验证会发挥非常大的作用。 -同样, 如果验证失败, 你会从返回的`MoyaError`中获取一个响应。 +同样地, 如果验证失败, 你会从返回的`MoyaError`中获取到一个响应。 ```swift provider.request(target) { result in From 71923bbcb8676f5ad30c89168432f1304438df1b Mon Sep 17 00:00:00 2001 From: Galvin Li Date: Thu, 15 Feb 2018 09:14:38 +0800 Subject: [PATCH 15/32] tiny change --- docs_CN/MigrationGuides/migration_10_to_11.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs_CN/MigrationGuides/migration_10_to_11.md b/docs_CN/MigrationGuides/migration_10_to_11.md index 32ba8e386..f7a3d3aa8 100644 --- a/docs_CN/MigrationGuides/migration_10_to_11.md +++ b/docs_CN/MigrationGuides/migration_10_to_11.md @@ -12,7 +12,7 @@ - 把原有的 `MoyaProvider.defaultEndpointMapping` 更改为 `MoyaProvider.defaultEndpointMapping`, `MoyaProvider.defaultRequestMapping` 更改为 `MoyaProvider.defaultRequestMapping`, `MoyaProvider.defaultAlamofireManager` 更改为 `MoyaProvider.defaultAlamofireManager`. ### Task 迁移 -- 添加 `.requestCustomJSONEncodable` case 到 `Task` 或者 默认case 以满足更多场景. +- 添加 `.requestCustomJSONEncodable` 枚举项到 `Task` 或者作为默认枚举项以完善相应的枚举类型. ### TargetType 迁移 - 把 `TargetType` 原有的属性 `validate` 更改为新属性 `validationType`。 From be5818c89ae7a54ca1ce8d067519f8c720fd39b0 Mon Sep 17 00:00:00 2001 From: Wilson Ding Date: Sat, 17 Feb 2018 10:50:21 -0600 Subject: [PATCH 16/32] Fixed grammar and contractions in Contributing.md --- Contributing.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Contributing.md b/Contributing.md index 446ebe8ff..b429b6915 100644 --- a/Contributing.md +++ b/Contributing.md @@ -1,6 +1,6 @@ # Community Contribution Guidelines v2.0.0 -As the creators, and maintainers of this project, we want to ensure that the project lives and continues to grow. Not blocked by any singular person's computer time. One of the simplest ways of doing this is by encouraging a larger set of shallow contributors. Through this, we hope to mitigate the problems of a project that needs updates but there's no-one who has the power to do so. +As the creators and maintainers of this project, we want to ensure that the project lives and continues to grow. Not blocked by any singular person's computer time. One of the simplest ways of doing this is by encouraging a larger set of shallow contributors. Through this, we hope to mitigate the problems of a project that needs updates, but there is no-one who has the power to do so. #### Development Process @@ -20,30 +20,30 @@ To run tests locally, you will need to download Moya's dependencies. To do so, run `carthage update --platform iOS` and take a nap, waiting for it to finish. 😴 -If you don't have Carthage installed, check the [installation instructions](https://github.com/Carthage/Carthage#installing-carthage). -And, of course, don't forget to run `carthage update --platform iOS` after. +If you do not have Carthage installed, check the [installation instructions](https://github.com/Carthage/Carthage#installing-carthage). +And, of course, do not forget to run `carthage update --platform iOS` after. Afer that, you can open `Moya.xcodeproj` and hit ⌘+U to start testing. #### Ownership -If you get a merged Pull Request, regardless of content (typos, code, doc fixes), then you're eligible for push access to this organization. This is checked for on pull request merges and an invite to the organization is sent via GitHub. +If you get a merged Pull Request, regardless of content (typos, code, doc fixes), then you are eligible for push access to this organization. This is checked for on pull request merges and an invite to the organization is sent via GitHub. -Offhand, it's easy to imagine that this would make code quality suffer, but in reality it offers fresh perspectives to the codebase and encourages ownership from people who are depending on the project. If you are building a project that relies on this codebase, then you probably have the skills to improve it and offer valuable feedback. +Offhand, it is easy to imagine that this would make code quality suffer, but in reality it offers fresh perspectives to the codebase and encourages ownership from people who are depending on the project. If you are building a project that relies on this codebase, then you probably have the skills to improve it and offer valuable feedback. Everyone comes in with their own perspective on what a project could/should look like, and encouraging discussion can help expose good ideas sooner. #### Why do we give out push access? -It can be overwhelming to be offered the chance to wipe the source code for a project. Don't worry, we don't let you push to master. All code is peer-reviewed, and we have the convention that someone other than the submitter should merge non-trivial pull requests. +It can be overwhelming to be offered the chance to wipe the source code for a project. Do not worry, we do not let you push to master. All code is peer-reviewed, and we have the convention that someone other than the submitter should merge non-trivial pull requests. -As an organization contributor, you can merge other people's pull requests, or other contributors can merge yours. You won't be assigned a pull request, but you're welcome to jump in and take a code review on topics that interest you. +As an organization contributor, you can merge other people's pull requests, or other contributors can merge yours. You will not be assigned a pull request, but you are welcome to jump in and take a code review on topics that interest you. This project is not continuously deployed, there is space for debate after review too. Offering everyone the chance to revert, or make an amending pull request. If it feels right, merge. #### How can we help you get comfortable contributing? -It's normal for a first pull request to be a potential fix for a problem, and moving on from there to helping the project's direction can be difficult. We try to help contributors cross that barrier by offering good first step issues. These issues can be fixed without feeling like you're stepping on toes. Ideally, these are non-critical issues that are well defined. They will be purposely avoided by mature contributors to the project, to make space for others. +It is normal for a first pull request to be a potential fix for a problem, and moving on from there to helping the project's direction can be difficult. We try to help contributors cross that barrier by offering good first step issues. These issues can be fixed without feeling like you are stepping on toes. Ideally, these are non-critical issues that are well defined. They will be purposely avoided by mature contributors to the project, to make space for others. We aim to keep all project discussion inside GitHub issues. This is to make sure valuable discussion is accessible via search. If you have questions about how to use the library, or how the project is running - GitHub issues are the goto tool for this project. @@ -51,19 +51,19 @@ We aim to keep all project discussion inside GitHub issues. This is to make sure To quote [@alloy](https://github.com/alloy) from [this issue](https://github.com/Moya/Moya/issues/135): -> Don't ever feel bad for not contributing to open source. +> Do not ever feel bad for not contributing to open source. We want contributors to provide ideas, keep the ship shipping and to take some of the load from others. It is non-obligatory; we’re here to get things done in an enjoyable way. :trophy: -The fact that you'll have push access will allow you to: +The fact that you will have push access will allow you to: -- Avoid having to fork the project if you want to submit other pull requests as you'll be able to create branches directly on the project. -- Help triage issues, merge pull requests. +- Avoid having to fork the project if you want to submit other pull requests, as you will be able to create branches directly on the project. +- Help triage issues and merge pull requests. - Pick up the project if other maintainers move their focus elsewhere. -It's up to you to use those superpowers or not though 😉 +It is up to you to use those superpowers or not though 😉 -If someone submits a pull request that's not perfect, and you are reviewing, it's better to think about the PR's motivation rather than the specific implementation. Having braces on the wrong line should not be a blocker. Though we do want to keep test coverage high, we will work with you to figure that out together. +If someone submits a pull request that is not perfect, and you are reviewing, it is better to think about the PR's motivation rather than the specific implementation. Having braces on the wrong line should not be a blocker. Though we do want to keep test coverage high, we will work with you to figure that out together. #### What about if you have problems that cannot be discussed in a public issue? From 75b71cf605bb2e5c5a32285aa43cb7008321344a Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Thu, 22 Feb 2018 04:34:28 -0600 Subject: [PATCH 17/32] Perform validation on multipart uploads --- Sources/Moya/MoyaProvider+Internal.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/Moya/MoyaProvider+Internal.swift b/Sources/Moya/MoyaProvider+Internal.swift index 249f1ac41..be56bd6f6 100644 --- a/Sources/Moya/MoyaProvider+Internal.swift +++ b/Sources/Moya/MoyaProvider+Internal.swift @@ -162,7 +162,9 @@ private extension MoyaProvider { self.cancelCompletion(completion, target: target) return } - cancellable.innerCancellable = self.sendAlamofireRequest(alamoRequest, target: target, callbackQueue: callbackQueue, progress: progress, completion: completion) + let validationCodes = target.validationType.statusCodes + let validated = validationCodes.isEmpty ? alamoRequest : alamoRequest.validate(statusCode: validationCodes) + cancellable.innerCancellable = self.sendAlamofireRequest(validated, target: target, callbackQueue: callbackQueue, progress: progress, completion: completion) case .failure(let error): completion(.failure(MoyaError.underlying(error as NSError, nil))) } From 95da093d978852bd392a9945b416829003f8dad6 Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Thu, 22 Feb 2018 04:34:44 -0600 Subject: [PATCH 18/32] Add test for #1590 --- Tests/MoyaProviderIntegrationTests.swift | 23 +++++++++++++++++ Tests/MoyaProviderSpec.swift | 9 ++----- Tests/TestHelpers.swift | 32 +++++++++++++++++++++--- 3 files changed, 53 insertions(+), 11 deletions(-) diff --git a/Tests/MoyaProviderIntegrationTests.swift b/Tests/MoyaProviderIntegrationTests.swift index 5e9824d24..da979dfc3 100644 --- a/Tests/MoyaProviderIntegrationTests.swift +++ b/Tests/MoyaProviderIntegrationTests.swift @@ -299,6 +299,29 @@ final class MoyaProviderIntegrationTests: QuickSpec { } } } + + describe("a provider performing a multipart upload with Alamofire validation") { + it("only allows status code 287") { + let formData = HTTPBin.createMultipartFormData() + let target = HTTPBin.validatedUploadMultipart(formData, nil) + let provider = MoyaProvider() + provider.request(target) { result in + switch result { + case .success(let response): + let validCodes = target.validationType.statusCodes + expect(validCodes).to(contain(response.statusCode)) + case .failure(let error): + switch error { + case .underlying(_, let response): + let validCodes = target.validationType.statusCodes + expect(validCodes).toNot(contain(response!.statusCode)) + default: + fatalError("Received unexpected error") + } + } + } + } + } } } diff --git a/Tests/MoyaProviderSpec.swift b/Tests/MoyaProviderSpec.swift index de8ae16e0..52606b258 100644 --- a/Tests/MoyaProviderSpec.swift +++ b/Tests/MoyaProviderSpec.swift @@ -841,13 +841,8 @@ final class MoyaProviderSpec: QuickSpec { it("tracks progress of multipart request") { - let url = Bundle(for: MoyaProviderSpec.self).url(forResource: "testImage", withExtension: "png")! - let string = "some data" - guard let data = string.data(using: .utf8) else { fatalError("Failed creating Data from String \(string)") } - let target: HTTPBin = .uploadMultipart([ - MultipartFormData(provider: .file(url), name: "file", fileName: "testImage"), - MultipartFormData(provider: .data(data), name: "data") - ], nil) + let formData = HTTPBin.createMultipartFormData() + let target = HTTPBin.uploadMultipart(formData, nil) var progressObjects: [Progress?] = [] var progressValues: [Double] = [] diff --git a/Tests/TestHelpers.swift b/Tests/TestHelpers.swift index d1f4a788f..eeeae3bbe 100644 --- a/Tests/TestHelpers.swift +++ b/Tests/TestHelpers.swift @@ -74,13 +74,14 @@ enum HTTPBin: TargetType { case post case upload(file: URL) case uploadMultipart([MultipartFormData], [String: Any]?) + case validatedUploadMultipart([MultipartFormData], [String: Any]?) var baseURL: URL { return URL(string: "http://httpbin.org")! } var path: String { switch self { case .basicAuth: return "/basic-auth/user/passwd" - case .post, .upload, .uploadMultipart: + case .post, .upload, .uploadMultipart, .validatedUploadMultipart: return "/post" } } @@ -89,7 +90,7 @@ enum HTTPBin: TargetType { switch self { case .basicAuth: return .get - case .post, .upload, .uploadMultipart: + case .post, .upload, .uploadMultipart, .validatedUploadMultipart: return .post } } @@ -100,7 +101,7 @@ enum HTTPBin: TargetType { return .requestParameters(parameters: [:], encoding: URLEncoding.default) case .upload(let fileURL): return .uploadFile(fileURL) - case .uploadMultipart(let data, let urlParameters): + case .uploadMultipart(let data, let urlParameters), .validatedUploadMultipart(let data, let urlParameters): if let urlParameters = urlParameters { return .uploadCompositeMultipart(data, urlParameters: urlParameters) } else { @@ -113,7 +114,7 @@ enum HTTPBin: TargetType { switch self { case .basicAuth: return "{\"authenticated\": true, \"user\": \"user\"}".data(using: String.Encoding.utf8)! - case .post, .upload, .uploadMultipart: + case .post, .upload, .uploadMultipart, .validatedUploadMultipart: return "{\"args\": {}, \"data\": \"\", \"files\": {}, \"form\": {}, \"headers\": { \"Connection\": \"close\", \"Content-Length\": \"0\", \"Host\": \"httpbin.org\" }, \"json\": null, \"origin\": \"198.168.1.1\", \"url\": \"https://httpbin.org/post\"}".data(using: String.Encoding.utf8)! } } @@ -121,6 +122,15 @@ enum HTTPBin: TargetType { var headers: [String: String]? { return nil } + + var validationType: ValidationType { + switch self { + case .validatedUploadMultipart: + return .customCodes([287]) + default: + return .none + } + } } public enum GitHubUserContent { @@ -171,6 +181,20 @@ extension GitHubUserContent: TargetType { } } +// MARK: - Upload Multipart Helpers + +extension HTTPBin { + static func createMultipartFormData() -> [MultipartFormData] { + let url = Bundle(for: MoyaProviderSpec.self).url(forResource: "testImage", withExtension: "png")! + let string = "some data" + guard let data = string.data(using: .utf8) else { fatalError("Failed creating Data from String \(string)") } + return [ + MultipartFormData(provider: .file(url), name: "file", fileName: "testImage"), + MultipartFormData(provider: .data(data), name: "data") + ] + } +} + // MARK: - String Helpers extension String { var urlEscaped: String { From bf09af4a236d7f8cab265e375c4cc480caa9382f Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Thu, 22 Feb 2018 04:37:40 -0600 Subject: [PATCH 19/32] Add changelog entry --- Changelog.md | 5 +++++ Tests/MoyaProviderIntegrationTests.swift | 1 + 2 files changed, 6 insertions(+) diff --git a/Changelog.md b/Changelog.md index 2bcc79f12..5d4da13de 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,11 @@ # Next +## Fixed +- Fixes Alamofire validation not being performed on `.uploadMultipart` requests. +[#1591](https://github.com/Moya/Moya/pull/1591) by [@SD10](https://github.com/SD10). + # [11.0.0] - 2018-02-07 +- No changes # [11.0.0-beta.2] - 2018-01-27 ## Changed diff --git a/Tests/MoyaProviderIntegrationTests.swift b/Tests/MoyaProviderIntegrationTests.swift index da979dfc3..155525505 100644 --- a/Tests/MoyaProviderIntegrationTests.swift +++ b/Tests/MoyaProviderIntegrationTests.swift @@ -300,6 +300,7 @@ final class MoyaProviderIntegrationTests: QuickSpec { } } + // Resolves ValidationType not working with multipart upload #1590 describe("a provider performing a multipart upload with Alamofire validation") { it("only allows status code 287") { let formData = HTTPBin.createMultipartFormData() From 7532434bbe9bce26c187783881ed8d2766ad63ce Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Thu, 22 Feb 2018 05:13:09 -0600 Subject: [PATCH 20/32] Add fatalError for missing resource --- Tests/TestHelpers.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Tests/TestHelpers.swift b/Tests/TestHelpers.swift index eeeae3bbe..46911b638 100644 --- a/Tests/TestHelpers.swift +++ b/Tests/TestHelpers.swift @@ -185,9 +185,13 @@ extension GitHubUserContent: TargetType { extension HTTPBin { static func createMultipartFormData() -> [MultipartFormData] { - let url = Bundle(for: MoyaProviderSpec.self).url(forResource: "testImage", withExtension: "png")! + guard let url = Bundle(for: MoyaProviderSpec.self).url(forResource: "testImage", withExtension: "png") else { + fatalError("Resource testImage.png could not be found in bundle") + } let string = "some data" - guard let data = string.data(using: .utf8) else { fatalError("Failed creating Data from String \(string)") } + guard let data = string.data(using: .utf8) else { + fatalError("Failed creating Data from String \(string)") + } return [ MultipartFormData(provider: .file(url), name: "file", fileName: "testImage"), MultipartFormData(provider: .data(data), name: "data") From 9cec5a29fe409230249c8e81801e63f4e29e4c69 Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Thu, 22 Feb 2018 06:46:31 -0600 Subject: [PATCH 21/32] Update integration tests to wait --- Sources/Moya/MoyaProvider+Internal.swift | 4 ++-- Tests/MoyaProviderIntegrationTests.swift | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Sources/Moya/MoyaProvider+Internal.swift b/Sources/Moya/MoyaProvider+Internal.swift index be56bd6f6..67dfb1729 100644 --- a/Sources/Moya/MoyaProvider+Internal.swift +++ b/Sources/Moya/MoyaProvider+Internal.swift @@ -163,8 +163,8 @@ private extension MoyaProvider { return } let validationCodes = target.validationType.statusCodes - let validated = validationCodes.isEmpty ? alamoRequest : alamoRequest.validate(statusCode: validationCodes) - cancellable.innerCancellable = self.sendAlamofireRequest(validated, target: target, callbackQueue: callbackQueue, progress: progress, completion: completion) + let validatedRequest = validationCodes.isEmpty ? alamoRequest : alamoRequest.validate(statusCode: validationCodes) + cancellable.innerCancellable = self.sendAlamofireRequest(validatedRequest, target: target, callbackQueue: callbackQueue, progress: progress, completion: completion) case .failure(let error): completion(.failure(MoyaError.underlying(error as NSError, nil))) } diff --git a/Tests/MoyaProviderIntegrationTests.swift b/Tests/MoyaProviderIntegrationTests.swift index 155525505..856187b8f 100644 --- a/Tests/MoyaProviderIntegrationTests.swift +++ b/Tests/MoyaProviderIntegrationTests.swift @@ -306,21 +306,21 @@ final class MoyaProviderIntegrationTests: QuickSpec { let formData = HTTPBin.createMultipartFormData() let target = HTTPBin.validatedUploadMultipart(formData, nil) let provider = MoyaProvider() - provider.request(target) { result in - switch result { - case .success(let response): - let validCodes = target.validationType.statusCodes - expect(validCodes).to(contain(response.statusCode)) - case .failure(let error): - switch error { - case .underlying(_, let response): - let validCodes = target.validationType.statusCodes - expect(validCodes).toNot(contain(response!.statusCode)) - default: - fatalError("Received unexpected error") + var receievedResponse: Response? + var receivedError: Error? + waitUntil(timeout: 5.0) { done in + provider.request(target) { result in + switch result { + case .success(let response): + receievedResponse = response + case .failure(let error): + receivedError = error } + done() } } + expect(receievedResponse).to(beNil()) + expect(receivedError).toNot(beNil()) } } } From 980fd7d252cfdf5f43ac4cb5a5a1b62e0afbf6c9 Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Thu, 22 Feb 2018 07:17:24 -0600 Subject: [PATCH 22/32] Perform validation on stubbed requests --- Sources/Moya/MoyaProvider+Internal.swift | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Sources/Moya/MoyaProvider+Internal.swift b/Sources/Moya/MoyaProvider+Internal.swift index 249f1ac41..e73f0506f 100644 --- a/Sources/Moya/MoyaProvider+Internal.swift +++ b/Sources/Moya/MoyaProvider+Internal.swift @@ -122,15 +122,29 @@ public extension MoyaProvider { return } + let validate = { (response: Moya.Response) -> Result in + let validCodes = target.validationType.statusCodes + guard !validCodes.isEmpty else { return .success(response) } + if validCodes.contains(response.statusCode) { + return .success(response) + } else { + let statusError = MoyaError.statusCode(response) + let error = MoyaError.underlying(statusError, response) + return .failure(error) + } + } + switch endpoint.sampleResponseClosure() { case .networkResponse(let statusCode, let data): let response = Moya.Response(statusCode: statusCode, data: data, request: request, response: nil) - plugins.forEach { $0.didReceive(.success(response), target: target) } - completion(.success(response)) + let result = validate(response) + plugins.forEach { $0.didReceive(result, target: target) } + completion(result) case .response(let customResponse, let data): let response = Moya.Response(statusCode: customResponse.statusCode, data: data, request: request, response: customResponse) - plugins.forEach { $0.didReceive(.success(response), target: target) } - completion(.success(response)) + let result = validate(response) + plugins.forEach { $0.didReceive(result, target: target) } + completion(result) case .networkError(let error): let error = MoyaError.underlying(error, nil) plugins.forEach { $0.didReceive(.failure(error), target: target) } From 84ff67748c635b00e509f7ee5fbd2226645e9816 Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Thu, 22 Feb 2018 07:17:39 -0600 Subject: [PATCH 23/32] Add tests for validated stubbed requests --- Tests/MoyaProviderSpec.swift | 64 ++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/Tests/MoyaProviderSpec.swift b/Tests/MoyaProviderSpec.swift index de8ae16e0..b97ad2dc2 100644 --- a/Tests/MoyaProviderSpec.swift +++ b/Tests/MoyaProviderSpec.swift @@ -409,10 +409,10 @@ final class MoyaProviderSpec: QuickSpec { } it("returns identical sample response") { + // TODO: Fix this failing test let response = HTTPURLResponse(url: URL(string: "http://example.com")!, mimeType: nil, expectedContentLength: 0, textEncodingName: nil) let endpointResolution: MoyaProvider.EndpointClosure = { target in - let url = target.baseURL.appendingPathComponent(target.path).absoluteString - return Endpoint(url: url, sampleResponseClosure: { .response(response, Data()) }, method: target.method, task: target.task, httpHeaderFields: target.headers) + return Endpoint(url: URL(target: target).absoluteString, sampleResponseClosure: { .response(response, target.sampleData) }, method: target.method, task: target.task, httpHeaderFields: target.headers) } let provider = MoyaProvider(endpointClosure: endpointResolution, stubClosure: MoyaProvider.immediatelyStub) @@ -603,7 +603,7 @@ final class MoyaProviderSpec: QuickSpec { } } - expect(dataString) == "sample data" + expect(dataString).to(equal("sample data")) } it("uses correct headers") { @@ -973,5 +973,63 @@ final class MoyaProviderSpec: QuickSpec { } } } + + describe("a provider for stubbed requests with validation") { + var stubbedProvider: MoyaProvider! + + context("response contains invalid status code") { + it("returns a failure case") { + let endpointClosure = { (target: GitHub) -> Endpoint in + return Endpoint( + url: URL(target: target).absoluteString, + sampleResponseClosure: { .networkResponse(400, target.sampleData) }, + method: target.method, + task: target.task, + httpHeaderFields: target.headers + ) + } + stubbedProvider = MoyaProvider(endpointClosure: endpointClosure, stubClosure: MoyaProvider.immediatelyStub) + stubbedProvider.request(.zen) { result in + let validStatusCodes = GitHub.zen.validationType.statusCodes + switch result { + case .success(let response): + expect(validStatusCodes).to(contain(response.statusCode)) + case .failure(let error): + guard case let MoyaError.underlying(_, response) = error else { + fatalError("Expected MoyaError.underlying for validation failure.") + } + expect(validStatusCodes).toNot(contain(response!.statusCode)) + } + } + } + } + context("response contains valid status code") { + it("returns a success case") { + let endpointClosure = { (target: GitHub) -> Endpoint in + return Endpoint( + url: URL(target: target).absoluteString, + sampleResponseClosure: { .networkResponse(200, target.sampleData) }, + method: target.method, + task: target.task, + httpHeaderFields: target.headers + ) + } + stubbedProvider = MoyaProvider(endpointClosure: endpointClosure, stubClosure: MoyaProvider.immediatelyStub) + let validStatusCodes = GitHub.zen.validationType.statusCodes + stubbedProvider.request(.zen) { result in + switch result { + case .success(let response): + expect(validStatusCodes).toNot(beEmpty()) + expect(validStatusCodes).to(contain(response.statusCode)) + case .failure(let error): + guard case let MoyaError.underlying(_, response) = error else { + fatalError("Expected MoyaError.underlying for validation failure.") + } + expect(validStatusCodes).toNot(contain(response!.statusCode)) + } + } + } + } + } } } From d34a05ccd41687b96c15afe4f4bb954d0a775ede Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Thu, 22 Feb 2018 07:23:41 -0600 Subject: [PATCH 24/32] Update HTTPURLResponse --- Tests/MoyaProviderSpec.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Tests/MoyaProviderSpec.swift b/Tests/MoyaProviderSpec.swift index b97ad2dc2..7d9da36e5 100644 --- a/Tests/MoyaProviderSpec.swift +++ b/Tests/MoyaProviderSpec.swift @@ -409,8 +409,7 @@ final class MoyaProviderSpec: QuickSpec { } it("returns identical sample response") { - // TODO: Fix this failing test - let response = HTTPURLResponse(url: URL(string: "http://example.com")!, mimeType: nil, expectedContentLength: 0, textEncodingName: nil) + let response = HTTPURLResponse(url: URL(string: "http://example.com")!, statusCode: 200, httpVersion: nil, headerFields: nil)! let endpointResolution: MoyaProvider.EndpointClosure = { target in return Endpoint(url: URL(target: target).absoluteString, sampleResponseClosure: { .response(response, target.sampleData) }, method: target.method, task: target.task, httpHeaderFields: target.headers) } From 1272bce859d83d099078091e9f77d6d27e3643fa Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Thu, 22 Feb 2018 10:17:50 -0600 Subject: [PATCH 25/32] Update unit tests --- Tests/MoyaProviderIntegrationTests.swift | 27 ++++++++++++++++++++---- Tests/MoyaProviderSpec.swift | 2 +- Tests/TestHelpers.swift | 10 ++++----- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/Tests/MoyaProviderIntegrationTests.swift b/Tests/MoyaProviderIntegrationTests.swift index 856187b8f..36702332f 100644 --- a/Tests/MoyaProviderIntegrationTests.swift +++ b/Tests/MoyaProviderIntegrationTests.swift @@ -302,10 +302,10 @@ final class MoyaProviderIntegrationTests: QuickSpec { // Resolves ValidationType not working with multipart upload #1590 describe("a provider performing a multipart upload with Alamofire validation") { - it("only allows status code 287") { - let formData = HTTPBin.createMultipartFormData() - let target = HTTPBin.validatedUploadMultipart(formData, nil) - let provider = MoyaProvider() + let provider = MoyaProvider() + let formData = HTTPBin.createTestMultipartFormData() + it("returns an error for status code different than 287") { + let target = HTTPBin.validatedUploadMultipart(formData, nil, [287]) var receievedResponse: Response? var receivedError: Error? waitUntil(timeout: 5.0) { done in @@ -322,6 +322,25 @@ final class MoyaProviderIntegrationTests: QuickSpec { expect(receievedResponse).to(beNil()) expect(receivedError).toNot(beNil()) } + it("returns a valid response for .succesCodes") { + let successCodes = ValidationType.successCodes.statusCodes + let target = HTTPBin.validatedUploadMultipart(formData, nil, successCodes) + var receievedResponse: Response? + var receivedError: Error? + waitUntil(timeout: 5.0) { done in + provider.request(target) { result in + switch result { + case .success(let response): + receievedResponse = response + case .failure(let error): + receivedError = error + } + done() + } + } + expect(receievedResponse).toNot(beNil()) + expect(receivedError).to(beNil()) + } } } } diff --git a/Tests/MoyaProviderSpec.swift b/Tests/MoyaProviderSpec.swift index 52606b258..1fe154a27 100644 --- a/Tests/MoyaProviderSpec.swift +++ b/Tests/MoyaProviderSpec.swift @@ -841,7 +841,7 @@ final class MoyaProviderSpec: QuickSpec { it("tracks progress of multipart request") { - let formData = HTTPBin.createMultipartFormData() + let formData = HTTPBin.createTestMultipartFormData() let target = HTTPBin.uploadMultipart(formData, nil) var progressObjects: [Progress?] = [] diff --git a/Tests/TestHelpers.swift b/Tests/TestHelpers.swift index 46911b638..7e7bf83a7 100644 --- a/Tests/TestHelpers.swift +++ b/Tests/TestHelpers.swift @@ -74,7 +74,7 @@ enum HTTPBin: TargetType { case post case upload(file: URL) case uploadMultipart([MultipartFormData], [String: Any]?) - case validatedUploadMultipart([MultipartFormData], [String: Any]?) + case validatedUploadMultipart([MultipartFormData], [String: Any]?, [Int]) var baseURL: URL { return URL(string: "http://httpbin.org")! } var path: String { @@ -101,7 +101,7 @@ enum HTTPBin: TargetType { return .requestParameters(parameters: [:], encoding: URLEncoding.default) case .upload(let fileURL): return .uploadFile(fileURL) - case .uploadMultipart(let data, let urlParameters), .validatedUploadMultipart(let data, let urlParameters): + case .uploadMultipart(let data, let urlParameters), .validatedUploadMultipart(let data, let urlParameters, _): if let urlParameters = urlParameters { return .uploadCompositeMultipart(data, urlParameters: urlParameters) } else { @@ -125,8 +125,8 @@ enum HTTPBin: TargetType { var validationType: ValidationType { switch self { - case .validatedUploadMultipart: - return .customCodes([287]) + case .validatedUploadMultipart(_, _, let codes): + return .customCodes(codes) default: return .none } @@ -184,7 +184,7 @@ extension GitHubUserContent: TargetType { // MARK: - Upload Multipart Helpers extension HTTPBin { - static func createMultipartFormData() -> [MultipartFormData] { + static func createTestMultipartFormData() -> [MultipartFormData] { guard let url = Bundle(for: MoyaProviderSpec.self).url(forResource: "testImage", withExtension: "png") else { fatalError("Resource testImage.png could not be found in bundle") } From 77f8622dc230d48de80d5557231ca78884487ed8 Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Sat, 24 Feb 2018 00:51:24 -0600 Subject: [PATCH 26/32] Add some spacing between tests --- Tests/MoyaProviderIntegrationTests.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tests/MoyaProviderIntegrationTests.swift b/Tests/MoyaProviderIntegrationTests.swift index 36702332f..f04db1b26 100644 --- a/Tests/MoyaProviderIntegrationTests.swift +++ b/Tests/MoyaProviderIntegrationTests.swift @@ -304,10 +304,12 @@ final class MoyaProviderIntegrationTests: QuickSpec { describe("a provider performing a multipart upload with Alamofire validation") { let provider = MoyaProvider() let formData = HTTPBin.createTestMultipartFormData() + it("returns an error for status code different than 287") { let target = HTTPBin.validatedUploadMultipart(formData, nil, [287]) var receievedResponse: Response? var receivedError: Error? + waitUntil(timeout: 5.0) { done in provider.request(target) { result in switch result { @@ -319,14 +321,17 @@ final class MoyaProviderIntegrationTests: QuickSpec { done() } } + expect(receievedResponse).to(beNil()) expect(receivedError).toNot(beNil()) } + it("returns a valid response for .succesCodes") { let successCodes = ValidationType.successCodes.statusCodes let target = HTTPBin.validatedUploadMultipart(formData, nil, successCodes) var receievedResponse: Response? var receivedError: Error? + waitUntil(timeout: 5.0) { done in provider.request(target) { result in switch result { @@ -338,6 +343,7 @@ final class MoyaProviderIntegrationTests: QuickSpec { done() } } + expect(receievedResponse).toNot(beNil()) expect(receivedError).to(beNil()) } From 9ed06cd22ddb85a006ac05ed9ead8058456bb9ec Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Sun, 25 Feb 2018 06:58:05 -0600 Subject: [PATCH 27/32] Update tests for code review --- Tests/MoyaProviderSpec.swift | 57 +++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/Tests/MoyaProviderSpec.swift b/Tests/MoyaProviderSpec.swift index 7d9da36e5..9d33a4c2e 100644 --- a/Tests/MoyaProviderSpec.swift +++ b/Tests/MoyaProviderSpec.swift @@ -977,7 +977,7 @@ final class MoyaProviderSpec: QuickSpec { var stubbedProvider: MoyaProvider! context("response contains invalid status code") { - it("returns a failure case") { + it("returns an error") { let endpointClosure = { (target: GitHub) -> Endpoint in return Endpoint( url: URL(target: target).absoluteString, @@ -987,23 +987,31 @@ final class MoyaProviderSpec: QuickSpec { httpHeaderFields: target.headers ) } + stubbedProvider = MoyaProvider(endpointClosure: endpointClosure, stubClosure: MoyaProvider.immediatelyStub) - stubbedProvider.request(.zen) { result in - let validStatusCodes = GitHub.zen.validationType.statusCodes - switch result { - case .success(let response): - expect(validStatusCodes).to(contain(response.statusCode)) - case .failure(let error): - guard case let MoyaError.underlying(_, response) = error else { - fatalError("Expected MoyaError.underlying for validation failure.") + + var receivedError: Error? + var receivedResponse: Response? + + waitUntil { done in + stubbedProvider.request(.zen) { result in + switch result { + case .success(let response): + receivedResponse = response + case .failure(let error): + receivedError = error } - expect(validStatusCodes).toNot(contain(response!.statusCode)) + done() } } + + expect(receivedResponse).to(beNil()) + expect(receivedError).toNot(beNil()) } } + context("response contains valid status code") { - it("returns a success case") { + it("returns a response") { let endpointClosure = { (target: GitHub) -> Endpoint in return Endpoint( url: URL(target: target).absoluteString, @@ -1013,20 +1021,27 @@ final class MoyaProviderSpec: QuickSpec { httpHeaderFields: target.headers ) } + stubbedProvider = MoyaProvider(endpointClosure: endpointClosure, stubClosure: MoyaProvider.immediatelyStub) - let validStatusCodes = GitHub.zen.validationType.statusCodes - stubbedProvider.request(.zen) { result in - switch result { - case .success(let response): - expect(validStatusCodes).toNot(beEmpty()) - expect(validStatusCodes).to(contain(response.statusCode)) - case .failure(let error): - guard case let MoyaError.underlying(_, response) = error else { - fatalError("Expected MoyaError.underlying for validation failure.") + + var receivedError: Error? + var receivedResponse: Response? + + waitUntil { done in + stubbedProvider.request(.zen) { result in + switch result { + case .success(let response): + receivedResponse = response + case .failure(let error): + receivedError = error } - expect(validStatusCodes).toNot(contain(response!.statusCode)) + done() } } + + expect(receivedResponse).toNot(beNil()) + expect(receivedError).to(beNil()) + expect(GitHub.zen.validationType.statusCodes).to(contain(receivedResponse!.statusCode)) } } } From 56c708041d25a197e3191a54874e1fbf7c2b2dfb Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Sun, 25 Feb 2018 07:01:27 -0600 Subject: [PATCH 28/32] Add CHANGELOG entry for #1592 --- Changelog.md | 4 ++++ Tests/MoyaProviderSpec.swift | 1 + 2 files changed, 5 insertions(+) diff --git a/Changelog.md b/Changelog.md index 2bcc79f12..d4a055abe 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ # Next +### Fixed +- Fixes `Response` validation not being performed on stubbed requests. +[#1593](https://github.com/Moya/Moya/pull/1593) by [@SD10](https://github.com/sd10). + # [11.0.0] - 2018-02-07 # [11.0.0-beta.2] - 2018-01-27 diff --git a/Tests/MoyaProviderSpec.swift b/Tests/MoyaProviderSpec.swift index 9d33a4c2e..c0a7f14fd 100644 --- a/Tests/MoyaProviderSpec.swift +++ b/Tests/MoyaProviderSpec.swift @@ -973,6 +973,7 @@ final class MoyaProviderSpec: QuickSpec { } } + // Resolves #1592 where validation is not performed on a stubbed request describe("a provider for stubbed requests with validation") { var stubbedProvider: MoyaProvider! From 3095767cde5f64b79afecdf30de0bf319652a5ba Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Sun, 25 Feb 2018 08:40:31 -0600 Subject: [PATCH 29/32] Fix CHANGELOG wording --- Changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 2d7ad3387..fb6a8455f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,7 +3,7 @@ ### Fixed - Fixed Alamofire validation not being performed on `.uploadMultipart` requests. [#1591](https://github.com/Moya/Moya/pull/1591) by [@SD10](https://github.com/SD10). -- Fixed `Response` validation not being performed on stubbed requests. +- Fixed Alamofire validation not being performed on stubbed requests. [#1593](https://github.com/Moya/Moya/pull/1593) by [@SD10](https://github.com/sd10). # [11.0.0] - 2018-02-07 From 4b3ff7e7ddd87c0ce73b39b5390c045fe1a8d4af Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Mon, 26 Feb 2018 00:26:35 -0600 Subject: [PATCH 30/32] Releasing version 11.0.1. --- Changelog.md | 2 ++ Moya.podspec | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index fb6a8455f..df400660f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,7 @@ # Next +# [11.0.1] - 2018-02-26 + ### Fixed - Fixed Alamofire validation not being performed on `.uploadMultipart` requests. [#1591](https://github.com/Moya/Moya/pull/1591) by [@SD10](https://github.com/SD10). diff --git a/Moya.podspec b/Moya.podspec index 3744edf20..f5f6436c1 100644 --- a/Moya.podspec +++ b/Moya.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Moya" - s.version = "11.0.0" + s.version = "11.0.1" s.summary = "Network abstraction layer written in Swift" s.description = <<-EOS Moya abstracts network commands using Swift Generics to provide developers From a2585faceef24ff7490034c9fb7766f5366292cc Mon Sep 17 00:00:00 2001 From: Shai Mishali Date: Wed, 28 Feb 2018 14:24:56 -0500 Subject: [PATCH 31/32] Fix integration tests Fix integration tests Fix integration tests for NetworkLogger --- Tests/MoyaProviderIntegrationTests.swift | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Tests/MoyaProviderIntegrationTests.swift b/Tests/MoyaProviderIntegrationTests.swift index f04db1b26..3504dc5e8 100644 --- a/Tests/MoyaProviderIntegrationTests.swift +++ b/Tests/MoyaProviderIntegrationTests.swift @@ -250,13 +250,16 @@ final class MoyaProviderIntegrationTests: QuickSpec { provider.request(.zen) { _ in done() } } - expect(log).to( contain("Request:") ) - expect(log).to( contain("{ URL: https://api.github.com/zen }") ) - expect(log).to( contain("Request Headers: [:]") ) - expect(log).to( contain("HTTP Request Method: GET") ) - expect(log).to( contain("Response:") ) - expect(log).to( contain("{ URL: https://api.github.com/zen } { status code: 200, headers") ) - expect(log).to( contain("\"Content-Length\" = 43;") ) + expect(log).to(contain("Request:")) + expect(log).to(contain("{ URL: https://api.github.com/zen }")) + expect(log).to(contain("Request Headers: [:]")) + expect(log).to(contain("HTTP Request Method: GET")) + expect(log).to(contain("Response:")) + expect(log).to(contain("{ URL: https://api.github.com/zen }")) + // Had to split these two below because of whitespaces/newlines + // Also these have the log lowercased because of the inconsistency on the backend side + expect(log.lowercased()).to(contain("{ status code: 200, headers")) + expect(log.lowercased()).to(contain("\"content-length\"")) } } } From 85c75a60f2c08859887eb89714208e2f482fc079 Mon Sep 17 00:00:00 2001 From: Ash Furrow Date: Tue, 27 Feb 2018 15:13:13 -0500 Subject: [PATCH 32/32] Migrate to CircleCI 2.0 --- .circleci/config.yml | 77 +++++++++++++++++++++++++++++++++++++++ Gemfile.lock | 86 +++++++++++++++++++++++--------------------- Rakefile | 4 +-- circle.yml | 24 ------------- 4 files changed, 125 insertions(+), 66 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 circle.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..d1d1771b8 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,77 @@ +version: 2 +jobs: + build: + working_directory: ~/Moya/Moya + parallelism: 1 + shell: /bin/bash --login + environment: + CIRCLE_ARTIFACTS: /tmp/circleci-artifacts + CIRCLE_TEST_REPORTS: /tmp/circleci-test-results + LANG: en_US.UTF-8 + BUNDLE_PATH: vendor/bundle + macos: + xcode: '9.2.0' + steps: + - checkout + - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS + - restore_cache: + keys: + - v1-dep-{{ .Branch }}- + - v1-dep-master- + - v1-dep- + - run: + name: Set Ruby Version + command: echo "ruby-2.4" > ~/.ruby-version + - run: + name: Fetch CocoaPods Specs + command: curl -sS https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash + - run: + name: Update Homebrew + command: brew update + - run: + name: Install Swiftlint + command: brew install swiftlint + - run: + name: Install Ruby Dependencies + command: bundle check || bundle install + environment: + BUNDLE_JOBS: 4 + BUNDLE_RETRY: 3 + - run: + name: Bootstrap Carthage + command: scripts/bootstrap-if-needed.sh + - save_cache: + key: v1-dep-{{ .Branch }}-{{ epoch }} + paths: + - vendor/bundle + - Carthage + - run: + name: Test on iOS + command: rake test:ios + - run: + name: Test on macOS + command: rake test:macos + - run: + name: Test on tvOS + command: rake test:tvos + - run: + name: Test with Carthage + command: rake test:carthage + - run: + name: Build Example Project + command: rake build_example + - run: + name: Run Danger + command: bundle exec danger + - run: + name: Send Code Coverage to Codecov.io + command: bash <(curl -s https://codecov.io/bash) -J Moya + - run: + name: Store Xcode Activity Log + command: find $HOME/Library/Developer/Xcode/DerivedData -name '*.xcactivitylog' -exec cp {} $CIRCLE_ARTIFACTS/xcactivitylog \; || true + - store_test_results: + path: /tmp/circleci-test-results + - store_artifacts: + path: /tmp/circleci-artifacts + - store_artifacts: + path: /tmp/circleci-test-results diff --git a/Gemfile.lock b/Gemfile.lock index 95b50324e..6246a66be 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,56 +1,58 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (2.3.5) - activesupport (4.2.8) + CFPropertyList (2.3.6) + activesupport (4.2.10) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.5.1) - public_suffix (~> 2.0, >= 2.0.2) - claide (1.0.1) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + atomos (0.1.2) + claide (1.0.2) claide-plugins (0.9.2) cork nap open4 (~> 1.3) - cocoapods (1.2.1) + cocoapods (1.4.0) activesupport (>= 4.0.2, < 5) - claide (>= 1.0.1, < 2.0) - cocoapods-core (= 1.2.1) - cocoapods-deintegrate (>= 1.0.1, < 2.0) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.4.0) + cocoapods-deintegrate (>= 1.0.2, < 2.0) cocoapods-downloader (>= 1.1.3, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.2.0, < 2.0) + cocoapods-trunk (>= 1.3.0, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) fourflusher (~> 2.0.1) gh_inspector (~> 1.0) - molinillo (~> 0.5.7) + molinillo (~> 0.6.4) nap (~> 1.0) ruby-macho (~> 1.1) - xcodeproj (>= 1.4.4, < 2.0) - cocoapods-core (1.2.1) - activesupport (>= 4.0.2, < 5) + xcodeproj (>= 1.5.4, < 2.0) + cocoapods-core (1.4.0) + activesupport (>= 4.0.2, < 6) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.1) + cocoapods-deintegrate (1.0.2) cocoapods-downloader (1.1.3) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) cocoapods-stats (1.0.0) - cocoapods-trunk (1.2.0) + cocoapods-trunk (1.3.0) nap (>= 0.8, < 2.0) - netrc (= 0.7.8) + netrc (~> 0.11) cocoapods-try (1.1.0) colored2 (3.1.2) + concurrent-ruby (1.0.5) cork (0.3.0) colored2 (~> 3.1) - danger (5.2.1) + danger (5.5.10) claide (~> 1.0) claide-plugins (>= 0.9.2) colored2 (~> 3.1) @@ -59,52 +61,56 @@ GEM faraday-http-cache (~> 1.0) git (~> 1) kramdown (~> 1.5) - octokit (~> 4.2) + no_proxy_fix + octokit (~> 4.7) terminal-table (~> 1) - danger-swiftlint (0.5.0) + danger-swiftlint (0.13.1) danger - rake (~> 10.0) + rake (> 10) thor (~> 0.19) escape (0.0.4) - faraday (0.12.1) + faraday (0.14.0) multipart-post (>= 1.2, < 3) faraday-http-cache (1.3.1) faraday (~> 0.8) fourflusher (2.0.1) fuzzy_match (2.0.4) - gh_inspector (1.0.3) + gh_inspector (1.1.2) git (1.3.0) - i18n (0.8.1) - kramdown (1.13.2) - minitest (5.10.1) - molinillo (0.5.7) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + kramdown (1.16.2) + minitest (5.11.3) + molinillo (0.6.4) multipart-post (2.0.0) nanaimo (0.2.3) nap (1.1.0) - netrc (0.7.8) - octokit (4.7.0) + netrc (0.11.0) + no_proxy_fix (0.1.2) + octokit (4.8.0) sawyer (~> 0.8.0, >= 0.5.3) open4 (1.3.4) - public_suffix (2.0.5) - rake (10.5.0) + public_suffix (3.0.2) + rake (12.3.0) rouge (2.0.7) ruby-macho (1.1.0) sawyer (0.8.1) addressable (>= 2.3.5, < 2.6) faraday (~> 0.8, < 1.0) - terminal-table (1.7.3) - unicode-display_width (~> 1.1.1) - thor (0.19.4) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + thor (0.20.0) thread_safe (0.3.6) - tzinfo (1.2.3) + tzinfo (1.2.5) thread_safe (~> 0.1) - unicode-display_width (1.1.3) - xcodeproj (1.4.4) + unicode-display_width (1.3.0) + xcodeproj (1.5.6) CFPropertyList (~> 2.3.3) - claide (>= 1.0.1, < 2.0) + atomos (~> 0.1.2) + claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.2.3) - xcpretty (0.2.7) + xcpretty (0.2.8) rouge (~> 2.0.7) PLATFORMS @@ -119,4 +125,4 @@ DEPENDENCIES xcpretty BUNDLED WITH - 1.14.6 + 1.16.0 diff --git a/Rakefile b/Rakefile index d16cbb1c0..fc4c68cac 100644 --- a/Rakefile +++ b/Rakefile @@ -63,8 +63,8 @@ end def device_os return { - ios: "11.0.1", - tvos: "11.0" + ios: "11.2", + tvos: "11.2" } end diff --git a/circle.yml b/circle.yml deleted file mode 100644 index ebeabfe3a..000000000 --- a/circle.yml +++ /dev/null @@ -1,24 +0,0 @@ -machine: - xcode: - version: 9.0 - environment: - LANG: en_US.UTF-8 - -dependencies: - pre: - - curl -sS https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash - override: - - brew update ; brew update # Due to a problem with Homebrew, see: https://github.com/Homebrew/brew/issues/991 - - brew install swiftlint - - bundle install - - scripts/bootstrap-if-needed.sh # only bootstrap if we have updated dependencies since our last cache. - cache_directories: - - "Carthage" # Cache carthage to speed up builds. - -test: - pre: - override: - - rake test && rake test:carthage && rake build_example - post: - - bundle exec danger - - bash <(curl -s https://codecov.io/bash) -J Moya