diff --git a/.gitignore b/.gitignore index 4538791..aa5b516 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,61 @@ -Harbor.xcodeproj/project.xcworkspace/xcuserdata/*.xcuserdatad/ -Harbor.xcodeproj/xcuserdata/*.xcuserdatad/ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated +build/ +DerivedData/ + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ + +## Other +*.moved-aside +*.xcuserstate + +## Obj-C/Swift specific +*.hmap +*.ipa + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +.build/ + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md + +fastlane/report.xml +fastlane/screenshots diff --git a/Components/AppComponent.swift b/Components/AppComponent.swift new file mode 100644 index 0000000..e8169d4 --- /dev/null +++ b/Components/AppComponent.swift @@ -0,0 +1,14 @@ + +import Drip + +class AppComponent: Component { + var system: SystemModule { return module() } + var service: ServiceModule { return module() } + var interactor: InteractorModule { return module() } +} + +class AppModule: Module { + required init(_ component: AppComponent) { + super.init(component) + } +} diff --git a/Components/InteractorModule.swift b/Components/InteractorModule.swift new file mode 100644 index 0000000..3344e9b --- /dev/null +++ b/Components/InteractorModule.swift @@ -0,0 +1,28 @@ + +class InteractorModule: AppModule { + func inject() -> Settings { + return single { + Settings( + defaults: $0.system.inject(), + keychain: $0.system.inject(), + notificationCenter: $0.system.inject()) + } + } + + func inject() -> ProjectsInteractor { + return single { + ProjectsProvider( + api: $0.service.inject(), + settings: $0.interactor.inject()) as ProjectsInteractor + } + } + + func inject() -> TimerCoordinator { + return single { + TimerCoordinator( + runLoop: $0.system.inject(), + projectsInteractor: $0.interactor.inject(), + settings: $0.interactor.inject()) + } + } +} diff --git a/Components/PreferencesViewModule.swift b/Components/PreferencesViewModule.swift new file mode 100644 index 0000000..edc5c26 --- /dev/null +++ b/Components/PreferencesViewModule.swift @@ -0,0 +1,11 @@ + +class PreferencesViewModule: ViewModule { + func inject(view: V) -> PreferencesPresenter { + return single { + PreferencesPresenter( + view: view, + projectsInteractor: $0.app.interactor.inject(), + settings: $0.app.interactor.inject()) + } + } +} diff --git a/Components/ServiceModule.swift b/Components/ServiceModule.swift new file mode 100644 index 0000000..347e2ea --- /dev/null +++ b/Components/ServiceModule.swift @@ -0,0 +1,8 @@ + +class ServiceModule: AppModule { + func inject() -> CodeshipApiType { + return transient { component in + CodeshipApi(settings: component.interactor.inject()) as CodeshipApiType + } + } +} diff --git a/Components/StatusMenuViewModule.swift b/Components/StatusMenuViewModule.swift new file mode 100644 index 0000000..4bfb2b6 --- /dev/null +++ b/Components/StatusMenuViewModule.swift @@ -0,0 +1,11 @@ + +class StatusMenuModule: ViewModule { + func inject(view: V) -> StatusMenuPresenter { + return single { + StatusMenuPresenter( + view: view, + projectsInteractor: $0.app.interactor.inject(), + settings: $0.app.interactor.inject()) + } + } +} diff --git a/Components/SystemModule.swift b/Components/SystemModule.swift new file mode 100644 index 0000000..35a7628 --- /dev/null +++ b/Components/SystemModule.swift @@ -0,0 +1,28 @@ + +import Foundation + +class SystemModule: AppModule { + func inject() -> UserDefaults { + return transient { + NSUserDefaults.standardUserDefaults() as UserDefaults + } + } + + func inject() -> NotificationCenter { + return transient { + NSNotificationCenter.defaultCenter() as NotificationCenter + } + } + + func inject() -> RunLoop { + return transient { + NSRunLoop.mainRunLoop() as RunLoop + } + } + + func inject() -> Keychain { + return transient { + KeychainWrapper() as Keychain + } + } +} diff --git a/Components/ViewComponent.swift b/Components/ViewComponent.swift new file mode 100644 index 0000000..36155b9 --- /dev/null +++ b/Components/ViewComponent.swift @@ -0,0 +1,14 @@ + +import Drip + +class ViewComponent: Component { + var app: AppComponent { return parent() } + var status: StatusMenuModule { return module() } + var preferences: PreferencesViewModule { return module() } +} + +class ViewModule: Module { + required init(_ component: ViewComponent) { + super.init(component) + } +} diff --git a/Harbor.xcodeproj/project.pbxproj b/Harbor.xcodeproj/project.pbxproj index fe774a0..5f33051 100644 --- a/Harbor.xcodeproj/project.pbxproj +++ b/Harbor.xcodeproj/project.pbxproj @@ -7,288 +7,595 @@ objects = { /* Begin PBXBuildFile section */ - D01EC80C1A5E1FBE009A8D22 /* quit.png in Resources */ = {isa = PBXBuildFile; fileRef = D01EC80A1A5E1FBE009A8D22 /* quit.png */; }; - D01EC80D1A5E1FBE009A8D22 /* quit@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D01EC80B1A5E1FBE009A8D22 /* quit@2x.png */; }; - D01EC8101A5E2BC0009A8D22 /* anchor-pref.png in Resources */ = {isa = PBXBuildFile; fileRef = D01EC80E1A5E2BC0009A8D22 /* anchor-pref.png */; }; - D01EC8111A5E2BC0009A8D22 /* anchor-pref@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D01EC80F1A5E2BC0009A8D22 /* anchor-pref@2x.png */; }; - D02B0BB41A17B1BB006B8143 /* Fonts in Resources */ = {isa = PBXBuildFile; fileRef = D02B0BB21A17B1BB006B8143 /* Fonts */; }; - D0610E261A0C952E0056B8A3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0610E251A0C952E0056B8A3 /* AppDelegate.swift */; }; - D0610E2B1A0C952E0056B8A3 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D0610E2A1A0C952E0056B8A3 /* Images.xcassets */; }; - D0610E2E1A0C952E0056B8A3 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = D0610E2C1A0C952E0056B8A3 /* MainMenu.xib */; }; - D0610E3A1A0C952E0056B8A3 /* HarborTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0610E391A0C952E0056B8A3 /* HarborTests.swift */; }; - D0610E481A0C976F0056B8A3 /* PopoverViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0610E431A0C976F0056B8A3 /* PopoverViewController.swift */; }; - D0610E4A1A0C976F0056B8A3 /* Popover.xib in Resources */ = {isa = PBXBuildFile; fileRef = D0610E441A0C976F0056B8A3 /* Popover.xib */; }; - D0610E4C1A0C976F0056B8A3 /* StatusView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0610E451A0C976F0056B8A3 /* StatusView.swift */; }; - D0610E4E1A0C976F0056B8A3 /* PreferencesPaneWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0610E461A0C976F0056B8A3 /* PreferencesPaneWindow.swift */; }; - D0610E501A0C976F0056B8A3 /* PreferencesPaneWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = D0610E471A0C976F0056B8A3 /* PreferencesPaneWindow.xib */; }; - D0610E551A0C97A80056B8A3 /* Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0610E521A0C97A80056B8A3 /* Account.swift */; }; - D0610E571A0C97A80056B8A3 /* Project.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0610E531A0C97A80056B8A3 /* Project.swift */; }; - D0610E591A0C97A80056B8A3 /* Build.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0610E541A0C97A80056B8A3 /* Build.swift */; }; - D0610E6D1A0C97CB0056B8A3 /* codeshipLogo_black.png in Resources */ = {isa = PBXBuildFile; fileRef = D0610E5F1A0C97CB0056B8A3 /* codeshipLogo_black.png */; }; - D0610E6E1A0C97CB0056B8A3 /* codeshipLogo_black.png in Resources */ = {isa = PBXBuildFile; fileRef = D0610E5F1A0C97CB0056B8A3 /* codeshipLogo_black.png */; }; - D0610E6F1A0C97CB0056B8A3 /* codeshipLogo_black@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D0610E601A0C97CB0056B8A3 /* codeshipLogo_black@2x.png */; }; - D0610E701A0C97CB0056B8A3 /* codeshipLogo_black@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D0610E601A0C97CB0056B8A3 /* codeshipLogo_black@2x.png */; }; - D0610E711A0C97CB0056B8A3 /* codeshipLogo_green.png in Resources */ = {isa = PBXBuildFile; fileRef = D0610E611A0C97CB0056B8A3 /* codeshipLogo_green.png */; }; - D0610E721A0C97CB0056B8A3 /* codeshipLogo_green.png in Resources */ = {isa = PBXBuildFile; fileRef = D0610E611A0C97CB0056B8A3 /* codeshipLogo_green.png */; }; - D0610E731A0C97CB0056B8A3 /* codeshipLogo_green@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D0610E621A0C97CB0056B8A3 /* codeshipLogo_green@2x.png */; }; - D0610E741A0C97CB0056B8A3 /* codeshipLogo_green@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D0610E621A0C97CB0056B8A3 /* codeshipLogo_green@2x.png */; }; - D0610E751A0C97CB0056B8A3 /* codeshipLogo_red.png in Resources */ = {isa = PBXBuildFile; fileRef = D0610E631A0C97CB0056B8A3 /* codeshipLogo_red.png */; }; - D0610E761A0C97CB0056B8A3 /* codeshipLogo_red.png in Resources */ = {isa = PBXBuildFile; fileRef = D0610E631A0C97CB0056B8A3 /* codeshipLogo_red.png */; }; - D0610E771A0C97CB0056B8A3 /* codeshipLogo_red@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D0610E641A0C97CB0056B8A3 /* codeshipLogo_red@2x.png */; }; - D0610E781A0C97CB0056B8A3 /* codeshipLogo_red@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D0610E641A0C97CB0056B8A3 /* codeshipLogo_red@2x.png */; }; - D0A1CC3F1A5D8CDB005FC2BE /* Harbor.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = D0A1CC3D1A5D8CDB005FC2BE /* Harbor.xcdatamodeld */; }; - D0F071351A5DA9A50043754D /* DMProject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F071341A5DA9A50043754D /* DMProject.swift */; }; - D0F071371A5DA9A60043754D /* DMAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F071361A5DA9A60043754D /* DMAccount.swift */; }; - D0F071391A5DA9A60043754D /* DMBuild.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F071381A5DA9A60043754D /* DMBuild.swift */; }; + 108689C61BC8227D00B2DD87 /* VerifierOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 108689C51BC8227D00B2DD87 /* VerifierOf.swift */; }; + 108689C91BC826C400B2DD87 /* Verifiable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 108689C81BC826C400B2DD87 /* Verifiable.swift */; }; + 108689CB1BC841BE00B2DD87 /* InvocationMatchers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 108689CA1BC841BE00B2DD87 /* InvocationMatchers.swift */; }; + 10DC90541BBDD31C00811234 /* HarborSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DC90531BBDD31C00811234 /* HarborSpec.swift */; }; + 10DC90561BBDDABF00811234 /* Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DC90551BBDDABF00811234 /* Example.swift */; }; + 10DC905F1BBEE12F00811234 /* StatusMenuPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DC905E1BBEE12F00811234 /* StatusMenuPresenter.swift */; }; + 10DC90611BBEE13700811234 /* StatusMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DC90601BBEE13700811234 /* StatusMenuView.swift */; }; + 10DC90641BBEE17A00811234 /* Presenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DC90631BBEE17A00811234 /* Presenter.swift */; }; + 10DC90661BBEE47C00811234 /* ViewType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DC90651BBEE47C00811234 /* ViewType.swift */; }; + 10DC906A1BBF088800811234 /* ProjectMenuItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DC90691BBF088800811234 /* ProjectMenuItem.swift */; }; + 10DC90701BBF096400811234 /* BuildStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DC906F1BBF096400811234 /* BuildStatus.swift */; }; + 10DC90721BBF16C900811234 /* ProjectMenuItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DC90711BBF16C900811234 /* ProjectMenuItemModel.swift */; }; + 10DC90741BBF198900811234 /* Collections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DC90731BBF198900811234 /* Collections.swift */; }; + 10DC90781BBF1CB700811234 /* BuildViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DC90771BBF1CB700811234 /* BuildViewModel.swift */; }; + 10DC909A1BC2E20F00811234 /* HarborHelper.app in Copy Helper App */ = {isa = PBXBuildFile; fileRef = 10DC90981BC2E13000811234 /* HarborHelper.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 10DC909C1BC2E23600811234 /* ServiceManagement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 10DC909B1BC2E23600811234 /* ServiceManagement.framework */; }; + 10FA1FF81C9237D800A642A7 /* AppComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10FA1FF71C9237D800A642A7 /* AppComponent.swift */; }; + 10FA20011C9326D600A642A7 /* InteractorModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10FA20001C9326D600A642A7 /* InteractorModule.swift */; }; + 10FA20031C93272B00A642A7 /* ServiceModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10FA20021C93272B00A642A7 /* ServiceModule.swift */; }; + 10FA20051C93274500A642A7 /* SystemModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10FA20041C93274500A642A7 /* SystemModule.swift */; }; + 10FA20091C93297B00A642A7 /* ViewComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10FA20081C93297B00A642A7 /* ViewComponent.swift */; }; + 10FA200B1C932A0800A642A7 /* PreferencesViewModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10FA200A1C932A0800A642A7 /* PreferencesViewModule.swift */; }; + 10FA200D1C932A2400A642A7 /* StatusMenuViewModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10FA200C1C932A2400A642A7 /* StatusMenuViewModule.swift */; }; + 10FA200F1C933E1B00A642A7 /* Application.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10FA200E1C933E1B00A642A7 /* Application.swift */; }; + 10FA20111C97770600A642A7 /* Environment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10FA20101C97770600A642A7 /* Environment.swift */; }; + 2E0EB95307EB9B5CA6ACB161 /* Pods_Harbor.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EFE3D042DFD06CDDD92762A5 /* Pods_Harbor.framework */; }; + CDD5638F36C28F1CBED22C30 /* Pods_Harbor_HarborTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1EF75FA103814CE2B8C146C9 /* Pods_Harbor_HarborTests.framework */; }; + D01093BC1BB5B3D7002D5794 /* SettingsSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D01093BB1BB5B3D7002D5794 /* SettingsSpec.swift */; }; + D01093BF1BB5D932002D5794 /* NotificationCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = D01093BE1BB5D932002D5794 /* NotificationCenter.swift */; }; + D01093C11BB5D93D002D5794 /* UserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = D01093C01BB5D93D002D5794 /* UserDefaults.swift */; }; + D01093C41BB5DB33002D5794 /* MockUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = D01093C31BB5DB33002D5794 /* MockUserDefaults.swift */; }; + D01093C71BB5F05E002D5794 /* Invocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D01093C61BB5F05E002D5794 /* Invocation.swift */; }; + D0458F4E1BB9B83000DCC4A6 /* MockNotificationCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0458F4D1BB9B83000DCC4A6 /* MockNotificationCenter.swift */; }; + D0458F501BB9C7B800DCC4A6 /* TimerCoordinatorSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0458F4F1BB9C7B800DCC4A6 /* TimerCoordinatorSpec.swift */; }; + D0458F521BB9C8AD00DCC4A6 /* RunLoop.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0458F511BB9C8AD00DCC4A6 /* RunLoop.swift */; }; + D0458F561BB9CFCB00DCC4A6 /* MockRunLoop.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0458F551BB9CFCB00DCC4A6 /* MockRunLoop.swift */; }; + D06054251B57F880007A5F81 /* Playground.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06054241B57F880007A5F81 /* Playground.swift */; }; + D0704EA81BBB117C005C808B /* PreferencesPresenterSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0704EA71BBB117C005C808B /* PreferencesPresenterSpec.swift */; }; + D0704EAA1BBB1418005C808B /* MockPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0704EA91BBB1418005C808B /* MockPreferencesView.swift */; }; + D0704EAC1BBB1584005C808B /* MockProjectsProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0704EAB1BBB1584005C808B /* MockProjectsProvider.swift */; }; + D0704EAE1BBB1851005C808B /* None.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0704EAD1BBB1851005C808B /* None.swift */; }; + D0772F0C1B3C437800031FB9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0772F0B1B3C437800031FB9 /* AppDelegate.swift */; }; + D0772F0F1B3C437800031FB9 /* Harbor.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = D0772F0D1B3C437800031FB9 /* Harbor.xcdatamodeld */; }; + D0772F111B3C437800031FB9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D0772F101B3C437800031FB9 /* Assets.xcassets */; }; + D0772F3A1B3C43B200031FB9 /* Project.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0772F391B3C43B200031FB9 /* Project.swift */; }; + D0772F401B3C44C000031FB9 /* SamplePayload.json in Resources */ = {isa = PBXBuildFile; fileRef = D0772F3F1B3C44C000031FB9 /* SamplePayload.json */; }; + D08EAB321B97531A009564CE /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = D08EAB311B97531A009564CE /* MainMenu.xib */; }; + D08EAB391B98A60A009564CE /* codeshipLogo_green.png in Resources */ = {isa = PBXBuildFile; fileRef = D08EAB351B98A60A009564CE /* codeshipLogo_green.png */; }; + D08EAB3A1B98A60A009564CE /* codeshipLogo_green@2px.png in Resources */ = {isa = PBXBuildFile; fileRef = D08EAB361B98A60A009564CE /* codeshipLogo_green@2px.png */; }; + D08EAB3B1B98A60A009564CE /* codeshipLogo_red.png in Resources */ = {isa = PBXBuildFile; fileRef = D08EAB371B98A60A009564CE /* codeshipLogo_red.png */; }; + D08EAB3C1B98A60A009564CE /* codeshipLogo_red@2px.png in Resources */ = {isa = PBXBuildFile; fileRef = D08EAB381B98A60A009564CE /* codeshipLogo_red@2px.png */; }; + D08EAB3E1B98D5C8009564CE /* BuildView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D08EAB3D1B98D5C8009564CE /* BuildView.swift */; }; + D08EAB411B98D5EA009564CE /* BuildView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D08EAB401B98D5EA009564CE /* BuildView.xib */; }; + D0AB5CE51BB9A31100F57790 /* MockKeychain.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AB5CE41BB9A31100F57790 /* MockKeychain.swift */; }; + D0B156FF1B9A361B00A8D95A /* StatusMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B156FE1B9A361B00A8D95A /* StatusMenu.swift */; }; + D0B177741B962A110055ECC6 /* ResponseObjectSerializable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B177731B962A110055ECC6 /* ResponseObjectSerializable.swift */; }; + D0B177761B9631BE0055ECC6 /* ResponseCollectionSerializable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B177751B9631BE0055ECC6 /* ResponseCollectionSerializable.swift */; }; + D0B177791B9651BD0055ECC6 /* codeshipLogo_black.png in Resources */ = {isa = PBXBuildFile; fileRef = D0B177771B9651BD0055ECC6 /* codeshipLogo_black.png */; }; + D0B1777A1B9651BD0055ECC6 /* codeshipLogo_black@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D0B177781B9651BD0055ECC6 /* codeshipLogo_black@2x.png */; }; + D0B1E16C1BB9E74D009D0151 /* ProjectsProviderSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B1E16B1BB9E74D009D0151 /* ProjectsProviderSpec.swift */; }; + D0B1E16E1BB9EA4C009D0151 /* MockCodeshipApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B1E16D1BB9EA4C009D0151 /* MockCodeshipApi.swift */; }; + D0C002C11BB3472B006A058C /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C002C01BB3472B006A058C /* TextField.swift */; }; + D0C002C31BB35114006A058C /* PreferencesPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C002C21BB35114006A058C /* PreferencesPresenter.swift */; }; + D0C002C51BB35136006A058C /* PreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C002C41BB35136006A058C /* PreferencesView.swift */; }; + D0C002C71BB48801006A058C /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C002C61BB48801006A058C /* Settings.swift */; }; + D0C002C91BB49334006A058C /* TimerCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C002C81BB49334006A058C /* TimerCoordinator.swift */; }; + D0C002CB1BB49445006A058C /* ProjectsProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C002CA1BB49445006A058C /* ProjectsProvider.swift */; }; + D0C002CE1BB4A3E2006A058C /* CodeshipApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0C002CD1BB4A3E2006A058C /* CodeshipApi.swift */; }; + D0E3C0C41B9F45FC00D1966C /* PreferencesPaneWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E3C0C21B9F45FC00D1966C /* PreferencesPaneWindowController.swift */; }; + D0E3C0C51B9F45FC00D1966C /* PreferencesPaneWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D0E3C0C31B9F45FC00D1966C /* PreferencesPaneWindowController.xib */; }; + D0E3C0C91B9F8F2C00D1966C /* KeychainWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0E3C0C81B9F8F2C00D1966C /* KeychainWrapper.swift */; }; + D0F5B1991B45786500D30EEF /* SampleProject.json in Resources */ = {isa = PBXBuildFile; fileRef = D0F5B1981B45786500D30EEF /* SampleProject.json */; }; + D0F5B19B1B4578D400D30EEF /* SampleBuild.json in Resources */ = {isa = PBXBuildFile; fileRef = D0F5B19A1B4578D400D30EEF /* SampleBuild.json */; }; + D0F5B19D1B45821200D30EEF /* Build.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F5B19C1B45821200D30EEF /* Build.swift */; }; + DFB8B53BFCAB01E8787FC59C /* Pods_HarborTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7150961101FB11B6275D20F3 /* Pods_HarborTests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - D0A1CC221A5CDE06005FC2BE /* PBXContainerItemProxy */ = { + 10DC90971BC2E13000811234 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = D0610E181A0C952E0056B8A3 /* Project object */; + containerPortal = 10DC90931BC2E13000811234 /* HarborHelper.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 10DC90831BC2E09800811234; + remoteInfo = HarborHelper; + }; + D0772F1B1B3C437800031FB9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D0772F001B3C437800031FB9 /* Project object */; proxyType = 1; - remoteGlobalIDString = D0610E1F1A0C952E0056B8A3; + remoteGlobalIDString = D0772F071B3C437800031FB9; remoteInfo = Harbor; }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + 10DC90991BC2E1E500811234 /* Copy Helper App */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = Contents/Library/LoginItems; + dstSubfolderSpec = 1; + files = ( + 10DC909A1BC2E20F00811234 /* HarborHelper.app in Copy Helper App */, + ); + name = "Copy Helper App"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ - D01EC80A1A5E1FBE009A8D22 /* quit.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = quit.png; sourceTree = ""; }; - D01EC80B1A5E1FBE009A8D22 /* quit@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "quit@2x.png"; sourceTree = ""; }; - D01EC80E1A5E2BC0009A8D22 /* anchor-pref.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "anchor-pref.png"; sourceTree = ""; }; - D01EC80F1A5E2BC0009A8D22 /* anchor-pref@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "anchor-pref@2x.png"; sourceTree = ""; }; - D02B0BB21A17B1BB006B8143 /* Fonts */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Fonts; sourceTree = ""; }; - D0610E201A0C952E0056B8A3 /* Harbor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Harbor.app; sourceTree = BUILT_PRODUCTS_DIR; }; - D0610E241A0C952E0056B8A3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - D0610E251A0C952E0056B8A3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - D0610E2A1A0C952E0056B8A3 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - D0610E2D1A0C952E0056B8A3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; - D0610E331A0C952E0056B8A3 /* HarborTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HarborTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - D0610E381A0C952E0056B8A3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - D0610E391A0C952E0056B8A3 /* HarborTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HarborTests.swift; sourceTree = ""; }; - D0610E431A0C976F0056B8A3 /* PopoverViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PopoverViewController.swift; sourceTree = ""; }; - D0610E441A0C976F0056B8A3 /* Popover.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Popover.xib; sourceTree = ""; }; - D0610E451A0C976F0056B8A3 /* StatusView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusView.swift; sourceTree = ""; }; - D0610E461A0C976F0056B8A3 /* PreferencesPaneWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesPaneWindow.swift; sourceTree = ""; }; - D0610E471A0C976F0056B8A3 /* PreferencesPaneWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PreferencesPaneWindow.xib; sourceTree = ""; }; - D0610E521A0C97A80056B8A3 /* Account.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Account.swift; sourceTree = ""; }; - D0610E531A0C97A80056B8A3 /* Project.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Project.swift; sourceTree = ""; }; - D0610E541A0C97A80056B8A3 /* Build.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Build.swift; sourceTree = ""; }; - D0610E5F1A0C97CB0056B8A3 /* codeshipLogo_black.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = codeshipLogo_black.png; sourceTree = ""; }; - D0610E601A0C97CB0056B8A3 /* codeshipLogo_black@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "codeshipLogo_black@2x.png"; sourceTree = ""; }; - D0610E611A0C97CB0056B8A3 /* codeshipLogo_green.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = codeshipLogo_green.png; sourceTree = ""; }; - D0610E621A0C97CB0056B8A3 /* codeshipLogo_green@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "codeshipLogo_green@2x.png"; sourceTree = ""; }; - D0610E631A0C97CB0056B8A3 /* codeshipLogo_red.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = codeshipLogo_red.png; sourceTree = ""; }; - D0610E641A0C97CB0056B8A3 /* codeshipLogo_red@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "codeshipLogo_red@2x.png"; sourceTree = ""; }; - D0A1CC3E1A5D8CDB005FC2BE /* Harbor.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Harbor.xcdatamodel; sourceTree = ""; }; - D0F071341A5DA9A50043754D /* DMProject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DMProject.swift; sourceTree = ""; }; - D0F071361A5DA9A60043754D /* DMAccount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DMAccount.swift; sourceTree = ""; }; - D0F071381A5DA9A60043754D /* DMBuild.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DMBuild.swift; sourceTree = ""; }; + 108689C51BC8227D00B2DD87 /* VerifierOf.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VerifierOf.swift; sourceTree = ""; }; + 108689C81BC826C400B2DD87 /* Verifiable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Verifiable.swift; sourceTree = ""; }; + 108689CA1BC841BE00B2DD87 /* InvocationMatchers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InvocationMatchers.swift; sourceTree = ""; }; + 10DC90531BBDD31C00811234 /* HarborSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HarborSpec.swift; sourceTree = ""; }; + 10DC90551BBDDABF00811234 /* Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Example.swift; sourceTree = ""; }; + 10DC905E1BBEE12F00811234 /* StatusMenuPresenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusMenuPresenter.swift; sourceTree = ""; }; + 10DC90601BBEE13700811234 /* StatusMenuView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusMenuView.swift; sourceTree = ""; }; + 10DC90631BBEE17A00811234 /* Presenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Presenter.swift; sourceTree = ""; }; + 10DC90651BBEE47C00811234 /* ViewType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewType.swift; sourceTree = ""; }; + 10DC90691BBF088800811234 /* ProjectMenuItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectMenuItem.swift; sourceTree = ""; }; + 10DC906F1BBF096400811234 /* BuildStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BuildStatus.swift; sourceTree = ""; }; + 10DC90711BBF16C900811234 /* ProjectMenuItemModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectMenuItemModel.swift; sourceTree = ""; }; + 10DC90731BBF198900811234 /* Collections.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Collections.swift; sourceTree = ""; }; + 10DC90771BBF1CB700811234 /* BuildViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BuildViewModel.swift; sourceTree = ""; }; + 10DC90931BC2E13000811234 /* HarborHelper.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = HarborHelper.xcodeproj; path = HarborHelper/HarborHelper.xcodeproj; sourceTree = ""; }; + 10DC909B1BC2E23600811234 /* ServiceManagement.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ServiceManagement.framework; path = System/Library/Frameworks/ServiceManagement.framework; sourceTree = SDKROOT; }; + 10DC909D1BC2E27600811234 /* Harbor.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Harbor.entitlements; sourceTree = ""; }; + 10DC909E1BC2F85C00811234 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; }; + 10FA1FF71C9237D800A642A7 /* AppComponent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppComponent.swift; sourceTree = ""; }; + 10FA20001C9326D600A642A7 /* InteractorModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InteractorModule.swift; sourceTree = ""; }; + 10FA20021C93272B00A642A7 /* ServiceModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceModule.swift; sourceTree = ""; }; + 10FA20041C93274500A642A7 /* SystemModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SystemModule.swift; sourceTree = ""; }; + 10FA20081C93297B00A642A7 /* ViewComponent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewComponent.swift; sourceTree = ""; }; + 10FA200A1C932A0800A642A7 /* PreferencesViewModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesViewModule.swift; sourceTree = ""; }; + 10FA200C1C932A2400A642A7 /* StatusMenuViewModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusMenuViewModule.swift; sourceTree = ""; }; + 10FA200E1C933E1B00A642A7 /* Application.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Application.swift; sourceTree = ""; }; + 10FA20101C97770600A642A7 /* Environment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Environment.swift; sourceTree = ""; }; + 1EF75FA103814CE2B8C146C9 /* Pods_Harbor_HarborTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Harbor_HarborTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 39CFCBB97ED57DD01D949C73 /* Pods-Harbor-HarborTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Harbor-HarborTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.test.xcconfig"; sourceTree = ""; }; + 3C6502C802E8A7C8D358AB2E /* Pods-HarborTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HarborTests.test.xcconfig"; path = "Pods/Target Support Files/Pods-HarborTests/Pods-HarborTests.test.xcconfig"; sourceTree = ""; }; + 5D9CECB5F6F368D2C4628413 /* Pods-Harbor.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Harbor.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Harbor/Pods-Harbor.debug.xcconfig"; sourceTree = ""; }; + 6A44CEAA7EBDF79EBEA74B01 /* Pods-Harbor-HarborTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Harbor-HarborTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.release.xcconfig"; sourceTree = ""; }; + 6AB17BFC533903194B2259FA /* Pods-HarborTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HarborTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-HarborTests/Pods-HarborTests.release.xcconfig"; sourceTree = ""; }; + 7150961101FB11B6275D20F3 /* Pods_HarborTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_HarborTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9F06F0036A0C8CA9A3D11BA6 /* Pods-Harbor.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Harbor.release.xcconfig"; path = "Pods/Target Support Files/Pods-Harbor/Pods-Harbor.release.xcconfig"; sourceTree = ""; }; + C0CEA4AAFB6873D19A822129 /* Pods-Harbor.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Harbor.test.xcconfig"; path = "Pods/Target Support Files/Pods-Harbor/Pods-Harbor.test.xcconfig"; sourceTree = ""; }; + D01093BB1BB5B3D7002D5794 /* SettingsSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsSpec.swift; sourceTree = ""; }; + D01093BE1BB5D932002D5794 /* NotificationCenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationCenter.swift; sourceTree = ""; }; + D01093C01BB5D93D002D5794 /* UserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserDefaults.swift; sourceTree = ""; }; + D01093C31BB5DB33002D5794 /* MockUserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockUserDefaults.swift; sourceTree = ""; }; + D01093C61BB5F05E002D5794 /* Invocation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Invocation.swift; sourceTree = ""; }; + D0458F4D1BB9B83000DCC4A6 /* MockNotificationCenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockNotificationCenter.swift; sourceTree = ""; }; + D0458F4F1BB9C7B800DCC4A6 /* TimerCoordinatorSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimerCoordinatorSpec.swift; sourceTree = ""; }; + D0458F511BB9C8AD00DCC4A6 /* RunLoop.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunLoop.swift; sourceTree = ""; }; + D0458F551BB9CFCB00DCC4A6 /* MockRunLoop.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockRunLoop.swift; sourceTree = ""; }; + D06054241B57F880007A5F81 /* Playground.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Playground.swift; sourceTree = ""; }; + D0704EA71BBB117C005C808B /* PreferencesPresenterSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesPresenterSpec.swift; sourceTree = ""; }; + D0704EA91BBB1418005C808B /* MockPreferencesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockPreferencesView.swift; sourceTree = ""; }; + D0704EAB1BBB1584005C808B /* MockProjectsProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockProjectsProvider.swift; sourceTree = ""; }; + D0704EAD1BBB1851005C808B /* None.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = None.swift; sourceTree = ""; }; + D0772F081B3C437800031FB9 /* Harbor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Harbor.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D0772F0B1B3C437800031FB9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AppDelegate.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; + D0772F0E1B3C437800031FB9 /* Harbor.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Harbor.xcdatamodel; sourceTree = ""; }; + D0772F101B3C437800031FB9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + D0772F151B3C437800031FB9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D0772F1A1B3C437800031FB9 /* HarborTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HarborTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + D0772F201B3C437800031FB9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D0772F391B3C43B200031FB9 /* Project.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Project.swift; sourceTree = ""; }; + D0772F3F1B3C44C000031FB9 /* SamplePayload.json */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = text.json; path = SamplePayload.json; sourceTree = ""; tabWidth = 2; }; + D08EAB311B97531A009564CE /* MainMenu.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainMenu.xib; sourceTree = ""; }; + D08EAB351B98A60A009564CE /* codeshipLogo_green.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = codeshipLogo_green.png; sourceTree = ""; }; + D08EAB361B98A60A009564CE /* codeshipLogo_green@2px.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "codeshipLogo_green@2px.png"; sourceTree = ""; }; + D08EAB371B98A60A009564CE /* codeshipLogo_red.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = codeshipLogo_red.png; sourceTree = ""; }; + D08EAB381B98A60A009564CE /* codeshipLogo_red@2px.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "codeshipLogo_red@2px.png"; sourceTree = ""; }; + D08EAB3D1B98D5C8009564CE /* BuildView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BuildView.swift; sourceTree = ""; }; + D08EAB401B98D5EA009564CE /* BuildView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BuildView.xib; sourceTree = ""; }; + D0A3E7501B73AC51006E4350 /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Alamofire.framework; path = Pods/../build/Release/Alamofire.framework; sourceTree = ""; }; + D0A3E7521B73AC57006E4350 /* OCMapper.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OCMapper.framework; path = Pods/../build/Debug/OCMapper.framework; sourceTree = ""; }; + D0AB5CE41BB9A31100F57790 /* MockKeychain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockKeychain.swift; sourceTree = ""; }; + D0B156FE1B9A361B00A8D95A /* StatusMenu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusMenu.swift; sourceTree = ""; }; + D0B177701B9611400055ECC6 /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Alamofire.framework; path = "../../../../../Library/Developer/Xcode/DerivedData/Harbor-heejklmuxvludkgdxatbozvazkoh/Build/Products/Debug/Alamofire.framework"; sourceTree = ""; }; + D0B177731B962A110055ECC6 /* ResponseObjectSerializable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResponseObjectSerializable.swift; sourceTree = ""; }; + D0B177751B9631BE0055ECC6 /* ResponseCollectionSerializable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResponseCollectionSerializable.swift; sourceTree = ""; }; + D0B177771B9651BD0055ECC6 /* codeshipLogo_black.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = codeshipLogo_black.png; sourceTree = ""; }; + D0B177781B9651BD0055ECC6 /* codeshipLogo_black@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "codeshipLogo_black@2x.png"; sourceTree = ""; }; + D0B1E16B1BB9E74D009D0151 /* ProjectsProviderSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectsProviderSpec.swift; sourceTree = ""; }; + D0B1E16D1BB9EA4C009D0151 /* MockCodeshipApi.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockCodeshipApi.swift; sourceTree = ""; }; + D0C002C01BB3472B006A058C /* TextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextField.swift; sourceTree = ""; }; + D0C002C21BB35114006A058C /* PreferencesPresenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesPresenter.swift; sourceTree = ""; }; + D0C002C41BB35136006A058C /* PreferencesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesView.swift; sourceTree = ""; }; + D0C002C61BB48801006A058C /* Settings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = ""; }; + D0C002C81BB49334006A058C /* TimerCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimerCoordinator.swift; sourceTree = ""; }; + D0C002CA1BB49445006A058C /* ProjectsProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectsProvider.swift; sourceTree = ""; }; + D0C002CD1BB4A3E2006A058C /* CodeshipApi.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = CodeshipApi.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; + D0E3C0C21B9F45FC00D1966C /* PreferencesPaneWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesPaneWindowController.swift; sourceTree = ""; }; + D0E3C0C31B9F45FC00D1966C /* PreferencesPaneWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PreferencesPaneWindowController.xib; sourceTree = ""; }; + D0E3C0C81B9F8F2C00D1966C /* KeychainWrapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainWrapper.swift; sourceTree = ""; }; + D0F5B1981B45786500D30EEF /* SampleProject.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = SampleProject.json; path = HarborTests/SampleProject.json; sourceTree = SOURCE_ROOT; }; + D0F5B19A1B4578D400D30EEF /* SampleBuild.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = SampleBuild.json; sourceTree = ""; }; + D0F5B19C1B45821200D30EEF /* Build.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Build.swift; sourceTree = ""; }; + D263D9B112452CA339017421 /* Pods-Harbor-HarborTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Harbor-HarborTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.debug.xcconfig"; sourceTree = ""; }; + EFE3D042DFD06CDDD92762A5 /* Pods_Harbor.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Harbor.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F2038433ED1FEE0835681600 /* Pods-HarborTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HarborTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-HarborTests/Pods-HarborTests.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - D0610E1D1A0C952E0056B8A3 /* Frameworks */ = { + D0772F051B3C437800031FB9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 10DC909C1BC2E23600811234 /* ServiceManagement.framework in Frameworks */, + 2E0EB95307EB9B5CA6ACB161 /* Pods_Harbor.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - D0610E301A0C952E0056B8A3 /* Frameworks */ = { + D0772F171B3C437800031FB9 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + DFB8B53BFCAB01E8787FC59C /* Pods_HarborTests.framework in Frameworks */, + CDD5638F36C28F1CBED22C30 /* Pods_Harbor_HarborTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - D0012FBD1A103F060009DEE4 /* images */ = { + 10DC905A1BBED7A000811234 /* Preferences */ = { + isa = PBXGroup; + children = ( + D0E3C0C31B9F45FC00D1966C /* PreferencesPaneWindowController.xib */, + D0E3C0C21B9F45FC00D1966C /* PreferencesPaneWindowController.swift */, + D0C002C41BB35136006A058C /* PreferencesView.swift */, + D0C002C21BB35114006A058C /* PreferencesPresenter.swift */, + ); + name = Preferences; + sourceTree = ""; + }; + 10DC905B1BBED7DE00811234 /* Menu */ = { + isa = PBXGroup; + children = ( + D08EAB311B97531A009564CE /* MainMenu.xib */, + D0B156FE1B9A361B00A8D95A /* StatusMenu.swift */, + 10DC90601BBEE13700811234 /* StatusMenuView.swift */, + 10DC905E1BBEE12F00811234 /* StatusMenuPresenter.swift */, + 10DC90691BBF088800811234 /* ProjectMenuItem.swift */, + 10DC90711BBF16C900811234 /* ProjectMenuItemModel.swift */, + D08EAB401B98D5EA009564CE /* BuildView.xib */, + D08EAB3D1B98D5C8009564CE /* BuildView.swift */, + 10DC90771BBF1CB700811234 /* BuildViewModel.swift */, + 10DC906F1BBF096400811234 /* BuildStatus.swift */, + ); + name = Menu; + sourceTree = ""; + }; + 10DC90621BBEE17100811234 /* Core */ = { + isa = PBXGroup; + children = ( + 10DC90631BBEE17A00811234 /* Presenter.swift */, + 10DC90651BBEE47C00811234 /* ViewType.swift */, + ); + name = Core; + sourceTree = ""; + }; + 10DC90791BC2CEDE00811234 /* Shared */ = { + isa = PBXGroup; + children = ( + D0C002C01BB3472B006A058C /* TextField.swift */, + ); + name = Shared; + sourceTree = ""; + }; + 10DC90941BC2E13000811234 /* Products */ = { isa = PBXGroup; children = ( - D01EC80E1A5E2BC0009A8D22 /* anchor-pref.png */, - D01EC80F1A5E2BC0009A8D22 /* anchor-pref@2x.png */, - D01EC80A1A5E1FBE009A8D22 /* quit.png */, - D01EC80B1A5E1FBE009A8D22 /* quit@2x.png */, - D0610E5F1A0C97CB0056B8A3 /* codeshipLogo_black.png */, - D0610E601A0C97CB0056B8A3 /* codeshipLogo_black@2x.png */, - D0610E611A0C97CB0056B8A3 /* codeshipLogo_green.png */, - D0610E621A0C97CB0056B8A3 /* codeshipLogo_green@2x.png */, - D0610E631A0C97CB0056B8A3 /* codeshipLogo_red.png */, - D0610E641A0C97CB0056B8A3 /* codeshipLogo_red@2x.png */, - ); - name = images; + 10DC90981BC2E13000811234 /* HarborHelper.app */, + ); + name = Products; + sourceTree = ""; + }; + 10FA1FF51C9236A400A642A7 /* Drip */ = { + isa = PBXGroup; + children = ( + 10FA20061C93280C00A642A7 /* App */, + 10FA20071C93295700A642A7 /* View */, + ); + name = Drip; + path = ../Components; + sourceTree = ""; + }; + 10FA20061C93280C00A642A7 /* App */ = { + isa = PBXGroup; + children = ( + 10FA1FF71C9237D800A642A7 /* AppComponent.swift */, + 10FA20041C93274500A642A7 /* SystemModule.swift */, + 10FA20021C93272B00A642A7 /* ServiceModule.swift */, + 10FA20001C9326D600A642A7 /* InteractorModule.swift */, + ); + name = App; + sourceTree = ""; + }; + 10FA20071C93295700A642A7 /* View */ = { + isa = PBXGroup; + children = ( + 10FA20081C93297B00A642A7 /* ViewComponent.swift */, + 10FA200C1C932A2400A642A7 /* StatusMenuViewModule.swift */, + 10FA200A1C932A0800A642A7 /* PreferencesViewModule.swift */, + ); + name = View; + sourceTree = ""; + }; + A338C7D8E749FE47B694D06D /* Pods */ = { + isa = PBXGroup; + children = ( + F2038433ED1FEE0835681600 /* Pods-HarborTests.debug.xcconfig */, + 3C6502C802E8A7C8D358AB2E /* Pods-HarborTests.test.xcconfig */, + 6AB17BFC533903194B2259FA /* Pods-HarborTests.release.xcconfig */, + 5D9CECB5F6F368D2C4628413 /* Pods-Harbor.debug.xcconfig */, + C0CEA4AAFB6873D19A822129 /* Pods-Harbor.test.xcconfig */, + 9F06F0036A0C8CA9A3D11BA6 /* Pods-Harbor.release.xcconfig */, + D263D9B112452CA339017421 /* Pods-Harbor-HarborTests.debug.xcconfig */, + 39CFCBB97ED57DD01D949C73 /* Pods-Harbor-HarborTests.test.xcconfig */, + 6A44CEAA7EBDF79EBEA74B01 /* Pods-Harbor-HarborTests.release.xcconfig */, + ); + name = Pods; sourceTree = ""; }; - D02B0BB61A17B1CF006B8143 /* Fonts */ = { + C61573DD1BA5E0B634D1395C /* Frameworks */ = { isa = PBXGroup; children = ( - D02B0BB21A17B1BB006B8143 /* Fonts */, + 10DC909E1BC2F85C00811234 /* CoreServices.framework */, + 10DC909B1BC2E23600811234 /* ServiceManagement.framework */, + D0B177701B9611400055ECC6 /* Alamofire.framework */, + D0A3E7521B73AC57006E4350 /* OCMapper.framework */, + D0A3E7501B73AC51006E4350 /* Alamofire.framework */, + EFE3D042DFD06CDDD92762A5 /* Pods_Harbor.framework */, + 7150961101FB11B6275D20F3 /* Pods_HarborTests.framework */, + 1EF75FA103814CE2B8C146C9 /* Pods_Harbor_HarborTests.framework */, ); - name = Fonts; + name = Frameworks; sourceTree = ""; }; - D0410F231A0FFEEF00641A1A /* Models */ = { + D01093BA1BB5B355002D5794 /* Interactors */ = { isa = PBXGroup; children = ( - D0610E521A0C97A80056B8A3 /* Account.swift */, - D0610E531A0C97A80056B8A3 /* Project.swift */, - D0610E541A0C97A80056B8A3 /* Build.swift */, + D01093BB1BB5B3D7002D5794 /* SettingsSpec.swift */, + D0458F4F1BB9C7B800DCC4A6 /* TimerCoordinatorSpec.swift */, + D0B1E16B1BB9E74D009D0151 /* ProjectsProviderSpec.swift */, ); - name = Models; + name = Interactors; sourceTree = ""; }; - D0410F241A0FFF0000641A1A /* prefs */ = { + D01093C21BB5DB27002D5794 /* Mocks */ = { isa = PBXGroup; children = ( - D0610E461A0C976F0056B8A3 /* PreferencesPaneWindow.swift */, - D0610E471A0C976F0056B8A3 /* PreferencesPaneWindow.xib */, + D01093C31BB5DB33002D5794 /* MockUserDefaults.swift */, + D0AB5CE41BB9A31100F57790 /* MockKeychain.swift */, + D0458F4D1BB9B83000DCC4A6 /* MockNotificationCenter.swift */, + D0458F551BB9CFCB00DCC4A6 /* MockRunLoop.swift */, + D0B1E16D1BB9EA4C009D0151 /* MockCodeshipApi.swift */, + D0704EA91BBB1418005C808B /* MockPreferencesView.swift */, + D0704EAB1BBB1584005C808B /* MockProjectsProvider.swift */, ); - name = prefs; + name = Mocks; sourceTree = ""; }; - D0410F251A0FFF0A00641A1A /* popover */ = { + D01093C51BB5F049002D5794 /* Support */ = { isa = PBXGroup; children = ( - D0610E431A0C976F0056B8A3 /* PopoverViewController.swift */, - D0610E441A0C976F0056B8A3 /* Popover.xib */, + 10DC90531BBDD31C00811234 /* HarborSpec.swift */, + 10DC90551BBDDABF00811234 /* Example.swift */, + D01093C61BB5F05E002D5794 /* Invocation.swift */, + 108689CA1BC841BE00B2DD87 /* InvocationMatchers.swift */, + 108689C81BC826C400B2DD87 /* Verifiable.swift */, + 108689C51BC8227D00B2DD87 /* VerifierOf.swift */, + D0704EAD1BBB1851005C808B /* None.swift */, ); - name = popover; + name = Support; sourceTree = ""; }; - D0410F261A0FFF1D00641A1A /* CoreData */ = { + D0254DA91B95FD1A00D12AF0 /* Extensions */ = { isa = PBXGroup; children = ( - D0A1CC3D1A5D8CDB005FC2BE /* Harbor.xcdatamodeld */, - D0F071381A5DA9A60043754D /* DMBuild.swift */, - D0F071361A5DA9A60043754D /* DMAccount.swift */, - D0F071341A5DA9A50043754D /* DMProject.swift */, + D0B177731B962A110055ECC6 /* ResponseObjectSerializable.swift */, + D0B177751B9631BE0055ECC6 /* ResponseCollectionSerializable.swift */, + D0E3C0C81B9F8F2C00D1966C /* KeychainWrapper.swift */, + D01093C01BB5D93D002D5794 /* UserDefaults.swift */, + D01093BE1BB5D932002D5794 /* NotificationCenter.swift */, + D0458F511BB9C8AD00DCC4A6 /* RunLoop.swift */, + 10DC90731BBF198900811234 /* Collections.swift */, + 10FA20101C97770600A642A7 /* Environment.swift */, ); - name = CoreData; + name = Extensions; sourceTree = ""; }; - D0610E171A0C952E0056B8A3 = { + D0704EA61BBB1168005C808B /* Presenters */ = { isa = PBXGroup; children = ( - D0610E221A0C952E0056B8A3 /* Harbor */, - D0610E361A0C952E0056B8A3 /* HarborTests */, - D0610E211A0C952E0056B8A3 /* Products */, + D0704EA71BBB117C005C808B /* PreferencesPresenterSpec.swift */, ); + name = Presenters; sourceTree = ""; - tabWidth = 4; }; - D0610E211A0C952E0056B8A3 /* Products */ = { + D0772EFF1B3C437800031FB9 = { isa = PBXGroup; children = ( - D0610E201A0C952E0056B8A3 /* Harbor.app */, - D0610E331A0C952E0056B8A3 /* HarborTests.xctest */, + 10DC90931BC2E13000811234 /* HarborHelper.xcodeproj */, + D0772F0A1B3C437800031FB9 /* Harbor */, + D0772F1D1B3C437800031FB9 /* HarborTests */, + D0772F091B3C437800031FB9 /* Products */, + C61573DD1BA5E0B634D1395C /* Frameworks */, + A338C7D8E749FE47B694D06D /* Pods */, + ); + sourceTree = ""; + }; + D0772F091B3C437800031FB9 /* Products */ = { + isa = PBXGroup; + children = ( + D0772F081B3C437800031FB9 /* Harbor.app */, + D0772F1A1B3C437800031FB9 /* HarborTests.xctest */, ); name = Products; sourceTree = ""; }; - D0610E221A0C952E0056B8A3 /* Harbor */ = { + D0772F0A1B3C437800031FB9 /* Harbor */ = { isa = PBXGroup; children = ( - D0610E251A0C952E0056B8A3 /* AppDelegate.swift */, - D0610E2C1A0C952E0056B8A3 /* MainMenu.xib */, - D0410F251A0FFF0A00641A1A /* popover */, - D0610E451A0C976F0056B8A3 /* StatusView.swift */, - D0410F241A0FFF0000641A1A /* prefs */, - D0410F231A0FFEEF00641A1A /* Models */, - D0610E2A1A0C952E0056B8A3 /* Images.xcassets */, - D0410F261A0FFF1D00641A1A /* CoreData */, - D0610E231A0C952E0056B8A3 /* Supporting Files */, + 10FA200E1C933E1B00A642A7 /* Application.swift */, + D0772F0B1B3C437800031FB9 /* AppDelegate.swift */, + D08EAB3F1B98D5D5009564CE /* Views */, + D0C002CC1BB49452006A058C /* Interactors */, + 10FA1FF51C9236A400A642A7 /* Drip */, + D0A3E7441B73A764006E4350 /* API */, + D0772F371B3C438900031FB9 /* Domain */, + D0254DA91B95FD1A00D12AF0 /* Extensions */, + 10DC909D1BC2E27600811234 /* Harbor.entitlements */, + D0772F101B3C437800031FB9 /* Assets.xcassets */, + D0772F151B3C437800031FB9 /* Info.plist */, + D0772F0D1B3C437800031FB9 /* Harbor.xcdatamodeld */, + D0B1777B1B9651C30055ECC6 /* Images */, ); path = Harbor; sourceTree = ""; }; - D0610E231A0C952E0056B8A3 /* Supporting Files */ = { + D0772F1D1B3C437800031FB9 /* HarborTests */ = { isa = PBXGroup; children = ( - D02B0BB61A17B1CF006B8143 /* Fonts */, - D0012FBD1A103F060009DEE4 /* images */, - D0610E241A0C952E0056B8A3 /* Info.plist */, + D01093BA1BB5B355002D5794 /* Interactors */, + D0704EA61BBB1168005C808B /* Presenters */, + D0772F381B3C439100031FB9 /* Domain */, + D01093C21BB5DB27002D5794 /* Mocks */, + D01093C51BB5F049002D5794 /* Support */, + D0772F201B3C437800031FB9 /* Info.plist */, ); - name = "Supporting Files"; + path = HarborTests; sourceTree = ""; }; - D0610E361A0C952E0056B8A3 /* HarborTests */ = { + D0772F371B3C438900031FB9 /* Domain */ = { isa = PBXGroup; children = ( - D0610E391A0C952E0056B8A3 /* HarborTests.swift */, - D0610E371A0C952E0056B8A3 /* Supporting Files */, + D0772F391B3C43B200031FB9 /* Project.swift */, + D0F5B19C1B45821200D30EEF /* Build.swift */, + D06054241B57F880007A5F81 /* Playground.swift */, + D0F5B1981B45786500D30EEF /* SampleProject.json */, ); - path = HarborTests; + name = Domain; sourceTree = ""; }; - D0610E371A0C952E0056B8A3 /* Supporting Files */ = { + D0772F381B3C439100031FB9 /* Domain */ = { isa = PBXGroup; children = ( - D0610E381A0C952E0056B8A3 /* Info.plist */, + D0772F3F1B3C44C000031FB9 /* SamplePayload.json */, + D0F5B19A1B4578D400D30EEF /* SampleBuild.json */, ); - name = "Supporting Files"; + name = Domain; + sourceTree = ""; + }; + D08EAB3F1B98D5D5009564CE /* Views */ = { + isa = PBXGroup; + children = ( + 10DC90621BBEE17100811234 /* Core */, + 10DC905B1BBED7DE00811234 /* Menu */, + 10DC905A1BBED7A000811234 /* Preferences */, + 10DC90791BC2CEDE00811234 /* Shared */, + ); + name = Views; + sourceTree = ""; + }; + D0A3E7441B73A764006E4350 /* API */ = { + isa = PBXGroup; + children = ( + D0C002CD1BB4A3E2006A058C /* CodeshipApi.swift */, + ); + name = API; + sourceTree = ""; + }; + D0B1777B1B9651C30055ECC6 /* Images */ = { + isa = PBXGroup; + children = ( + D08EAB351B98A60A009564CE /* codeshipLogo_green.png */, + D08EAB361B98A60A009564CE /* codeshipLogo_green@2px.png */, + D08EAB371B98A60A009564CE /* codeshipLogo_red.png */, + D08EAB381B98A60A009564CE /* codeshipLogo_red@2px.png */, + D0B177771B9651BD0055ECC6 /* codeshipLogo_black.png */, + D0B177781B9651BD0055ECC6 /* codeshipLogo_black@2x.png */, + ); + name = Images; + sourceTree = ""; + }; + D0C002CC1BB49452006A058C /* Interactors */ = { + isa = PBXGroup; + children = ( + D0C002C61BB48801006A058C /* Settings.swift */, + D0C002C81BB49334006A058C /* TimerCoordinator.swift */, + D0C002CA1BB49445006A058C /* ProjectsProvider.swift */, + ); + name = Interactors; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - D0610E1F1A0C952E0056B8A3 /* Harbor */ = { + D0772F071B3C437800031FB9 /* Harbor */ = { isa = PBXNativeTarget; - buildConfigurationList = D0610E3D1A0C952E0056B8A3 /* Build configuration list for PBXNativeTarget "Harbor" */; + buildConfigurationList = D0772F2E1B3C437800031FB9 /* Build configuration list for PBXNativeTarget "Harbor" */; buildPhases = ( - D0610E1C1A0C952E0056B8A3 /* Sources */, - D0610E1D1A0C952E0056B8A3 /* Frameworks */, - D0610E1E1A0C952E0056B8A3 /* Resources */, + 74748A0262D4DB5BB92BFA43 /* 📦 Check Pods Manifest.lock */, + D0772F041B3C437800031FB9 /* Sources */, + D0772F051B3C437800031FB9 /* Frameworks */, + D0772F061B3C437800031FB9 /* Resources */, + 10DC90991BC2E1E500811234 /* Copy Helper App */, + 151204C4C159CC2997B64C1B /* 📦 Embed Pods Frameworks */, + A870D6751F5FCECE247C0B90 /* 📦 Copy Pods Resources */, ); buildRules = ( ); dependencies = ( ); name = Harbor; - productName = Harbor2; - productReference = D0610E201A0C952E0056B8A3 /* Harbor.app */; + productName = Harbor; + productReference = D0772F081B3C437800031FB9 /* Harbor.app */; productType = "com.apple.product-type.application"; }; - D0610E321A0C952E0056B8A3 /* HarborTests */ = { + D0772F191B3C437800031FB9 /* HarborTests */ = { isa = PBXNativeTarget; - buildConfigurationList = D0610E401A0C952E0056B8A3 /* Build configuration list for PBXNativeTarget "HarborTests" */; + buildConfigurationList = D0772F311B3C437800031FB9 /* Build configuration list for PBXNativeTarget "HarborTests" */; buildPhases = ( - D0610E2F1A0C952E0056B8A3 /* Sources */, - D0610E301A0C952E0056B8A3 /* Frameworks */, - D0610E311A0C952E0056B8A3 /* Resources */, + C74A075B257374DF83F3EEA0 /* 📦 Check Pods Manifest.lock */, + D0772F161B3C437800031FB9 /* Sources */, + D0772F171B3C437800031FB9 /* Frameworks */, + D0772F181B3C437800031FB9 /* Resources */, + 4D6108BCB9DD434C1F0F72E0 /* 📦 Embed Pods Frameworks */, + B384A84D6DFD9BC94E8D5E31 /* 📦 Copy Pods Resources */, ); buildRules = ( ); dependencies = ( - D0A1CC231A5CDE06005FC2BE /* PBXTargetDependency */, + D0772F1C1B3C437800031FB9 /* PBXTargetDependency */, ); name = HarborTests; - productName = Harbor2Tests; - productReference = D0610E331A0C952E0056B8A3 /* HarborTests.xctest */; + productName = HarborTests; + productReference = D0772F1A1B3C437800031FB9 /* HarborTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - D0610E181A0C952E0056B8A3 /* Project object */ = { + D0772F001B3C437800031FB9 /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0610; - ORGANIZATIONNAME = dvm; + LastSwiftMigration = 0700; + LastUpgradeCheck = 0700; + ORGANIZATIONNAME = DevMynd; TargetAttributes = { - D0610E1F1A0C952E0056B8A3 = { - CreatedOnToolsVersion = 6.1; + D0772F071B3C437800031FB9 = { + CreatedOnToolsVersion = 7.0; DevelopmentTeam = 5T84PP4W5D; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; }; - D0610E321A0C952E0056B8A3 = { - CreatedOnToolsVersion = 6.1; - TestTargetID = D0610E1F1A0C952E0056B8A3; + D0772F191B3C437800031FB9 = { + CreatedOnToolsVersion = 7.0; + TestTargetID = D0772F071B3C437800031FB9; }; }; }; - buildConfigurationList = D0610E1B1A0C952E0056B8A3 /* Build configuration list for PBXProject "Harbor" */; + buildConfigurationList = D0772F031B3C437800031FB9 /* Build configuration list for PBXProject "Harbor" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -296,105 +603,318 @@ en, Base, ); - mainGroup = D0610E171A0C952E0056B8A3; - productRefGroup = D0610E211A0C952E0056B8A3 /* Products */; + mainGroup = D0772EFF1B3C437800031FB9; + productRefGroup = D0772F091B3C437800031FB9 /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 10DC90941BC2E13000811234 /* Products */; + ProjectRef = 10DC90931BC2E13000811234 /* HarborHelper.xcodeproj */; + }, + ); projectRoot = ""; targets = ( - D0610E1F1A0C952E0056B8A3 /* Harbor */, - D0610E321A0C952E0056B8A3 /* HarborTests */, + D0772F071B3C437800031FB9 /* Harbor */, + D0772F191B3C437800031FB9 /* HarborTests */, ); }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + 10DC90981BC2E13000811234 /* HarborHelper.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = HarborHelper.app; + remoteRef = 10DC90971BC2E13000811234 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ - D0610E1E1A0C952E0056B8A3 /* Resources */ = { + D0772F061B3C437800031FB9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - D01EC80C1A5E1FBE009A8D22 /* quit.png in Resources */, - D0610E6D1A0C97CB0056B8A3 /* codeshipLogo_black.png in Resources */, - D0610E771A0C97CB0056B8A3 /* codeshipLogo_red@2x.png in Resources */, - D02B0BB41A17B1BB006B8143 /* Fonts in Resources */, - D0610E711A0C97CB0056B8A3 /* codeshipLogo_green.png in Resources */, - D0610E501A0C976F0056B8A3 /* PreferencesPaneWindow.xib in Resources */, - D01EC8111A5E2BC0009A8D22 /* anchor-pref@2x.png in Resources */, - D0610E6F1A0C97CB0056B8A3 /* codeshipLogo_black@2x.png in Resources */, - D0610E2B1A0C952E0056B8A3 /* Images.xcassets in Resources */, - D0610E4A1A0C976F0056B8A3 /* Popover.xib in Resources */, - D0610E751A0C97CB0056B8A3 /* codeshipLogo_red.png in Resources */, - D0610E731A0C97CB0056B8A3 /* codeshipLogo_green@2x.png in Resources */, - D01EC80D1A5E1FBE009A8D22 /* quit@2x.png in Resources */, - D0610E2E1A0C952E0056B8A3 /* MainMenu.xib in Resources */, - D01EC8101A5E2BC0009A8D22 /* anchor-pref.png in Resources */, + D0E3C0C51B9F45FC00D1966C /* PreferencesPaneWindowController.xib in Resources */, + D0772F111B3C437800031FB9 /* Assets.xcassets in Resources */, + D08EAB411B98D5EA009564CE /* BuildView.xib in Resources */, + D08EAB3B1B98A60A009564CE /* codeshipLogo_red.png in Resources */, + D08EAB391B98A60A009564CE /* codeshipLogo_green.png in Resources */, + D08EAB321B97531A009564CE /* MainMenu.xib in Resources */, + D0B1777A1B9651BD0055ECC6 /* codeshipLogo_black@2x.png in Resources */, + D0B177791B9651BD0055ECC6 /* codeshipLogo_black.png in Resources */, + D08EAB3A1B98A60A009564CE /* codeshipLogo_green@2px.png in Resources */, + D08EAB3C1B98A60A009564CE /* codeshipLogo_red@2px.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - D0610E311A0C952E0056B8A3 /* Resources */ = { + D0772F181B3C437800031FB9 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - D0610E781A0C97CB0056B8A3 /* codeshipLogo_red@2x.png in Resources */, - D0610E761A0C97CB0056B8A3 /* codeshipLogo_red.png in Resources */, - D0610E701A0C97CB0056B8A3 /* codeshipLogo_black@2x.png in Resources */, - D0610E6E1A0C97CB0056B8A3 /* codeshipLogo_black.png in Resources */, - D0610E721A0C97CB0056B8A3 /* codeshipLogo_green.png in Resources */, - D0610E741A0C97CB0056B8A3 /* codeshipLogo_green@2x.png in Resources */, + D0772F401B3C44C000031FB9 /* SamplePayload.json in Resources */, + D0F5B19B1B4578D400D30EEF /* SampleBuild.json in Resources */, + D0F5B1991B45786500D30EEF /* SampleProject.json in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 151204C4C159CC2997B64C1B /* 📦 Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "📦 Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 4D6108BCB9DD434C1F0F72E0 /* 📦 Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "📦 Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 74748A0262D4DB5BB92BFA43 /* 📦 Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "📦 Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + A870D6751F5FCECE247C0B90 /* 📦 Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "📦 Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + B384A84D6DFD9BC94E8D5E31 /* 📦 Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "📦 Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + C74A075B257374DF83F3EEA0 /* 📦 Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "📦 Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ - D0610E1C1A0C952E0056B8A3 /* Sources */ = { + D0772F041B3C437800031FB9 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D0A1CC3F1A5D8CDB005FC2BE /* Harbor.xcdatamodeld in Sources */, - D0610E481A0C976F0056B8A3 /* PopoverViewController.swift in Sources */, - D0610E4C1A0C976F0056B8A3 /* StatusView.swift in Sources */, - D0610E4E1A0C976F0056B8A3 /* PreferencesPaneWindow.swift in Sources */, - D0F071351A5DA9A50043754D /* DMProject.swift in Sources */, - D0610E261A0C952E0056B8A3 /* AppDelegate.swift in Sources */, - D0F071391A5DA9A60043754D /* DMBuild.swift in Sources */, - D0F071371A5DA9A60043754D /* DMAccount.swift in Sources */, - D0610E571A0C97A80056B8A3 /* Project.swift in Sources */, - D0610E591A0C97A80056B8A3 /* Build.swift in Sources */, - D0610E551A0C97A80056B8A3 /* Account.swift in Sources */, + D0772F0C1B3C437800031FB9 /* AppDelegate.swift in Sources */, + 10DC90641BBEE17A00811234 /* Presenter.swift in Sources */, + D08EAB3E1B98D5C8009564CE /* BuildView.swift in Sources */, + D0C002C11BB3472B006A058C /* TextField.swift in Sources */, + D0B177761B9631BE0055ECC6 /* ResponseCollectionSerializable.swift in Sources */, + D0E3C0C41B9F45FC00D1966C /* PreferencesPaneWindowController.swift in Sources */, + 10FA20031C93272B00A642A7 /* ServiceModule.swift in Sources */, + 10DC90781BBF1CB700811234 /* BuildViewModel.swift in Sources */, + 10DC90721BBF16C900811234 /* ProjectMenuItemModel.swift in Sources */, + 10FA20111C97770600A642A7 /* Environment.swift in Sources */, + 10DC906A1BBF088800811234 /* ProjectMenuItem.swift in Sources */, + D01093BF1BB5D932002D5794 /* NotificationCenter.swift in Sources */, + D0C002CB1BB49445006A058C /* ProjectsProvider.swift in Sources */, + D0E3C0C91B9F8F2C00D1966C /* KeychainWrapper.swift in Sources */, + 10FA200B1C932A0800A642A7 /* PreferencesViewModule.swift in Sources */, + 10FA200D1C932A2400A642A7 /* StatusMenuViewModule.swift in Sources */, + 10FA20091C93297B00A642A7 /* ViewComponent.swift in Sources */, + 10DC90611BBEE13700811234 /* StatusMenuView.swift in Sources */, + D06054251B57F880007A5F81 /* Playground.swift in Sources */, + D0772F0F1B3C437800031FB9 /* Harbor.xcdatamodeld in Sources */, + D0C002C31BB35114006A058C /* PreferencesPresenter.swift in Sources */, + D0C002C51BB35136006A058C /* PreferencesView.swift in Sources */, + 10DC90741BBF198900811234 /* Collections.swift in Sources */, + 10FA200F1C933E1B00A642A7 /* Application.swift in Sources */, + 10FA20011C9326D600A642A7 /* InteractorModule.swift in Sources */, + 10FA20051C93274500A642A7 /* SystemModule.swift in Sources */, + D0C002CE1BB4A3E2006A058C /* CodeshipApi.swift in Sources */, + 10DC905F1BBEE12F00811234 /* StatusMenuPresenter.swift in Sources */, + 10DC90661BBEE47C00811234 /* ViewType.swift in Sources */, + D0458F521BB9C8AD00DCC4A6 /* RunLoop.swift in Sources */, + D0B156FF1B9A361B00A8D95A /* StatusMenu.swift in Sources */, + D0C002C91BB49334006A058C /* TimerCoordinator.swift in Sources */, + 10DC90701BBF096400811234 /* BuildStatus.swift in Sources */, + D0C002C71BB48801006A058C /* Settings.swift in Sources */, + D01093C11BB5D93D002D5794 /* UserDefaults.swift in Sources */, + 10FA1FF81C9237D800A642A7 /* AppComponent.swift in Sources */, + D0F5B19D1B45821200D30EEF /* Build.swift in Sources */, + D0772F3A1B3C43B200031FB9 /* Project.swift in Sources */, + D0B177741B962A110055ECC6 /* ResponseObjectSerializable.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - D0610E2F1A0C952E0056B8A3 /* Sources */ = { + D0772F161B3C437800031FB9 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D0610E3A1A0C952E0056B8A3 /* HarborTests.swift in Sources */, + D0B1E16E1BB9EA4C009D0151 /* MockCodeshipApi.swift in Sources */, + D0458F4E1BB9B83000DCC4A6 /* MockNotificationCenter.swift in Sources */, + 108689C91BC826C400B2DD87 /* Verifiable.swift in Sources */, + 108689C61BC8227D00B2DD87 /* VerifierOf.swift in Sources */, + D0458F501BB9C7B800DCC4A6 /* TimerCoordinatorSpec.swift in Sources */, + D0704EAC1BBB1584005C808B /* MockProjectsProvider.swift in Sources */, + 10DC90541BBDD31C00811234 /* HarborSpec.swift in Sources */, + D01093C71BB5F05E002D5794 /* Invocation.swift in Sources */, + D01093C41BB5DB33002D5794 /* MockUserDefaults.swift in Sources */, + 108689CB1BC841BE00B2DD87 /* InvocationMatchers.swift in Sources */, + D0704EAE1BBB1851005C808B /* None.swift in Sources */, + D0704EAA1BBB1418005C808B /* MockPreferencesView.swift in Sources */, + D0458F561BB9CFCB00DCC4A6 /* MockRunLoop.swift in Sources */, + D01093BC1BB5B3D7002D5794 /* SettingsSpec.swift in Sources */, + D0704EA81BBB117C005C808B /* PreferencesPresenterSpec.swift in Sources */, + D0B1E16C1BB9E74D009D0151 /* ProjectsProviderSpec.swift in Sources */, + D0AB5CE51BB9A31100F57790 /* MockKeychain.swift in Sources */, + 10DC90561BBDDABF00811234 /* Example.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - D0A1CC231A5CDE06005FC2BE /* PBXTargetDependency */ = { + D0772F1C1B3C437800031FB9 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = D0610E1F1A0C952E0056B8A3 /* Harbor */; - targetProxy = D0A1CC221A5CDE06005FC2BE /* PBXContainerItemProxy */; + target = D0772F071B3C437800031FB9 /* Harbor */; + targetProxy = D0772F1B1B3C437800031FB9 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ -/* Begin PBXVariantGroup section */ - D0610E2C1A0C952E0056B8A3 /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - D0610E2D1A0C952E0056B8A3 /* Base */, - ); - name = MainMenu.xib; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - /* Begin XCBuildConfiguration section */ - D0610E3B1A0C952E0056B8A3 /* Debug */ = { + 10FA20181C97834C00A642A7 /* Test */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "TESTING=1", + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + OTHER_SWIFT_FLAGS = "-DTEST -DDEBUG"; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Test; + }; + 10FA20191C97834C00A642A7 /* Test */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C0CEA4AAFB6873D19A822129 /* Pods-Harbor.test.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = Harbor/Harbor.entitlements; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; + INFOPLIST_FILE = Harbor/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited)"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + PRODUCT_BUNDLE_IDENTIFIER = com.dvm.Harbor; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = NO; + }; + name = Test; + }; + 10FA201A1C97834C00A642A7 /* Test */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 39CFCBB97ED57DD01D949C73 /* Pods-Harbor-HarborTests.test.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = HarborTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -DTEST"; + PRODUCT_BUNDLE_IDENTIFIER = com.dvm.HarborTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Harbor.app/Contents/MacOS/Harbor"; + }; + name = Test; + }; + D0772F2C1B3C437800031FB9 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -413,15 +933,18 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( + "TESTING=1", "DEBUG=1", "$(inherited)", ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -431,13 +954,13 @@ MACOSX_DEPLOYMENT_TARGET = 10.10; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ""; + OTHER_SWIFT_FLAGS = "-DDEBUG"; SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; - D0610E3C1A0C952E0056B8A3 /* Release */ = { + D0772F2D1B3C437800031FB9 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -455,11 +978,12 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "-"; - COPY_PHASE_STRIP = YES; + COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -468,75 +992,71 @@ GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.10; MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ""; + OTHER_SWIFT_FLAGS = ""; SDKROOT = macosx; }; name = Release; }; - D0610E3E1A0C952E0056B8A3 /* Debug */ = { + D0772F2F1B3C437800031FB9 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 5D9CECB5F6F368D2C4628413 /* Pods-Harbor.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = ""; - "CODE_SIGN_IDENTITY[sdk=macosx10.10]" = ""; + CODE_SIGN_ENTITLEMENTS = Harbor/Harbor.entitlements; COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = Harbor/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - PRODUCT_NAME = Harbor; - PROVISIONING_PROFILE = ""; + LD_RUNPATH_SEARCH_PATHS = "$(inherited)"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + PRODUCT_BUNDLE_IDENTIFIER = com.dvm.Harbor; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = NO; }; name = Debug; }; - D0610E3F1A0C952E0056B8A3 /* Release */ = { + D0772F301B3C437800031FB9 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 9F06F0036A0C8CA9A3D11BA6 /* Pods-Harbor.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = ""; - "CODE_SIGN_IDENTITY[sdk=macosx10.10]" = ""; + CODE_SIGN_ENTITLEMENTS = Harbor/Harbor.entitlements; COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = Harbor/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - PRODUCT_NAME = Harbor; - PROVISIONING_PROFILE = ""; + LD_RUNPATH_SEARCH_PATHS = "$(inherited)"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + PRODUCT_BUNDLE_IDENTIFIER = com.dvm.Harbor; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = NO; }; name = Release; }; - D0610E411A0C952E0056B8A3 /* Debug */ = { + D0772F321B3C437800031FB9 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = D263D9B112452CA339017421 /* Pods-Harbor-HarborTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); INFOPLIST_FILE = HarborTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - PRODUCT_NAME = HarborTests; + OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -DTEST"; + PRODUCT_BUNDLE_IDENTIFIER = com.dvm.HarborTests; + PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Harbor.app/Contents/MacOS/Harbor"; }; name = Debug; }; - D0610E421A0C952E0056B8A3 /* Release */ = { + D0772F331B3C437800031FB9 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 6A44CEAA7EBDF79EBEA74B01 /* Pods-Harbor-HarborTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); INFOPLIST_FILE = HarborTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - PRODUCT_NAME = HarborTests; + OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -DTEST"; + PRODUCT_BUNDLE_IDENTIFIER = com.dvm.HarborTests; + PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Harbor.app/Contents/MacOS/Harbor"; }; name = Release; @@ -544,29 +1064,32 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - D0610E1B1A0C952E0056B8A3 /* Build configuration list for PBXProject "Harbor" */ = { + D0772F031B3C437800031FB9 /* Build configuration list for PBXProject "Harbor" */ = { isa = XCConfigurationList; buildConfigurations = ( - D0610E3B1A0C952E0056B8A3 /* Debug */, - D0610E3C1A0C952E0056B8A3 /* Release */, + D0772F2C1B3C437800031FB9 /* Debug */, + 10FA20181C97834C00A642A7 /* Test */, + D0772F2D1B3C437800031FB9 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - D0610E3D1A0C952E0056B8A3 /* Build configuration list for PBXNativeTarget "Harbor" */ = { + D0772F2E1B3C437800031FB9 /* Build configuration list for PBXNativeTarget "Harbor" */ = { isa = XCConfigurationList; buildConfigurations = ( - D0610E3E1A0C952E0056B8A3 /* Debug */, - D0610E3F1A0C952E0056B8A3 /* Release */, + D0772F2F1B3C437800031FB9 /* Debug */, + 10FA20191C97834C00A642A7 /* Test */, + D0772F301B3C437800031FB9 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - D0610E401A0C952E0056B8A3 /* Build configuration list for PBXNativeTarget "HarborTests" */ = { + D0772F311B3C437800031FB9 /* Build configuration list for PBXNativeTarget "HarborTests" */ = { isa = XCConfigurationList; buildConfigurations = ( - D0610E411A0C952E0056B8A3 /* Debug */, - D0610E421A0C952E0056B8A3 /* Release */, + D0772F321B3C437800031FB9 /* Debug */, + 10FA201A1C97834C00A642A7 /* Test */, + D0772F331B3C437800031FB9 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -574,17 +1097,17 @@ /* End XCConfigurationList section */ /* Begin XCVersionGroup section */ - D0A1CC3D1A5D8CDB005FC2BE /* Harbor.xcdatamodeld */ = { + D0772F0D1B3C437800031FB9 /* Harbor.xcdatamodeld */ = { isa = XCVersionGroup; children = ( - D0A1CC3E1A5D8CDB005FC2BE /* Harbor.xcdatamodel */, + D0772F0E1B3C437800031FB9 /* Harbor.xcdatamodel */, ); - currentVersion = D0A1CC3E1A5D8CDB005FC2BE /* Harbor.xcdatamodel */; + currentVersion = D0772F0E1B3C437800031FB9 /* Harbor.xcdatamodel */; path = Harbor.xcdatamodeld; sourceTree = ""; versionGroupType = wrapper.xcdatamodel; }; /* End XCVersionGroup section */ }; - rootObject = D0610E181A0C952E0056B8A3 /* Project object */; + rootObject = D0772F001B3C437800031FB9 /* Project object */; } diff --git a/Harbor.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Harbor.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index ec2e40d..0000000 --- a/Harbor.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Harbor.xcodeproj/project.xcworkspace/xcshareddata/Harbor.xccheckout b/Harbor.xcodeproj/project.xcworkspace/xcshareddata/Harbor.xccheckout deleted file mode 100644 index 63cbb98..0000000 --- a/Harbor.xcodeproj/project.xcworkspace/xcshareddata/Harbor.xccheckout +++ /dev/null @@ -1,41 +0,0 @@ - - - - - IDESourceControlProjectFavoriteDictionaryKey - - IDESourceControlProjectIdentifier - 94941523-098D-40CD-8F6C-A4519279E1CA - IDESourceControlProjectName - Harbor - IDESourceControlProjectOriginsDictionary - - 6CE47EAE52B57371B61AB99B723F18899AD99FD4 - github.com:devmynd/harbor.git - - IDESourceControlProjectPath - Harbor.xcodeproj - IDESourceControlProjectRelativeInstallPathDictionary - - 6CE47EAE52B57371B61AB99B723F18899AD99FD4 - ../.. - - IDESourceControlProjectURL - github.com:devmynd/harbor.git - IDESourceControlProjectVersion - 111 - IDESourceControlProjectWCCIdentifier - 6CE47EAE52B57371B61AB99B723F18899AD99FD4 - IDESourceControlProjectWCConfigurations - - - IDESourceControlRepositoryExtensionIdentifierKey - public.vcs.git - IDESourceControlWCCIdentifierKey - 6CE47EAE52B57371B61AB99B723F18899AD99FD4 - IDESourceControlWCCName - Harbor - - - - diff --git a/Harbor.xcodeproj/project.xcworkspace/xcshareddata/Harbor2.xccheckout b/Harbor.xcodeproj/project.xcworkspace/xcshareddata/Harbor2.xccheckout deleted file mode 100644 index 8d40aea..0000000 --- a/Harbor.xcodeproj/project.xcworkspace/xcshareddata/Harbor2.xccheckout +++ /dev/null @@ -1,41 +0,0 @@ - - - - - IDESourceControlProjectFavoriteDictionaryKey - - IDESourceControlProjectIdentifier - B7D8EFE7-FB02-4603-8C7B-0AB6D5EFCCA5 - IDESourceControlProjectName - Harbor2 - IDESourceControlProjectOriginsDictionary - - 6CE47EAE52B57371B61AB99B723F18899AD99FD4 - github.com:devmynd/harbor.git - - IDESourceControlProjectPath - Harbor2.xcodeproj - IDESourceControlProjectRelativeInstallPathDictionary - - 6CE47EAE52B57371B61AB99B723F18899AD99FD4 - ../.. - - IDESourceControlProjectURL - github.com:devmynd/harbor.git - IDESourceControlProjectVersion - 111 - IDESourceControlProjectWCCIdentifier - 6CE47EAE52B57371B61AB99B723F18899AD99FD4 - IDESourceControlProjectWCConfigurations - - - IDESourceControlRepositoryExtensionIdentifierKey - public.vcs.git - IDESourceControlWCCIdentifierKey - 6CE47EAE52B57371B61AB99B723F18899AD99FD4 - IDESourceControlWCCName - Harbor - - - - diff --git a/Harbor.xcodeproj/xcuserdata/erinhochstatter.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Harbor.xcodeproj/xcuserdata/erinhochstatter.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index fe2b454..0000000 --- a/Harbor.xcodeproj/xcuserdata/erinhochstatter.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/Harbor.xcodeproj/xcuserdata/erinhochstatter.xcuserdatad/xcschemes/Harbor.xcscheme b/Harbor.xcodeproj/xcuserdata/erinhochstatter.xcuserdatad/xcschemes/Harbor.xcscheme deleted file mode 100644 index 0c6f339..0000000 --- a/Harbor.xcodeproj/xcuserdata/erinhochstatter.xcuserdatad/xcschemes/Harbor.xcscheme +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Harbor.xcodeproj/xcuserdata/erinhochstatter.xcuserdatad/xcschemes/xcschememanagement.plist b/Harbor.xcodeproj/xcuserdata/erinhochstatter.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 07063e7..0000000 --- a/Harbor.xcodeproj/xcuserdata/erinhochstatter.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,27 +0,0 @@ - - - - - SchemeUserState - - Harbor.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - D0610E1F1A0C952E0056B8A3 - - primary - - - D0610E321A0C952E0056B8A3 - - primary - - - - - diff --git a/Harbor.xcworkspace/contents.xcworkspacedata b/Harbor.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..eb4de27 --- /dev/null +++ b/Harbor.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Harbor.xcworkspace/xcshareddata/Harbor.xcscmblueprint b/Harbor.xcworkspace/xcshareddata/Harbor.xcscmblueprint new file mode 100644 index 0000000..3dd2b64 --- /dev/null +++ b/Harbor.xcworkspace/xcshareddata/Harbor.xcscmblueprint @@ -0,0 +1,30 @@ +{ + "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "6CE47EAE52B57371B61AB99B723F18899AD99FD4", + "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { + + }, + "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { + "E42085E796FF8DBAE442FD4D0A31934D03C74DEE" : 0, + "6CE47EAE52B57371B61AB99B723F18899AD99FD4" : 0 + }, + "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "190B933B-84F0-4E21-83F3-2D28D1D744AD", + "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { + "E42085E796FF8DBAE442FD4D0A31934D03C74DEE" : "..\/drip\/Drip", + "6CE47EAE52B57371B61AB99B723F18899AD99FD4" : "repo\/" + }, + "DVTSourceControlWorkspaceBlueprintNameKey" : "Harbor", + "DVTSourceControlWorkspaceBlueprintVersion" : 204, + "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Harbor.xcworkspace", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:devmynd\/harbor.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "6CE47EAE52B57371B61AB99B723F18899AD99FD4" + }, + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:devmynd\/drip.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "E42085E796FF8DBAE442FD4D0A31934D03C74DEE" + } + ] +} \ No newline at end of file diff --git a/Harbor/Account.swift b/Harbor/Account.swift deleted file mode 100644 index 8526acc..0000000 --- a/Harbor/Account.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// Account.swift -// Harbor -// -// Created by Erin Hochstatter on 8/13/14. -// Copyright (c) 2014 devMynd. All rights reserved. -// - -import Foundation -class Account : NSObject{ - var key: String? - var projects: [Project] = [] - - override init(){ - print("made an account") - super.init() - } - - func currentProjects() -> [Project] { - - return projects - } -} \ No newline at end of file diff --git a/Harbor/AppDelegate.swift b/Harbor/AppDelegate.swift index 6394105..63ec4a1 100644 --- a/Harbor/AppDelegate.swift +++ b/Harbor/AppDelegate.swift @@ -1,366 +1,63 @@ -// -// AppDelegate.swift -// Harbor -// -// Created by Erin Hochstatter on 11/6/14. -// Copyright (c) 2014 ekh. All rights reserved. -// import Cocoa @NSApplicationMain -class AppDelegate: NSObject, NSApplicationDelegate { - - var preferencesPaneWindow: PreferencesPaneWindow? - var statusView: StatusView? - var projectList: [Project]? - let currentRunLoop: NSRunLoop = NSRunLoop.currentRunLoop() - - func applicationDidFinishLaunching(aNotification: NSNotification) { - - self.fetchApiKeys { (projects) -> () in - print(projects.count) - } - - preferencesPaneWindow = PreferencesPaneWindow(windowNibName: "PreferencesPaneWindow") - preferencesPaneWindow?.prefManagedObjectContext = self.managedObjectContext! - print(self.managedObjectContext!) - statusView = StatusView() - fetchRefreshRate() - } - - func showPopover(sender: AnyObject) { - let popoverViewController = PopoverViewController(nibName: "Popover", bundle: nil) - statusView!.showPopoverWithViewController(popoverViewController!) - } - - func hidePopover(sender: AnyObject) { - statusView!.hidePopover() - } - - func applicationWillTerminate(aNotification: NSNotification) { - // Insert code here to tear down your application - } - - // MARK: CoreData Fetch - func fetchRefreshRate() { - let request: NSFetchRequest = NSFetchRequest(entityName: "DMAccount") - request.sortDescriptors = [NSSortDescriptor(key: "accountDescription", ascending: true)] - - do { - let account = try managedObjectContext!.executeFetchRequest(request).first as? DMAccount - if let refreshRate = account?.refreshRate { - setupTimer((refreshRate as NSString).doubleValue) - } else { - setupTimer(120) - } - } catch let error as NSError { - print(error) - } - } - - func setupTimer(refreshRate: Double) { - - - let timer = NSTimer(timeInterval: refreshRate, target: self, selector:"updateData", userInfo: nil, repeats: true) - currentRunLoop.addTimer(timer, forMode: NSDefaultRunLoopMode) - - print("refresh rate: \(refreshRate)") - } - - func updateData(){ - fetchApiKeys { (projects) -> () in - self.statusView!.updateUI() - print("updateData completion block") - } - } - - func fetchApiKeys(completionClosure: (projects: [Project]) -> ()) { - - let request: NSFetchRequest = NSFetchRequest(entityName: "DMAccount") - request.sortDescriptors = [NSSortDescriptor(key: "accountDescription", ascending: true)] - - var errorPointer: NSErrorPointer = NSErrorPointer() - - var projectArray: [Project] = [] - - if let fetchResults = managedObjectContext!.executeFetchRequest(request) as? [DMAccount] { - for account in fetchResults { - - self.retrieveProjectsForAccount(account, completionClosure: { (projects) -> () in - projectArray += projects - completionClosure(projects: projectArray) - }) - print("apiKey: \(account.apiKey)") - } - } else { - print("fetch error on Popover for apiKey") - } - } - - func fetchProjectsWithID(id: String) -> [DMProject] { - - let request: NSFetchRequest = NSFetchRequest(entityName: "DMProject") - let projectIdPredicate = NSPredicate(format: "id == %@", id) - request.predicate = projectIdPredicate - - let sortDescriptor: NSSortDescriptor = NSSortDescriptor(key: "repositoryName", ascending: true) - request.sortDescriptors = [sortDescriptor] - - var errorPointer: NSErrorPointer = NSErrorPointer() - - let fetchResults = managedObjectContext!.executeFetchRequest(request) as? [DMProject] - - return fetchResults! - - } - - func processProject (hash: AnyObject, account: DMAccount) { - let project = Project() - project.id = Int(hash.objectForKey("id") as! NSNumber) - project.repositoryName = (hash.objectForKey("repository_name") as! String) - let dmProjectFetchResults = self.fetchProjectsWithID("\(project.id!)") - - if dmProjectFetchResults.count == 0 { - project.active = true; - - let dmProject: DMProject = NSEntityDescription.insertNewObjectForEntityForName("DMProject", inManagedObjectContext: self.managedObjectContext!) as! DMProject - - dmProject.id = "\(project.id!)" - dmProject.repositoryName = project.repositoryName! - dmProject.account = account - dmProject.active = true - let errorPointer: NSErrorPointer = NSErrorPointer() - - do { - try self.managedObjectContext?.save() - } catch var error as NSError { - errorPointer.memory = error - } - - } else if dmProjectFetchResults.count == 1 { - - project.active = dmProjectFetchResults.first?.active.boolValue - - } else { - print("more than one project with ID: \(project.id!)") - } - - let projectBuildJson: Array = hash.objectForKey("builds") as! Array -  - for buildHash in projectBuildJson { - - let build = Build() - build.id = Int(buildHash.objectForKey("id") as! NSNumber) - build.uuid = (buildHash.objectForKey("uuid") as! String) - build.status = (buildHash.objectForKey("status") as! String) - build.commitId = (buildHash.objectForKey("commit_id") as! String) - build.message = (buildHash.objectForKey("message") as! String) - build.branch = (buildHash.objectForKey("branch") as! String) - - project.builds.append(build) - } - - if project.active == true { - self.projectList?.append(project) - - if project.builds.first!.status == "testing"{ - print("\(project.repositoryName!) & \(project.builds.first!.status!)") - self.statusView?.hasPendingBuild = false - - } else if project.builds.first!.status != "success" { - print("\(project.repositoryName!) & \(project.builds.first!.status!)") - self.statusView!.hasFailedBuild = true - } - } - } - - - - - func retrieveProjectsForAccount(account: DMAccount, completionClosure: (projects: [Project]) -> ()){ - - let urlWithKey = "https://www.codeship.io/api/v1/projects.json?api_key=" + account.apiKey - let urlRequest: NSURLRequest = NSURLRequest(URL: NSURL(string:urlWithKey)!); - - NSURLConnection.sendAsynchronousRequest(urlRequest, queue: NSOperationQueue.mainQueue()) { (urlResponse, data, error) -> Void in - - let responseDictionary: NSDictionary = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.AllowFragments) as! NSDictionary - self.projectList = [] - - let projectsArray: Array = responseDictionary.objectForKey("projects") as!Array - - self.statusView?.hasFailedBuild = false - self.statusView?.hasPendingBuild = false - - for hash in projectsArray { - if let repository_name = hash.objectForKey("repository_name") as? String { - self.processProject(hash, account: account) - } - } - self.statusView!.updateUI() - completionClosure(projects: self.projectList!) - - } - } - - // MARK: - Core Data stack - - lazy var applicationDocumentsDirectory: NSURL = { - // The directory the application uses to store the Core Data store file. This code uses a directory named "ekh.Harbor" in the user's Application Support directory. - let urls = NSFileManager.defaultManager().URLsForDirectory(.ApplicationSupportDirectory, inDomains: .UserDomainMask) - let appSupportURL = urls[urls.count - 1] as NSURL - return appSupportURL.URLByAppendingPathComponent("dvm.Harbor") - }() - - lazy var managedObjectModel: NSManagedObjectModel = { - // The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model. - let modelURL = NSBundle.mainBundle().URLForResource("Harbor", withExtension: "momd")! - return NSManagedObjectModel(contentsOfURL: modelURL)! - }() - - lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator? = { - // The persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. (The directory for the store is created, if necessary.) This property is optional since there are legitimate error conditions that could cause the creation of the store to fail. - let fileManager = NSFileManager.defaultManager() - var shouldFail = false - var error: NSError? = nil - var failureReason = "There was an error creating or loading the application's saved data." - - // Make sure the application files directory is there - let propertiesOpt: [NSObject: AnyObject]? - do { - propertiesOpt = try self.applicationDocumentsDirectory.resourceValuesForKeys([NSURLIsDirectoryKey]) - } catch var error1 as NSError { - error = error1 - propertiesOpt = nil - } catch { - fatalError() - } - if let properties = propertiesOpt { - if !properties[NSURLIsDirectoryKey]!.boolValue { - failureReason = "Expected a folder to store application data, found a file \(self.applicationDocumentsDirectory.path)." - shouldFail = true - } - } else if error!.code == NSFileReadNoSuchFileError { - error = nil - do { - dtry fileManager.createDirectoryAtPath(self.applicationDocumentsDirectory.path!, withIntermediateDirectories: true, attributes: nil) - } catch var error1 as NSError { - error = error1 - } catch { - fatalError() - } - } - - // Create the coordinator and store - var coordinator: NSPersistentStoreCoordinator? - if !shouldFail && (error == nil) { - coordinator = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel) - let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("Harbor.storedata") - do { - try coordinator!.addPersistentStoreWithType(NSXMLStoreType, configuration: nil, URL: url, options: nil) - } catch var error1 as NSError { - error = error1 - coordinator = nil - } catch { - fatalError() - } - } - - if shouldFail || (error != nil) { - // Report any error we got. - let dict = NSMutableDictionary() - dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data" - dict[NSLocalizedFailureReasonErrorKey] = failureReason - if error != nil { - dict[NSUnderlyingErrorKey] = error - } - error = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict as [NSObject : AnyObject]) - NSApplication.sharedApplication().presentError(error!) - return nil - } else { - return coordinator - } - }() - - lazy var managedObjectContext: NSManagedObjectContext? = { - // Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail. - let coordinator = self.persistentStoreCoordinator - if coordinator == nil { - return nil - } - var managedObjectContext = NSManagedObjectContext() - managedObjectContext.persistentStoreCoordinator = coordinator - return managedObjectContext - }() - - // MARK: - Core Data Saving and Undo support - - @IBAction func saveAction(sender: AnyObject!) { - // Performs the save action for the application, which is to send the save: message to the application's managed object context. Any encountered errors are presented to the user. - if let moc = self.managedObjectContext { - if !moc.commitEditing() { - NSLog("\(NSStringFromClass(self.dynamicType)) unable to commit editing before saving") - } - var error: NSError? = nil - if moc.hasChanges && !moc.save() { - NSApplication.sharedApplication().presentError(error!) - } - } - } - - func windowWillReturnUndoManager(window: NSWindow) -> NSUndoManager? { - // Returns the NSUndoManager for the application. In this case, the manager returned is that of the managed object context for the application. - if let moc = self.managedObjectContext { - return moc.undoManager - } else { - return nil - } +class AppDelegate: NSObject, NSApplicationDelegate, StatusMenuDelegate { + // + // MARK: Dependencies + var component: AppComponent { return Application.component() } + + private lazy var settings: Settings = self.component.interactor.inject() + private lazy var projectsInteractor: ProjectsInteractor = self.component.interactor.inject() + private lazy var timerCoordinator: TimerCoordinator = self.component.interactor.inject() + + // + // MARK: Interface Elements + @IBOutlet weak var statusItemMenu: StatusMenu! + var preferencesWindowController: PreferencesPaneWindowController! + + // + // MARK: NSApplicationDelegate + func applicationDidFinishLaunching(aNotification: NSNotification) { + if Environment.active == .Testing { + return } - - func applicationShouldTerminate(sender: NSApplication) -> NSApplicationTerminateReply { - // Save changes in the application's managed object context before the application terminates. - - if let moc = managedObjectContext { - if !moc.commitEditing() { - NSLog("\(NSStringFromClass(self.dynamicType)) unable to commit editing to terminate") - return .TerminateCancel - } - - if !moc.hasChanges { - return .TerminateNow - } - - var error: NSError? = nil - do { - try moc.save() - } catch var error1 as NSError { - error = error1 - // Customize this code block to include application-specific recovery steps. - let result = sender.presentError(error!) - if (result) { - return .TerminateCancel - } - - let question = NSLocalizedString("Could not save changes while quitting. Quit anyway?", comment: "Quit without saves error question message") - let info = NSLocalizedString("Quitting now will lose any changes you have made since the last successful save", comment: "Quit without saves error question info"); - let quitButton = NSLocalizedString("Quit anyway", comment: "Quit anyway button title") - let cancelButton = NSLocalizedString("Cancel", comment: "Cancel button title") - let alert = NSAlert() - alert.messageText = question - alert.informativeText = info - alert.addButtonWithTitle(quitButton) - alert.addButtonWithTitle(cancelButton) - - let answer = alert.runModal() - if answer == NSAlertFirstButtonReturn { - return .TerminateCancel - } - } - } - // If we got here, it is time to quit. - return .TerminateNow + + preferencesWindowController = PreferencesPaneWindowController(windowNibName: "PreferencesPaneWindowController") + statusItemMenu.statusMenuDelegate = self + + // run startup logic + startup() + } + + // + // MARK: Startup + private func startup() { + settings.startup() + timerCoordinator.startup() + + refreshProjects() + } + + private func refreshProjects() { + if !settings.apiKey.isEmpty { + projectsInteractor.refreshProjects() + } else { + showPreferencesPane() } - -} + } + // + // MARK: StatusMenuDelegate + func statusMenuDidSelectPreferences(statusMenu: StatusMenu) { + showPreferencesPane() + } + + private func showPreferencesPane() { + preferencesWindowController.window?.center() + preferencesWindowController.window?.orderFront(self) + + // Show your window in front of all other apps + NSApp.activateIgnoringOtherApps(true) + } +} diff --git a/Harbor/Application.swift b/Harbor/Application.swift new file mode 100644 index 0000000..98490f8 --- /dev/null +++ b/Harbor/Application.swift @@ -0,0 +1,15 @@ + +import AppKit + +@objc(Application) +class Application: NSApplication { + // MARK: Dependencies + private let _component = AppComponent() + .module { InteractorModule($0) } + .module { ServiceModule($0) } + .module { SystemModule($0) } + + class func component() -> AppComponent { + return (NSApp as! Application)._component + } +} diff --git a/Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo128.png b/Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo128.png similarity index 100% rename from Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo128.png rename to Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo128.png diff --git a/Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo16.png b/Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo16.png similarity index 100% rename from Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo16.png rename to Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo16.png diff --git a/Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo256-1.png b/Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo256-1.png similarity index 100% rename from Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo256-1.png rename to Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo256-1.png diff --git a/Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo256.png b/Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo256.png similarity index 100% rename from Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo256.png rename to Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo256.png diff --git a/Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo32-1.png b/Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo32-1.png similarity index 100% rename from Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo32-1.png rename to Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo32-1.png diff --git a/Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo32.png b/Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo32.png similarity index 100% rename from Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo32.png rename to Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo32.png diff --git a/Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo512.png b/Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo512-1.png similarity index 100% rename from Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo512.png rename to Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo512-1.png diff --git a/Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo512.png b/Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo512.png new file mode 100644 index 0000000..8a9d832 Binary files /dev/null and b/Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo512.png differ diff --git a/Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo64.png b/Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo64.png similarity index 100% rename from Harbor/Images.xcassets/AppIcon.appiconset/:Harbor_logo64.png rename to Harbor/Assets.xcassets/AppIcon.appiconset/:Harbor_logo64.png diff --git a/Harbor/Images.xcassets/AppIcon.appiconset/Contents.json b/Harbor/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 96% rename from Harbor/Images.xcassets/AppIcon.appiconset/Contents.json rename to Harbor/Assets.xcassets/AppIcon.appiconset/Contents.json index 20f5b0b..51dde60 100644 --- a/Harbor/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Harbor/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -49,8 +49,9 @@ "scale" : "2x" }, { - "idiom" : "mac", "size" : "512x512", + "idiom" : "mac", + "filename" : ":Harbor_logo512-1.png", "scale" : "1x" }, { diff --git a/Harbor/Build.swift b/Harbor/Build.swift index 1085bea..0525c1f 100644 --- a/Harbor/Build.swift +++ b/Harbor/Build.swift @@ -1,43 +1,56 @@ -// -// Build.swift -// Harbor -// -// Created by Erin Hochstatter on 8/13/14. -// Copyright (c) 2014 devMynd. All rights reserved. -// - import Foundation -class Build : NSObject{ - var id: Int? - var uuid: String? - var status: String? - var commitId: String? - var message: String? - var branch: String? - var date: NSDate? - - override init(){ - super.init() + +final class Build: ResponseObjectSerializable, ResponseCollectionSerializable { + var id: Int? + var uuid: String? + var projectID: Int? + var status: String? + var gitHubUsername: String? + var commitID: String? + var message: String? + var branch: String? + var startedAt: NSDate? + var finishedAt: NSDate? + var codeshipLinkString: String? + + init?(response: NSHTTPURLResponse, representation: AnyObject){ + self.id = representation.valueForKeyPath("id") as? Int + self.uuid = representation.valueForKeyPath("uuid") as? String + self.projectID = representation.valueForKeyPath("project_id") as? Int + self.status = representation.valueForKeyPath("status") as? String + self.gitHubUsername = representation.valueForKeyPath("github_username") as? String + self.commitID = representation.valueForKeyPath("commit_id") as? String + self.message = representation.valueForKeyPath("message") as? String + self.branch = representation.valueForKeyPath("branch") as? String + self.startedAt = self.convertDateFromString(representation.valueForKeyPath("started_at") as? String) + if let finishedAtString = representation.valueForKeyPath("finished_at") as? String{ + self.finishedAt = self.convertDateFromString(finishedAtString) } - - init(id: Int, - uuid: String, - status: String, - commitId: String, - message: String, - branch: String - ){ - self.id = id - self.uuid = uuid - self.status = status - self.commitId = commitId - self.message = message - self.branch = branch - - super.init() + } + + static func collection(response response: NSHTTPURLResponse, representation: AnyObject) -> [Build] { + var builds: [Build] = [] + + if let representation = representation.valueForKeyPath("builds") as? [[String: AnyObject]] { + for buildRepresentation in representation { + if let build = Build(response: response, representation: buildRepresentation) { + builds.append(build) + } + } } - - func generateDate() -> NSDate { - return NSDate() + return builds + } + + func convertDateFromString(aString: String?) -> NSDate{ + let dateFormatter = NSDateFormatter(); + dateFormatter.dateFormat = "YYYY-MM-dd'T'HH:mm:ss.SSSZ" + + var date : String + if let dateString = aString { + date = dateString + } else { + date = "" } + return dateFormatter.dateFromString(date)! + } } \ No newline at end of file diff --git a/Harbor/BuildStatus.swift b/Harbor/BuildStatus.swift new file mode 100644 index 0000000..83baaed --- /dev/null +++ b/Harbor/BuildStatus.swift @@ -0,0 +1,17 @@ +import Cocoa + +enum BuildStatus : String { + case Unknown = "codeshipLogo_black" + case Passing = "codeshipLogo_green" + case Failing = "codeshipLogo_red" +} + +extension BuildStatus { + func icon() -> NSImage { + let image = NSImage(named: self.rawValue)! + // allows black icon to work with light & dark menubars + image.template = self == .Unknown + + return image + } +} \ No newline at end of file diff --git a/Harbor/BuildView.swift b/Harbor/BuildView.swift new file mode 100644 index 0000000..bcf02b4 --- /dev/null +++ b/Harbor/BuildView.swift @@ -0,0 +1,68 @@ +import Cocoa + +class BuildView: NSView { + private var model: BuildViewModel! + + @IBOutlet var view: NSView! + @IBOutlet weak var buildMessageLabel: NSTextField! + @IBOutlet weak var dateAndUsernameLabel: NSTextField! + + convenience init(model: BuildViewModel) { + self.init(frame: NSRect(x: 0, y: 0, width: 300, height: 53)) + + self.model = model + self.buildMessageLabel.stringValue = model.message + self.dateAndUsernameLabel.stringValue = model.authorshipInformation() + } + + func didClickBuild(sender: NSMenuItem) { + self.model.openBuildUrl() + } + + override init(frame frameRect: NSRect) { + super.init(frame: frameRect) + + NSBundle.mainBundle().loadNibNamed("BuildView", owner: self, topLevelObjects: nil) + let contentFrame = NSRect(x: 0, y: 0, width: frame.width, height: frame.height) + self.view.frame = contentFrame + self.addSubview(self.view) + } + + required init?(coder: NSCoder) { + super.init(coder: coder) + } + + // enables highlighting of view on mouseover + override func drawRect(dirtyRect: NSRect) { + let menuItem = self.enclosingMenuItem + if menuItem?.highlighted == true { + NSColor.blueColor().set() + NSBezierPath.fillRect(dirtyRect) + } else { + super.drawRect(dirtyRect) + } + } + + // enables selecting view on mouseup + override func mouseUp(theEvent: NSEvent) { + let menuItem = self.enclosingMenuItem + let menu = menuItem?.menu + menu?.cancelTracking() + + let menuItemIndex = menu?.indexOfItem(menuItem!) + menu?.performActionForItemAtIndex(menuItemIndex!) + debugPrint(menu!.delegate) + } +} + +extension BuildView { + class func menuItemForModel(model: BuildViewModel) -> NSMenuItem { + let result = NSMenuItem(title: model.message, action: #selector(BuildView.didClickBuild(_:)), keyEquivalent: "") + result.representedObject = model.build + + result.view = BuildView(model: model) + result.target = result.view + + return result + } +} \ No newline at end of file diff --git a/Harbor/BuildView.xib b/Harbor/BuildView.xib new file mode 100644 index 0000000..c12767e --- /dev/null +++ b/Harbor/BuildView.xib @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Harbor/BuildViewModel.swift b/Harbor/BuildViewModel.swift new file mode 100644 index 0000000..98911c0 --- /dev/null +++ b/Harbor/BuildViewModel.swift @@ -0,0 +1,56 @@ +import Cocoa + +struct BuildViewModel { + let build: Build + let projectId: Int + + init(build: Build, projectId: Int) { + self.build = build + self.projectId = projectId + } + + // + // MARK: display + // + + var message: String { + get { return self.build.message != nil ? self.build.message! : "Unknown" } + } + + var buildUrl: String { + get { return "https://codeship.com/projects/\(projectId)/builds/\(build.id!)" } + } + + func authorshipInformation() -> String { + let dateString = self.dateString() + + if let name = self.build.gitHubUsername { + return "By \(name) at \(dateString)" + } else { + return "Started at \(dateString)" + } + } + + private func dateString() -> String { + guard let date = self.build.startedAt else { + return "Unknown Date" + } + + // TODO: date formatters are expensive (on iOS at least) so it might be worth + // caching this + let dateFormatter = NSDateFormatter() + dateFormatter.dateFormat = "MM/dd/YY 'at' hh:mm a" + return dateFormatter.stringFromDate(date) + } + + // + // MARK: Actions + // + + func openBuildUrl() { + let buildURL = NSURL(string: self.buildUrl)! + let workspace = NSWorkspace.sharedWorkspace() + + workspace.openURL(buildURL) + } +} \ No newline at end of file diff --git a/Harbor/CodeshipApi.swift b/Harbor/CodeshipApi.swift new file mode 100644 index 0000000..3d6c732 --- /dev/null +++ b/Harbor/CodeshipApi.swift @@ -0,0 +1,30 @@ +import Alamofire + +protocol CodeshipApiType { + func getProjects(successHandler: ([Project]) -> (), errorHandler: (String)->()) +} + +class CodeshipApi : CodeshipApiType { + static let apiRootPath = "https://codeship.com/api/v1/projects.json?api_key=" + + private let settings: Settings + + init(settings: Settings) { + self.settings = settings + } + + func getProjects(successHandler: ([Project]) -> (), errorHandler: (String)->()){ + let apiKey = settings.apiKey + let apiURL = "\(CodeshipApi.apiRootPath)\(apiKey)" + + Alamofire.request(.GET, apiURL).responseCollection{(response: Response<[Project], NSError> ) in + if(response.result.isSuccess) { + successHandler(response.result.value!) + } else { + //log the error + debugPrint(response.result) + errorHandler("Error!") + } + } + } +} \ No newline at end of file diff --git a/Harbor/Collections.swift b/Harbor/Collections.swift new file mode 100644 index 0000000..47bddd1 --- /dev/null +++ b/Harbor/Collections.swift @@ -0,0 +1,11 @@ +extension SequenceType { + func any(predicate: (Generator.Element) -> Bool) -> Bool { + for element in self { + if(predicate(element)) { + return true + } + } + + return false + } +} \ No newline at end of file diff --git a/Harbor/DMAccount.swift b/Harbor/DMAccount.swift deleted file mode 100644 index 54bd798..0000000 --- a/Harbor/DMAccount.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// DMAccount.swift -// Harbor -// -// Created by Erin Hochstatter on 1/7/15. -// Copyright (c) 2015 dvm. All rights reserved. -// - -import Foundation -import CoreData - -class DMAccount: NSManagedObject { - - @NSManaged var accountDescription: String - @NSManaged var apiKey: String - @NSManaged var refreshRate: String? - @NSManaged var projects: NSSet - -} diff --git a/Harbor/DMBuild.swift b/Harbor/DMBuild.swift deleted file mode 100644 index fce27c6..0000000 --- a/Harbor/DMBuild.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// DMBuild.swift -// Harbor -// -// Created by Erin Hochstatter on 1/7/15. -// Copyright (c) 2015 dvm. All rights reserved. -// - -import Foundation -import CoreData - -class DMBuild: NSManagedObject { - - @NSManaged var project: DMProject - -} diff --git a/Harbor/DMProject.swift b/Harbor/DMProject.swift deleted file mode 100644 index d6e0423..0000000 --- a/Harbor/DMProject.swift +++ /dev/null @@ -1,20 +0,0 @@ -// -// DMProject.swift -// Harbor -// -// Created by Erin Hochstatter on 1/7/15. -// Copyright (c) 2015 dvm. All rights reserved. -// - -import Foundation -import CoreData - -class DMProject: NSManagedObject { - - @NSManaged var active: NSNumber - @NSManaged var id: String - @NSManaged var repositoryName: String - @NSManaged var account: DMAccount - @NSManaged var builds: NSSet - -} diff --git a/Harbor/Environment.swift b/Harbor/Environment.swift new file mode 100644 index 0000000..6e1b0f0 --- /dev/null +++ b/Harbor/Environment.swift @@ -0,0 +1,15 @@ +enum Environment { + case Debug + case Release + case Testing + + static var active: Environment { + #if TEST + return .Testing + #elseif DEBUG + return .Debug + #else + return .Release + #endif + } +} \ No newline at end of file diff --git a/Harbor/Fonts/Bariol_Bold.otf b/Harbor/Fonts/Bariol_Bold.otf deleted file mode 100644 index e4aba11..0000000 Binary files a/Harbor/Fonts/Bariol_Bold.otf and /dev/null differ diff --git a/Harbor/Fonts/Bariol_Light.otf b/Harbor/Fonts/Bariol_Light.otf deleted file mode 100644 index ec047c8..0000000 Binary files a/Harbor/Fonts/Bariol_Light.otf and /dev/null differ diff --git a/Harbor.xcodeproj/project.xcworkspace/xcuserdata/erinhochstatter.xcuserdatad/WorkspaceSettings.xcsettings b/Harbor/Harbor.entitlements similarity index 62% rename from Harbor.xcodeproj/project.xcworkspace/xcuserdata/erinhochstatter.xcuserdatad/WorkspaceSettings.xcsettings rename to Harbor/Harbor.entitlements index 659c876..ee95ab7 100644 --- a/Harbor.xcodeproj/project.xcworkspace/xcuserdata/erinhochstatter.xcuserdatad/WorkspaceSettings.xcsettings +++ b/Harbor/Harbor.entitlements @@ -2,9 +2,9 @@ - HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges + com.apple.security.app-sandbox - SnapshotAutomaticallyBeforeSignificantChanges + com.apple.security.network.client diff --git a/Harbor/Harbor.xcdatamodeld/.xccurrentversion b/Harbor/Harbor.xcdatamodeld/.xccurrentversion new file mode 100644 index 0000000..c38b0b4 --- /dev/null +++ b/Harbor/Harbor.xcdatamodeld/.xccurrentversion @@ -0,0 +1,8 @@ + + + + + _XCCurrentVersionName + Harbor.xcdatamodel + + diff --git a/Harbor/Harbor.xcdatamodeld/Harbor.xcdatamodel/contents b/Harbor/Harbor.xcdatamodeld/Harbor.xcdatamodel/contents index 9648450..e113c7c 100644 --- a/Harbor/Harbor.xcdatamodeld/Harbor.xcdatamodel/contents +++ b/Harbor/Harbor.xcdatamodeld/Harbor.xcdatamodel/contents @@ -1,24 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - + + \ No newline at end of file diff --git a/Harbor/Info.plist b/Harbor/Info.plist index 4f3660b..d54ec6f 100644 --- a/Harbor/Info.plist +++ b/Harbor/Info.plist @@ -2,10 +2,6 @@ - NSMainNibFile - MainMenu - ATSApplicationFontsPath - Fonts CFBundleDevelopmentRegion en CFBundleExecutable @@ -13,7 +9,7 @@ CFBundleIconFile CFBundleIdentifier - dvm.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -25,16 +21,16 @@ CFBundleSignature ???? CFBundleVersion - 2 - LSApplicationCategoryType - public.app-category.developer-tools + 1 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) LSUIElement NSHumanReadableCopyright - Copyright © 2014 ekh. All rights reserved. + Copyright © 2015 DevMynd. All rights reserved. + NSMainNibFile + MainMenu NSPrincipalClass - NSApplication + Application diff --git a/Harbor/KeychainWrapper.swift b/Harbor/KeychainWrapper.swift new file mode 100644 index 0000000..7883709 --- /dev/null +++ b/Harbor/KeychainWrapper.swift @@ -0,0 +1,245 @@ +// +// KeychainWrapper.swift +// KeychainWrapper +// +// Created by Jason Rendel on 9/23/14. +// Copyright (c) 2014 Jason Rendel. All rights reserved. +// +// The MIT License (MIT) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +import Foundation + +let SecMatchLimit: String! = kSecMatchLimit as String +let SecReturnData: String! = kSecReturnData as String +let SecValueData: String! = kSecValueData as String +let SecAttrAccessible: String! = kSecAttrAccessible as String +let SecClass: String! = kSecClass as String +let SecAttrService: String! = kSecAttrService as String +let SecAttrGeneric: String! = kSecAttrGeneric as String +let SecAttrAccount: String! = kSecAttrAccount as String +let SecAttrAccessGroup: String! = kSecAttrAccessGroup as String + +public protocol Keychain { + func setString(value: String, forKey keyName: CustomStringConvertible) -> Bool + func stringForKey(keyName: CustomStringConvertible) -> String? + func removeValueForKey(key: CustomStringConvertible) -> Bool +} + +/// KeychainWrapper is a class to help make Keychain access in Swift more straightforward. It is designed to make accessing the Keychain services more like using NSUserDefaults, which is much more familiar to people. +public class KeychainWrapper : Keychain { + // MARK: Private static Properties + private struct internalVars { + static var serviceName: String = "HarborApp" + static var accessGroup: String = "" + } + + // MARK: Public Properties + + /// ServiceName is used for the kSecAttrService property to uniquely identify this keychain accessor. If no service name is specified, KeychainWrapper will default to using the bundleIdentifier. + /// + ///This is a static property and only needs to be set once + public class var serviceName: String { + get { + if internalVars.serviceName.isEmpty { + internalVars.serviceName = NSBundle.mainBundle().bundleIdentifier ?? "SwiftKeychainWrapper" + } + return internalVars.serviceName + } + set(newServiceName) { + internalVars.serviceName = newServiceName + } + } + + /// AccessGroup is used for the kSecAttrAccessGroup property to identify which Keychain Access Group this entry belongs to. This allows you to use the KeychainWrapper with shared keychain access between different applications. + /// + /// Access Group defaults to an empty string and is not used until a valid value is set. + /// + /// This is a static property and only needs to be set once. To remove the access group property after one has been set, set this to an empty string. + public class var accessGroup: String { + get { + return internalVars.accessGroup + } + set(newAccessGroup){ + internalVars.accessGroup = newAccessGroup + } + } + + // MARK: Public Methods + + /// Returns a string value for a specified key. + /// + /// :param: keyName The key to lookup data for. + /// :returns: The String associated with the key if it exists. If no data exists, or the data found cannot be encoded as a string, returns nil. + public func stringForKey(keyName: CustomStringConvertible) -> String? { + let keychainData: NSData? = KeychainWrapper.dataForKey(keyName.description) + var stringValue: String? + if let data = keychainData { + stringValue = NSString(data: data, encoding: NSUTF8StringEncoding) as String? + } + + return stringValue + } + + + /// Returns an object that conforms to NSCoding for a specified key. + /// + /// :param: keyName The key to lookup data for. + /// :returns: The decoded object associated with the key if it exists. If no data exists, or the data found cannot be decoded, returns nil. + public class func objectForKey(keyName: String) -> NSCoding? { + let dataValue: NSData? = self.dataForKey(keyName) + + var objectValue: NSCoding? + + if let data = dataValue { + objectValue = NSKeyedUnarchiver.unarchiveObjectWithData(data) as? NSCoding + } + + return objectValue; + } + + + /// Returns a NSData object for a specified key. + /// + /// :param: keyName The key to lookup data for. + /// :returns: The NSData object associated with the key if it exists. If no data exists, returns nil. + public class func dataForKey(keyName: String) -> NSData? { + var keychainQueryDictionary = self.setupKeychainQueryDictionaryForKey(keyName) + var result: AnyObject? + + // Limit search results to one + keychainQueryDictionary[SecMatchLimit] = kSecMatchLimitOne + + // Specify we want NSData/CFData returned + keychainQueryDictionary[SecReturnData] = kCFBooleanTrue + + // Search + let status = withUnsafeMutablePointer(&result) { + SecItemCopyMatching(keychainQueryDictionary, UnsafeMutablePointer($0)) + } + + return status == noErr ? result as? NSData : nil + } + + /// Save a String value to the keychain associated with a specified key. If a String value already exists for the given keyname, the string will be overwritten with the new value. + /// + /// :param: value The String value to save. + /// :param: forKey The key to save the String under. + /// :returns: True if the save was successful, false otherwise. + public func setString(value: String, forKey keyName: CustomStringConvertible) -> Bool { + if let data = value.dataUsingEncoding(NSUTF8StringEncoding) { + return KeychainWrapper.setData(data, forKey: keyName.description) + } else { + return false + } + } + + /// Save an NSCoding compliant object to the keychain associated with a specified key. If an object already exists for the given keyname, the object will be overwritten with the new value. + /// + /// :param: value The NSCoding compliant object to save. + /// :param: forKey The key to save the object under. + /// :returns: True if the save was successful, false otherwise. + public class func setObject(value: NSCoding, forKey keyName: String) -> Bool { + let data = NSKeyedArchiver.archivedDataWithRootObject(value) + + return self.setData(data, forKey: keyName) + } + + /// Save a NSData object to the keychain associated with a specified key. If data already exists for the given keyname, the data will be overwritten with the new value. + /// + /// :param: value The NSData object to save. + /// :param: forKey The key to save the object under. + /// :returns: True if the save was successful, false otherwise. + public class func setData(value: NSData, forKey keyName: String) -> Bool { + var keychainQueryDictionary: [String:AnyObject] = self.setupKeychainQueryDictionaryForKey(keyName) + + keychainQueryDictionary[SecValueData] = value + + // Protect the keychain entry so it's only valid when the device is unlocked + keychainQueryDictionary[SecAttrAccessible] = kSecAttrAccessibleWhenUnlocked + + let status: OSStatus = SecItemAdd(keychainQueryDictionary, nil) + + if status == errSecSuccess { + return true + } else if status == errSecDuplicateItem { + return self.updateData(value, forKey: keyName) + } else { + return false + } + } + + /// Remove an object associated with a specified key. + /// + /// :param: key The key value to remove data for. + /// :returns: True if successful, false otherwise. + public func removeValueForKey(key: CustomStringConvertible) -> Bool { + let keychainQueryDictionary: [String:AnyObject] = KeychainWrapper.setupKeychainQueryDictionaryForKey(key.description) + + // Delete + let status: OSStatus = SecItemDelete(keychainQueryDictionary); + + if status == errSecSuccess { + return true + } else { + return false + } + } + + // MARK: Private Methods + + /// Update existing data associated with a specified key name. The existing data will be overwritten by the new data + private class func updateData(value: NSData, forKey keyName: String) -> Bool { + let keychainQueryDictionary: [String:AnyObject] = self.setupKeychainQueryDictionaryForKey(keyName) + let updateDictionary = [SecValueData:value] + + // Update + let status: OSStatus = SecItemUpdate(keychainQueryDictionary, updateDictionary) + + if status == errSecSuccess { + return true + } else { + return false + } + } + + /// Setup the keychain query dictionary used to access the keychain on iOS for a specified key name. Takes into account the Service Name and Access Group if one is set. + /// + /// :param: keyName The key this query is for + /// :returns: A dictionary with all the needed properties setup to access the keychain on iOS + private class func setupKeychainQueryDictionaryForKey(keyName: String) -> [String:AnyObject] { + // Setup dictionary to access keychain and specify we are using a generic password (rather than a certificate, internet password, etc) + var keychainQueryDictionary: [String:AnyObject] = [SecClass:kSecClassGenericPassword] + + // Uniquely identify this keychain accessor + keychainQueryDictionary[SecAttrService] = KeychainWrapper.serviceName + + // Set the keychain access group if defined + if !KeychainWrapper.accessGroup.isEmpty { + keychainQueryDictionary[SecAttrAccessGroup] = KeychainWrapper.accessGroup + } + + // Uniquely identify the account who will be accessing the keychain + let encodedIdentifier: NSData? = keyName.dataUsingEncoding(NSUTF8StringEncoding) + keychainQueryDictionary[SecAttrAccount] = encodedIdentifier + + return keychainQueryDictionary + } +} \ No newline at end of file diff --git a/Harbor/MainMenu.xib b/Harbor/MainMenu.xib new file mode 100644 index 0000000..be1724b --- /dev/null +++ b/Harbor/MainMenu.xib @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Harbor/NotificationCenter.swift b/Harbor/NotificationCenter.swift new file mode 100644 index 0000000..09d2e42 --- /dev/null +++ b/Harbor/NotificationCenter.swift @@ -0,0 +1,10 @@ +import Foundation + +public protocol NotificationCenter { + func addObserverForName(name: String?, object obj: AnyObject?, queue: NSOperationQueue?, usingBlock block: (NSNotification) -> Void) -> NSObjectProtocol + func postNotificationName(aName: String, object anObject: AnyObject?) +} + +extension NSNotificationCenter : NotificationCenter { + +} \ No newline at end of file diff --git a/Harbor/Playground.swift b/Harbor/Playground.swift new file mode 100644 index 0000000..f40933d --- /dev/null +++ b/Harbor/Playground.swift @@ -0,0 +1,22 @@ +import Foundation + +class Playground { + func writeFile(text: String) -> Bool { + + do { + let tempURL = NSURL(string: "file:///tmp/holyfuckingshit.txt") + try text.writeToURL(tempURL!, atomically: true, encoding: NSUTF8StringEncoding) + return true + } catch { + print("Failed to write file") + return false + } + } + + func readFromFile(fileName: String) throws -> String { + // let path = NSBundle.mainBundle().bundleURL + // let fileURL = path.URLByAppendingPathComponent(fileName); + let fileURL = NSURL(string: fileName); + return try String(contentsOfURL: fileURL!) + } +} \ No newline at end of file diff --git a/Harbor/Popover.xib b/Harbor/Popover.xib deleted file mode 100644 index c52d8f5..0000000 --- a/Harbor/Popover.xib +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Harbor/PopoverViewController.swift b/Harbor/PopoverViewController.swift deleted file mode 100644 index 2755bd8..0000000 --- a/Harbor/PopoverViewController.swift +++ /dev/null @@ -1,151 +0,0 @@ -// -// Popover.swift -// Harbor -// -// Created by Erin Hochstatter on 8/16/14. -// Copyright (c) 2014 devMynd. All rights reserved. -// - -import Cocoa - -class PopoverViewController: NSViewController, NSTableViewDataSource, NSTableViewDelegate, NSTextFieldDelegate, NSControlTextEditingDelegate{ - - - dynamic var projectList: [Project]? - dynamic var managedObjectContext: NSManagedObjectContext? - let appDelegate: AppDelegate = (NSApplication.sharedApplication().delegate as! AppDelegate) - - @IBAction func quitButton(sender: AnyObject) { - NSApplication.sharedApplication().terminate(self) - } - @IBOutlet weak var tableView: NSTableView! - @IBOutlet weak var preferencesButton: NSButton! - @IBOutlet weak var titleLabel: NSTextField! - - required init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) - } - - override init?(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) { - super.init(nibName: "Popover", bundle: nil) - - } - - // MARK: View Lifecycle - - - override func loadView() { - super.loadView() - projectList = [] - - let bariolBold16: NSFont = NSFont (name: "Bariol-Bold", size: 16)! - self.titleLabel.font = bariolBold16 - } - - override func viewDidAppear() { - self.refreshTableView() - print("projectlist count at reload data \(projectList!.count)") - } - - func refreshTableView() { - appDelegate.fetchApiKeys { (projects) -> () in - self.projectList = projects - self.tableView.reloadData() - } - } - - // MARK: NSTableViewDelegate - - - func numberOfRowsInTableView(NSTableView) -> Int { - - return projectList!.isEmpty ? 1 : projectList!.count - } - - func tableView(aTableView: NSTableView!, - objectValueForTableColumn aTableColumn: NSTableColumn!, - - row rowIndex: Int) -> AnyObject! { - - if !projectList!.isEmpty { - let project: Project = projectList![rowIndex] - let recentBuild: Build = project.builds.first! - - if aTableColumn.identifier == "statusImageColumn" { - - var statusImage: NSImage - - if project.builds.first?.status == "success"{ - statusImage = NSImage(named: "codeshipLogo_green")! - - } else if project.builds.first?.status == "testing" { - statusImage = NSImage(named: "codeshipLogo_black")! - - } else { - statusImage = NSImage(named: "codeshipLogo_red")! - } - - return statusImage - - } else if aTableColumn.identifier == "buildInfoColumn" { - - let bariolBold: NSFont = NSFont (name: "Bariol-Bold", size: 13)! - let repoAttrs = [NSFontAttributeName : bariolBold] - let projectBuildSummary = NSMutableAttributedString(string: - "\(project.repositoryName!.capitalizedString)\n", attributes: repoAttrs) - - let bariolLight: NSFont = NSFont (name: "Bariol-Light", size: 11)! - let commitAttrs = [NSFontAttributeName : bariolLight] - let buildMessage = NSMutableAttributedString(string: "\(recentBuild.message!)", attributes: commitAttrs) - - projectBuildSummary.appendAttributedString(buildMessage) - return projectBuildSummary - - } else { - return nil - } - } else { - return nil - } - - } - - - // Only allow rows to be selectable if there are items in the list. - func tableView(NSTableView, shouldSelectRow: Int) -> Bool { - return !projectList!.isEmpty - } - - func tableViewSelectionDidChange(notification: NSNotification) { - - let index = tableView.selectedRow - - if index >= 0 { - let selectedProject: Project = projectList![tableView.selectedRow] - let recentBuild: Build = selectedProject.builds.first! - - let buildLinkString = "https://codeship.com/projects/\(selectedProject.id!)/builds/\(recentBuild.id!)" - let buildURL: NSURL = NSURL(string: buildLinkString)! - let workspace = NSWorkspace.sharedWorkspace() - - workspace.openURL(buildURL) - tableView.deselectRow(index) - appDelegate.hidePopover(self) - } - } - - - @IBAction func preferencesButton(sender: AnyObject) { - - let window = appDelegate.preferencesPaneWindow?.window - appDelegate.hidePopover(self) - - // Set position of the window and display it - window?.makeKeyAndOrderFront(self) - window?.center() - - // Show your window in front of all other apps - NSApp.activateIgnoringOtherApps(true) - - } -} \ No newline at end of file diff --git a/Harbor/PreferencesPaneWindow.swift b/Harbor/PreferencesPaneWindow.swift deleted file mode 100644 index ac20ff5..0000000 --- a/Harbor/PreferencesPaneWindow.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// PreferencesPaneWindow.swift -// Harbor -// -// Created by Erin Hochstatter on 9/10/14. -// Copyright (c) 2014 devMynd. All rights reserved. -// - -import Cocoa - -class PreferencesPaneWindow: NSWindowController, NSWindowDelegate { - - var prefManagedObjectContext: NSManagedObjectContext? - - @IBOutlet var dmProjectArrayController: NSArrayController! - @IBOutlet var dmAccountArrayController: NSArrayController! - - @IBOutlet weak var accountNameLabel: NSTextField! - @IBOutlet weak var apiKeyLabel: NSTextField! - @IBOutlet weak var refreshRateLabel: NSTextField! - @IBOutlet weak var projectColumn: NSTableColumn! - @IBOutlet weak var followColumn: NSTableColumn! - @IBOutlet weak var tableView: NSTableView! - - override func windowDidLoad() { - super.windowDidLoad() - let bariolBold: NSFont = NSFont (name: "Bariol-Bold", size: 15)! - accountNameLabel.font = bariolBold - apiKeyLabel.font = bariolBold - refreshRateLabel.font = bariolBold - let sortDescriptor = NSSortDescriptor(key: "repositoryName", ascending: true) - tableView.sortDescriptors = [sortDescriptor] - } - - func windowWillClose(notification: NSNotification) { - let appDelegate = (NSApplication.sharedApplication().delegate as! AppDelegate) - appDelegate.showPopover(self) - } - - - @IBAction func saveButton(sender: AnyObject) { - let errorPointer = NSErrorPointer() - do { - try prefManagedObjectContext?.save() - } catch var error as NSError { - errorPointer.memory = error - } - - self.close() - } -} diff --git a/Harbor/PreferencesPaneWindow.xib b/Harbor/PreferencesPaneWindow.xib deleted file mode 100644 index bcd34d9..0000000 --- a/Harbor/PreferencesPaneWindow.xib +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Harbor/PreferencesPaneWindowController.swift b/Harbor/PreferencesPaneWindowController.swift new file mode 100644 index 0000000..3f7247c --- /dev/null +++ b/Harbor/PreferencesPaneWindowController.swift @@ -0,0 +1,125 @@ +import Cocoa + +class PreferencesPaneWindowController: NSWindowController, NSWindowDelegate, NSTextFieldDelegate, NSTableViewDataSource, NSTableViewDelegate, PreferencesView { + enum ColumnIdentifier: String { + case ShowProject = "ShowProject" + case RepositoryName = "RepositoryName" + } + + // + // MARK: Dependencies + private var component = ViewComponent() + .parent { Application.component() } + .module { PreferencesViewModule($0) } + + private lazy var presenter: PreferencesPresenter = self.component.preferences.inject(self) + + // + // MARK: Interface Elements + @IBOutlet weak var codeshipAPIKey: TextField! + @IBOutlet weak var refreshRateTextField: TextField! + @IBOutlet weak var projectTableView: NSTableView! + @IBOutlet weak var launchOnLoginCheckbox: NSButton! + + override init(window: NSWindow?) { + super.init(window: window) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func windowDidLoad() { + super.windowDidLoad() + + self.presenter.didInitialize() + } + + func windowDidChangeOcclusionState(notification: NSNotification) { + let window = notification.object! + + if window.occlusionState.contains(NSWindowOcclusionState.Visible) { + presenter.didBecomeActive() + } else { + presenter.didResignActive() + } + } + + // + // MARK: PreferencesView + func updateProjects(projects: [Project]) { + projectTableView.reloadData() + } + + func updateApiKey(apiKey: String) { + codeshipAPIKey.stringValue = apiKey + } + + func updateRefreshRate(refreshRate: String) { + refreshRateTextField.stringValue = refreshRate + } + + func updateLaunchOnLogin(launchOnLogin: Bool) { + launchOnLoginCheckbox.enabled = launchOnLogin + } + + // + // MARK: Interface Actions + @IBAction func launchOnLoginCheckboxClicked(sender: AnyObject) { + presenter.updateLaunchOnLogin(launchOnLoginCheckbox.enabled) + } + + @IBAction func isEnabledCheckboxClicked(sender: AnyObject) { + let button = sender as? NSButton + + if let view = button?.nextKeyView as? NSTableCellView { + let row = projectTableView.rowForView(view) + presenter.toggleEnabledStateForProjectAtIndex(row) + } + } + + @IBAction func saveButton(sender: AnyObject) { + presenter.savePreferences() + close() + } + + // + // MARK: NSTextFieldDelegate + override func controlTextDidChange(obj: NSNotification) { + if let textField = obj.object as? TextField { + if textField == codeshipAPIKey { + presenter.updateApiKey(textField.stringValue) + } else if textField == refreshRateTextField { + presenter.updateRefreshRate(textField.stringValue) + } + } + } + + // + // MARK: NSTableViewDataSource + func numberOfRowsInTableView(tableView: NSTableView) -> Int { + return presenter.numberOfProjects + } + + // + // MARK: NSTableViewDelegate + func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView? { + var view: NSView? = nil + + if let tableColumn = tableColumn { + let project = presenter.projectAtIndex(row) + let cellView = tableView.makeViewWithIdentifier(tableColumn.identifier, owner: self) as! NSTableCellView + + switch ColumnIdentifier(rawValue: tableColumn.identifier)! { + case .ShowProject: + cellView.objectValue = project.isEnabled ? NSOnState : NSOffState + case .RepositoryName: + cellView.textField!.stringValue = project.repositoryName + } + + view = cellView + } + + return view + } +} \ No newline at end of file diff --git a/Harbor/PreferencesPaneWindowController.xib b/Harbor/PreferencesPaneWindowController.xib new file mode 100644 index 0000000..a7c7866 --- /dev/null +++ b/Harbor/PreferencesPaneWindowController.xib @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Harbor/PreferencesPresenter.swift b/Harbor/PreferencesPresenter.swift new file mode 100644 index 0000000..9f6be2a --- /dev/null +++ b/Harbor/PreferencesPresenter.swift @@ -0,0 +1,134 @@ +import Foundation +import Cocoa + +class PreferencesPresenter : Presenter { + // + // MARK: Dependencies + private let settings: Settings + private let projectsInteractor: ProjectsInteractor + + // + // MARK: Properties + private var apiKey: String = "" + private var refreshRate: Double = 60.0 + private var launchOnLogin: Bool = true + private var allProjects: [Project] + + private(set) var needsRefresh: Bool = true + + init(view: V, projectsInteractor: ProjectsInteractor, settings: Settings) { + self.projectsInteractor = projectsInteractor + self.settings = settings + self.allProjects = [Project]() + + super.init(view: view) + } + + // + // MARK: Presentation Cycle + override func didInitialize() { + super.didInitialize() + projectsInteractor.addListener(refreshProjects) + } + + override func didBecomeActive() { + super.didBecomeActive() + refreshIfNecessary() + } + + override func didResignActive() { + super.didResignActive() + refreshIfNecessary() + } + + func setNeedsRefresh() { + if(!needsRefresh) { + needsRefresh = true + } + } + + private func refreshIfNecessary() { + if(needsRefresh) { + refreshConfiguration() + needsRefresh = false + } + } + + // + // MARK: Preferences + func savePreferences() { + // persist our configuration + settings.apiKey = apiKey + settings.refreshRate = refreshRate + + // serialize the hidden projects + settings.disabledProjectIds = allProjects.reduce([Int]()) { memo, project in + var memo = memo + + if !project.isEnabled { + memo.append(project.id) + } + + return memo + } + + needsRefresh = false + } + + func updateApiKey(apiKey: String) { + self.apiKey = apiKey + setNeedsRefresh() + } + + func updateRefreshRate(refreshRate: String) { + self.refreshRate = (refreshRate as NSString).doubleValue + setNeedsRefresh() + } + + func updateLaunchOnLogin(launchOnLogin: Bool) { + self.launchOnLogin = launchOnLogin + setNeedsRefresh() + } + + private func refreshConfiguration() { + // load data from user defaults + launchOnLogin = settings.launchOnLogin + refreshRate = settings.refreshRate + apiKey = settings.apiKey + + // update our view after refreshing + view.updateApiKey(apiKey) + view.updateRefreshRate(refreshRate.description) + view.updateLaunchOnLogin(launchOnLogin) + } + + // + // MARK: Projects + var numberOfProjects: Int { + get { return allProjects.count } + } + + func projectAtIndex(index: Int) -> Project { + return allProjects[index]; + } + + func toggleEnabledStateForProjectAtIndex(index: Int) { + let project = projectAtIndex(index) + project.isEnabled = !project.isEnabled + + setNeedsRefresh() + } + + private func refreshProjects(projects: [Project]) { + allProjects = projects + + // notify the view that the projects refreshed + view.updateProjects(allProjects) + } + + // + // MARK: Accessors + private var defaults: NSUserDefaults { + get { return NSUserDefaults.standardUserDefaults() } + } +} \ No newline at end of file diff --git a/Harbor/PreferencesView.swift b/Harbor/PreferencesView.swift new file mode 100644 index 0000000..0395b47 --- /dev/null +++ b/Harbor/PreferencesView.swift @@ -0,0 +1,8 @@ +import Foundation + +protocol PreferencesView : ViewType { + func updateProjects(projects: [Project]) + func updateRefreshRate(refreshRate: String) + func updateApiKey(apiKey: String) + func updateLaunchOnLogin(launchOnLogin: Bool) +} \ No newline at end of file diff --git a/Harbor/Presenter.swift b/Harbor/Presenter.swift new file mode 100644 index 0000000..338b2ed --- /dev/null +++ b/Harbor/Presenter.swift @@ -0,0 +1,22 @@ +import Foundation + +class Presenter { + private(set) weak var view: V! + private(set) var isActive: Bool = false + + required init(view: V) { + self.view = view + } + + func didInitialize() { + + } + + func didBecomeActive() { + self.isActive = true + } + + func didResignActive() { + self.isActive = false + } +} \ No newline at end of file diff --git a/Harbor/Project.swift b/Harbor/Project.swift index 9da7fb5..0aef05a 100644 --- a/Harbor/Project.swift +++ b/Harbor/Project.swift @@ -1,26 +1,63 @@ -// -// Project.swift -// Harbor -// -// Created by Erin Hochstatter on 8/13/14. -// Copyright (c) 2014 devMynd. All rights reserved. -// - import Foundation -class Project : NSObject{ - var id: Int? - var repositoryName: String? - var builds: [Build] = [] - var active: Bool? - - override init(){ - super.init() +import Alamofire + +public final class Project: ResponseObjectSerializable, ResponseCollectionSerializable, Equatable { + let id: Int + let uuid: String + let repositoryName: String! + let status : Int + let builds: [Build] + var isEnabled : Bool + + public init(id: Int) { + self.id = id + self.uuid = NSUUID().UUIDString + self.repositoryName = "" + self.builds = [Build]() + self.status = 0 + self.isEnabled = false + } + + public init?(response:NSHTTPURLResponse, representation:AnyObject){ + self.isEnabled = true + + self.id = representation.valueForKeyPath("id") as! Int + self.uuid = representation.valueForKeyPath("uuid") as! String + self.builds = Build.collection(response: response, representation: representation).sort({ left, right in + return left.startedAt!.compare(right.startedAt!) == .OrderedDescending + }) + + if let repositoryName = representation.valueForKeyPath("repository_name") as? String { + self.repositoryName = repositoryName + } else { + self.repositoryName = nil } - - init(id: Int, - repositoryName: String){ - self.id = id - self.repositoryName = repositoryName - super.init() + + let firstBuild = self.builds.first + // make this an enum + if firstBuild?.status == "success" { + self.status = 0 + } else if firstBuild?.status == "error" { + self.status = 1 + } else { + self.status = 2 + } + } + + public static func collection(response response: NSHTTPURLResponse, representation: AnyObject) -> [Project] { + guard let representations = representation.valueForKeyPath("projects") as? [[String: AnyObject]] else { + return [Project]() } + + // map representations into projects and filter out any unnamed elements + let projects = representations + .flatMap { representation in Project(response: response, representation: representation) } + .filter { project in project.repositoryName != nil } + + return projects + } +} + +public func ==(lhs: Project, rhs: Project) -> Bool { + return lhs.id == rhs.id } \ No newline at end of file diff --git a/Harbor/ProjectMenuItem.swift b/Harbor/ProjectMenuItem.swift new file mode 100644 index 0000000..adc28de --- /dev/null +++ b/Harbor/ProjectMenuItem.swift @@ -0,0 +1,23 @@ +import Cocoa + +class ProjectMenuItem : NSMenuItem { + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + } + + init(model: ProjectMenuItemModel) { + super.init(title: model.title, action: nil, keyEquivalent: "") + + self.image = model.status.icon() + self.submenu = self.submenuForModel(model) + } + + func submenuForModel(model: ProjectMenuItemModel) -> NSMenu { + let menu = NSMenu(title: model.submenuTitle) + for build in model.builds() { + menu.addItem(BuildView.menuItemForModel(build)) + } + + return menu + } +} diff --git a/Harbor/ProjectMenuItemModel.swift b/Harbor/ProjectMenuItemModel.swift new file mode 100644 index 0000000..e8466d9 --- /dev/null +++ b/Harbor/ProjectMenuItemModel.swift @@ -0,0 +1,41 @@ +struct ProjectMenuItemModel { + private let project: Project + + init(project: Project) { + self.project = project + } + + // + // MARK: Display + // + + var title: String { + get { return self.project.repositoryName } + } + + var submenuTitle: String { + get { return "Builds" } + } + + // + // MARK: Status + // + + var status: BuildStatus { + return self.project.status == 0 ? .Passing : .Failing + } + + var isFailing: Bool { + get { return self.status == .Failing } + } + + // + // MARK: Children + // + + func builds() -> [BuildViewModel] { + return self.project.builds.map { build in + return BuildViewModel(build: build, projectId: self.project.id) + } + } +} \ No newline at end of file diff --git a/Harbor/ProjectsProvider.swift b/Harbor/ProjectsProvider.swift new file mode 100644 index 0000000..708a1e5 --- /dev/null +++ b/Harbor/ProjectsProvider.swift @@ -0,0 +1,66 @@ +import Foundation + +typealias ProjectHandler = ([Project] -> Void) + +protocol ProjectsInteractor { + func refreshProjects() + func refreshCurrentProjects() + func addListener(listener: ProjectHandler) +} + +class ProjectsProvider : ProjectsInteractor { + // + // MARK: dependencies + // + private let settings: Settings + private let codeshipApi: CodeshipApiType + + // + // MARK: properties + // + private var projects: [Project] + private var listeners: [ProjectHandler] + + init(api: CodeshipApiType, settings: Settings) { + self.projects = [Project]() + self.listeners = [ProjectHandler]() + self.settings = settings + self.codeshipApi = api + + settings.observeNotification(.ApiKey) { _ in + self.refreshProjects() + } + + settings.observeNotification(.DisabledProjects) { _ in + self.refreshCurrentProjects() + } + } + + func refreshProjects() { + codeshipApi.getProjects(didRefreshProjects, errorHandler: { error in + debugPrint(error) + }) + } + + func refreshCurrentProjects() { + didRefreshProjects(projects) + } + + private func didRefreshProjects(projects: [Project]){ + // update our projects hidden state appropriately according to the user settings + for project in projects { + project.isEnabled = !settings.disabledProjectIds.contains(project.id) + } + + self.projects = projects + + for listener in listeners { + listener(projects) + } + } + + func addListener(listener: ProjectHandler){ + listeners.append(listener) + listener(projects) + } +} \ No newline at end of file diff --git a/Harbor/ResponseCollectionSerializable.swift b/Harbor/ResponseCollectionSerializable.swift new file mode 100644 index 0000000..382b397 --- /dev/null +++ b/Harbor/ResponseCollectionSerializable.swift @@ -0,0 +1,33 @@ + +import Foundation +import Alamofire + +public protocol ResponseCollectionSerializable { + static func collection(response response: NSHTTPURLResponse, representation: AnyObject) -> [Self] +} + +extension Alamofire.Request { + public func responseCollection(completionHandler: Response<[T], NSError> -> Void) -> Self { + let responseSerializer = ResponseSerializer<[T], NSError> { request, response, data, error in + guard error == nil else { return .Failure(error!) } + + let JSONSerializer = Request.JSONResponseSerializer(options: .AllowFragments) + let result = JSONSerializer.serializeResponse(request, response, data, error) + + switch result { + case .Success(let value): + if let response = response { + return .Success(T.collection(response: response, representation: value)) + } else { + let failureReason = "Response collection could not be serialized due to nil response" + let error = Error.errorWithCode(.JSONSerializationFailed, failureReason: failureReason) + return .Failure(error) + } + case .Failure(let error): + return .Failure(error) + } + } + + return response(responseSerializer: responseSerializer, completionHandler: completionHandler) + } +} diff --git a/Harbor/ResponseObjectSerializable.swift b/Harbor/ResponseObjectSerializable.swift new file mode 100644 index 0000000..21f8e92 --- /dev/null +++ b/Harbor/ResponseObjectSerializable.swift @@ -0,0 +1,35 @@ +import Foundation +import Alamofire + +public protocol ResponseObjectSerializable { + init?(response: NSHTTPURLResponse, representation: AnyObject) +} + +extension Request { + public func responseObject(completionHandler: (Response) -> Void) -> Self { + let responseSerializer = ResponseSerializer { request, response, data, error in + guard error == nil else { return .Failure(error!) } + + let JSONResponseSerializer = Request.JSONResponseSerializer(options: .AllowFragments) + let result = JSONResponseSerializer.serializeResponse(request, response, data, error) + + switch result { + case .Success(let value): + if let + response = response, + responseObject = T(response: response, representation: value) + { + return .Success(responseObject) + } else { + let failureReason = "JSON could not be serialized into response object: \(value)" + let error = Error.errorWithCode(.JSONSerializationFailed, failureReason: failureReason) + return .Failure(error) + } + case .Failure(let error): + return .Failure(error) + } + } + + return response(responseSerializer: responseSerializer, completionHandler: completionHandler) + } +} \ No newline at end of file diff --git a/Harbor/RunLoop.swift b/Harbor/RunLoop.swift new file mode 100644 index 0000000..b573f42 --- /dev/null +++ b/Harbor/RunLoop.swift @@ -0,0 +1,9 @@ +import Foundation + +public protocol RunLoop { + func addTimer(timer: NSTimer, forMode mode: String) +} + +extension NSRunLoop : RunLoop { + +} \ No newline at end of file diff --git a/Harbor/Settings.swift b/Harbor/Settings.swift new file mode 100644 index 0000000..a3e5f1c --- /dev/null +++ b/Harbor/Settings.swift @@ -0,0 +1,121 @@ +import Foundation +import ServiceManagement +import CoreServices + +class Settings { + private enum Key: String, CustomStringConvertible { + case ApiKey = "ApiKey" + case RefreshRate = "RefreshRate" + case DisabledProjects = "DisabledProjects" + case LaunchOnLogin = "LaunchOnLogin" + case HasLaunched = "HasLaunched" + + var description: String { + get { return rawValue } + } + + var storedInKeychain: Bool { + get { return self == .ApiKey } + } + + static func all() -> [Key] { + return [ .ApiKey, .RefreshRate, .DisabledProjects, .LaunchOnLogin, .HasLaunched ] + } + } + + // + // MARK: Dependencies + private let defaults: UserDefaults + private let keychain: Keychain + private let notificationCenter: NotificationCenter + + // + // MARK: Properties + var apiKey: String { + didSet { + keychain.setString(apiKey, forKey: Key.ApiKey) + postNotification(.ApiKey) + } + } + + var refreshRate: Double { + didSet { + defaults.setDouble(refreshRate, forKey: Key.RefreshRate) + postNotification(.RefreshRate) + } + } + + var disabledProjectIds: [Int] { + didSet { + defaults.setObject(disabledProjectIds, forKey: Key.DisabledProjects) + postNotification(.DisabledProjects) + } + } + + var launchOnLogin: Bool { + didSet { + defaults.setBool(launchOnLogin, forKey: Key.LaunchOnLogin) + if oldValue != launchOnLogin { + updateHelperLoginItem(launchOnLogin) + } + } + } + + var isFirstRun: Bool + + init(defaults: UserDefaults, keychain: Keychain, notificationCenter: NotificationCenter) { + self.defaults = defaults + self.keychain = keychain + self.notificationCenter = notificationCenter + + apiKey = keychain.stringForKey(Key.ApiKey) ?? "" + refreshRate = defaults.doubleForKey(Key.RefreshRate) + disabledProjectIds = defaults.objectForKey(Key.DisabledProjects) as? [Int] ?? [Int]() + isFirstRun = !defaults.boolForKey(Key.HasLaunched) + launchOnLogin = isFirstRun ? true : defaults.boolForKey(Key.LaunchOnLogin) + } + + func startup() { + // on first run, update the login item immediately and mark the app as launched + if isFirstRun { + defaults.setBool(true, forKey: Key.HasLaunched) + updateHelperLoginItem(launchOnLogin) + } + } + + func reset() { + // clear out values for all the stored keys + for key in Key.all() { + if key.storedInKeychain { + keychain.removeValueForKey(key) + } else { + defaults.removeValueForKey(key) + } + } + } + + private func updateHelperLoginItem(launchOnLogin: Bool) { + let result = SMLoginItemSetEnabled("com.dvm.Harbor.Helper", launchOnLogin) + let enabled = launchOnLogin ? "enabling" : "disabling" + let success = result ? "succeeded" : "failed" + print("\(enabled) launch on login \(success)") + } +} + +// +// MARK: Notifications +extension Settings { + enum NotificationName: String { + case ApiKey = "ApiKey" + case RefreshRate = "RefreshRate" + case DisabledProjects = "DisabledProjects" + } + + func observeNotification(notification: Settings.NotificationName, handler: (NSNotification -> Void)) -> NSObjectProtocol { + return notificationCenter.addObserverForName(notification.rawValue, object: nil, queue: nil, usingBlock: handler) + } + + private func postNotification(notification: Settings.NotificationName) { + notificationCenter.postNotificationName(notification.rawValue, object: nil) + } +} \ No newline at end of file diff --git a/Harbor/StatusMenu.swift b/Harbor/StatusMenu.swift new file mode 100644 index 0000000..16d2371 --- /dev/null +++ b/Harbor/StatusMenu.swift @@ -0,0 +1,72 @@ +import Cocoa + +protocol StatusMenuDelegate: NSMenuDelegate { + func statusMenuDidSelectPreferences(statusMenu: StatusMenu) +} + +class StatusMenu: NSMenu, StatusMenuView { + // + // MARK: Dependencies + private var component = ViewComponent() + .parent { Application.component() } + .module { StatusMenuModule($0) } + + private lazy var presenter: StatusMenuPresenter = self.component.status.inject(self) + + // + // MARK: Properties + private let fixedMenuItemCount = 3 + private let statusBarItem = NSStatusBar.systemStatusBar().statusItemWithLength(-1) // NSVariableStatusItemLength + + required init?(coder: NSCoder) { + super.init(coder: coder) + + if Environment.active != .Testing { + presenter.didInitialize() + } + } + + // + // MARK: StatusMenuView + func createCoreMenuItems() { + statusBarItem.menu = self + + let preferences = itemAtIndex(1)! + preferences.target = self + preferences.action = #selector(StatusMenu.didClickPreferencesItem) + } + + func updateBuildStatus(status: BuildStatus) { + statusBarItem.image = status.icon() + } + + func updateProjects(projects: [ProjectMenuItemModel]) { + // clear stale projects, if any, from menu + let range = fixedMenuItemCount.. : Presenter { + // + // MARK: Dependencies + private let projectsInteractor: ProjectsInteractor + private let settings: Settings + + // + // MARK: Properties + init(view: V, projectsInteractor: ProjectsInteractor, settings: Settings) { + self.projectsInteractor = projectsInteractor + self.settings = settings + + super.init(view: view) + } + + override func didInitialize() { + super.didInitialize() + + view.createCoreMenuItems() + projectsInteractor.addListener(self.handleProjects) + } + + // + // MARK: Projects + private func handleProjects(projects: [Project]) { + // filter out projects the user disabled and convert them to menu item models + let disabledProjectIds = settings.disabledProjectIds + let enabledProjects = projects + .filter { !disabledProjectIds.contains($0.id) } + .map { ProjectMenuItemModel(project: $0) } + + view.updateProjects(enabledProjects) + view.updateBuildStatus(self.buildStatusFromProjects(enabledProjects)) + } + + private func buildStatusFromProjects(projects: [ProjectMenuItemModel]) -> BuildStatus { + if projects.count == 0 { + return .Unknown + } else if (projects.any { $0.isFailing }) { + return .Failing + } else { + return .Passing + } + } +} \ No newline at end of file diff --git a/Harbor/StatusMenuView.swift b/Harbor/StatusMenuView.swift new file mode 100644 index 0000000..1a9e99e --- /dev/null +++ b/Harbor/StatusMenuView.swift @@ -0,0 +1,5 @@ +protocol StatusMenuView : ViewType { + func createCoreMenuItems() + func updateBuildStatus(status: BuildStatus) + func updateProjects(projects: [ProjectMenuItemModel]) +} \ No newline at end of file diff --git a/Harbor/StatusView.swift b/Harbor/StatusView.swift deleted file mode 100644 index 47ec5f1..0000000 --- a/Harbor/StatusView.swift +++ /dev/null @@ -1,153 +0,0 @@ -// -// StatusView.swift -// Harbor -// -// Created by Erin Hochstatter on 8/16/14. -// Copyright (c) 2014 devMynd. All rights reserved. -// -import Cocoa - -class StatusView: NSView, NSMenuDelegate, NSPopoverDelegate { - - var active: Bool - var hasFailedBuild: Bool? - var hasPendingBuild: Bool? - - let appDelegate: AppDelegate = (NSApplication.sharedApplication().delegate as! AppDelegate) - var managedObjectContext: NSManagedObjectContext? - - var imageView: NSImageView - var popover: NSPopover? - var popoverViewController = PopoverViewController(nibName: "Popover", bundle: nil) - let statusBar: NSStatusBar - var statusItem: NSStatusItem - var statusItemMenu: NSMenu - - - - required init(coder aDecoder: (NSCoder!)) { - active = false - hasFailedBuild? = false - - statusBar = NSStatusBar.systemStatusBar() - imageView = NSImageView(frame: NSMakeRect(0, 0, statusBar.thickness, statusBar.thickness)) - statusItem = statusBar.statusItemWithLength(statusBar.thickness) - statusItem.image = NSImage(named: "codeshipLogo_black") - - statusItemMenu = NSMenu() - statusItem.menu = statusItemMenu - - self.addSubview(imageView) - statusItem.view = self - self.managedObjectContext = appDelegate.managedObjectContext! - self.setupMenu() - - } - - convenience init() { - active = false - hasFailedBuild? = false - hasPendingBuild? = false - - statusBar = NSStatusBar.systemStatusBar() - imageView = NSImageView(frame: NSMakeRect(0, 0, statusBar.thickness, statusBar.thickness)) - statusItem = statusBar.statusItemWithLength(statusBar.thickness) - statusItem.image = NSImage(named: "codeshipLogo_black") - - statusItemMenu = NSMenu() - statusItem.menu = statusItemMenu - - self.init(frame: imageView.frame) - - self.addSubview(imageView) - statusItem.view = self - self.managedObjectContext = appDelegate.managedObjectContext! - self.setupMenu() - - } - - // MARK: View Life Cycle - - func setupMenu(){ - statusItemMenu.delegate = self - statusItemMenu.autoenablesItems = false - statusItem.menu = statusItemMenu - self.updateUI() - } - - - func setIsActive(isActive: Bool) - { - active = isActive; - self.updateUI() - } - - func updateUI() - { - if self.hasPendingBuild == true { - self.imageView.image = NSImage(named: "codeshipLogo_black") - //add rotation - - } else if self.hasFailedBuild == true { - self.imageView.image = NSImage(named: "codeshipLogo_red") - - } else { - imageView.image = NSImage(named: "codeshipLogo_green") - } - - - self.setNeedsDisplayInRect(self.frame) - } - - override func drawRect(dirtyRect: NSRect) { - if(active){ - NSColor.selectedMenuItemColor().setFill() - NSRectFill(dirtyRect) - } else { - NSColor.clearColor().setFill() - NSRectFill(dirtyRect) - } - } - - // MARK: Actions - - override func mouseDown(theEvent: NSEvent) - { - if(active){ - self.hidePopover() - - } else { - popoverViewController?.managedObjectContext = self.managedObjectContext - self.showPopoverWithViewController(popoverViewController!) - } - } - - func showPopoverWithViewController(viewController: NSViewController){ - - if(popover == nil){ - popover = NSPopover() - popover?.behavior = NSPopoverBehavior.Semitransient - popover!.contentViewController = viewController - } - - if(!popover!.shown){ - popover!.showRelativeToRect(self.frame, ofView: self, preferredEdge: 1) - self.setIsActive(true) - - } - - } - - func hidePopover() { - if (popover != nil && popover!.shown){ - popover!.close() - self.setIsActive(false) - - } - } - - func quitMenuItemAction(sender: AnyObject){ - NSApplication.sharedApplication().terminate(self) - } - -} diff --git a/Harbor/TextField.swift b/Harbor/TextField.swift new file mode 100644 index 0000000..18ae11b --- /dev/null +++ b/Harbor/TextField.swift @@ -0,0 +1,40 @@ +import AppKit + +class TextField: NSTextField { + private let commandKey = NSEventModifierFlags.CommandKeyMask.rawValue + + override func performKeyEquivalent(theEvent: NSEvent) -> Bool { + if let key = self.unmodifiedKeyForEvent(theEvent) { + if let action = self.actionForKey(key) { + if NSApp.sendAction(action, to:nil, from:self) { + return true + } + } + } + + return super.performKeyEquivalent(theEvent) + } + + func unmodifiedKeyForEvent(event: NSEvent) -> String? { + if event.type == .KeyDown { + if (event.modifierFlags.rawValue & NSEventModifierFlags.DeviceIndependentModifierFlagsMask.rawValue) == commandKey { + return event.charactersIgnoringModifiers + } + } + + return nil + } + + func actionForKey(key: String) -> Selector? { + switch(key) { + case "x": + return #selector(NSText.cut(_:)) + case "c": + return #selector(NSText.copy(_:)) + case "v": + return #selector(NSText.paste(_:)) + default: + return nil + } + } +} \ No newline at end of file diff --git a/Harbor/TimerCoordinator.swift b/Harbor/TimerCoordinator.swift new file mode 100644 index 0000000..1d7367a --- /dev/null +++ b/Harbor/TimerCoordinator.swift @@ -0,0 +1,56 @@ +import Foundation + +class TimerCoordinator : NSObject { + // + // MARK: Dependencies + var settings: Settings! + var runLoop: RunLoop! + var projectsInteractor: ProjectsInteractor! + + // + // MARK: Properties + private var currentTimer: NSTimer? + + init(runLoop: RunLoop, projectsInteractor: ProjectsInteractor, settings: Settings) { + self.runLoop = runLoop + self.settings = settings + self.projectsInteractor = projectsInteractor + + super.init() + + settings.observeNotification(.RefreshRate) { notification in + self.startTimer() + } + } + + // + // MARK: Scheduling + func startup() { + startTimer() + } + + func startTimer() -> NSTimer? { + return setupTimer(settings.refreshRate) + } + + // + // MARK: Helpers + private func setupTimer(refreshRate: Double) -> NSTimer? { + // cancel current timer if necessary + currentTimer?.invalidate() + currentTimer = nil + + if !refreshRate.isZero { + currentTimer = NSTimer(timeInterval: refreshRate, target: self, selector:#selector(TimerCoordinator.handleUpdateTimer(_:)), userInfo: nil, repeats: true) + runLoop.addTimer(currentTimer!, forMode: NSDefaultRunLoopMode) + } + + return currentTimer + } + + func handleUpdateTimer(timer: NSTimer) { + if(timer == currentTimer) { + projectsInteractor.refreshProjects() + } + } +} \ No newline at end of file diff --git a/Harbor/UserDefaults.swift b/Harbor/UserDefaults.swift new file mode 100644 index 0000000..7eaf9b1 --- /dev/null +++ b/Harbor/UserDefaults.swift @@ -0,0 +1,44 @@ +import Foundation + +protocol UserDefaults { + func setObject(object: AnyObject?, forKey key: CustomStringConvertible) + func objectForKey(key: CustomStringConvertible) -> AnyObject? + + func setDouble(double: Double, forKey key: CustomStringConvertible) + func doubleForKey(key: CustomStringConvertible) -> Double + + func setBool(bool: Bool, forKey key: CustomStringConvertible) + func boolForKey(key: CustomStringConvertible) -> Bool + + func removeValueForKey(key: CustomStringConvertible) +} + +extension NSUserDefaults : UserDefaults { + func setObject(object: AnyObject?, forKey key: CustomStringConvertible) { + self.setObject(object, forKey: key.description) + } + + func objectForKey(key: CustomStringConvertible) -> AnyObject? { + return self.objectForKey(key.description) + } + + func setDouble(double: Double, forKey key: CustomStringConvertible) { + self.setDouble(double, forKey: key.description) + } + + func doubleForKey(key: CustomStringConvertible) -> Double { + return self.doubleForKey(key.description) + } + + func setBool(bool: Bool, forKey key: CustomStringConvertible) { + self.setBool(bool, forKey: key.description) + } + + func boolForKey(key: CustomStringConvertible) -> Bool { + return self.boolForKey(key.description) + } + + func removeValueForKey(key: CustomStringConvertible) { + self.removeObjectForKey(key.description) + } +} \ No newline at end of file diff --git a/Harbor/ViewType.swift b/Harbor/ViewType.swift new file mode 100644 index 0000000..1d47553 --- /dev/null +++ b/Harbor/ViewType.swift @@ -0,0 +1,5 @@ +import AppKit + +protocol ViewType : class { + +} \ No newline at end of file diff --git a/Harbor/anchor-pref.png b/Harbor/anchor-pref.png deleted file mode 100644 index 44bbcd3..0000000 Binary files a/Harbor/anchor-pref.png and /dev/null differ diff --git a/Harbor/anchor-pref@2x.png b/Harbor/anchor-pref@2x.png deleted file mode 100644 index 68b907f..0000000 Binary files a/Harbor/anchor-pref@2x.png and /dev/null differ diff --git a/Harbor/codeshipLogo_black.png b/Harbor/codeshipLogo_black.png index a1e84d5..ece8594 100644 Binary files a/Harbor/codeshipLogo_black.png and b/Harbor/codeshipLogo_black.png differ diff --git a/Harbor/codeshipLogo_black@2x.png b/Harbor/codeshipLogo_black@2x.png index 0284fad..83b662d 100644 Binary files a/Harbor/codeshipLogo_black@2x.png and b/Harbor/codeshipLogo_black@2x.png differ diff --git a/Harbor/codeshipLogo_green@2x.png b/Harbor/codeshipLogo_green@2px.png similarity index 100% rename from Harbor/codeshipLogo_green@2x.png rename to Harbor/codeshipLogo_green@2px.png diff --git a/Harbor/codeshipLogo_red@2x.png b/Harbor/codeshipLogo_red@2px.png similarity index 100% rename from Harbor/codeshipLogo_red@2x.png rename to Harbor/codeshipLogo_red@2px.png diff --git a/Harbor/quit.png b/Harbor/quit.png deleted file mode 100644 index fee6315..0000000 Binary files a/Harbor/quit.png and /dev/null differ diff --git a/Harbor/quit@2x.png b/Harbor/quit@2x.png deleted file mode 100644 index cc8c432..0000000 Binary files a/Harbor/quit@2x.png and /dev/null differ diff --git a/HarborHelper/HarborHelper.xcodeproj/project.pbxproj b/HarborHelper/HarborHelper.xcodeproj/project.pbxproj new file mode 100644 index 0000000..73cb71c --- /dev/null +++ b/HarborHelper/HarborHelper.xcodeproj/project.pbxproj @@ -0,0 +1,288 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 10DC90871BC2E09800811234 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10DC90861BC2E09800811234 /* AppDelegate.swift */; }; + 10DC90891BC2E09800811234 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 10DC90881BC2E09800811234 /* Assets.xcassets */; }; + 10DC908C1BC2E09800811234 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 10DC908A1BC2E09800811234 /* MainMenu.xib */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 10DC90831BC2E09800811234 /* HarborHelper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HarborHelper.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 10DC90861BC2E09800811234 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 10DC90881BC2E09800811234 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 10DC908B1BC2E09800811234 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 10DC908D1BC2E09800811234 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D00142C91BC3225100F5959B /* HarborHelper.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = HarborHelper.entitlements; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 10DC90801BC2E09800811234 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 10DC907A1BC2E09800811234 = { + isa = PBXGroup; + children = ( + 10DC90851BC2E09800811234 /* HarborHelper */, + 10DC90841BC2E09800811234 /* Products */, + ); + sourceTree = ""; + }; + 10DC90841BC2E09800811234 /* Products */ = { + isa = PBXGroup; + children = ( + 10DC90831BC2E09800811234 /* HarborHelper.app */, + ); + name = Products; + sourceTree = ""; + }; + 10DC90851BC2E09800811234 /* HarborHelper */ = { + isa = PBXGroup; + children = ( + D00142C91BC3225100F5959B /* HarborHelper.entitlements */, + 10DC90861BC2E09800811234 /* AppDelegate.swift */, + 10DC90881BC2E09800811234 /* Assets.xcassets */, + 10DC908A1BC2E09800811234 /* MainMenu.xib */, + 10DC908D1BC2E09800811234 /* Info.plist */, + ); + path = HarborHelper; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 10DC90821BC2E09800811234 /* HarborHelper */ = { + isa = PBXNativeTarget; + buildConfigurationList = 10DC90901BC2E09800811234 /* Build configuration list for PBXNativeTarget "HarborHelper" */; + buildPhases = ( + 10DC907F1BC2E09800811234 /* Sources */, + 10DC90801BC2E09800811234 /* Frameworks */, + 10DC90811BC2E09800811234 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = HarborHelper; + productName = HarborHelper; + productReference = 10DC90831BC2E09800811234 /* HarborHelper.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 10DC907B1BC2E09800811234 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0700; + ORGANIZATIONNAME = Devmynd; + TargetAttributes = { + 10DC90821BC2E09800811234 = { + CreatedOnToolsVersion = 7.0.1; + DevelopmentTeam = 5T84PP4W5D; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + }; + }; + buildConfigurationList = 10DC907E1BC2E09800811234 /* Build configuration list for PBXProject "HarborHelper" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 10DC907A1BC2E09800811234; + productRefGroup = 10DC90841BC2E09800811234 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 10DC90821BC2E09800811234 /* HarborHelper */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 10DC90811BC2E09800811234 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 10DC90891BC2E09800811234 /* Assets.xcassets in Resources */, + 10DC908C1BC2E09800811234 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 10DC907F1BC2E09800811234 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 10DC90871BC2E09800811234 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 10DC908A1BC2E09800811234 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 10DC908B1BC2E09800811234 /* Base */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 10DC908E1BC2E09800811234 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 10DC908F1BC2E09800811234 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + 10DC90911BC2E09800811234 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = HarborHelper/HarborHelper.entitlements; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = HarborHelper/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.dvm.Harbor.Helper; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 10DC90921BC2E09800811234 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = HarborHelper/HarborHelper.entitlements; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = HarborHelper/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.dvm.Harbor.Helper; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 10DC907E1BC2E09800811234 /* Build configuration list for PBXProject "HarborHelper" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 10DC908E1BC2E09800811234 /* Debug */, + 10DC908F1BC2E09800811234 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 10DC90901BC2E09800811234 /* Build configuration list for PBXNativeTarget "HarborHelper" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 10DC90911BC2E09800811234 /* Debug */, + 10DC90921BC2E09800811234 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 10DC907B1BC2E09800811234 /* Project object */; +} diff --git a/HarborHelper/HarborHelper/AppDelegate.swift b/HarborHelper/HarborHelper/AppDelegate.swift new file mode 100644 index 0000000..e9fed02 --- /dev/null +++ b/HarborHelper/HarborHelper/AppDelegate.swift @@ -0,0 +1,44 @@ +// +// AppDelegate.swift +// HarborHelper +// +// Created by Ty Cobb on 10/5/15. +// Copyright © 2015 Devmynd. All rights reserved. +// + +import Cocoa + +@NSApplicationMain +class AppDelegate: NSObject, NSApplicationDelegate { + func applicationDidFinishLaunching(aNotification: NSNotification) { + let app = NSWorkspace.sharedWorkspace().runningApplications.find { app in + return app.bundleIdentifier == "com.dvm.Harbor" + } + + // if the app isn't running, then let's start it + if app == nil || !app!.active { + let path = self.applicationPath() + NSWorkspace.sharedWorkspace().launchApplication(path) + } + + // kill the helper app + NSApp.terminate(nil) + } + + private func applicationPath() -> String { + var components = NSBundle.mainBundle().bundlePath.componentsSeparatedByString("/") + + // helper is at "Library/LoginItems/HarborHelper" relative to the app root + components.removeRange(components.count-3.. Bool) -> Generator.Element? { + return self.filter(predicate).first + } +} diff --git a/HarborHelper/HarborHelper/Assets.xcassets/AppIcon.appiconset/Contents.json b/HarborHelper/HarborHelper/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2db2b1c --- /dev/null +++ b/HarborHelper/HarborHelper/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Harbor/Base.lproj/MainMenu.xib b/HarborHelper/HarborHelper/Base.lproj/MainMenu.xib similarity index 54% rename from Harbor/Base.lproj/MainMenu.xib rename to HarborHelper/HarborHelper/Base.lproj/MainMenu.xib index 50a3a97..e9b2221 100644 --- a/Harbor/Base.lproj/MainMenu.xib +++ b/HarborHelper/HarborHelper/Base.lproj/MainMenu.xib @@ -1,7 +1,7 @@ - + - + @@ -11,15 +11,15 @@ - + - + - + - + @@ -33,7 +33,7 @@ - + @@ -51,7 +51,7 @@ - + @@ -342,6 +342,268 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -390,7 +652,7 @@ - + diff --git a/HarborHelper/HarborHelper/HarborHelper.entitlements b/HarborHelper/HarborHelper/HarborHelper.entitlements new file mode 100644 index 0000000..852fa1a --- /dev/null +++ b/HarborHelper/HarborHelper/HarborHelper.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/HarborHelper/HarborHelper/Info.plist b/HarborHelper/HarborHelper/Info.plist new file mode 100644 index 0000000..9119808 --- /dev/null +++ b/HarborHelper/HarborHelper/Info.plist @@ -0,0 +1,36 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSBackgroundOnly + + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2015 Devmynd. All rights reserved. + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/HarborTests/Example.swift b/HarborTests/Example.swift new file mode 100644 index 0000000..4caeb31 --- /dev/null +++ b/HarborTests/Example.swift @@ -0,0 +1,47 @@ +@testable import Harbor + +import Drip + +class Example { + // + // MARK: Subject + private let constructor: Example -> T + + var subject: T! + + // MARK: Components + lazy var app: AppComponent = AppComponent() + .module { InteractorModule($0) } + .module { ServiceModule($0) } + .module { SystemModule($0) } + + lazy var view: ViewComponent = ViewComponent() + .parent { self.app } + + // + // MARK: Dependencies + lazy var api = MockCodeshipApi() + lazy var runLoop = MockRunLoop() + lazy var keychain = MockKeychain() + lazy var defaults = MockUserDefaults() + + lazy var settings: Settings = self.app.interactor.inject() + lazy var projectsInteractor = MockProjectsProvider() + lazy var notificationCenter = MockNotificationCenter() + + // + // MARK: Lifecycle + init(_ constructor: Example -> T) { + self.constructor = constructor + subject = constructor(self) + } + + func rebuild(update: (Example -> Void)? = nil) -> Example { + let original = constructor + + return Example { copy in + update?(copy) + return original(copy) + } + } +} \ No newline at end of file diff --git a/HarborTests/HarborSpec.swift b/HarborTests/HarborSpec.swift new file mode 100644 index 0000000..3fd840e --- /dev/null +++ b/HarborTests/HarborSpec.swift @@ -0,0 +1,7 @@ +@testable import Harbor + +import Quick + +class HarborSpec : QuickSpec { + +} \ No newline at end of file diff --git a/HarborTests/HarborTests.swift b/HarborTests/HarborTests.swift deleted file mode 100644 index e25f43e..0000000 --- a/HarborTests/HarborTests.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// HarborTests.swift -// HarborTests -// -// Created by Erin Hochstatter on 11/6/14. -// Copyright (c) 2014 ekh. All rights reserved. -// - -import Cocoa -import XCTest - -class HarborTests: XCTestCase { - - override func setUp() { - super.setUp() - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - - func testExample() { - // This is an example of a functional test case. - XCTAssert(true, "Pass") - } - - func testPerformanceExample() { - // This is an example of a performance test case. - self.measureBlock() { - // Put the code you want to measure the time of here. - } - } - -} diff --git a/HarborTests/Info.plist b/HarborTests/Info.plist index d88c615..ba72822 100644 --- a/HarborTests/Info.plist +++ b/HarborTests/Info.plist @@ -4,12 +4,10 @@ CFBundleDevelopmentRegion en - LSApplicationCategoryType - CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - ekh.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/HarborTests/Invocation.swift b/HarborTests/Invocation.swift new file mode 100644 index 0000000..ecf72f5 --- /dev/null +++ b/HarborTests/Invocation.swift @@ -0,0 +1,32 @@ +// protocol all specialized method types must conform to +protocol MethodType : Equatable { + +} + +// container for invocation generation heleprs +struct Invocations { + +} + +// source invocation mocks can store; erases the value type +struct Invocation { + var method: M + var value: Any? + + init(_ method: M, _ value: Any?) { + self.method = method + self.value = value + } +} + +// expected invocation that captures type for running expectations against +// source invocations +struct ExpectedInvocation { + let method: M + let value: E? + + init(_ method: M, _ value: E?) { + self.method = method + self.value = value + } +} \ No newline at end of file diff --git a/HarborTests/InvocationMatchers.swift b/HarborTests/InvocationMatchers.swift new file mode 100644 index 0000000..b47155f --- /dev/null +++ b/HarborTests/InvocationMatchers.swift @@ -0,0 +1,57 @@ +import Nimble + +func match(expected: ExpectedInvocation) -> NonNilMatcherFunc> { + return NonNilMatcherFunc { actualExpression, failureMessage in + if let actual = try actualExpression.evaluate() { + return verifyInvocations(actual, expected) + } + + return false + } +} + +func haveAnyMatch>(expected: ExpectedInvocation) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + guard let actual = try actualExpression.evaluate() else { + return false + } + + // if we successfully match any invocation, then the match succeeds + for invocation in actual { + if verifyInvocations(invocation, expected) { + return true + } + } + + return false + } +} + +// +// MARK: Helpers +// + +private func verifyInvocations(actual: Invocation, _ expected: ExpectedInvocation) -> Bool { + // check methods and allow the comparator to evaluate value equality + let methodsEqual = actual.method == expected.method + // TODO: customize failure message if method comparison fails + if !methodsEqual { + return false + } + + if actual.value == nil && expected.value == nil { + return true + } + + // TODO: customize failure message if only actual is nil + guard let actualValue = actual.value else { + return false + } + + // TODO: customize failure message if only expected is nil + guard let expectedValue = expected.value else { + return false + } + + return expectedValue.verify(actualValue) +} \ No newline at end of file diff --git a/HarborTests/MockCodeshipApi.swift b/HarborTests/MockCodeshipApi.swift new file mode 100644 index 0000000..4634f42 --- /dev/null +++ b/HarborTests/MockCodeshipApi.swift @@ -0,0 +1,25 @@ +@testable import Harbor + +class MockCodeshipApi : CodeshipApiType { + var projects: [Project]? + + init() { + + } + + func getProjects(successHandler:([Project]) -> (), errorHandler:(String) -> ()) { + if let projects = self.projects { + successHandler(projects) + } else { + errorHandler("nope") + } + } + + func mockProjects() { + self.projects = self.generateProjects() + } + + func generateProjects() -> [Project] { + return (0...10).map { Project(id: $0) } + } +} \ No newline at end of file diff --git a/HarborTests/MockKeychain.swift b/HarborTests/MockKeychain.swift new file mode 100644 index 0000000..5447a91 --- /dev/null +++ b/HarborTests/MockKeychain.swift @@ -0,0 +1,30 @@ +@testable import Harbor + +class MockKeychain : Keychain { + enum Method : MethodType { + case SetString + case StringForKey + } + + var invocation: Invocation? + + func setString(value: String, forKey keyName: CustomStringConvertible) -> Bool { + invocation = Invocation(.SetString, value) + return true + } + + func stringForKey(keyName: CustomStringConvertible) -> String? { + invocation = Invocation(.StringForKey, self.invocation?.value) + return invocation?.value as! String? + } + + func removeValueForKey(key: CustomStringConvertible) -> Bool { + return false + } +} + +extension Invocations { + static func keychain(method: MockKeychain.Method, _ value: E) -> ExpectedInvocation { + return ExpectedInvocation(method, value) + } +} \ No newline at end of file diff --git a/HarborTests/MockNotificationCenter.swift b/HarborTests/MockNotificationCenter.swift new file mode 100644 index 0000000..1648526 --- /dev/null +++ b/HarborTests/MockNotificationCenter.swift @@ -0,0 +1,27 @@ +@testable import Harbor + +import Foundation + +class MockNotificationCenter : NotificationCenter { + enum Method : MethodType { + case AddObserverForName + case PostNotificationName + } + + var invocation: Invocation? + + func addObserverForName(name: String?, object obj: AnyObject?, queue: NSOperationQueue?, usingBlock block: (NSNotification) -> Void) -> NSObjectProtocol { + invocation = Invocation(.AddObserverForName, name) + return name! as NSString + } + + func postNotificationName(aName: String, object anObject: AnyObject?){ + invocation = Invocation(.PostNotificationName, aName) + } +} + +extension Invocations { + static func notification(method: MockNotificationCenter.Method, _ key: Settings.NotificationName) -> ExpectedInvocation { + return ExpectedInvocation(method, VerifierOf(key.rawValue)) + } +} \ No newline at end of file diff --git a/HarborTests/MockPreferencesView.swift b/HarborTests/MockPreferencesView.swift new file mode 100644 index 0000000..4197499 --- /dev/null +++ b/HarborTests/MockPreferencesView.swift @@ -0,0 +1,37 @@ +@testable import Harbor + +class MockPreferencesView : PreferencesView { + enum Method : MethodType { + case UpdateProjects + case UpdateRefreshRate + case UpdateApiKey + } + + var invocations: [Invocation] + + init() { + self.invocations = [Invocation]() + } + + func updateProjects(projects: [Project]) { + self.invocations.append(Invocation(.UpdateProjects, projects)) + } + + func updateRefreshRate(refreshRate: String) { + self.invocations.append(Invocation(.UpdateRefreshRate, refreshRate)) + } + + func updateApiKey(apiKey: String) { + self.invocations.append(Invocation(.UpdateApiKey, apiKey)) + } + + func updateLaunchOnLogin(launchOnLogin: Bool) { + + } +} + +extension Invocations { + static func preferencesView(method: MockPreferencesView.Method, _ value: E) -> ExpectedInvocation { + return ExpectedInvocation(method, value) + } +} \ No newline at end of file diff --git a/HarborTests/MockProjectsProvider.swift b/HarborTests/MockProjectsProvider.swift new file mode 100644 index 0000000..baaba38 --- /dev/null +++ b/HarborTests/MockProjectsProvider.swift @@ -0,0 +1,35 @@ +@testable import Harbor + +class MockProjectsProvider : ProjectsInteractor { + enum Method : MethodType { + case RefreshProjects + case RefreshCurrentProjects + case AddListener + } + + let projects : [Project] + var invocation: Invocation? + + init() { + projects = MockCodeshipApi().generateProjects() + } + + func refreshProjects(){ + invocation = Invocation(.RefreshProjects, None.Nothing) + } + + func refreshCurrentProjects(){ + invocation = Invocation(.RefreshCurrentProjects, None.Nothing) + } + + func addListener(listener: ProjectHandler){ + invocation = Invocation(.AddListener, None.Nothing) + listener(self.projects) + } +} + +extension Invocations { + static func projectsInteractor(method: MockProjectsProvider.Method, _ value: E) -> ExpectedInvocation { + return ExpectedInvocation(method, value) + } +} \ No newline at end of file diff --git a/HarborTests/MockRunLoop.swift b/HarborTests/MockRunLoop.swift new file mode 100644 index 0000000..82d412a --- /dev/null +++ b/HarborTests/MockRunLoop.swift @@ -0,0 +1,21 @@ +@testable import Harbor + +import Foundation + +class MockRunLoop : RunLoop { + enum Method : MethodType { + case AddTimer + } + + var invocation: Invocation? + + func addTimer(timer: NSTimer, forMode mode: String){ + invocation = Invocation(.AddTimer, timer) + } +} + +extension Invocations { + static func runloop(method: MockRunLoop.Method, _ value: E?) -> ExpectedInvocation { + return ExpectedInvocation(method, value) + } +} \ No newline at end of file diff --git a/HarborTests/MockUserDefaults.swift b/HarborTests/MockUserDefaults.swift new file mode 100644 index 0000000..a4d301c --- /dev/null +++ b/HarborTests/MockUserDefaults.swift @@ -0,0 +1,50 @@ +@testable import Harbor + +class MockUserDefaults : UserDefaults { + enum Method : MethodType { + case SetObject + case ObjectForKey + case SetDouble + case DoubleForKey + } + + var invocation: Invocation? + + func setObject(object: AnyObject?, forKey key: CustomStringConvertible) { + invocation = Invocation(.SetObject, object) + } + + func objectForKey(key: CustomStringConvertible) -> AnyObject? { + let lastValue = invocation?.value + invocation = Invocation(.ObjectForKey, lastValue) + return lastValue as! AnyObject? + } + + func setDouble(double: Double, forKey key: CustomStringConvertible) { + invocation = Invocation(.SetDouble, double) + } + + func doubleForKey(key: CustomStringConvertible) -> Double { + let lastValue = invocation?.value + invocation = Invocation(.DoubleForKey, lastValue) + return lastValue as? Double ?? 0.0 + } + + func setBool(bool: Bool, forKey key: CustomStringConvertible) { + + } + + func boolForKey(key: CustomStringConvertible) -> Bool { + return false + } + + func removeValueForKey(key: CustomStringConvertible) { + + } +} + +extension Invocations { + static func defaults(method: MockUserDefaults.Method, _ value: E) -> ExpectedInvocation { + return ExpectedInvocation(method, value) + } +} \ No newline at end of file diff --git a/HarborTests/None.swift b/HarborTests/None.swift new file mode 100644 index 0000000..50029e1 --- /dev/null +++ b/HarborTests/None.swift @@ -0,0 +1,3 @@ +enum None { + case Nothing +} \ No newline at end of file diff --git a/HarborTests/PreferencesPresenterSpec.swift b/HarborTests/PreferencesPresenterSpec.swift new file mode 100644 index 0000000..1d84f8e --- /dev/null +++ b/HarborTests/PreferencesPresenterSpec.swift @@ -0,0 +1,60 @@ +@testable import Harbor + +import Quick +import Nimble +import Drip + +class PreferencesPresenterSpec: HarborSpec { + override func spec() { + super.spec() + + var view: MockPreferencesView! + var example: Example>! + + beforeEach{ + view = MockPreferencesView() + + example = Example { ex in + ex.view.module(PreferencesViewModule.self) { PreferencesViewModule($0) } + ex.app.override(ex.projectsInteractor as ProjectsInteractor) + + return ex.view.preferences.inject(view) + } + } + + describe("presentation cycle"){ + it("listens to the projectsProvider") { + let invocation = Invocations.projectsInteractor(.AddListener, VerifierOf(None.Nothing)) + + example.subject.didInitialize() + expect(example.projectsInteractor.invocation).to(match(invocation)) + } + + it("sets the needsRefresh flag properly") { + example.subject.setNeedsRefresh() + expect(example.subject.needsRefresh).to(beTrue()) + } + + it("refreshes the view when it appears") { + example.subject.setNeedsRefresh() + expect(example.subject.needsRefresh).to(beTrue()) + + example.subject.didBecomeActive() + expect(example.subject.needsRefresh).to(beFalse()) + } + + it("refreshes the view when it disappears") { + example.subject.setNeedsRefresh() + expect(example.subject.needsRefresh).to(beTrue()) + + example.subject.didResignActive() + expect(example.subject.needsRefresh).to(beFalse()) + } + + xit("updates the view when refreshing") { + let invocation = Invocations.preferencesView(.UpdateApiKey, VerifierOf("asdf")) + expect(view.invocations).to(haveAnyMatch(invocation)) + } + } + } +} \ No newline at end of file diff --git a/HarborTests/ProjectsProviderSpec.swift b/HarborTests/ProjectsProviderSpec.swift new file mode 100644 index 0000000..28be6c6 --- /dev/null +++ b/HarborTests/ProjectsProviderSpec.swift @@ -0,0 +1,62 @@ +@testable import Harbor + +import Quick +import Nimble +import Drip + +class ProjectsProviderSpec: HarborSpec { + override func spec() { + super.spec() + + var example: Example! + var projects: [Project]? + + beforeEach { + example = Example { ex in + ex.app + .override(ex.notificationCenter as NotificationCenter) + .override(ex.api as CodeshipApiType) + + return ex.app.interactor.inject() + } + + example.subject.addListener { local in + projects = local + } + } + + describe("refreshing projects") { + beforeEach { + example.api.mockProjects() + example.subject.refreshProjects() + } + + it("refreshes all projects") { + expect(projects).to(equal(example.api.projects!)) + } + + it("updates the disabled projects when the disabledProjectIds change") { + let disabledIds = [0] + + example.settings.disabledProjectIds = disabledIds + example.subject.refreshCurrentProjects() + + expect(projects).to(allPass { project in + return !disabledIds.contains(project!.id) == project!.isEnabled + }) + } + } + + describe("when a listener is added"){ + it("calls the listener back immediately with the current projects") { + let projects = [ Project(id: 5) ] + + example.api.projects = projects + example.subject.refreshProjects() + example.subject.addListener { local in + expect(local).to(equal(projects)) + } + } + } + } +} diff --git a/HarborTests/SampleBuild.json b/HarborTests/SampleBuild.json new file mode 100644 index 0000000..902e034 --- /dev/null +++ b/HarborTests/SampleBuild.json @@ -0,0 +1,12 @@ +{ + id: 6510210, + uuid: "f9b83410-fcda-0132-9304-0a454b72204a", + project_id: 57847, + status: "success", + github_username: "Miaplacidus", + commit_id: "afc571548260e4e0ccc8ca7ead63f851476de502", + message: "Fix JSON parsing error by changing column name in FeedbackMessages table", + branch: "master", + started_at: "2015-06-24T20:10:26.059Z", + finished_at: "2015-06-24T20:13:34.539Z" +} \ No newline at end of file diff --git a/HarborTests/SamplePayload.json b/HarborTests/SamplePayload.json new file mode 100644 index 0000000..e7f87dc --- /dev/null +++ b/HarborTests/SamplePayload.json @@ -0,0 +1,24 @@ +{ +projects: [ + { + id: 57847, + uuid: "77b1edc0-8258-0132-1f00-72ed2dde02fa", + repository_name: "devmynd/booth-performance-tracker", + repository_provider: "github", + builds: [ + { + id: 6510210, + uuid: "f9b83410-fcda-0132-9304-0a454b72204a", + project_id: 57847, + status: "success", + github_username: "Miaplacidus", + commit_id: "afc571548260e4e0ccc8ca7ead63f851476de502", + message: "Fix JSON parsing error by changing column name in FeedbackMessages table", + branch: "master", + started_at: "2015-06-24T20:10:26.059Z", + finished_at: "2015-06-24T20:13:34.539Z" + }, + ] + } + ] +} \ No newline at end of file diff --git a/HarborTests/SampleProject.json b/HarborTests/SampleProject.json new file mode 100644 index 0000000..b56d8e1 --- /dev/null +++ b/HarborTests/SampleProject.json @@ -0,0 +1,7 @@ +{ + id: 57847, + uuid: "77b1edc0-8258-0132-1f00-72ed2dde02fa", + repository_name: "devmynd/booth-performance-tracker", + repository_provider: "github", + builds: [] +} diff --git a/HarborTests/SettingsSpec.swift b/HarborTests/SettingsSpec.swift new file mode 100644 index 0000000..494d187 --- /dev/null +++ b/HarborTests/SettingsSpec.swift @@ -0,0 +1,117 @@ +@testable import Harbor + +import Quick +import Nimble +import Drip + +class SettingsSpec: HarborSpec { + override func spec() { + super.spec() + + var example: Example! + + beforeEach { + example = Example { ex in + ex.app + .override(ex.keychain as Keychain) + .override(ex.defaults as UserDefaults) + .override(ex.notificationCenter as NotificationCenter) + + return ex.app.interactor.inject() + } + } + + describe("the initializer"){ + it("retrieves the correct API Key") { + let apiKey = "12903jasjfd0aj21" + example.subject.apiKey = apiKey + + let local = example.rebuild { $0.keychain = example.keychain } + expect(local.subject.apiKey).to(equal(apiKey)) + } + + it("retrieves the correct refresh rate"){ + let refreshRate = 60.0 + example.subject.refreshRate = refreshRate + + let local = example.rebuild { $0.defaults = example.defaults } + expect(local.subject.refreshRate).to(equal(refreshRate)) + } + + it("retrieves the correct disabled project ids"){ + let disabledProjectIds = [1, 2, 3, 4] + example.subject.disabledProjectIds = disabledProjectIds + + let local = example.rebuild { $0.defaults = example.defaults } + expect(local.subject.disabledProjectIds).to(equal(disabledProjectIds)) + } + } + + describe("setting") { + describe("the refresh rate") { + let value = 60.0 + + it("updates user defaults with the given rate"){ + let invocation = Invocations.defaults(.SetDouble, VerifierOf(value)) + + example.subject.refreshRate = value + expect(example.defaults.invocation).to(match(invocation)) + } + + it("posts a notification") { + let invocation = Invocations.notification(.PostNotificationName, .RefreshRate) + example.subject.refreshRate = value + expect(example.notificationCenter.invocation).to(match(invocation)) + } + } + + describe("the API key") { + let apiKey = "9900alk00sd52fjsadlkjfsal" + + it("sets the API Key in the keychain"){ + let invocation = Invocations.keychain(.SetString, VerifierOf(apiKey)) + + example.subject.apiKey = apiKey + expect(example.keychain.invocation).to(match(invocation)) + } + + it("posts a notification") { + let invocation = Invocations.notification(.PostNotificationName, .ApiKey) + + example.subject.apiKey = apiKey + expect(example.notificationCenter.invocation).to(match(invocation)) + } + } + + describe("the disabled projects array") { + let disabledProjectIds = [3, 17, 23, 50] + + it("sends user defaults the disabled project id array"){ + let invocation = Invocations.defaults(.SetObject, VerifierOf(disabledProjectIds)) + + example.subject.disabledProjectIds = disabledProjectIds + expect(example.defaults.invocation).to(match(invocation)) + } + + it("posts a notification") { + let invocation = Invocations.notification(.PostNotificationName, .DisabledProjects) + + example.subject.disabledProjectIds = disabledProjectIds + expect(example.notificationCenter.invocation).to(match(invocation)) + } + } + } + + describe("notification extension") { + describe("observeNotification") { + it("should add an observer to notification center") { + let notification = Settings.NotificationName.ApiKey + let invocation = Invocations.notification(.AddObserverForName, notification) + + example.subject.observeNotification(notification, handler: { _ in }) + expect(example.notificationCenter.invocation).to(match(invocation)) + } + } + } + } +} diff --git a/HarborTests/TimerCoordinatorSpec.swift b/HarborTests/TimerCoordinatorSpec.swift new file mode 100644 index 0000000..7fc7650 --- /dev/null +++ b/HarborTests/TimerCoordinatorSpec.swift @@ -0,0 +1,67 @@ +@testable import Harbor + +import Quick +import Nimble +import Drip + +class TimerCoordinatorSpec: HarborSpec { + override func spec() { + super.spec() + + var example: Example! + + beforeEach { + example = Example { ex in + ex.app + .override(ex.runLoop as RunLoop) + .override(ex.notificationCenter as NotificationCenter) + .override(ex.projectsInteractor as ProjectsInteractor) + + return ex.app.interactor.inject() + } + } + + describe("the initializer") { + it("observes the settings' refresh rate"){ + let invocation = Invocations.notification(.AddObserverForName, .RefreshRate) + expect(example.notificationCenter.invocation).to(match(invocation)) + } + } + + describe("when starting a timer") { + beforeEach { + example.settings.refreshRate = 60.0 + } + + it("should not create a timer when the refresh rate is 0.0") { + example.settings.refreshRate = 0.0 + + let timer = example.subject.startTimer() + expect(timer).to(beNil()) + } + + it("creates a timer") { + let timer = example.subject.startTimer() + expect(timer).toNot(beNil()) + expect(timer!.timeInterval).to(equal(example.settings.refreshRate)) + } + + it("adds the timer to the run loop") { + let timer = example.subject.startTimer() + let invocation = Invocations.runloop(.AddTimer, VerifierOf(timer)) + + expect(example.runLoop.invocation).to(match(invocation)) + } + + context("when there's an existing timer") { + it("cancels the existing timer") { + let existingTimer = example.subject.startTimer() + let currentTimer = example.subject.startTimer() + + expect(existingTimer?.valid).to(beFalse()) + expect(existingTimer).toNot(equal(currentTimer)) + } + } + } + } +} \ No newline at end of file diff --git a/HarborTests/Verifiable.swift b/HarborTests/Verifiable.swift new file mode 100644 index 0000000..2ff3dfe --- /dev/null +++ b/HarborTests/Verifiable.swift @@ -0,0 +1,3 @@ +protocol Verifiable { + func verify(actual: Any) -> Bool +} \ No newline at end of file diff --git a/HarborTests/VerifierOf.swift b/HarborTests/VerifierOf.swift new file mode 100644 index 0000000..308008c --- /dev/null +++ b/HarborTests/VerifierOf.swift @@ -0,0 +1,29 @@ +import Foundation + +struct VerifierOf : Verifiable { + private let verifier: (Any) -> Bool + + init(_ element: E?) { + self.verifier = { actual in + guard let element = element else { + return false + } + + return (actual as! E) == element + } + } + + init(_ sequence: S?) { + self.verifier = { actual in + guard let sequence = sequence else { + return false + } + + return (actual as! S).elementsEqual(sequence) + } + } + + func verify(actual: Any) -> Bool { + return self.verifier(actual) + } +} \ No newline at end of file diff --git a/Podfile b/Podfile new file mode 100644 index 0000000..d9f1fa2 --- /dev/null +++ b/Podfile @@ -0,0 +1,20 @@ +source 'https://github.com/CocoaPods/Specs.git' + +# platform +platform :osx, '10.10' +use_frameworks! + +# build configuration inheritance +project 'Harbor', 'Test' => :debug + +# dependencies +target 'Harbor' do + pod 'Alamofire', '~> 3.0' + pod 'Drip', '~> 0.1' + + target 'HarborTests' do + pod 'Quick', '~> 0.9' + pod 'Nimble', '~> 4.0' + end +end + diff --git a/Podfile.lock b/Podfile.lock new file mode 100644 index 0000000..50f39c8 --- /dev/null +++ b/Podfile.lock @@ -0,0 +1,21 @@ +PODS: + - Alamofire (3.2.1) + - Drip (0.1.0) + - Nimble (4.0.1) + - Quick (0.9.1) + +DEPENDENCIES: + - Alamofire (~> 3.0) + - Drip (~> 0.1) + - Nimble (~> 4.0) + - Quick (~> 0.9) + +SPEC CHECKSUMS: + Alamofire: f11d8624a05f5d39e0c99309b3e600a3ba64298a + Drip: b499d3537bbe35630bde86a95a0d6521520c7625 + Nimble: 0f3c8b8b084cda391209c3c5efbb48bedeeb920a + Quick: a5221fc21788b6aeda934805e68b061839bc3165 + +PODFILE CHECKSUM: 48a24fdf9dc6683748ff23878c99f0e521ea7b97 + +COCOAPODS: 1.0.0 diff --git a/Pods/Alamofire/LICENSE b/Pods/Alamofire/LICENSE new file mode 100644 index 0000000..bf300e4 --- /dev/null +++ b/Pods/Alamofire/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Pods/Alamofire/README.md b/Pods/Alamofire/README.md new file mode 100644 index 0000000..ebc35db --- /dev/null +++ b/Pods/Alamofire/README.md @@ -0,0 +1,1196 @@ +![Alamofire: Elegant Networking in Swift](https://raw.githubusercontent.com/Alamofire/Alamofire/assets/alamofire.png) + +[![Build Status](https://travis-ci.org/Alamofire/Alamofire.svg)](https://travis-ci.org/Alamofire/Alamofire) +[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/Alamofire.svg)](https://img.shields.io/cocoapods/v/Alamofire.svg) +[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) +[![Platform](https://img.shields.io/cocoapods/p/Alamofire.svg?style=flat)](http://cocoadocs.org/docsets/Alamofire) +[![Twitter](https://img.shields.io/badge/twitter-@AlamofireSF-blue.svg?style=flat)](http://twitter.com/AlamofireSF) + +Alamofire is an HTTP networking library written in Swift. + +## Features + +- [x] Chainable Request / Response methods +- [x] URL / JSON / plist Parameter Encoding +- [x] Upload File / Data / Stream / MultipartFormData +- [x] Download using Request or Resume data +- [x] Authentication with NSURLCredential +- [x] HTTP Response Validation +- [x] TLS Certificate and Public Key Pinning +- [x] Progress Closure & NSProgress +- [x] cURL Debug Output +- [x] Comprehensive Unit Test Coverage +- [x] [Complete Documentation](http://cocoadocs.org/docsets/Alamofire) + +## Component Libraries + +In order to keep Alamofire focused specifically on core networking implementations, additional component libraries have been created by the [Alamofire Software Foundation](https://github.com/Alamofire/Foundation) to bring additional functionality to the Alamofire ecosystem. + +* [AlamofireImage](https://github.com/Alamofire/AlamofireImage) - An image library including image response serializers, `UIImage` and `UIImageView` extensions, custom image filters, an auto-purging in-memory cache and a priority-based image downloading system. +* [AlamofireNetworkActivityIndicator](https://github.com/Alamofire/AlamofireNetworkActivityIndicator) - Controls the visibility of the network activity indicator on iOS using Alamofire. It contains configurable delay timers to help mitigate flicker and can support `NSURLSession` instances not managed by Alamofire. + +## Requirements + +- iOS 8.0+ / Mac OS X 10.9+ / tvOS 9.0+ / watchOS 2.0+ +- Xcode 7.2+ + +## Migration Guides + +- [Alamofire 3.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%203.0%20Migration%20Guide.md) +- [Alamofire 2.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%202.0%20Migration%20Guide.md) + +## Communication + +- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/alamofire). (Tag 'alamofire') +- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/alamofire). +- If you **found a bug**, open an issue. +- If you **have a feature request**, open an issue. +- If you **want to contribute**, submit a pull request. + +## Installation + +> **Embedded frameworks require a minimum deployment target of iOS 8 or OS X Mavericks (10.9).** +> +> Alamofire is no longer supported on iOS 7 due to the lack of support for frameworks. Without frameworks, running Travis-CI against iOS 7 would require a second duplicated test target. The separate test suite would need to import all the Swift files and the tests would need to be duplicated and re-written. This split would be too difficult to maintain to ensure the highest possible quality of the Alamofire ecosystem. + +### CocoaPods + +[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command: + +```bash +$ gem install cocoapods +``` + +> CocoaPods 0.39.0+ is required to build Alamofire 3.0.0+. + +To integrate Alamofire into your Xcode project using CocoaPods, specify it in your `Podfile`: + +```ruby +source 'https://github.com/CocoaPods/Specs.git' +platform :ios, '8.0' +use_frameworks! + +pod 'Alamofire', '~> 3.0' +``` + +Then, run the following command: + +```bash +$ pod install +``` + +### Carthage + +[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. + +You can install Carthage with [Homebrew](http://brew.sh/) using the following command: + +```bash +$ brew update +$ brew install carthage +``` + +To integrate Alamofire into your Xcode project using Carthage, specify it in your `Cartfile`: + +```ogdl +github "Alamofire/Alamofire" ~> 3.0 +``` + +Run `carthage update` to build the framework and drag the built `Alamofire.framework` into your Xcode project. + +### Manually + +If you prefer not to use either of the aforementioned dependency managers, you can integrate Alamofire into your project manually. + +#### Embedded Framework + +- Open up Terminal, `cd` into your top-level project directory, and run the following command "if" your project is not initialized as a git repository: + +```bash +$ git init +``` + +- Add Alamofire as a git [submodule](http://git-scm.com/docs/git-submodule) by running the following command: + +```bash +$ git submodule add https://github.com/Alamofire/Alamofire.git +``` + +- Open the new `Alamofire` folder, and drag the `Alamofire.xcodeproj` into the Project Navigator of your application's Xcode project. + + > It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter. + +- Select the `Alamofire.xcodeproj` in the Project Navigator and verify the deployment target matches that of your application target. +- Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar. +- In the tab bar at the top of that window, open the "General" panel. +- Click on the `+` button under the "Embedded Binaries" section. +- You will see two different `Alamofire.xcodeproj` folders each with two different versions of the `Alamofire.framework` nested inside a `Products` folder. + + > It does not matter which `Products` folder you choose from, but it does matter whether you choose the top or bottom `Alamofire.framework`. + +- Select the top `Alamofire.framework` for iOS and the bottom one for OS X. + + > You can verify which one you selected by inspecting the build log for your project. The build target for `Alamofire` will be listed as either `Alamofire iOS` or `Alamofire OSX`. + +- And that's it! + +> The `Alamofire.framework` is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device. + +--- + +## Usage + +### Making a Request + +```swift +import Alamofire + +Alamofire.request(.GET, "https://httpbin.org/get") +``` + +### Response Handling + +```swift +Alamofire.request(.GET, "https://httpbin.org/get", parameters: ["foo": "bar"]) + .responseJSON { response in + print(response.request) // original URL request + print(response.response) // URL response + print(response.data) // server data + print(response.result) // result of response serialization + + if let JSON = response.result.value { + print("JSON: \(JSON)") + } + } +``` + +> Networking in Alamofire is done _asynchronously_. Asynchronous programming may be a source of frustration to programmers unfamiliar with the concept, but there are [very good reasons](https://developer.apple.com/library/ios/qa/qa1693/_index.html) for doing it this way. + +> Rather than blocking execution to wait for a response from the server, a [callback](http://en.wikipedia.org/wiki/Callback_%28computer_programming%29) is specified to handle the response once it's received. The result of a request is only available inside the scope of a response handler. Any execution contingent on the response or data received from the server must be done within a handler. + +### Response Serialization + +**Built-in Response Methods** + +- `response()` +- `responseData()` +- `responseString(encoding: NSStringEncoding)` +- `responseJSON(options: NSJSONReadingOptions)` +- `responsePropertyList(options: NSPropertyListReadOptions)` + +#### Response Handler + +```swift +Alamofire.request(.GET, "https://httpbin.org/get", parameters: ["foo": "bar"]) + .response { request, response, data, error in + print(request) + print(response) + print(data) + print(error) + } +``` + +> The `response` serializer does NOT evaluate any of the response data. It merely forwards on all the information directly from the URL session delegate. We strongly encourage you to leverage the other response serializers taking advantage of `Response` and `Result` types. + +#### Response Data Handler + +```swift +Alamofire.request(.GET, "https://httpbin.org/get", parameters: ["foo": "bar"]) + .responseData { response in + print(response.request) + print(response.response) + print(response.result) + } +``` + +#### Response String Handler + +```swift +Alamofire.request(.GET, "https://httpbin.org/get") + .responseString { response in + print("Success: \(response.result.isSuccess)") + print("Response String: \(response.result.value)") + } +``` + +#### Response JSON Handler + +```swift +Alamofire.request(.GET, "https://httpbin.org/get") + .responseJSON { response in + debugPrint(response) + } +``` + +#### Chained Response Handlers + +Response handlers can even be chained: + +```swift +Alamofire.request(.GET, "https://httpbin.org/get") + .responseString { response in + print("Response String: \(response.result.value)") + } + .responseJSON { response in + print("Response JSON: \(response.result.value)") + } +``` + +### HTTP Methods + +`Alamofire.Method` lists the HTTP methods defined in [RFC 7231 §4.3](http://tools.ietf.org/html/rfc7231#section-4.3): + +```swift +public enum Method: String { + case OPTIONS, GET, HEAD, POST, PUT, PATCH, DELETE, TRACE, CONNECT +} +``` + +These values can be passed as the first argument of the `Alamofire.request` method: + +```swift +Alamofire.request(.POST, "https://httpbin.org/post") + +Alamofire.request(.PUT, "https://httpbin.org/put") + +Alamofire.request(.DELETE, "https://httpbin.org/delete") +``` + +### Parameters + +#### GET Request With URL-Encoded Parameters + +```swift +Alamofire.request(.GET, "https://httpbin.org/get", parameters: ["foo": "bar"]) +// https://httpbin.org/get?foo=bar +``` + +#### POST Request With URL-Encoded Parameters + +```swift +let parameters = [ + "foo": "bar", + "baz": ["a", 1], + "qux": [ + "x": 1, + "y": 2, + "z": 3 + ] +] + +Alamofire.request(.POST, "https://httpbin.org/post", parameters: parameters) +// HTTP body: foo=bar&baz[]=a&baz[]=1&qux[x]=1&qux[y]=2&qux[z]=3 +``` + +### Parameter Encoding + +Parameters can also be encoded as JSON, Property List, or any custom format, using the `ParameterEncoding` enum: + +```swift +enum ParameterEncoding { + case URL + case URLEncodedInURL + case JSON + case PropertyList(format: NSPropertyListFormat, options: NSPropertyListWriteOptions) + case Custom((URLRequestConvertible, [String: AnyObject]?) -> (NSMutableURLRequest, NSError?)) + + func encode(request: NSURLRequest, parameters: [String: AnyObject]?) -> (NSURLRequest, NSError?) + { ... } +} +``` + +- `URL`: A query string to be set as or appended to any existing URL query for `GET`, `HEAD`, and `DELETE` requests, or set as the body for requests with any other HTTP method. The `Content-Type` HTTP header field of an encoded request with HTTP body is set to `application/x-www-form-urlencoded`. _Since there is no published specification for how to encode collection types, Alamofire follows the convention of appending `[]` to the key for array values (`foo[]=1&foo[]=2`), and appending the key surrounded by square brackets for nested dictionary values (`foo[bar]=baz`)._ +- `URLEncodedInURL`: Creates query string to be set as or appended to any existing URL query. Uses the same implementation as the `.URL` case, but always applies the encoded result to the URL. +- `JSON`: Uses `NSJSONSerialization` to create a JSON representation of the parameters object, which is set as the body of the request. The `Content-Type` HTTP header field of an encoded request is set to `application/json`. +- `PropertyList`: Uses `NSPropertyListSerialization` to create a plist representation of the parameters object, according to the associated format and write options values, which is set as the body of the request. The `Content-Type` HTTP header field of an encoded request is set to `application/x-plist`. +- `Custom`: Uses the associated closure value to construct a new request given an existing request and parameters. + +#### Manual Parameter Encoding of an NSURLRequest + +```swift +let URL = NSURL(string: "https://httpbin.org/get")! +var request = NSMutableURLRequest(URL: URL) + +let parameters = ["foo": "bar"] +let encoding = Alamofire.ParameterEncoding.URL +(request, _) = encoding.encode(request, parameters: parameters) +``` + +#### POST Request with JSON-encoded Parameters + +```swift +let parameters = [ + "foo": [1,2,3], + "bar": [ + "baz": "qux" + ] +] + +Alamofire.request(.POST, "https://httpbin.org/post", parameters: parameters, encoding: .JSON) +// HTTP body: {"foo": [1, 2, 3], "bar": {"baz": "qux"}} +``` + +### HTTP Headers + +Adding a custom HTTP header to a `Request` is supported directly in the global `request` method. This makes it easy to attach HTTP headers to a `Request` that can be constantly changing. + +> For HTTP headers that do not change, it is recommended to set them on the `NSURLSessionConfiguration` so they are automatically applied to any `NSURLSessionTask` created by the underlying `NSURLSession`. + +```swift +let headers = [ + "Authorization": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", + "Content-Type": "application/x-www-form-urlencoded" +] + +Alamofire.request(.GET, "https://httpbin.org/get", headers: headers) + .responseJSON { response in + debugPrint(response) + } +``` + +### Caching + +Caching is handled on the system framework level by [`NSURLCache`](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURLCache_Class/Reference/Reference.html#//apple_ref/occ/cl/NSURLCache). + +### Uploading + +**Supported Upload Types** + +- File +- Data +- Stream +- MultipartFormData + +#### Uploading a File + +```swift +let fileURL = NSBundle.mainBundle().URLForResource("Default", withExtension: "png") +Alamofire.upload(.POST, "https://httpbin.org/post", file: fileURL) +``` + +#### Uploading with Progress + +```swift +Alamofire.upload(.POST, "https://httpbin.org/post", file: fileURL) + .progress { bytesWritten, totalBytesWritten, totalBytesExpectedToWrite in + print(totalBytesWritten) + + // This closure is NOT called on the main queue for performance + // reasons. To update your ui, dispatch to the main queue. + dispatch_async(dispatch_get_main_queue()) { + print("Total bytes written on main queue: \(totalBytesWritten)") + } + } + .responseJSON { response in + debugPrint(response) + } +``` + +#### Uploading MultipartFormData + +```swift +Alamofire.upload( + .POST, + "https://httpbin.org/post", + multipartFormData: { multipartFormData in + multipartFormData.appendBodyPart(fileURL: unicornImageURL, name: "unicorn") + multipartFormData.appendBodyPart(fileURL: rainbowImageURL, name: "rainbow") + }, + encodingCompletion: { encodingResult in + switch encodingResult { + case .Success(let upload, _, _): + upload.responseJSON { response in + debugPrint(response) + } + case .Failure(let encodingError): + print(encodingError) + } + } +) +``` + +### Downloading + +**Supported Download Types** + +- Request +- Resume Data + +#### Downloading a File + +```swift +Alamofire.download(.GET, "https://httpbin.org/stream/100") { temporaryURL, response in + let fileManager = NSFileManager.defaultManager() + let directoryURL = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] + let pathComponent = response.suggestedFilename + + return directoryURL.URLByAppendingPathComponent(pathComponent!) +} +``` + +#### Using the Default Download Destination + +```swift +let destination = Alamofire.Request.suggestedDownloadDestination(directory: .DocumentDirectory, domain: .UserDomainMask) +Alamofire.download(.GET, "https://httpbin.org/stream/100", destination: destination) +``` + +#### Downloading a File w/Progress + +```swift +Alamofire.download(.GET, "https://httpbin.org/stream/100", destination: destination) + .progress { bytesRead, totalBytesRead, totalBytesExpectedToRead in + print(totalBytesRead) + + // This closure is NOT called on the main queue for performance + // reasons. To update your ui, dispatch to the main queue. + dispatch_async(dispatch_get_main_queue()) { + print("Total bytes read on main queue: \(totalBytesRead)") + } + } + .response { _, _, _, error in + if let error = error { + print("Failed with error: \(error)") + } else { + print("Downloaded file successfully") + } + } +``` + +#### Accessing Resume Data for Failed Downloads + +```swift +Alamofire.download(.GET, "https://httpbin.org/stream/100", destination: destination) + .response { _, _, data, _ in + if let + data = data, + resumeDataString = NSString(data: data, encoding: NSUTF8StringEncoding) + { + print("Resume Data: \(resumeDataString)") + } else { + print("Resume Data was empty") + } + } +``` + +> The `data` parameter is automatically populated with the `resumeData` if available. + +```swift +let download = Alamofire.download(.GET, "https://httpbin.org/stream/100", destination: destination) +download.response { _, _, _, _ in + if let + resumeData = download.resumeData, + resumeDataString = NSString(data: resumeData, encoding: NSUTF8StringEncoding) + { + print("Resume Data: \(resumeDataString)") + } else { + print("Resume Data was empty") + } +} +``` + +### Authentication + +Authentication is handled on the system framework level by [`NSURLCredential` and `NSURLAuthenticationChallenge`](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURLAuthenticationChallenge_Class/Reference/Reference.html). + +**Supported Authentication Schemes** + +- [HTTP Basic](http://en.wikipedia.org/wiki/Basic_access_authentication) +- [HTTP Digest](http://en.wikipedia.org/wiki/Digest_access_authentication) +- [Kerberos](http://en.wikipedia.org/wiki/Kerberos_%28protocol%29) +- [NTLM](http://en.wikipedia.org/wiki/NT_LAN_Manager) + +#### HTTP Basic Authentication + +The `authenticate` method on a `Request` will automatically provide an `NSURLCredential` to an `NSURLAuthenticationChallenge` when appropriate: + +```swift +let user = "user" +let password = "password" + +Alamofire.request(.GET, "https://httpbin.org/basic-auth/\(user)/\(password)") + .authenticate(user: user, password: password) + .responseJSON { response in + debugPrint(response) + } +``` + +Depending upon your server implementation, an `Authorization` header may also be appropriate: + +```swift +let user = "user" +let password = "password" + +let credentialData = "\(user):\(password)".dataUsingEncoding(NSUTF8StringEncoding)! +let base64Credentials = credentialData.base64EncodedStringWithOptions([]) + +let headers = ["Authorization": "Basic \(base64Credentials)"] + +Alamofire.request(.GET, "https://httpbin.org/basic-auth/user/password", headers: headers) + .responseJSON { response in + debugPrint(response) + } +``` + +#### Authentication with NSURLCredential + +```swift +let user = "user" +let password = "password" + +let credential = NSURLCredential(user: user, password: password, persistence: .ForSession) + +Alamofire.request(.GET, "https://httpbin.org/basic-auth/\(user)/\(password)") + .authenticate(usingCredential: credential) + .responseJSON { response in + debugPrint(response) + } +``` + +### Validation + +By default, Alamofire treats any completed request to be successful, regardless of the content of the response. Calling `validate` before a response handler causes an error to be generated if the response had an unacceptable status code or MIME type. + +#### Manual Validation + +```swift +Alamofire.request(.GET, "https://httpbin.org/get", parameters: ["foo": "bar"]) + .validate(statusCode: 200..<300) + .validate(contentType: ["application/json"]) + .response { response in + print(response) + } +``` + +#### Automatic Validation + +Automatically validates status code within `200...299` range, and that the `Content-Type` header of the response matches the `Accept` header of the request, if one is provided. + +```swift +Alamofire.request(.GET, "https://httpbin.org/get", parameters: ["foo": "bar"]) + .validate() + .responseJSON { response in + switch response.result { + case .Success: + print("Validation Successful") + case .Failure(let error): + print(error) + } + } +``` + +### Timeline + +Alamofire collects timings throughout the lifecycle of a `Request` and creates a `Timeline` object exposed as a property on a `Response`. + +```swift +Alamofire.request(.GET, "https://httpbin.org/get", parameters: ["foo": "bar"]) + .validate() + .responseJSON { response in + print(response.timeline) + } +``` + +The above reports the following `Timeline` info: + +- `Latency`: 0.428 seconds +- `Request Duration`: 0.428 seconds +- `Serialization Duration`: 0.001 seconds +- `Total Duration`: 0.429 seconds + +### Printable + +```swift +let request = Alamofire.request(.GET, "https://httpbin.org/ip") + +print(request) +// GET https://httpbin.org/ip (200) +``` + +### DebugPrintable + +```swift +let request = Alamofire.request(.GET, "https://httpbin.org/get", parameters: ["foo": "bar"]) + +debugPrint(request) +``` + +#### Output (cURL) + +```bash +$ curl -i \ + -H "User-Agent: Alamofire" \ + -H "Accept-Encoding: Accept-Encoding: gzip;q=1.0,compress;q=0.5" \ + -H "Accept-Language: en;q=1.0,fr;q=0.9,de;q=0.8,zh-Hans;q=0.7,zh-Hant;q=0.6,ja;q=0.5" \ + "https://httpbin.org/get?foo=bar" +``` + +--- + +## Advanced Usage + +> Alamofire is built on `NSURLSession` and the Foundation URL Loading System. To make the most of +this framework, it is recommended that you be familiar with the concepts and capabilities of the underlying networking stack. + +**Recommended Reading** + +- [URL Loading System Programming Guide](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html) +- [NSURLSession Class Reference](https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/Introduction/Introduction.html#//apple_ref/occ/cl/NSURLSession) +- [NSURLCache Class Reference](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURLCache_Class/Reference/Reference.html#//apple_ref/occ/cl/NSURLCache) +- [NSURLAuthenticationChallenge Class Reference](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURLAuthenticationChallenge_Class/Reference/Reference.html) + +### Manager + +Top-level convenience methods like `Alamofire.request` use a shared instance of `Alamofire.Manager`, which is configured with the default `NSURLSessionConfiguration`. + +As such, the following two statements are equivalent: + +```swift +Alamofire.request(.GET, "https://httpbin.org/get") +``` + +```swift +let manager = Alamofire.Manager.sharedInstance +manager.request(NSURLRequest(URL: NSURL(string: "https://httpbin.org/get")!)) +``` + +Applications can create managers for background and ephemeral sessions, as well as new managers that customize the default session configuration, such as for default headers (`HTTPAdditionalHeaders`) or timeout interval (`timeoutIntervalForRequest`). + +#### Creating a Manager with Default Configuration + +```swift +let configuration = NSURLSessionConfiguration.defaultSessionConfiguration() +let manager = Alamofire.Manager(configuration: configuration) +``` + +#### Creating a Manager with Background Configuration + +```swift +let configuration = NSURLSessionConfiguration.backgroundSessionConfigurationWithIdentifier("com.example.app.background") +let manager = Alamofire.Manager(configuration: configuration) +``` + +#### Creating a Manager with Ephemeral Configuration + +```swift +let configuration = NSURLSessionConfiguration.ephemeralSessionConfiguration() +let manager = Alamofire.Manager(configuration: configuration) +``` + +#### Modifying Session Configuration + +```swift +var defaultHeaders = Alamofire.Manager.sharedInstance.session.configuration.HTTPAdditionalHeaders ?? [:] +defaultHeaders["DNT"] = "1 (Do Not Track Enabled)" + +let configuration = NSURLSessionConfiguration.defaultSessionConfiguration() +configuration.HTTPAdditionalHeaders = defaultHeaders + +let manager = Alamofire.Manager(configuration: configuration) +``` + +> This is **not** recommended for `Authorization` or `Content-Type` headers. Instead, use `URLRequestConvertible` and `ParameterEncoding`, respectively. + +### Request + +The result of a `request`, `upload`, or `download` method is an instance of `Alamofire.Request`. A request is always created using a constructor method from an owning manager, and never initialized directly. + +Methods like `authenticate`, `validate` and `responseData` return the caller in order to facilitate chaining. + +Requests can be suspended, resumed, and cancelled: + +- `suspend()`: Suspends the underlying task and dispatch queue +- `resume()`: Resumes the underlying task and dispatch queue. If the owning manager does not have `startRequestsImmediately` set to `true`, the request must call `resume()` in order to start. +- `cancel()`: Cancels the underlying task, producing an error that is passed to any registered response handlers. + +### Response Serialization + +#### Creating a Custom Response Serializer + +Alamofire provides built-in response serialization for strings, JSON, and property lists, but others can be added in extensions on `Alamofire.Request`. + +For example, here's how a response handler using [Ono](https://github.com/mattt/Ono) might be implemented: + +```swift +extension Request { + public static func XMLResponseSerializer() -> ResponseSerializer { + return ResponseSerializer { request, response, data, error in + guard error == nil else { return .Failure(error!) } + + guard let validData = data else { + let failureReason = "Data could not be serialized. Input data was nil." + let error = Error.errorWithCode(.DataSerializationFailed, failureReason: failureReason) + return .Failure(error) + } + + do { + let XML = try ONOXMLDocument(data: validData) + return .Success(XML) + } catch { + return .Failure(error as NSError) + } + } + } + + public func responseXMLDocument(completionHandler: Response -> Void) -> Self { + return response(responseSerializer: Request.XMLResponseSerializer(), completionHandler: completionHandler) + } +} +``` + +#### Generic Response Object Serialization + +Generics can be used to provide automatic, type-safe response object serialization. + +```swift +public protocol ResponseObjectSerializable { + init?(response: NSHTTPURLResponse, representation: AnyObject) +} + +extension Request { + public func responseObject(completionHandler: Response -> Void) -> Self { + let responseSerializer = ResponseSerializer { request, response, data, error in + guard error == nil else { return .Failure(error!) } + + let JSONResponseSerializer = Request.JSONResponseSerializer(options: .AllowFragments) + let result = JSONResponseSerializer.serializeResponse(request, response, data, error) + + switch result { + case .Success(let value): + if let + response = response, + responseObject = T(response: response, representation: value) + { + return .Success(responseObject) + } else { + let failureReason = "JSON could not be serialized into response object: \(value)" + let error = Error.errorWithCode(.JSONSerializationFailed, failureReason: failureReason) + return .Failure(error) + } + case .Failure(let error): + return .Failure(error) + } + } + + return response(responseSerializer: responseSerializer, completionHandler: completionHandler) + } +} +``` + +```swift +final class User: ResponseObjectSerializable { + let username: String + let name: String + + init?(response: NSHTTPURLResponse, representation: AnyObject) { + self.username = response.URL!.lastPathComponent! + self.name = representation.valueForKeyPath("name") as! String + } +} +``` + +```swift +Alamofire.request(.GET, "https://example.com/users/mattt") + .responseObject { (response: Response) in + debugPrint(response) + } +``` + +The same approach can also be used to handle endpoints that return a representation of a collection of objects: + +```swift +public protocol ResponseCollectionSerializable { + static func collection(response response: NSHTTPURLResponse, representation: AnyObject) -> [Self] +} + +extension Alamofire.Request { + public func responseCollection(completionHandler: Response<[T], NSError> -> Void) -> Self { + let responseSerializer = ResponseSerializer<[T], NSError> { request, response, data, error in + guard error == nil else { return .Failure(error!) } + + let JSONSerializer = Request.JSONResponseSerializer(options: .AllowFragments) + let result = JSONSerializer.serializeResponse(request, response, data, error) + + switch result { + case .Success(let value): + if let response = response { + return .Success(T.collection(response: response, representation: value)) + } else { + let failureReason = "Response collection could not be serialized due to nil response" + let error = Error.errorWithCode(.JSONSerializationFailed, failureReason: failureReason) + return .Failure(error) + } + case .Failure(let error): + return .Failure(error) + } + } + + return response(responseSerializer: responseSerializer, completionHandler: completionHandler) + } +} +``` + +```swift +final class User: ResponseObjectSerializable, ResponseCollectionSerializable { + let username: String + let name: String + + init?(response: NSHTTPURLResponse, representation: AnyObject) { + self.username = response.URL!.lastPathComponent! + self.name = representation.valueForKeyPath("name") as! String + } + + static func collection(response response: NSHTTPURLResponse, representation: AnyObject) -> [User] { + var users: [User] = [] + + if let representation = representation as? [[String: AnyObject]] { + for userRepresentation in representation { + if let user = User(response: response, representation: userRepresentation) { + users.append(user) + } + } + } + + return users + } +} +``` + +```swift +Alamofire.request(.GET, "http://example.com/users") + .responseCollection { (response: Response<[User], NSError>) in + debugPrint(response) + } +``` + +### URLStringConvertible + +Types adopting the `URLStringConvertible` protocol can be used to construct URL strings, which are then used to construct URL requests. `NSString`, `NSURL`, `NSURLComponents`, and `NSURLRequest` conform to `URLStringConvertible` by default, allowing any of them to be passed as `URLString` parameters to the `request`, `upload`, and `download` methods: + +```swift +let string = NSString(string: "https://httpbin.org/post") +Alamofire.request(.POST, string) + +let URL = NSURL(string: string)! +Alamofire.request(.POST, URL) + +let URLRequest = NSURLRequest(URL: URL) +Alamofire.request(.POST, URLRequest) // overrides `HTTPMethod` of `URLRequest` + +let URLComponents = NSURLComponents(URL: URL, resolvingAgainstBaseURL: true) +Alamofire.request(.POST, URLComponents) +``` + +Applications interacting with web applications in a significant manner are encouraged to have custom types conform to `URLStringConvertible` as a convenient way to map domain-specific models to server resources. + +#### Type-Safe Routing + +```swift +extension User: URLStringConvertible { + static let baseURLString = "http://example.com" + + var URLString: String { + return User.baseURLString + "/users/\(username)/" + } +} +``` + +```swift +let user = User(username: "mattt") +Alamofire.request(.GET, user) // http://example.com/users/mattt +``` + +### URLRequestConvertible + +Types adopting the `URLRequestConvertible` protocol can be used to construct URL requests. `NSURLRequest` conforms to `URLRequestConvertible` by default, allowing it to be passed into `request`, `upload`, and `download` methods directly (this is the recommended way to specify custom HTTP body for individual requests): + +```swift +let URL = NSURL(string: "https://httpbin.org/post")! +let mutableURLRequest = NSMutableURLRequest(URL: URL) +mutableURLRequest.HTTPMethod = "POST" + +let parameters = ["foo": "bar"] + +do { + mutableURLRequest.HTTPBody = try NSJSONSerialization.dataWithJSONObject(parameters, options: NSJSONWritingOptions()) +} catch { + // No-op +} + +mutableURLRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") + +Alamofire.request(mutableURLRequest) +``` + +Applications interacting with web applications in a significant manner are encouraged to have custom types conform to `URLRequestConvertible` as a way to ensure consistency of requested endpoints. Such an approach can be used to abstract away server-side inconsistencies and provide type-safe routing, as well as manage authentication credentials and other state. + +#### API Parameter Abstraction + +```swift +enum Router: URLRequestConvertible { + static let baseURLString = "http://example.com" + static let perPage = 50 + + case Search(query: String, page: Int) + + // MARK: URLRequestConvertible + + var URLRequest: NSMutableURLRequest { + let result: (path: String, parameters: [String: AnyObject]) = { + switch self { + case .Search(let query, let page) where page > 1: + return ("/search", ["q": query, "offset": Router.perPage * page]) + case .Search(let query, _): + return ("/search", ["q": query]) + } + }() + + let URL = NSURL(string: Router.baseURLString)! + let URLRequest = NSURLRequest(URL: URL.URLByAppendingPathComponent(result.path)) + let encoding = Alamofire.ParameterEncoding.URL + + return encoding.encode(URLRequest, parameters: result.parameters).0 + } +} +``` + +```swift +Alamofire.request(Router.Search(query: "foo bar", page: 1)) // ?q=foo%20bar&offset=50 +``` + +#### CRUD & Authorization + +```swift +enum Router: URLRequestConvertible { + static let baseURLString = "http://example.com" + static var OAuthToken: String? + + case CreateUser([String: AnyObject]) + case ReadUser(String) + case UpdateUser(String, [String: AnyObject]) + case DestroyUser(String) + + var method: Alamofire.Method { + switch self { + case .CreateUser: + return .POST + case .ReadUser: + return .GET + case .UpdateUser: + return .PUT + case .DestroyUser: + return .DELETE + } + } + + var path: String { + switch self { + case .CreateUser: + return "/users" + case .ReadUser(let username): + return "/users/\(username)" + case .UpdateUser(let username, _): + return "/users/\(username)" + case .DestroyUser(let username): + return "/users/\(username)" + } + } + + // MARK: URLRequestConvertible + + var URLRequest: NSMutableURLRequest { + let URL = NSURL(string: Router.baseURLString)! + let mutableURLRequest = NSMutableURLRequest(URL: URL.URLByAppendingPathComponent(path)) + mutableURLRequest.HTTPMethod = method.rawValue + + if let token = Router.OAuthToken { + mutableURLRequest.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization") + } + + switch self { + case .CreateUser(let parameters): + return Alamofire.ParameterEncoding.JSON.encode(mutableURLRequest, parameters: parameters).0 + case .UpdateUser(_, let parameters): + return Alamofire.ParameterEncoding.URL.encode(mutableURLRequest, parameters: parameters).0 + default: + return mutableURLRequest + } + } +} +``` + +```swift +Alamofire.request(Router.ReadUser("mattt")) // GET /users/mattt +``` + +### Security + +Using a secure HTTPS connection when communicating with servers and web services is an important step in securing sensitive data. By default, Alamofire will evaluate the certificate chain provided by the server using Apple's built in validation provided by the Security framework. While this guarantees the certificate chain is valid, it does not prevent man-in-the-middle (MITM) attacks or other potential vulnerabilities. In order to mitigate MITM attacks, applications dealing with sensitive customer data or financial information should use certificate or public key pinning provided by the `ServerTrustPolicy`. + +#### ServerTrustPolicy + +The `ServerTrustPolicy` enumeration evaluates the server trust generally provided by an `NSURLAuthenticationChallenge` when connecting to a server over a secure HTTPS connection. + +```swift +let serverTrustPolicy = ServerTrustPolicy.PinCertificates( + certificates: ServerTrustPolicy.certificatesInBundle(), + validateCertificateChain: true, + validateHost: true +) +``` + +There are many different cases of server trust evaluation giving you complete control over the validation process: + +* `PerformDefaultEvaluation`: Uses the default server trust evaluation while allowing you to control whether to validate the host provided by the challenge. +* `PinCertificates`: Uses the pinned certificates to validate the server trust. The server trust is considered valid if one of the pinned certificates match one of the server certificates. +* `PinPublicKeys`: Uses the pinned public keys to validate the server trust. The server trust is considered valid if one of the pinned public keys match one of the server certificate public keys. +* `DisableEvaluation`: Disables all evaluation which in turn will always consider any server trust as valid. +* `CustomEvaluation`: Uses the associated closure to evaluate the validity of the server trust thus giving you complete control over the validation process. Use with caution. + +#### Server Trust Policy Manager + +The `ServerTrustPolicyManager` is responsible for storing an internal mapping of server trust policies to a particular host. This allows Alamofire to evaluate each host against a different server trust policy. + +```swift +let serverTrustPolicies: [String: ServerTrustPolicy] = [ + "test.example.com": .PinCertificates( + certificates: ServerTrustPolicy.certificatesInBundle(), + validateCertificateChain: true, + validateHost: true + ), + "insecure.expired-apis.com": .DisableEvaluation +] + +let manager = Manager( + serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustPolicies) +) +``` + +> Make sure to keep a reference to the new `Manager` instance, otherwise your requests will all get cancelled when your `manager` is deallocated. + +These server trust policies will result in the following behavior: + +* `test.example.com` will always use certificate pinning with certificate chain and host validation enabled thus requiring the following criteria to be met to allow the TLS handshake to succeed: + * Certificate chain MUST be valid. + * Certificate chain MUST include one of the pinned certificates. + * Challenge host MUST match the host in the certificate chain's leaf certificate. +* `insecure.expired-apis.com` will never evaluate the certificate chain and will always allow the TLS handshake to succeed. +* All other hosts will use the default evaluation provided by Apple. + +##### Subclassing Server Trust Policy Manager + +If you find yourself needing more flexible server trust policy matching behavior (i.e. wildcarded domains), then subclass the `ServerTrustPolicyManager` and override the `serverTrustPolicyForHost` method with your own custom implementation. + +```swift +class CustomServerTrustPolicyManager: ServerTrustPolicyManager { + override func serverTrustPolicyForHost(host: String) -> ServerTrustPolicy? { + var policy: ServerTrustPolicy? + + // Implement your custom domain matching behavior... + + return policy + } +} +``` + +#### Validating the Host + +The `.PerformDefaultEvaluation`, `.PinCertificates` and `.PinPublicKeys` server trust policies all take a `validateHost` parameter. Setting the value to `true` will cause the server trust evaluation to verify that hostname in the certificate matches the hostname of the challenge. If they do not match, evaluation will fail. A `validateHost` value of `false` will still evaluate the full certificate chain, but will not validate the hostname of the leaf certificate. + +> It is recommended that `validateHost` always be set to `true` in production environments. + +#### Validating the Certificate Chain + +Pinning certificates and public keys both have the option of validating the certificate chain using the `validateCertificateChain` parameter. By setting this value to `true`, the full certificate chain will be evaluated in addition to performing a byte equality check against the pinned certficates or public keys. A value of `false` will skip the certificate chain validation, but will still perform the byte equality check. + +There are several cases where it may make sense to disable certificate chain validation. The most common use cases for disabling validation are self-signed and expired certificates. The evaluation would always fail in both of these cases, but the byte equality check will still ensure you are receiving the certificate you expect from the server. + +> It is recommended that `validateCertificateChain` always be set to `true` in production environments. + +#### App Transport Security + +With the addition of App Transport Security (ATS) in iOS 9, it is possible that using a custom `ServerTrustPolicyManager` with several `ServerTrustPolicy` objects will have no effect. If you continuously see `CFNetwork SSLHandshake failed (-9806)` errors, you have probably run into this problem. Apple's ATS system overrides the entire challenge system unless you configure the ATS settings in your app's plist to disable enough of it to allow your app to evaluate the server trust. + +If you run into this problem (high probability with self-signed certificates), you can work around this issue by adding the following to your `Info.plist`. + +```xml + + NSAppTransportSecurity + + NSExceptionDomains + + example.com + + NSExceptionAllowsInsecureHTTPLoads + + NSExceptionRequiresForwardSecrecy + + NSIncludesSubdomains + + + NSTemporaryExceptionMinimumTLSVersion + TLSv1.2 + + + + +``` + +Whether you need to set the `NSExceptionRequiresForwardSecrecy` to `NO` depends on whether your TLS connection is using an allowed cipher suite. In certain cases, it will need to be set to `NO`. The `NSExceptionAllowsInsecureHTTPLoads` MUST be set to `YES` in order to allow the `SessionDelegate` to receive challenge callbacks. Once the challenge callbacks are being called, the `ServerTrustPolicyManager` will take over the server trust evaluation. You may also need to specify the `NSTemporaryExceptionMinimumTLSVersion` if you're trying to connect to a host that only supports TLS versions less than `1.2`. + +> It is recommended to always use valid certificates in production environments. + +### Network Reachability + +The `NetworkReachabilityManager` listens for reachability changes of hosts and addresses for both WWAN and WiFi network interfaces. + +```swift +let manager = NetworkReachabilityManager(host: "www.apple.com") + +manager?.listener = { status in + print("Network Status Changed: \(status)") +} + +manager?.startListening() +``` + +> Make sure to remember to retain the `manager` in the above example, or no status changes will be reported. + +There are some important things to remember when using network reachability to determine what to do next. + +* **Do NOT** use Reachability to determine if a network request should be sent. + * You should **ALWAYS** send it. +* When Reachability is restored, use the event to retry failed network requests. + * Even though the network requests may still fail, this is a good moment to retry them. +* The network reachability status can be useful for determining why a network request may have failed. + * If a network request fails, it is more useful to tell the user that the network request failed due to being offline rather than a more technical errror, such as "request timed out." + +> It is recommended to check out [WWDC 2012 Session 706, "Networking Best Practices"](https://developer.apple.com/videos/play/wwdc2012-706/) for more info. + +--- + +## Open Rdars + +The following rdars have some affect on the current implementation of Alamofire. + +* [rdar://21349340](http://www.openradar.me/radar?id=5517037090635776) - Compiler throwing warning due to toll-free bridging issue in test case + +## FAQ + +### What's the origin of the name Alamofire? + +Alamofire is named after the [Alamo Fire flower](https://aggie-horticulture.tamu.edu/wildseed/alamofire.html), a hybrid variant of the Bluebonnet, the official state flower of Texas. + +--- + +## Credits + +Alamofire is owned and maintained by the [Alamofire Software Foundation](http://alamofire.org). You can follow them on Twitter at [@AlamofireSF](https://twitter.com/AlamofireSF) for project updates and releases. + +### Security Disclosure + +If you believe you have identified a security vulnerability with Alamofire, you should report it as soon as possible via email to security@alamofire.org. Please do not post it to a public issue tracker. + +## License + +Alamofire is released under the MIT license. See LICENSE for details. diff --git a/Pods/Alamofire/Source/Alamofire.swift b/Pods/Alamofire/Source/Alamofire.swift new file mode 100644 index 0000000..b866f42 --- /dev/null +++ b/Pods/Alamofire/Source/Alamofire.swift @@ -0,0 +1,368 @@ +// Alamofire.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +// MARK: - URLStringConvertible + +/** + Types adopting the `URLStringConvertible` protocol can be used to construct URL strings, which are then used to + construct URL requests. +*/ +public protocol URLStringConvertible { + /** + A URL that conforms to RFC 2396. + + Methods accepting a `URLStringConvertible` type parameter parse it according to RFCs 1738 and 1808. + + See https://tools.ietf.org/html/rfc2396 + See https://tools.ietf.org/html/rfc1738 + See https://tools.ietf.org/html/rfc1808 + */ + var URLString: String { get } +} + +extension String: URLStringConvertible { + public var URLString: String { + return self + } +} + +extension NSURL: URLStringConvertible { + public var URLString: String { + return absoluteString + } +} + +extension NSURLComponents: URLStringConvertible { + public var URLString: String { + return URL!.URLString + } +} + +extension NSURLRequest: URLStringConvertible { + public var URLString: String { + return URL!.URLString + } +} + +// MARK: - URLRequestConvertible + +/** + Types adopting the `URLRequestConvertible` protocol can be used to construct URL requests. +*/ +public protocol URLRequestConvertible { + /// The URL request. + var URLRequest: NSMutableURLRequest { get } +} + +extension NSURLRequest: URLRequestConvertible { + public var URLRequest: NSMutableURLRequest { + return self.mutableCopy() as! NSMutableURLRequest + } +} + +// MARK: - Convenience + +func URLRequest( + method: Method, + _ URLString: URLStringConvertible, + headers: [String: String]? = nil) + -> NSMutableURLRequest +{ + let mutableURLRequest = NSMutableURLRequest(URL: NSURL(string: URLString.URLString)!) + mutableURLRequest.HTTPMethod = method.rawValue + + if let headers = headers { + for (headerField, headerValue) in headers { + mutableURLRequest.setValue(headerValue, forHTTPHeaderField: headerField) + } + } + + return mutableURLRequest +} + +// MARK: - Request Methods + +/** + Creates a request using the shared manager instance for the specified method, URL string, parameters, and + parameter encoding. + + - parameter method: The HTTP method. + - parameter URLString: The URL string. + - parameter parameters: The parameters. `nil` by default. + - parameter encoding: The parameter encoding. `.URL` by default. + - parameter headers: The HTTP headers. `nil` by default. + + - returns: The created request. +*/ +public func request( + method: Method, + _ URLString: URLStringConvertible, + parameters: [String: AnyObject]? = nil, + encoding: ParameterEncoding = .URL, + headers: [String: String]? = nil) + -> Request +{ + return Manager.sharedInstance.request( + method, + URLString, + parameters: parameters, + encoding: encoding, + headers: headers + ) +} + +/** + Creates a request using the shared manager instance for the specified URL request. + + If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + + - parameter URLRequest: The URL request + + - returns: The created request. +*/ +public func request(URLRequest: URLRequestConvertible) -> Request { + return Manager.sharedInstance.request(URLRequest.URLRequest) +} + +// MARK: - Upload Methods + +// MARK: File + +/** + Creates an upload request using the shared manager instance for the specified method, URL string, and file. + + - parameter method: The HTTP method. + - parameter URLString: The URL string. + - parameter headers: The HTTP headers. `nil` by default. + - parameter file: The file to upload. + + - returns: The created upload request. +*/ +public func upload( + method: Method, + _ URLString: URLStringConvertible, + headers: [String: String]? = nil, + file: NSURL) + -> Request +{ + return Manager.sharedInstance.upload(method, URLString, headers: headers, file: file) +} + +/** + Creates an upload request using the shared manager instance for the specified URL request and file. + + - parameter URLRequest: The URL request. + - parameter file: The file to upload. + + - returns: The created upload request. +*/ +public func upload(URLRequest: URLRequestConvertible, file: NSURL) -> Request { + return Manager.sharedInstance.upload(URLRequest, file: file) +} + +// MARK: Data + +/** + Creates an upload request using the shared manager instance for the specified method, URL string, and data. + + - parameter method: The HTTP method. + - parameter URLString: The URL string. + - parameter headers: The HTTP headers. `nil` by default. + - parameter data: The data to upload. + + - returns: The created upload request. +*/ +public func upload( + method: Method, + _ URLString: URLStringConvertible, + headers: [String: String]? = nil, + data: NSData) + -> Request +{ + return Manager.sharedInstance.upload(method, URLString, headers: headers, data: data) +} + +/** + Creates an upload request using the shared manager instance for the specified URL request and data. + + - parameter URLRequest: The URL request. + - parameter data: The data to upload. + + - returns: The created upload request. +*/ +public func upload(URLRequest: URLRequestConvertible, data: NSData) -> Request { + return Manager.sharedInstance.upload(URLRequest, data: data) +} + +// MARK: Stream + +/** + Creates an upload request using the shared manager instance for the specified method, URL string, and stream. + + - parameter method: The HTTP method. + - parameter URLString: The URL string. + - parameter headers: The HTTP headers. `nil` by default. + - parameter stream: The stream to upload. + + - returns: The created upload request. +*/ +public func upload( + method: Method, + _ URLString: URLStringConvertible, + headers: [String: String]? = nil, + stream: NSInputStream) + -> Request +{ + return Manager.sharedInstance.upload(method, URLString, headers: headers, stream: stream) +} + +/** + Creates an upload request using the shared manager instance for the specified URL request and stream. + + - parameter URLRequest: The URL request. + - parameter stream: The stream to upload. + + - returns: The created upload request. +*/ +public func upload(URLRequest: URLRequestConvertible, stream: NSInputStream) -> Request { + return Manager.sharedInstance.upload(URLRequest, stream: stream) +} + +// MARK: MultipartFormData + +/** + Creates an upload request using the shared manager instance for the specified method and URL string. + + - parameter method: The HTTP method. + - parameter URLString: The URL string. + - parameter headers: The HTTP headers. `nil` by default. + - parameter multipartFormData: The closure used to append body parts to the `MultipartFormData`. + - parameter encodingMemoryThreshold: The encoding memory threshold in bytes. + `MultipartFormDataEncodingMemoryThreshold` by default. + - parameter encodingCompletion: The closure called when the `MultipartFormData` encoding is complete. +*/ +public func upload( + method: Method, + _ URLString: URLStringConvertible, + headers: [String: String]? = nil, + multipartFormData: MultipartFormData -> Void, + encodingMemoryThreshold: UInt64 = Manager.MultipartFormDataEncodingMemoryThreshold, + encodingCompletion: (Manager.MultipartFormDataEncodingResult -> Void)?) +{ + return Manager.sharedInstance.upload( + method, + URLString, + headers: headers, + multipartFormData: multipartFormData, + encodingMemoryThreshold: encodingMemoryThreshold, + encodingCompletion: encodingCompletion + ) +} + +/** + Creates an upload request using the shared manager instance for the specified method and URL string. + + - parameter URLRequest: The URL request. + - parameter multipartFormData: The closure used to append body parts to the `MultipartFormData`. + - parameter encodingMemoryThreshold: The encoding memory threshold in bytes. + `MultipartFormDataEncodingMemoryThreshold` by default. + - parameter encodingCompletion: The closure called when the `MultipartFormData` encoding is complete. +*/ +public func upload( + URLRequest: URLRequestConvertible, + multipartFormData: MultipartFormData -> Void, + encodingMemoryThreshold: UInt64 = Manager.MultipartFormDataEncodingMemoryThreshold, + encodingCompletion: (Manager.MultipartFormDataEncodingResult -> Void)?) +{ + return Manager.sharedInstance.upload( + URLRequest, + multipartFormData: multipartFormData, + encodingMemoryThreshold: encodingMemoryThreshold, + encodingCompletion: encodingCompletion + ) +} + +// MARK: - Download Methods + +// MARK: URL Request + +/** + Creates a download request using the shared manager instance for the specified method and URL string. + + - parameter method: The HTTP method. + - parameter URLString: The URL string. + - parameter parameters: The parameters. `nil` by default. + - parameter encoding: The parameter encoding. `.URL` by default. + - parameter headers: The HTTP headers. `nil` by default. + - parameter destination: The closure used to determine the destination of the downloaded file. + + - returns: The created download request. +*/ +public func download( + method: Method, + _ URLString: URLStringConvertible, + parameters: [String: AnyObject]? = nil, + encoding: ParameterEncoding = .URL, + headers: [String: String]? = nil, + destination: Request.DownloadFileDestination) + -> Request +{ + return Manager.sharedInstance.download( + method, + URLString, + parameters: parameters, + encoding: encoding, + headers: headers, + destination: destination + ) +} + +/** + Creates a download request using the shared manager instance for the specified URL request. + + - parameter URLRequest: The URL request. + - parameter destination: The closure used to determine the destination of the downloaded file. + + - returns: The created download request. +*/ +public func download(URLRequest: URLRequestConvertible, destination: Request.DownloadFileDestination) -> Request { + return Manager.sharedInstance.download(URLRequest, destination: destination) +} + +// MARK: Resume Data + +/** + Creates a request using the shared manager instance for downloading from the resume data produced from a + previous request cancellation. + + - parameter resumeData: The resume data. This is an opaque data blob produced by `NSURLSessionDownloadTask` + when a task is cancelled. See `NSURLSession -downloadTaskWithResumeData:` for additional + information. + - parameter destination: The closure used to determine the destination of the downloaded file. + + - returns: The created download request. +*/ +public func download(resumeData data: NSData, destination: Request.DownloadFileDestination) -> Request { + return Manager.sharedInstance.download(data, destination: destination) +} diff --git a/Pods/Alamofire/Source/Download.swift b/Pods/Alamofire/Source/Download.swift new file mode 100644 index 0000000..2ebe40f --- /dev/null +++ b/Pods/Alamofire/Source/Download.swift @@ -0,0 +1,246 @@ +// Download.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +extension Manager { + private enum Downloadable { + case Request(NSURLRequest) + case ResumeData(NSData) + } + + private func download(downloadable: Downloadable, destination: Request.DownloadFileDestination) -> Request { + var downloadTask: NSURLSessionDownloadTask! + + switch downloadable { + case .Request(let request): + dispatch_sync(queue) { + downloadTask = self.session.downloadTaskWithRequest(request) + } + case .ResumeData(let resumeData): + dispatch_sync(queue) { + downloadTask = self.session.downloadTaskWithResumeData(resumeData) + } + } + + let request = Request(session: session, task: downloadTask) + + if let downloadDelegate = request.delegate as? Request.DownloadTaskDelegate { + downloadDelegate.downloadTaskDidFinishDownloadingToURL = { session, downloadTask, URL in + return destination(URL, downloadTask.response as! NSHTTPURLResponse) + } + } + + delegate[request.delegate.task] = request.delegate + + if startRequestsImmediately { + request.resume() + } + + return request + } + + // MARK: Request + + /** + Creates a download request for the specified method, URL string, parameters, parameter encoding, headers + and destination. + + If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + + - parameter method: The HTTP method. + - parameter URLString: The URL string. + - parameter parameters: The parameters. `nil` by default. + - parameter encoding: The parameter encoding. `.URL` by default. + - parameter headers: The HTTP headers. `nil` by default. + - parameter destination: The closure used to determine the destination of the downloaded file. + + - returns: The created download request. + */ + public func download( + method: Method, + _ URLString: URLStringConvertible, + parameters: [String: AnyObject]? = nil, + encoding: ParameterEncoding = .URL, + headers: [String: String]? = nil, + destination: Request.DownloadFileDestination) + -> Request + { + let mutableURLRequest = URLRequest(method, URLString, headers: headers) + let encodedURLRequest = encoding.encode(mutableURLRequest, parameters: parameters).0 + + return download(encodedURLRequest, destination: destination) + } + + /** + Creates a request for downloading from the specified URL request. + + If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + + - parameter URLRequest: The URL request + - parameter destination: The closure used to determine the destination of the downloaded file. + + - returns: The created download request. + */ + public func download(URLRequest: URLRequestConvertible, destination: Request.DownloadFileDestination) -> Request { + return download(.Request(URLRequest.URLRequest), destination: destination) + } + + // MARK: Resume Data + + /** + Creates a request for downloading from the resume data produced from a previous request cancellation. + + If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + + - parameter resumeData: The resume data. This is an opaque data blob produced by `NSURLSessionDownloadTask` + when a task is cancelled. See `NSURLSession -downloadTaskWithResumeData:` for + additional information. + - parameter destination: The closure used to determine the destination of the downloaded file. + + - returns: The created download request. + */ + public func download(resumeData: NSData, destination: Request.DownloadFileDestination) -> Request { + return download(.ResumeData(resumeData), destination: destination) + } +} + +// MARK: - + +extension Request { + /** + A closure executed once a request has successfully completed in order to determine where to move the temporary + file written to during the download process. The closure takes two arguments: the temporary file URL and the URL + response, and returns a single argument: the file URL where the temporary file should be moved. + */ + public typealias DownloadFileDestination = (NSURL, NSHTTPURLResponse) -> NSURL + + /** + Creates a download file destination closure which uses the default file manager to move the temporary file to a + file URL in the first available directory with the specified search path directory and search path domain mask. + + - parameter directory: The search path directory. `.DocumentDirectory` by default. + - parameter domain: The search path domain mask. `.UserDomainMask` by default. + + - returns: A download file destination closure. + */ + public class func suggestedDownloadDestination( + directory directory: NSSearchPathDirectory = .DocumentDirectory, + domain: NSSearchPathDomainMask = .UserDomainMask) + -> DownloadFileDestination + { + return { temporaryURL, response -> NSURL in + let directoryURLs = NSFileManager.defaultManager().URLsForDirectory(directory, inDomains: domain) + + if !directoryURLs.isEmpty { + return directoryURLs[0].URLByAppendingPathComponent(response.suggestedFilename!) + } + + return temporaryURL + } + } + + /// The resume data of the underlying download task if available after a failure. + public var resumeData: NSData? { + var data: NSData? + + if let delegate = delegate as? DownloadTaskDelegate { + data = delegate.resumeData + } + + return data + } + + // MARK: - DownloadTaskDelegate + + class DownloadTaskDelegate: TaskDelegate, NSURLSessionDownloadDelegate { + var downloadTask: NSURLSessionDownloadTask? { return task as? NSURLSessionDownloadTask } + var downloadProgress: ((Int64, Int64, Int64) -> Void)? + + var resumeData: NSData? + override var data: NSData? { return resumeData } + + // MARK: - NSURLSessionDownloadDelegate + + // MARK: Override Closures + + var downloadTaskDidFinishDownloadingToURL: ((NSURLSession, NSURLSessionDownloadTask, NSURL) -> NSURL)? + var downloadTaskDidWriteData: ((NSURLSession, NSURLSessionDownloadTask, Int64, Int64, Int64) -> Void)? + var downloadTaskDidResumeAtOffset: ((NSURLSession, NSURLSessionDownloadTask, Int64, Int64) -> Void)? + + // MARK: Delegate Methods + + func URLSession( + session: NSURLSession, + downloadTask: NSURLSessionDownloadTask, + didFinishDownloadingToURL location: NSURL) + { + if let downloadTaskDidFinishDownloadingToURL = downloadTaskDidFinishDownloadingToURL { + do { + let destination = downloadTaskDidFinishDownloadingToURL(session, downloadTask, location) + try NSFileManager.defaultManager().moveItemAtURL(location, toURL: destination) + } catch { + self.error = error as NSError + } + } + } + + func URLSession( + session: NSURLSession, + downloadTask: NSURLSessionDownloadTask, + didWriteData bytesWritten: Int64, + totalBytesWritten: Int64, + totalBytesExpectedToWrite: Int64) + { + if initialResponseTime == nil { initialResponseTime = CFAbsoluteTimeGetCurrent() } + + if let downloadTaskDidWriteData = downloadTaskDidWriteData { + downloadTaskDidWriteData( + session, + downloadTask, + bytesWritten, + totalBytesWritten, + totalBytesExpectedToWrite + ) + } else { + progress.totalUnitCount = totalBytesExpectedToWrite + progress.completedUnitCount = totalBytesWritten + + downloadProgress?(bytesWritten, totalBytesWritten, totalBytesExpectedToWrite) + } + } + + func URLSession( + session: NSURLSession, + downloadTask: NSURLSessionDownloadTask, + didResumeAtOffset fileOffset: Int64, + expectedTotalBytes: Int64) + { + if let downloadTaskDidResumeAtOffset = downloadTaskDidResumeAtOffset { + downloadTaskDidResumeAtOffset(session, downloadTask, fileOffset, expectedTotalBytes) + } else { + progress.totalUnitCount = expectedTotalBytes + progress.completedUnitCount = fileOffset + } + } + } +} diff --git a/Pods/Alamofire/Source/Error.swift b/Pods/Alamofire/Source/Error.swift new file mode 100644 index 0000000..7a813f1 --- /dev/null +++ b/Pods/Alamofire/Source/Error.swift @@ -0,0 +1,66 @@ +// Error.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +/// The `Error` struct provides a convenience for creating custom Alamofire NSErrors. +public struct Error { + /// The domain used for creating all Alamofire errors. + public static let Domain = "com.alamofire.error" + + /// The custom error codes generated by Alamofire. + public enum Code: Int { + case InputStreamReadFailed = -6000 + case OutputStreamWriteFailed = -6001 + case ContentTypeValidationFailed = -6002 + case StatusCodeValidationFailed = -6003 + case DataSerializationFailed = -6004 + case StringSerializationFailed = -6005 + case JSONSerializationFailed = -6006 + case PropertyListSerializationFailed = -6007 + } + + /** + Creates an `NSError` with the given error code and failure reason. + + - parameter code: The error code. + - parameter failureReason: The failure reason. + + - returns: An `NSError` with the given error code and failure reason. + */ + public static func errorWithCode(code: Code, failureReason: String) -> NSError { + return errorWithCode(code.rawValue, failureReason: failureReason) + } + + /** + Creates an `NSError` with the given error code and failure reason. + + - parameter code: The error code. + - parameter failureReason: The failure reason. + + - returns: An `NSError` with the given error code and failure reason. + */ + public static func errorWithCode(code: Int, failureReason: String) -> NSError { + let userInfo = [NSLocalizedFailureReasonErrorKey: failureReason] + return NSError(domain: Domain, code: code, userInfo: userInfo) + } +} diff --git a/Pods/Alamofire/Source/Manager.swift b/Pods/Alamofire/Source/Manager.swift new file mode 100644 index 0000000..b10045c --- /dev/null +++ b/Pods/Alamofire/Source/Manager.swift @@ -0,0 +1,695 @@ +// Manager.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +/** + Responsible for creating and managing `Request` objects, as well as their underlying `NSURLSession`. +*/ +public class Manager { + + // MARK: - Properties + + /** + A shared instance of `Manager`, used by top-level Alamofire request methods, and suitable for use directly + for any ad hoc requests. + */ + public static let sharedInstance: Manager = { + let configuration = NSURLSessionConfiguration.defaultSessionConfiguration() + configuration.HTTPAdditionalHeaders = Manager.defaultHTTPHeaders + + return Manager(configuration: configuration) + }() + + /** + Creates default values for the "Accept-Encoding", "Accept-Language" and "User-Agent" headers. + */ + public static let defaultHTTPHeaders: [String: String] = { + // Accept-Encoding HTTP Header; see https://tools.ietf.org/html/rfc7230#section-4.2.3 + let acceptEncoding: String = "gzip;q=1.0, compress;q=0.5" + + // Accept-Language HTTP Header; see https://tools.ietf.org/html/rfc7231#section-5.3.5 + let acceptLanguage = NSLocale.preferredLanguages().prefix(6).enumerate().map { index, languageCode in + let quality = 1.0 - (Double(index) * 0.1) + return "\(languageCode);q=\(quality)" + }.joinWithSeparator(", ") + + // User-Agent Header; see https://tools.ietf.org/html/rfc7231#section-5.5.3 + let userAgent: String = { + if let info = NSBundle.mainBundle().infoDictionary { + let executable: AnyObject = info[kCFBundleExecutableKey as String] ?? "Unknown" + let bundle: AnyObject = info[kCFBundleIdentifierKey as String] ?? "Unknown" + let version: AnyObject = info[kCFBundleVersionKey as String] ?? "Unknown" + let os: AnyObject = NSProcessInfo.processInfo().operatingSystemVersionString ?? "Unknown" + + var mutableUserAgent = NSMutableString(string: "\(executable)/\(bundle) (\(version); OS \(os))") as CFMutableString + let transform = NSString(string: "Any-Latin; Latin-ASCII; [:^ASCII:] Remove") as CFString + + if CFStringTransform(mutableUserAgent, UnsafeMutablePointer(nil), transform, false) { + return mutableUserAgent as String + } + } + + return "Alamofire" + }() + + return [ + "Accept-Encoding": acceptEncoding, + "Accept-Language": acceptLanguage, + "User-Agent": userAgent + ] + }() + + let queue = dispatch_queue_create(nil, DISPATCH_QUEUE_SERIAL) + + /// The underlying session. + public let session: NSURLSession + + /// The session delegate handling all the task and session delegate callbacks. + public let delegate: SessionDelegate + + /// Whether to start requests immediately after being constructed. `true` by default. + public var startRequestsImmediately: Bool = true + + /** + The background completion handler closure provided by the UIApplicationDelegate + `application:handleEventsForBackgroundURLSession:completionHandler:` method. By setting the background + completion handler, the SessionDelegate `sessionDidFinishEventsForBackgroundURLSession` closure implementation + will automatically call the handler. + + If you need to handle your own events before the handler is called, then you need to override the + SessionDelegate `sessionDidFinishEventsForBackgroundURLSession` and manually call the handler when finished. + + `nil` by default. + */ + public var backgroundCompletionHandler: (() -> Void)? + + // MARK: - Lifecycle + + /** + Initializes the `Manager` instance with the specified configuration, delegate and server trust policy. + + - parameter configuration: The configuration used to construct the managed session. + `NSURLSessionConfiguration.defaultSessionConfiguration()` by default. + - parameter delegate: The delegate used when initializing the session. `SessionDelegate()` by + default. + - parameter serverTrustPolicyManager: The server trust policy manager to use for evaluating all server trust + challenges. `nil` by default. + + - returns: The new `Manager` instance. + */ + public init( + configuration: NSURLSessionConfiguration = NSURLSessionConfiguration.defaultSessionConfiguration(), + delegate: SessionDelegate = SessionDelegate(), + serverTrustPolicyManager: ServerTrustPolicyManager? = nil) + { + self.delegate = delegate + self.session = NSURLSession(configuration: configuration, delegate: delegate, delegateQueue: nil) + + commonInit(serverTrustPolicyManager: serverTrustPolicyManager) + } + + /** + Initializes the `Manager` instance with the specified session, delegate and server trust policy. + + - parameter session: The URL session. + - parameter delegate: The delegate of the URL session. Must equal the URL session's delegate. + - parameter serverTrustPolicyManager: The server trust policy manager to use for evaluating all server trust + challenges. `nil` by default. + + - returns: The new `Manager` instance if the URL session's delegate matches the delegate parameter. + */ + public init?( + session: NSURLSession, + delegate: SessionDelegate, + serverTrustPolicyManager: ServerTrustPolicyManager? = nil) + { + self.delegate = delegate + self.session = session + + guard delegate === session.delegate else { return nil } + + commonInit(serverTrustPolicyManager: serverTrustPolicyManager) + } + + private func commonInit(serverTrustPolicyManager serverTrustPolicyManager: ServerTrustPolicyManager?) { + session.serverTrustPolicyManager = serverTrustPolicyManager + + delegate.sessionDidFinishEventsForBackgroundURLSession = { [weak self] session in + guard let strongSelf = self else { return } + dispatch_async(dispatch_get_main_queue()) { strongSelf.backgroundCompletionHandler?() } + } + } + + deinit { + session.invalidateAndCancel() + } + + // MARK: - Request + + /** + Creates a request for the specified method, URL string, parameters, parameter encoding and headers. + + - parameter method: The HTTP method. + - parameter URLString: The URL string. + - parameter parameters: The parameters. `nil` by default. + - parameter encoding: The parameter encoding. `.URL` by default. + - parameter headers: The HTTP headers. `nil` by default. + + - returns: The created request. + */ + public func request( + method: Method, + _ URLString: URLStringConvertible, + parameters: [String: AnyObject]? = nil, + encoding: ParameterEncoding = .URL, + headers: [String: String]? = nil) + -> Request + { + let mutableURLRequest = URLRequest(method, URLString, headers: headers) + let encodedURLRequest = encoding.encode(mutableURLRequest, parameters: parameters).0 + return request(encodedURLRequest) + } + + /** + Creates a request for the specified URL request. + + If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + + - parameter URLRequest: The URL request + + - returns: The created request. + */ + public func request(URLRequest: URLRequestConvertible) -> Request { + var dataTask: NSURLSessionDataTask! + dispatch_sync(queue) { dataTask = self.session.dataTaskWithRequest(URLRequest.URLRequest) } + + let request = Request(session: session, task: dataTask) + delegate[request.delegate.task] = request.delegate + + if startRequestsImmediately { + request.resume() + } + + return request + } + + // MARK: - SessionDelegate + + /** + Responsible for handling all delegate callbacks for the underlying session. + */ + public final class SessionDelegate: NSObject, NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDataDelegate, NSURLSessionDownloadDelegate { + private var subdelegates: [Int: Request.TaskDelegate] = [:] + private let subdelegateQueue = dispatch_queue_create(nil, DISPATCH_QUEUE_CONCURRENT) + + subscript(task: NSURLSessionTask) -> Request.TaskDelegate? { + get { + var subdelegate: Request.TaskDelegate? + dispatch_sync(subdelegateQueue) { subdelegate = self.subdelegates[task.taskIdentifier] } + + return subdelegate + } + + set { + dispatch_barrier_async(subdelegateQueue) { self.subdelegates[task.taskIdentifier] = newValue } + } + } + + /** + Initializes the `SessionDelegate` instance. + + - returns: The new `SessionDelegate` instance. + */ + public override init() { + super.init() + } + + // MARK: - NSURLSessionDelegate + + // MARK: Override Closures + + /// Overrides default behavior for NSURLSessionDelegate method `URLSession:didBecomeInvalidWithError:`. + public var sessionDidBecomeInvalidWithError: ((NSURLSession, NSError?) -> Void)? + + /// Overrides default behavior for NSURLSessionDelegate method `URLSession:didReceiveChallenge:completionHandler:`. + public var sessionDidReceiveChallenge: ((NSURLSession, NSURLAuthenticationChallenge) -> (NSURLSessionAuthChallengeDisposition, NSURLCredential?))? + + /// Overrides default behavior for NSURLSessionDelegate method `URLSessionDidFinishEventsForBackgroundURLSession:`. + public var sessionDidFinishEventsForBackgroundURLSession: ((NSURLSession) -> Void)? + + // MARK: Delegate Methods + + /** + Tells the delegate that the session has been invalidated. + + - parameter session: The session object that was invalidated. + - parameter error: The error that caused invalidation, or nil if the invalidation was explicit. + */ + public func URLSession(session: NSURLSession, didBecomeInvalidWithError error: NSError?) { + sessionDidBecomeInvalidWithError?(session, error) + } + + /** + Requests credentials from the delegate in response to a session-level authentication request from the remote server. + + - parameter session: The session containing the task that requested authentication. + - parameter challenge: An object that contains the request for authentication. + - parameter completionHandler: A handler that your delegate method must call providing the disposition and credential. + */ + public func URLSession( + session: NSURLSession, + didReceiveChallenge challenge: NSURLAuthenticationChallenge, + completionHandler: ((NSURLSessionAuthChallengeDisposition, NSURLCredential?) -> Void)) + { + var disposition: NSURLSessionAuthChallengeDisposition = .PerformDefaultHandling + var credential: NSURLCredential? + + if let sessionDidReceiveChallenge = sessionDidReceiveChallenge { + (disposition, credential) = sessionDidReceiveChallenge(session, challenge) + } else if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust { + let host = challenge.protectionSpace.host + + if let + serverTrustPolicy = session.serverTrustPolicyManager?.serverTrustPolicyForHost(host), + serverTrust = challenge.protectionSpace.serverTrust + { + if serverTrustPolicy.evaluateServerTrust(serverTrust, isValidForHost: host) { + disposition = .UseCredential + credential = NSURLCredential(forTrust: serverTrust) + } else { + disposition = .CancelAuthenticationChallenge + } + } + } + + completionHandler(disposition, credential) + } + + /** + Tells the delegate that all messages enqueued for a session have been delivered. + + - parameter session: The session that no longer has any outstanding requests. + */ + public func URLSessionDidFinishEventsForBackgroundURLSession(session: NSURLSession) { + sessionDidFinishEventsForBackgroundURLSession?(session) + } + + // MARK: - NSURLSessionTaskDelegate + + // MARK: Override Closures + + /// Overrides default behavior for NSURLSessionTaskDelegate method `URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:`. + public var taskWillPerformHTTPRedirection: ((NSURLSession, NSURLSessionTask, NSHTTPURLResponse, NSURLRequest) -> NSURLRequest?)? + + /// Overrides default behavior for NSURLSessionTaskDelegate method `URLSession:task:didReceiveChallenge:completionHandler:`. + public var taskDidReceiveChallenge: ((NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge) -> (NSURLSessionAuthChallengeDisposition, NSURLCredential?))? + + /// Overrides default behavior for NSURLSessionTaskDelegate method `URLSession:session:task:needNewBodyStream:`. + public var taskNeedNewBodyStream: ((NSURLSession, NSURLSessionTask) -> NSInputStream!)? + + /// Overrides default behavior for NSURLSessionTaskDelegate method `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:`. + public var taskDidSendBodyData: ((NSURLSession, NSURLSessionTask, Int64, Int64, Int64) -> Void)? + + /// Overrides default behavior for NSURLSessionTaskDelegate method `URLSession:task:didCompleteWithError:`. + public var taskDidComplete: ((NSURLSession, NSURLSessionTask, NSError?) -> Void)? + + // MARK: Delegate Methods + + /** + Tells the delegate that the remote server requested an HTTP redirect. + + - parameter session: The session containing the task whose request resulted in a redirect. + - parameter task: The task whose request resulted in a redirect. + - parameter response: An object containing the server’s response to the original request. + - parameter request: A URL request object filled out with the new location. + - parameter completionHandler: A closure that your handler should call with either the value of the request + parameter, a modified URL request object, or NULL to refuse the redirect and + return the body of the redirect response. + */ + public func URLSession( + session: NSURLSession, + task: NSURLSessionTask, + willPerformHTTPRedirection response: NSHTTPURLResponse, + newRequest request: NSURLRequest, + completionHandler: ((NSURLRequest?) -> Void)) + { + var redirectRequest: NSURLRequest? = request + + if let taskWillPerformHTTPRedirection = taskWillPerformHTTPRedirection { + redirectRequest = taskWillPerformHTTPRedirection(session, task, response, request) + } + + completionHandler(redirectRequest) + } + + /** + Requests credentials from the delegate in response to an authentication request from the remote server. + + - parameter session: The session containing the task whose request requires authentication. + - parameter task: The task whose request requires authentication. + - parameter challenge: An object that contains the request for authentication. + - parameter completionHandler: A handler that your delegate method must call providing the disposition and credential. + */ + public func URLSession( + session: NSURLSession, + task: NSURLSessionTask, + didReceiveChallenge challenge: NSURLAuthenticationChallenge, + completionHandler: ((NSURLSessionAuthChallengeDisposition, NSURLCredential?) -> Void)) + { + if let taskDidReceiveChallenge = taskDidReceiveChallenge { + completionHandler(taskDidReceiveChallenge(session, task, challenge)) + } else if let delegate = self[task] { + delegate.URLSession( + session, + task: task, + didReceiveChallenge: challenge, + completionHandler: completionHandler + ) + } else { + URLSession(session, didReceiveChallenge: challenge, completionHandler: completionHandler) + } + } + + /** + Tells the delegate when a task requires a new request body stream to send to the remote server. + + - parameter session: The session containing the task that needs a new body stream. + - parameter task: The task that needs a new body stream. + - parameter completionHandler: A completion handler that your delegate method should call with the new body stream. + */ + public func URLSession( + session: NSURLSession, + task: NSURLSessionTask, + needNewBodyStream completionHandler: ((NSInputStream?) -> Void)) + { + if let taskNeedNewBodyStream = taskNeedNewBodyStream { + completionHandler(taskNeedNewBodyStream(session, task)) + } else if let delegate = self[task] { + delegate.URLSession(session, task: task, needNewBodyStream: completionHandler) + } + } + + /** + Periodically informs the delegate of the progress of sending body content to the server. + + - parameter session: The session containing the data task. + - parameter task: The data task. + - parameter bytesSent: The number of bytes sent since the last time this delegate method was called. + - parameter totalBytesSent: The total number of bytes sent so far. + - parameter totalBytesExpectedToSend: The expected length of the body data. + */ + public func URLSession( + session: NSURLSession, + task: NSURLSessionTask, + didSendBodyData bytesSent: Int64, + totalBytesSent: Int64, + totalBytesExpectedToSend: Int64) + { + if let taskDidSendBodyData = taskDidSendBodyData { + taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend) + } else if let delegate = self[task] as? Request.UploadTaskDelegate { + delegate.URLSession( + session, + task: task, + didSendBodyData: bytesSent, + totalBytesSent: totalBytesSent, + totalBytesExpectedToSend: totalBytesExpectedToSend + ) + } + } + + /** + Tells the delegate that the task finished transferring data. + + - parameter session: The session containing the task whose request finished transferring data. + - parameter task: The task whose request finished transferring data. + - parameter error: If an error occurred, an error object indicating how the transfer failed, otherwise nil. + */ + public func URLSession(session: NSURLSession, task: NSURLSessionTask, didCompleteWithError error: NSError?) { + if let taskDidComplete = taskDidComplete { + taskDidComplete(session, task, error) + } else if let delegate = self[task] { + delegate.URLSession(session, task: task, didCompleteWithError: error) + } + + NSNotificationCenter.defaultCenter().postNotificationName(Notifications.Task.DidComplete, object: task) + + self[task] = nil + } + + // MARK: - NSURLSessionDataDelegate + + // MARK: Override Closures + + /// Overrides default behavior for NSURLSessionDataDelegate method `URLSession:dataTask:didReceiveResponse:completionHandler:`. + public var dataTaskDidReceiveResponse: ((NSURLSession, NSURLSessionDataTask, NSURLResponse) -> NSURLSessionResponseDisposition)? + + /// Overrides default behavior for NSURLSessionDataDelegate method `URLSession:dataTask:didBecomeDownloadTask:`. + public var dataTaskDidBecomeDownloadTask: ((NSURLSession, NSURLSessionDataTask, NSURLSessionDownloadTask) -> Void)? + + /// Overrides default behavior for NSURLSessionDataDelegate method `URLSession:dataTask:didReceiveData:`. + public var dataTaskDidReceiveData: ((NSURLSession, NSURLSessionDataTask, NSData) -> Void)? + + /// Overrides default behavior for NSURLSessionDataDelegate method `URLSession:dataTask:willCacheResponse:completionHandler:`. + public var dataTaskWillCacheResponse: ((NSURLSession, NSURLSessionDataTask, NSCachedURLResponse) -> NSCachedURLResponse!)? + + // MARK: Delegate Methods + + /** + Tells the delegate that the data task received the initial reply (headers) from the server. + + - parameter session: The session containing the data task that received an initial reply. + - parameter dataTask: The data task that received an initial reply. + - parameter response: A URL response object populated with headers. + - parameter completionHandler: A completion handler that your code calls to continue the transfer, passing a + constant to indicate whether the transfer should continue as a data task or + should become a download task. + */ + public func URLSession( + session: NSURLSession, + dataTask: NSURLSessionDataTask, + didReceiveResponse response: NSURLResponse, + completionHandler: ((NSURLSessionResponseDisposition) -> Void)) + { + var disposition: NSURLSessionResponseDisposition = .Allow + + if let dataTaskDidReceiveResponse = dataTaskDidReceiveResponse { + disposition = dataTaskDidReceiveResponse(session, dataTask, response) + } + + completionHandler(disposition) + } + + /** + Tells the delegate that the data task was changed to a download task. + + - parameter session: The session containing the task that was replaced by a download task. + - parameter dataTask: The data task that was replaced by a download task. + - parameter downloadTask: The new download task that replaced the data task. + */ + public func URLSession( + session: NSURLSession, + dataTask: NSURLSessionDataTask, + didBecomeDownloadTask downloadTask: NSURLSessionDownloadTask) + { + if let dataTaskDidBecomeDownloadTask = dataTaskDidBecomeDownloadTask { + dataTaskDidBecomeDownloadTask(session, dataTask, downloadTask) + } else { + let downloadDelegate = Request.DownloadTaskDelegate(task: downloadTask) + self[downloadTask] = downloadDelegate + } + } + + /** + Tells the delegate that the data task has received some of the expected data. + + - parameter session: The session containing the data task that provided data. + - parameter dataTask: The data task that provided data. + - parameter data: A data object containing the transferred data. + */ + public func URLSession(session: NSURLSession, dataTask: NSURLSessionDataTask, didReceiveData data: NSData) { + if let dataTaskDidReceiveData = dataTaskDidReceiveData { + dataTaskDidReceiveData(session, dataTask, data) + } else if let delegate = self[dataTask] as? Request.DataTaskDelegate { + delegate.URLSession(session, dataTask: dataTask, didReceiveData: data) + } + } + + /** + Asks the delegate whether the data (or upload) task should store the response in the cache. + + - parameter session: The session containing the data (or upload) task. + - parameter dataTask: The data (or upload) task. + - parameter proposedResponse: The default caching behavior. This behavior is determined based on the current + caching policy and the values of certain received headers, such as the Pragma + and Cache-Control headers. + - parameter completionHandler: A block that your handler must call, providing either the original proposed + response, a modified version of that response, or NULL to prevent caching the + response. If your delegate implements this method, it must call this completion + handler; otherwise, your app leaks memory. + */ + public func URLSession( + session: NSURLSession, + dataTask: NSURLSessionDataTask, + willCacheResponse proposedResponse: NSCachedURLResponse, + completionHandler: ((NSCachedURLResponse?) -> Void)) + { + if let dataTaskWillCacheResponse = dataTaskWillCacheResponse { + completionHandler(dataTaskWillCacheResponse(session, dataTask, proposedResponse)) + } else if let delegate = self[dataTask] as? Request.DataTaskDelegate { + delegate.URLSession( + session, + dataTask: dataTask, + willCacheResponse: proposedResponse, + completionHandler: completionHandler + ) + } else { + completionHandler(proposedResponse) + } + } + + // MARK: - NSURLSessionDownloadDelegate + + // MARK: Override Closures + + /// Overrides default behavior for NSURLSessionDownloadDelegate method `URLSession:downloadTask:didFinishDownloadingToURL:`. + public var downloadTaskDidFinishDownloadingToURL: ((NSURLSession, NSURLSessionDownloadTask, NSURL) -> Void)? + + /// Overrides default behavior for NSURLSessionDownloadDelegate method `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:`. + public var downloadTaskDidWriteData: ((NSURLSession, NSURLSessionDownloadTask, Int64, Int64, Int64) -> Void)? + + /// Overrides default behavior for NSURLSessionDownloadDelegate method `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:`. + public var downloadTaskDidResumeAtOffset: ((NSURLSession, NSURLSessionDownloadTask, Int64, Int64) -> Void)? + + // MARK: Delegate Methods + + /** + Tells the delegate that a download task has finished downloading. + + - parameter session: The session containing the download task that finished. + - parameter downloadTask: The download task that finished. + - parameter location: A file URL for the temporary file. Because the file is temporary, you must either + open the file for reading or move it to a permanent location in your app’s sandbox + container directory before returning from this delegate method. + */ + public func URLSession( + session: NSURLSession, + downloadTask: NSURLSessionDownloadTask, + didFinishDownloadingToURL location: NSURL) + { + if let downloadTaskDidFinishDownloadingToURL = downloadTaskDidFinishDownloadingToURL { + downloadTaskDidFinishDownloadingToURL(session, downloadTask, location) + } else if let delegate = self[downloadTask] as? Request.DownloadTaskDelegate { + delegate.URLSession(session, downloadTask: downloadTask, didFinishDownloadingToURL: location) + } + } + + /** + Periodically informs the delegate about the download’s progress. + + - parameter session: The session containing the download task. + - parameter downloadTask: The download task. + - parameter bytesWritten: The number of bytes transferred since the last time this delegate + method was called. + - parameter totalBytesWritten: The total number of bytes transferred so far. + - parameter totalBytesExpectedToWrite: The expected length of the file, as provided by the Content-Length + header. If this header was not provided, the value is + `NSURLSessionTransferSizeUnknown`. + */ + public func URLSession( + session: NSURLSession, + downloadTask: NSURLSessionDownloadTask, + didWriteData bytesWritten: Int64, + totalBytesWritten: Int64, + totalBytesExpectedToWrite: Int64) + { + if let downloadTaskDidWriteData = downloadTaskDidWriteData { + downloadTaskDidWriteData(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite) + } else if let delegate = self[downloadTask] as? Request.DownloadTaskDelegate { + delegate.URLSession( + session, + downloadTask: downloadTask, + didWriteData: bytesWritten, + totalBytesWritten: totalBytesWritten, + totalBytesExpectedToWrite: totalBytesExpectedToWrite + ) + } + } + + /** + Tells the delegate that the download task has resumed downloading. + + - parameter session: The session containing the download task that finished. + - parameter downloadTask: The download task that resumed. See explanation in the discussion. + - parameter fileOffset: If the file's cache policy or last modified date prevents reuse of the + existing content, then this value is zero. Otherwise, this value is an + integer representing the number of bytes on disk that do not need to be + retrieved again. + - parameter expectedTotalBytes: The expected length of the file, as provided by the Content-Length header. + If this header was not provided, the value is NSURLSessionTransferSizeUnknown. + */ + public func URLSession( + session: NSURLSession, + downloadTask: NSURLSessionDownloadTask, + didResumeAtOffset fileOffset: Int64, + expectedTotalBytes: Int64) + { + if let downloadTaskDidResumeAtOffset = downloadTaskDidResumeAtOffset { + downloadTaskDidResumeAtOffset(session, downloadTask, fileOffset, expectedTotalBytes) + } else if let delegate = self[downloadTask] as? Request.DownloadTaskDelegate { + delegate.URLSession( + session, + downloadTask: downloadTask, + didResumeAtOffset: fileOffset, + expectedTotalBytes: expectedTotalBytes + ) + } + } + + // MARK: - NSURLSessionStreamDelegate + + var _streamTaskReadClosed: Any? + var _streamTaskWriteClosed: Any? + var _streamTaskBetterRouteDiscovered: Any? + var _streamTaskDidBecomeInputStream: Any? + + // MARK: - NSObject + + public override func respondsToSelector(selector: Selector) -> Bool { + switch selector { + case "URLSession:didBecomeInvalidWithError:": + return sessionDidBecomeInvalidWithError != nil + case "URLSession:didReceiveChallenge:completionHandler:": + return sessionDidReceiveChallenge != nil + case "URLSessionDidFinishEventsForBackgroundURLSession:": + return sessionDidFinishEventsForBackgroundURLSession != nil + case "URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:": + return taskWillPerformHTTPRedirection != nil + case "URLSession:dataTask:didReceiveResponse:completionHandler:": + return dataTaskDidReceiveResponse != nil + default: + return self.dynamicType.instancesRespondToSelector(selector) + } + } + } +} diff --git a/Pods/Alamofire/Source/MultipartFormData.swift b/Pods/Alamofire/Source/MultipartFormData.swift new file mode 100644 index 0000000..8c37f16 --- /dev/null +++ b/Pods/Alamofire/Source/MultipartFormData.swift @@ -0,0 +1,669 @@ +// MultipartFormData.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +#if os(iOS) || os(watchOS) || os(tvOS) +import MobileCoreServices +#elseif os(OSX) +import CoreServices +#endif + +/** + Constructs `multipart/form-data` for uploads within an HTTP or HTTPS body. There are currently two ways to encode + multipart form data. The first way is to encode the data directly in memory. This is very efficient, but can lead + to memory issues if the dataset is too large. The second way is designed for larger datasets and will write all the + data to a single file on disk with all the proper boundary segmentation. The second approach MUST be used for + larger datasets such as video content, otherwise your app may run out of memory when trying to encode the dataset. + + For more information on `multipart/form-data` in general, please refer to the RFC-2388 and RFC-2045 specs as well + and the w3 form documentation. + + - https://www.ietf.org/rfc/rfc2388.txt + - https://www.ietf.org/rfc/rfc2045.txt + - https://www.w3.org/TR/html401/interact/forms.html#h-17.13 +*/ +public class MultipartFormData { + + // MARK: - Helper Types + + struct EncodingCharacters { + static let CRLF = "\r\n" + } + + struct BoundaryGenerator { + enum BoundaryType { + case Initial, Encapsulated, Final + } + + static func randomBoundary() -> String { + return String(format: "alamofire.boundary.%08x%08x", arc4random(), arc4random()) + } + + static func boundaryData(boundaryType boundaryType: BoundaryType, boundary: String) -> NSData { + let boundaryText: String + + switch boundaryType { + case .Initial: + boundaryText = "--\(boundary)\(EncodingCharacters.CRLF)" + case .Encapsulated: + boundaryText = "\(EncodingCharacters.CRLF)--\(boundary)\(EncodingCharacters.CRLF)" + case .Final: + boundaryText = "\(EncodingCharacters.CRLF)--\(boundary)--\(EncodingCharacters.CRLF)" + } + + return boundaryText.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)! + } + } + + class BodyPart { + let headers: [String: String] + let bodyStream: NSInputStream + let bodyContentLength: UInt64 + var hasInitialBoundary = false + var hasFinalBoundary = false + + init(headers: [String: String], bodyStream: NSInputStream, bodyContentLength: UInt64) { + self.headers = headers + self.bodyStream = bodyStream + self.bodyContentLength = bodyContentLength + } + } + + // MARK: - Properties + + /// The `Content-Type` header value containing the boundary used to generate the `multipart/form-data`. + public var contentType: String { return "multipart/form-data; boundary=\(boundary)" } + + /// The content length of all body parts used to generate the `multipart/form-data` not including the boundaries. + public var contentLength: UInt64 { return bodyParts.reduce(0) { $0 + $1.bodyContentLength } } + + /// The boundary used to separate the body parts in the encoded form data. + public let boundary: String + + private var bodyParts: [BodyPart] + private var bodyPartError: NSError? + private let streamBufferSize: Int + + // MARK: - Lifecycle + + /** + Creates a multipart form data object. + + - returns: The multipart form data object. + */ + public init() { + self.boundary = BoundaryGenerator.randomBoundary() + self.bodyParts = [] + + /** + * The optimal read/write buffer size in bytes for input and output streams is 1024 (1KB). For more + * information, please refer to the following article: + * - https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Streams/Articles/ReadingInputStreams.html + */ + + self.streamBufferSize = 1024 + } + + // MARK: - Body Parts + + /** + Creates a body part from the data and appends it to the multipart form data object. + + The body part data will be encoded using the following format: + + - `Content-Disposition: form-data; name=#{name}` (HTTP Header) + - Encoded data + - Multipart form boundary + + - parameter data: The data to encode into the multipart form data. + - parameter name: The name to associate with the data in the `Content-Disposition` HTTP header. + */ + public func appendBodyPart(data data: NSData, name: String) { + let headers = contentHeaders(name: name) + let stream = NSInputStream(data: data) + let length = UInt64(data.length) + + appendBodyPart(stream: stream, length: length, headers: headers) + } + + /** + Creates a body part from the data and appends it to the multipart form data object. + + The body part data will be encoded using the following format: + + - `Content-Disposition: form-data; name=#{name}` (HTTP Header) + - `Content-Type: #{generated mimeType}` (HTTP Header) + - Encoded data + - Multipart form boundary + + - parameter data: The data to encode into the multipart form data. + - parameter name: The name to associate with the data in the `Content-Disposition` HTTP header. + - parameter mimeType: The MIME type to associate with the data content type in the `Content-Type` HTTP header. + */ + public func appendBodyPart(data data: NSData, name: String, mimeType: String) { + let headers = contentHeaders(name: name, mimeType: mimeType) + let stream = NSInputStream(data: data) + let length = UInt64(data.length) + + appendBodyPart(stream: stream, length: length, headers: headers) + } + + /** + Creates a body part from the data and appends it to the multipart form data object. + + The body part data will be encoded using the following format: + + - `Content-Disposition: form-data; name=#{name}; filename=#{filename}` (HTTP Header) + - `Content-Type: #{mimeType}` (HTTP Header) + - Encoded file data + - Multipart form boundary + + - parameter data: The data to encode into the multipart form data. + - parameter name: The name to associate with the data in the `Content-Disposition` HTTP header. + - parameter fileName: The filename to associate with the data in the `Content-Disposition` HTTP header. + - parameter mimeType: The MIME type to associate with the data in the `Content-Type` HTTP header. + */ + public func appendBodyPart(data data: NSData, name: String, fileName: String, mimeType: String) { + let headers = contentHeaders(name: name, fileName: fileName, mimeType: mimeType) + let stream = NSInputStream(data: data) + let length = UInt64(data.length) + + appendBodyPart(stream: stream, length: length, headers: headers) + } + + /** + Creates a body part from the file and appends it to the multipart form data object. + + The body part data will be encoded using the following format: + + - `Content-Disposition: form-data; name=#{name}; filename=#{generated filename}` (HTTP Header) + - `Content-Type: #{generated mimeType}` (HTTP Header) + - Encoded file data + - Multipart form boundary + + The filename in the `Content-Disposition` HTTP header is generated from the last path component of the + `fileURL`. The `Content-Type` HTTP header MIME type is generated by mapping the `fileURL` extension to the + system associated MIME type. + + - parameter fileURL: The URL of the file whose content will be encoded into the multipart form data. + - parameter name: The name to associate with the file content in the `Content-Disposition` HTTP header. + */ + public func appendBodyPart(fileURL fileURL: NSURL, name: String) { + if let + fileName = fileURL.lastPathComponent, + pathExtension = fileURL.pathExtension + { + let mimeType = mimeTypeForPathExtension(pathExtension) + appendBodyPart(fileURL: fileURL, name: name, fileName: fileName, mimeType: mimeType) + } else { + let failureReason = "Failed to extract the fileName of the provided URL: \(fileURL)" + setBodyPartError(Error.errorWithCode(NSURLErrorBadURL, failureReason: failureReason)) + } + } + + /** + Creates a body part from the file and appends it to the multipart form data object. + + The body part data will be encoded using the following format: + + - Content-Disposition: form-data; name=#{name}; filename=#{filename} (HTTP Header) + - Content-Type: #{mimeType} (HTTP Header) + - Encoded file data + - Multipart form boundary + + - parameter fileURL: The URL of the file whose content will be encoded into the multipart form data. + - parameter name: The name to associate with the file content in the `Content-Disposition` HTTP header. + - parameter fileName: The filename to associate with the file content in the `Content-Disposition` HTTP header. + - parameter mimeType: The MIME type to associate with the file content in the `Content-Type` HTTP header. + */ + public func appendBodyPart(fileURL fileURL: NSURL, name: String, fileName: String, mimeType: String) { + let headers = contentHeaders(name: name, fileName: fileName, mimeType: mimeType) + + //============================================================ + // Check 1 - is file URL? + //============================================================ + + guard fileURL.fileURL else { + let failureReason = "The file URL does not point to a file URL: \(fileURL)" + let error = Error.errorWithCode(NSURLErrorBadURL, failureReason: failureReason) + setBodyPartError(error) + return + } + + //============================================================ + // Check 2 - is file URL reachable? + //============================================================ + + var isReachable = true + + if #available(OSX 10.10, *) { + isReachable = fileURL.checkPromisedItemIsReachableAndReturnError(nil) + } + + guard isReachable else { + let error = Error.errorWithCode(NSURLErrorBadURL, failureReason: "The file URL is not reachable: \(fileURL)") + setBodyPartError(error) + return + } + + //============================================================ + // Check 3 - is file URL a directory? + //============================================================ + + var isDirectory: ObjCBool = false + + guard let + path = fileURL.path + where NSFileManager.defaultManager().fileExistsAtPath(path, isDirectory: &isDirectory) && !isDirectory else + { + let failureReason = "The file URL is a directory, not a file: \(fileURL)" + let error = Error.errorWithCode(NSURLErrorBadURL, failureReason: failureReason) + setBodyPartError(error) + return + } + + //============================================================ + // Check 4 - can the file size be extracted? + //============================================================ + + var bodyContentLength: UInt64? + + do { + if let + path = fileURL.path, + fileSize = try NSFileManager.defaultManager().attributesOfItemAtPath(path)[NSFileSize] as? NSNumber + { + bodyContentLength = fileSize.unsignedLongLongValue + } + } catch { + // No-op + } + + guard let length = bodyContentLength else { + let failureReason = "Could not fetch attributes from the file URL: \(fileURL)" + let error = Error.errorWithCode(NSURLErrorBadURL, failureReason: failureReason) + setBodyPartError(error) + return + } + + //============================================================ + // Check 5 - can a stream be created from file URL? + //============================================================ + + guard let stream = NSInputStream(URL: fileURL) else { + let failureReason = "Failed to create an input stream from the file URL: \(fileURL)" + let error = Error.errorWithCode(NSURLErrorCannotOpenFile, failureReason: failureReason) + setBodyPartError(error) + return + } + + appendBodyPart(stream: stream, length: length, headers: headers) + } + + /** + Creates a body part from the stream and appends it to the multipart form data object. + + The body part data will be encoded using the following format: + + - `Content-Disposition: form-data; name=#{name}; filename=#{filename}` (HTTP Header) + - `Content-Type: #{mimeType}` (HTTP Header) + - Encoded stream data + - Multipart form boundary + + - parameter stream: The input stream to encode in the multipart form data. + - parameter length: The content length of the stream. + - parameter name: The name to associate with the stream content in the `Content-Disposition` HTTP header. + - parameter fileName: The filename to associate with the stream content in the `Content-Disposition` HTTP header. + - parameter mimeType: The MIME type to associate with the stream content in the `Content-Type` HTTP header. + */ + public func appendBodyPart( + stream stream: NSInputStream, + length: UInt64, + name: String, + fileName: String, + mimeType: String) + { + let headers = contentHeaders(name: name, fileName: fileName, mimeType: mimeType) + appendBodyPart(stream: stream, length: length, headers: headers) + } + + /** + Creates a body part with the headers, stream and length and appends it to the multipart form data object. + + The body part data will be encoded using the following format: + + - HTTP headers + - Encoded stream data + - Multipart form boundary + + - parameter stream: The input stream to encode in the multipart form data. + - parameter length: The content length of the stream. + - parameter headers: The HTTP headers for the body part. + */ + public func appendBodyPart(stream stream: NSInputStream, length: UInt64, headers: [String: String]) { + let bodyPart = BodyPart(headers: headers, bodyStream: stream, bodyContentLength: length) + bodyParts.append(bodyPart) + } + + // MARK: - Data Encoding + + /** + Encodes all the appended body parts into a single `NSData` object. + + It is important to note that this method will load all the appended body parts into memory all at the same + time. This method should only be used when the encoded data will have a small memory footprint. For large data + cases, please use the `writeEncodedDataToDisk(fileURL:completionHandler:)` method. + + - throws: An `NSError` if encoding encounters an error. + + - returns: The encoded `NSData` if encoding is successful. + */ + public func encode() throws -> NSData { + if let bodyPartError = bodyPartError { + throw bodyPartError + } + + let encoded = NSMutableData() + + bodyParts.first?.hasInitialBoundary = true + bodyParts.last?.hasFinalBoundary = true + + for bodyPart in bodyParts { + let encodedData = try encodeBodyPart(bodyPart) + encoded.appendData(encodedData) + } + + return encoded + } + + /** + Writes the appended body parts into the given file URL. + + This process is facilitated by reading and writing with input and output streams, respectively. Thus, + this approach is very memory efficient and should be used for large body part data. + + - parameter fileURL: The file URL to write the multipart form data into. + + - throws: An `NSError` if encoding encounters an error. + */ + public func writeEncodedDataToDisk(fileURL: NSURL) throws { + if let bodyPartError = bodyPartError { + throw bodyPartError + } + + if let path = fileURL.path where NSFileManager.defaultManager().fileExistsAtPath(path) { + let failureReason = "A file already exists at the given file URL: \(fileURL)" + throw Error.errorWithCode(NSURLErrorBadURL, failureReason: failureReason) + } else if !fileURL.fileURL { + let failureReason = "The URL does not point to a valid file: \(fileURL)" + throw Error.errorWithCode(NSURLErrorBadURL, failureReason: failureReason) + } + + let outputStream: NSOutputStream + + if let possibleOutputStream = NSOutputStream(URL: fileURL, append: false) { + outputStream = possibleOutputStream + } else { + let failureReason = "Failed to create an output stream with the given URL: \(fileURL)" + throw Error.errorWithCode(NSURLErrorCannotOpenFile, failureReason: failureReason) + } + + outputStream.scheduleInRunLoop(NSRunLoop.currentRunLoop(), forMode: NSDefaultRunLoopMode) + outputStream.open() + + self.bodyParts.first?.hasInitialBoundary = true + self.bodyParts.last?.hasFinalBoundary = true + + for bodyPart in self.bodyParts { + try writeBodyPart(bodyPart, toOutputStream: outputStream) + } + + outputStream.close() + outputStream.removeFromRunLoop(NSRunLoop.currentRunLoop(), forMode: NSDefaultRunLoopMode) + } + + // MARK: - Private - Body Part Encoding + + private func encodeBodyPart(bodyPart: BodyPart) throws -> NSData { + let encoded = NSMutableData() + + let initialData = bodyPart.hasInitialBoundary ? initialBoundaryData() : encapsulatedBoundaryData() + encoded.appendData(initialData) + + let headerData = encodeHeaderDataForBodyPart(bodyPart) + encoded.appendData(headerData) + + let bodyStreamData = try encodeBodyStreamDataForBodyPart(bodyPart) + encoded.appendData(bodyStreamData) + + if bodyPart.hasFinalBoundary { + encoded.appendData(finalBoundaryData()) + } + + return encoded + } + + private func encodeHeaderDataForBodyPart(bodyPart: BodyPart) -> NSData { + var headerText = "" + + for (key, value) in bodyPart.headers { + headerText += "\(key): \(value)\(EncodingCharacters.CRLF)" + } + headerText += EncodingCharacters.CRLF + + return headerText.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)! + } + + private func encodeBodyStreamDataForBodyPart(bodyPart: BodyPart) throws -> NSData { + let inputStream = bodyPart.bodyStream + inputStream.scheduleInRunLoop(NSRunLoop.currentRunLoop(), forMode: NSDefaultRunLoopMode) + inputStream.open() + + var error: NSError? + let encoded = NSMutableData() + + while inputStream.hasBytesAvailable { + var buffer = [UInt8](count: streamBufferSize, repeatedValue: 0) + let bytesRead = inputStream.read(&buffer, maxLength: streamBufferSize) + + if inputStream.streamError != nil { + error = inputStream.streamError + break + } + + if bytesRead > 0 { + encoded.appendBytes(buffer, length: bytesRead) + } else if bytesRead < 0 { + let failureReason = "Failed to read from input stream: \(inputStream)" + error = Error.errorWithCode(.InputStreamReadFailed, failureReason: failureReason) + break + } else { + break + } + } + + inputStream.close() + inputStream.removeFromRunLoop(NSRunLoop.currentRunLoop(), forMode: NSDefaultRunLoopMode) + + if let error = error { + throw error + } + + return encoded + } + + // MARK: - Private - Writing Body Part to Output Stream + + private func writeBodyPart(bodyPart: BodyPart, toOutputStream outputStream: NSOutputStream) throws { + try writeInitialBoundaryDataForBodyPart(bodyPart, toOutputStream: outputStream) + try writeHeaderDataForBodyPart(bodyPart, toOutputStream: outputStream) + try writeBodyStreamForBodyPart(bodyPart, toOutputStream: outputStream) + try writeFinalBoundaryDataForBodyPart(bodyPart, toOutputStream: outputStream) + } + + private func writeInitialBoundaryDataForBodyPart( + bodyPart: BodyPart, + toOutputStream outputStream: NSOutputStream) + throws + { + let initialData = bodyPart.hasInitialBoundary ? initialBoundaryData() : encapsulatedBoundaryData() + return try writeData(initialData, toOutputStream: outputStream) + } + + private func writeHeaderDataForBodyPart(bodyPart: BodyPart, toOutputStream outputStream: NSOutputStream) throws { + let headerData = encodeHeaderDataForBodyPart(bodyPart) + return try writeData(headerData, toOutputStream: outputStream) + } + + private func writeBodyStreamForBodyPart(bodyPart: BodyPart, toOutputStream outputStream: NSOutputStream) throws { + let inputStream = bodyPart.bodyStream + inputStream.scheduleInRunLoop(NSRunLoop.currentRunLoop(), forMode: NSDefaultRunLoopMode) + inputStream.open() + + while inputStream.hasBytesAvailable { + var buffer = [UInt8](count: streamBufferSize, repeatedValue: 0) + let bytesRead = inputStream.read(&buffer, maxLength: streamBufferSize) + + if let streamError = inputStream.streamError { + throw streamError + } + + if bytesRead > 0 { + if buffer.count != bytesRead { + buffer = Array(buffer[0.. 0 { + if outputStream.hasSpaceAvailable { + let bytesWritten = outputStream.write(buffer, maxLength: bytesToWrite) + + if let streamError = outputStream.streamError { + throw streamError + } + + if bytesWritten < 0 { + let failureReason = "Failed to write to output stream: \(outputStream)" + throw Error.errorWithCode(.OutputStreamWriteFailed, failureReason: failureReason) + } + + bytesToWrite -= bytesWritten + + if bytesToWrite > 0 { + buffer = Array(buffer[bytesWritten.. String { + if let + id = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension, nil)?.takeRetainedValue(), + contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?.takeRetainedValue() + { + return contentType as String + } + + return "application/octet-stream" + } + + // MARK: - Private - Content Headers + + private func contentHeaders(name name: String) -> [String: String] { + return ["Content-Disposition": "form-data; name=\"\(name)\""] + } + + private func contentHeaders(name name: String, mimeType: String) -> [String: String] { + return [ + "Content-Disposition": "form-data; name=\"\(name)\"", + "Content-Type": "\(mimeType)" + ] + } + + private func contentHeaders(name name: String, fileName: String, mimeType: String) -> [String: String] { + return [ + "Content-Disposition": "form-data; name=\"\(name)\"; filename=\"\(fileName)\"", + "Content-Type": "\(mimeType)" + ] + } + + // MARK: - Private - Boundary Encoding + + private func initialBoundaryData() -> NSData { + return BoundaryGenerator.boundaryData(boundaryType: .Initial, boundary: boundary) + } + + private func encapsulatedBoundaryData() -> NSData { + return BoundaryGenerator.boundaryData(boundaryType: .Encapsulated, boundary: boundary) + } + + private func finalBoundaryData() -> NSData { + return BoundaryGenerator.boundaryData(boundaryType: .Final, boundary: boundary) + } + + // MARK: - Private - Errors + + private func setBodyPartError(error: NSError) { + if bodyPartError == nil { + bodyPartError = error + } + } +} diff --git a/Pods/Alamofire/Source/NetworkReachabilityManager.swift b/Pods/Alamofire/Source/NetworkReachabilityManager.swift new file mode 100644 index 0000000..63f97b6 --- /dev/null +++ b/Pods/Alamofire/Source/NetworkReachabilityManager.swift @@ -0,0 +1,239 @@ +// NetworkReachabilityManager.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#if !os(watchOS) + +import Foundation +import SystemConfiguration + +/** + The `NetworkReachabilityManager` class listens for reachability changes of hosts and addresses for both WWAN and + WiFi network interfaces. + + Reachability can be used to determine background information about why a network operation failed, or to retry + network requests when a connection is established. It should not be used to prevent a user from initiating a network + request, as it's possible that an initial request may be required to establish reachability. +*/ +public class NetworkReachabilityManager { + /** + Defines the various states of network reachability. + + - Unknown: It is unknown whether the network is reachable. + - NotReachable: The network is not reachable. + - ReachableOnWWAN: The network is reachable over the WWAN connection. + - ReachableOnWiFi: The network is reachable over the WiFi connection. + */ + public enum NetworkReachabilityStatus { + case Unknown + case NotReachable + case Reachable(ConnectionType) + } + + /** + Defines the various connection types detected by reachability flags. + + - EthernetOrWiFi: The connection type is either over Ethernet or WiFi. + - WWAN: The connection type is a WWAN connection. + */ + public enum ConnectionType { + case EthernetOrWiFi + case WWAN + } + + /// A closure executed when the network reachability status changes. The closure takes a single argument: the + /// network reachability status. + public typealias Listener = NetworkReachabilityStatus -> Void + + // MARK: - Properties + + /// Whether the network is currently reachable. + public var isReachable: Bool { return isReachableOnWWAN || isReachableOnEthernetOrWiFi } + + /// Whether the network is currently reachable over the WWAN interface. + public var isReachableOnWWAN: Bool { return networkReachabilityStatus == .Reachable(.WWAN) } + + /// Whether the network is currently reachable over Ethernet or WiFi interface. + public var isReachableOnEthernetOrWiFi: Bool { return networkReachabilityStatus == .Reachable(.EthernetOrWiFi) } + + /// The current network reachability status. + public var networkReachabilityStatus: NetworkReachabilityStatus { + guard let flags = self.flags else { return .Unknown } + return networkReachabilityStatusForFlags(flags) + } + + /// The dispatch queue to execute the `listener` closure on. + public var listenerQueue: dispatch_queue_t = dispatch_get_main_queue() + + /// A closure executed when the network reachability status changes. + public var listener: Listener? + + private var flags: SCNetworkReachabilityFlags? { + var flags = SCNetworkReachabilityFlags() + + if SCNetworkReachabilityGetFlags(reachability, &flags) { + return flags + } + + return nil + } + + private let reachability: SCNetworkReachability + private var previousFlags: SCNetworkReachabilityFlags + + // MARK: - Initialization + + /** + Creates a `NetworkReachabilityManager` instance with the specified host. + + - parameter host: The host used to evaluate network reachability. + + - returns: The new `NetworkReachabilityManager` instance. + */ + public convenience init?(host: String) { + guard let reachability = SCNetworkReachabilityCreateWithName(nil, host) else { return nil } + self.init(reachability: reachability) + } + + /** + Creates a `NetworkReachabilityManager` instance with the default socket address (`sockaddr_in6`). + + - returns: The new `NetworkReachabilityManager` instance. + */ + public convenience init?() { + var address = sockaddr_in6() + address.sin6_len = UInt8(sizeofValue(address)) + address.sin6_family = sa_family_t(AF_INET6) + + guard let reachability = withUnsafePointer(&address, { + SCNetworkReachabilityCreateWithAddress(nil, UnsafePointer($0)) + }) else { return nil } + + self.init(reachability: reachability) + } + + private init(reachability: SCNetworkReachability) { + self.reachability = reachability + self.previousFlags = SCNetworkReachabilityFlags() + } + + deinit { + stopListening() + } + + // MARK: - Listening + + /** + Starts listening for changes in network reachability status. + + - returns: `true` if listening was started successfully, `false` otherwise. + */ + public func startListening() -> Bool { + var context = SCNetworkReachabilityContext(version: 0, info: nil, retain: nil, release: nil, copyDescription: nil) + context.info = UnsafeMutablePointer(Unmanaged.passUnretained(self).toOpaque()) + + let callbackEnabled = SCNetworkReachabilitySetCallback( + reachability, + { (_, flags, info) in + let reachability = Unmanaged.fromOpaque(COpaquePointer(info)).takeUnretainedValue() + reachability.notifyListener(flags) + }, + &context + ) + + let queueEnabled = SCNetworkReachabilitySetDispatchQueue(reachability, listenerQueue) + + dispatch_async(listenerQueue) { + self.previousFlags = SCNetworkReachabilityFlags() + self.notifyListener(self.flags ?? SCNetworkReachabilityFlags()) + } + + return callbackEnabled && queueEnabled + } + + /** + Stops listening for changes in network reachability status. + */ + public func stopListening() { + SCNetworkReachabilitySetCallback(reachability, nil, nil) + SCNetworkReachabilitySetDispatchQueue(reachability, nil) + } + + // MARK: - Internal - Listener Notification + + func notifyListener(flags: SCNetworkReachabilityFlags) { + guard previousFlags != flags else { return } + previousFlags = flags + + listener?(networkReachabilityStatusForFlags(flags)) + } + + // MARK: - Internal - Network Reachability Status + + func networkReachabilityStatusForFlags(flags: SCNetworkReachabilityFlags) -> NetworkReachabilityStatus { + guard flags.contains(.Reachable) else { return .NotReachable } + + var networkStatus: NetworkReachabilityStatus = .NotReachable + + if !flags.contains(.ConnectionRequired) { networkStatus = .Reachable(.EthernetOrWiFi) } + + if flags.contains(.ConnectionOnDemand) || flags.contains(.ConnectionOnTraffic) { + if !flags.contains(.InterventionRequired) { networkStatus = .Reachable(.EthernetOrWiFi) } + } + + #if os(iOS) + if flags.contains(.IsWWAN) { networkStatus = .Reachable(.WWAN) } + #endif + + return networkStatus + } +} + +// MARK: - + +extension NetworkReachabilityManager.NetworkReachabilityStatus: Equatable {} + +/** + Returns whether the two network reachability status values are equal. + + - parameter lhs: The left-hand side value to compare. + - parameter rhs: The right-hand side value to compare. + + - returns: `true` if the two values are equal, `false` otherwise. +*/ +public func ==( + lhs: NetworkReachabilityManager.NetworkReachabilityStatus, + rhs: NetworkReachabilityManager.NetworkReachabilityStatus) + -> Bool +{ + switch (lhs, rhs) { + case (.Unknown, .Unknown): + return true + case (.NotReachable, .NotReachable): + return true + case let (.Reachable(lhsConnectionType), .Reachable(rhsConnectionType)): + return lhsConnectionType == rhsConnectionType + default: + return false + } +} + +#endif diff --git a/Pods/Alamofire/Source/Notifications.swift b/Pods/Alamofire/Source/Notifications.swift new file mode 100644 index 0000000..1c23540 --- /dev/null +++ b/Pods/Alamofire/Source/Notifications.swift @@ -0,0 +1,45 @@ +// Notifications.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +/// Contains all the `NSNotification` names posted by Alamofire with descriptions of each notification's payload. +public struct Notifications { + /// Used as a namespace for all `NSURLSessionTask` related notifications. + public struct Task { + /// Notification posted when an `NSURLSessionTask` is resumed. The notification `object` contains the resumed + /// `NSURLSessionTask`. + public static let DidResume = "com.alamofire.notifications.task.didResume" + + /// Notification posted when an `NSURLSessionTask` is suspended. The notification `object` contains the + /// suspended `NSURLSessionTask`. + public static let DidSuspend = "com.alamofire.notifications.task.didSuspend" + + /// Notification posted when an `NSURLSessionTask` is cancelled. The notification `object` contains the + /// cancelled `NSURLSessionTask`. + public static let DidCancel = "com.alamofire.notifications.task.didCancel" + + /// Notification posted when an `NSURLSessionTask` is completed. The notification `object` contains the + /// completed `NSURLSessionTask`. + public static let DidComplete = "com.alamofire.notifications.task.didComplete" + } +} diff --git a/Pods/Alamofire/Source/ParameterEncoding.swift b/Pods/Alamofire/Source/ParameterEncoding.swift new file mode 100644 index 0000000..130bf0f --- /dev/null +++ b/Pods/Alamofire/Source/ParameterEncoding.swift @@ -0,0 +1,259 @@ +// ParameterEncoding.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +/** + HTTP method definitions. + + See https://tools.ietf.org/html/rfc7231#section-4.3 +*/ +public enum Method: String { + case OPTIONS, GET, HEAD, POST, PUT, PATCH, DELETE, TRACE, CONNECT +} + +// MARK: ParameterEncoding + +/** + Used to specify the way in which a set of parameters are applied to a URL request. + + - `URL`: Creates a query string to be set as or appended to any existing URL query for `GET`, `HEAD`, + and `DELETE` requests, or set as the body for requests with any other HTTP method. The + `Content-Type` HTTP header field of an encoded request with HTTP body is set to + `application/x-www-form-urlencoded; charset=utf-8`. Since there is no published specification + for how to encode collection types, the convention of appending `[]` to the key for array + values (`foo[]=1&foo[]=2`), and appending the key surrounded by square brackets for nested + dictionary values (`foo[bar]=baz`). + + - `URLEncodedInURL`: Creates query string to be set as or appended to any existing URL query. Uses the same + implementation as the `.URL` case, but always applies the encoded result to the URL. + + - `JSON`: Uses `NSJSONSerialization` to create a JSON representation of the parameters object, which is + set as the body of the request. The `Content-Type` HTTP header field of an encoded request is + set to `application/json`. + + - `PropertyList`: Uses `NSPropertyListSerialization` to create a plist representation of the parameters object, + according to the associated format and write options values, which is set as the body of the + request. The `Content-Type` HTTP header field of an encoded request is set to + `application/x-plist`. + + - `Custom`: Uses the associated closure value to construct a new request given an existing request and + parameters. +*/ +public enum ParameterEncoding { + case URL + case URLEncodedInURL + case JSON + case PropertyList(NSPropertyListFormat, NSPropertyListWriteOptions) + case Custom((URLRequestConvertible, [String: AnyObject]?) -> (NSMutableURLRequest, NSError?)) + + /** + Creates a URL request by encoding parameters and applying them onto an existing request. + + - parameter URLRequest: The request to have parameters applied. + - parameter parameters: The parameters to apply. + + - returns: A tuple containing the constructed request and the error that occurred during parameter encoding, + if any. + */ + public func encode( + URLRequest: URLRequestConvertible, + parameters: [String: AnyObject]?) + -> (NSMutableURLRequest, NSError?) + { + var mutableURLRequest = URLRequest.URLRequest + + guard let parameters = parameters else { return (mutableURLRequest, nil) } + + var encodingError: NSError? = nil + + switch self { + case .URL, .URLEncodedInURL: + func query(parameters: [String: AnyObject]) -> String { + var components: [(String, String)] = [] + + for key in parameters.keys.sort(<) { + let value = parameters[key]! + components += queryComponents(key, value) + } + + return (components.map { "\($0)=\($1)" } as [String]).joinWithSeparator("&") + } + + func encodesParametersInURL(method: Method) -> Bool { + switch self { + case .URLEncodedInURL: + return true + default: + break + } + + switch method { + case .GET, .HEAD, .DELETE: + return true + default: + return false + } + } + + if let method = Method(rawValue: mutableURLRequest.HTTPMethod) where encodesParametersInURL(method) { + if let + URLComponents = NSURLComponents(URL: mutableURLRequest.URL!, resolvingAgainstBaseURL: false) + where !parameters.isEmpty + { + let percentEncodedQuery = (URLComponents.percentEncodedQuery.map { $0 + "&" } ?? "") + query(parameters) + URLComponents.percentEncodedQuery = percentEncodedQuery + mutableURLRequest.URL = URLComponents.URL + } + } else { + if mutableURLRequest.valueForHTTPHeaderField("Content-Type") == nil { + mutableURLRequest.setValue( + "application/x-www-form-urlencoded; charset=utf-8", + forHTTPHeaderField: "Content-Type" + ) + } + + mutableURLRequest.HTTPBody = query(parameters).dataUsingEncoding( + NSUTF8StringEncoding, + allowLossyConversion: false + ) + } + case .JSON: + do { + let options = NSJSONWritingOptions() + let data = try NSJSONSerialization.dataWithJSONObject(parameters, options: options) + + if mutableURLRequest.valueForHTTPHeaderField("Content-Type") == nil { + mutableURLRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") + } + + mutableURLRequest.HTTPBody = data + } catch { + encodingError = error as NSError + } + case .PropertyList(let format, let options): + do { + let data = try NSPropertyListSerialization.dataWithPropertyList( + parameters, + format: format, + options: options + ) + + if mutableURLRequest.valueForHTTPHeaderField("Content-Type") == nil { + mutableURLRequest.setValue("application/x-plist", forHTTPHeaderField: "Content-Type") + } + + mutableURLRequest.HTTPBody = data + } catch { + encodingError = error as NSError + } + case .Custom(let closure): + (mutableURLRequest, encodingError) = closure(mutableURLRequest, parameters) + } + + return (mutableURLRequest, encodingError) + } + + /** + Creates percent-escaped, URL encoded query string components from the given key-value pair using recursion. + + - parameter key: The key of the query component. + - parameter value: The value of the query component. + + - returns: The percent-escaped, URL encoded query string components. + */ + public func queryComponents(key: String, _ value: AnyObject) -> [(String, String)] { + var components: [(String, String)] = [] + + if let dictionary = value as? [String: AnyObject] { + for (nestedKey, value) in dictionary { + components += queryComponents("\(key)[\(nestedKey)]", value) + } + } else if let array = value as? [AnyObject] { + for value in array { + components += queryComponents("\(key)[]", value) + } + } else { + components.append((escape(key), escape("\(value)"))) + } + + return components + } + + /** + Returns a percent-escaped string following RFC 3986 for a query string key or value. + + RFC 3986 states that the following characters are "reserved" characters. + + - General Delimiters: ":", "#", "[", "]", "@", "?", "/" + - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "=" + + In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow + query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/" + should be percent-escaped in the query string. + + - parameter string: The string to be percent-escaped. + + - returns: The percent-escaped string. + */ + public func escape(string: String) -> String { + let generalDelimitersToEncode = ":#[]@" // does not include "?" or "/" due to RFC 3986 - Section 3.4 + let subDelimitersToEncode = "!$&'()*+,;=" + + let allowedCharacterSet = NSCharacterSet.URLQueryAllowedCharacterSet().mutableCopy() as! NSMutableCharacterSet + allowedCharacterSet.removeCharactersInString(generalDelimitersToEncode + subDelimitersToEncode) + + var escaped = "" + + //========================================================================================================== + // + // Batching is required for escaping due to an internal bug in iOS 8.1 and 8.2. Encoding more than a few + // hundred Chinense characters causes various malloc error crashes. To avoid this issue until iOS 8 is no + // longer supported, batching MUST be used for encoding. This introduces roughly a 20% overhead. For more + // info, please refer to: + // + // - https://github.com/Alamofire/Alamofire/issues/206 + // + //========================================================================================================== + + if #available(iOS 8.3, OSX 10.10, *) { + escaped = string.stringByAddingPercentEncodingWithAllowedCharacters(allowedCharacterSet) ?? string + } else { + let batchSize = 50 + var index = string.startIndex + + while index != string.endIndex { + let startIndex = index + let endIndex = index.advancedBy(batchSize, limit: string.endIndex) + let range = Range(start: startIndex, end: endIndex) + + let substring = string.substringWithRange(range) + + escaped += substring.stringByAddingPercentEncodingWithAllowedCharacters(allowedCharacterSet) ?? substring + + index = endIndex + } + } + + return escaped + } +} diff --git a/Pods/Alamofire/Source/Request.swift b/Pods/Alamofire/Source/Request.swift new file mode 100644 index 0000000..fa196a2 --- /dev/null +++ b/Pods/Alamofire/Source/Request.swift @@ -0,0 +1,552 @@ +// Request.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +/** + Responsible for sending a request and receiving the response and associated data from the server, as well as + managing its underlying `NSURLSessionTask`. +*/ +public class Request { + + // MARK: - Properties + + /// The delegate for the underlying task. + public let delegate: TaskDelegate + + /// The underlying task. + public var task: NSURLSessionTask { return delegate.task } + + /// The session belonging to the underlying task. + public let session: NSURLSession + + /// The request sent or to be sent to the server. + public var request: NSURLRequest? { return task.originalRequest } + + /// The response received from the server, if any. + public var response: NSHTTPURLResponse? { return task.response as? NSHTTPURLResponse } + + /// The progress of the request lifecycle. + public var progress: NSProgress { return delegate.progress } + + var startTime: CFAbsoluteTime? + var endTime: CFAbsoluteTime? + + // MARK: - Lifecycle + + init(session: NSURLSession, task: NSURLSessionTask) { + self.session = session + + switch task { + case is NSURLSessionUploadTask: + delegate = UploadTaskDelegate(task: task) + case is NSURLSessionDataTask: + delegate = DataTaskDelegate(task: task) + case is NSURLSessionDownloadTask: + delegate = DownloadTaskDelegate(task: task) + default: + delegate = TaskDelegate(task: task) + } + + delegate.queue.addOperationWithBlock { self.endTime = CFAbsoluteTimeGetCurrent() } + } + + // MARK: - Authentication + + /** + Associates an HTTP Basic credential with the request. + + - parameter user: The user. + - parameter password: The password. + - parameter persistence: The URL credential persistence. `.ForSession` by default. + + - returns: The request. + */ + public func authenticate( + user user: String, + password: String, + persistence: NSURLCredentialPersistence = .ForSession) + -> Self + { + let credential = NSURLCredential(user: user, password: password, persistence: persistence) + + return authenticate(usingCredential: credential) + } + + /** + Associates a specified credential with the request. + + - parameter credential: The credential. + + - returns: The request. + */ + public func authenticate(usingCredential credential: NSURLCredential) -> Self { + delegate.credential = credential + + return self + } + + // MARK: - Progress + + /** + Sets a closure to be called periodically during the lifecycle of the request as data is written to or read + from the server. + + - For uploads, the progress closure returns the bytes written, total bytes written, and total bytes expected + to write. + - For downloads and data tasks, the progress closure returns the bytes read, total bytes read, and total bytes + expected to read. + + - parameter closure: The code to be executed periodically during the lifecycle of the request. + + - returns: The request. + */ + public func progress(closure: ((Int64, Int64, Int64) -> Void)? = nil) -> Self { + if let uploadDelegate = delegate as? UploadTaskDelegate { + uploadDelegate.uploadProgress = closure + } else if let dataDelegate = delegate as? DataTaskDelegate { + dataDelegate.dataProgress = closure + } else if let downloadDelegate = delegate as? DownloadTaskDelegate { + downloadDelegate.downloadProgress = closure + } + + return self + } + + /** + Sets a closure to be called periodically during the lifecycle of the request as data is read from the server. + + This closure returns the bytes most recently received from the server, not including data from previous calls. + If this closure is set, data will only be available within this closure, and will not be saved elsewhere. It is + also important to note that the `response` closure will be called with nil `responseData`. + + - parameter closure: The code to be executed periodically during the lifecycle of the request. + + - returns: The request. + */ + public func stream(closure: (NSData -> Void)? = nil) -> Self { + if let dataDelegate = delegate as? DataTaskDelegate { + dataDelegate.dataStream = closure + } + + return self + } + + // MARK: - State + + /** + Resumes the request. + */ + public func resume() { + if startTime == nil { startTime = CFAbsoluteTimeGetCurrent() } + + task.resume() + NSNotificationCenter.defaultCenter().postNotificationName(Notifications.Task.DidResume, object: task) + } + + /** + Suspends the request. + */ + public func suspend() { + task.suspend() + NSNotificationCenter.defaultCenter().postNotificationName(Notifications.Task.DidSuspend, object: task) + } + + /** + Cancels the request. + */ + public func cancel() { + if let + downloadDelegate = delegate as? DownloadTaskDelegate, + downloadTask = downloadDelegate.downloadTask + { + downloadTask.cancelByProducingResumeData { data in + downloadDelegate.resumeData = data + } + } else { + task.cancel() + } + + NSNotificationCenter.defaultCenter().postNotificationName(Notifications.Task.DidCancel, object: task) + } + + // MARK: - TaskDelegate + + /** + The task delegate is responsible for handling all delegate callbacks for the underlying task as well as + executing all operations attached to the serial operation queue upon task completion. + */ + public class TaskDelegate: NSObject { + + /// The serial operation queue used to execute all operations after the task completes. + public let queue: NSOperationQueue + + let task: NSURLSessionTask + let progress: NSProgress + + var data: NSData? { return nil } + var error: NSError? + + var initialResponseTime: CFAbsoluteTime? + var credential: NSURLCredential? + + init(task: NSURLSessionTask) { + self.task = task + self.progress = NSProgress(totalUnitCount: 0) + self.queue = { + let operationQueue = NSOperationQueue() + operationQueue.maxConcurrentOperationCount = 1 + operationQueue.suspended = true + + if #available(OSX 10.10, *) { + operationQueue.qualityOfService = NSQualityOfService.Utility + } + + return operationQueue + }() + } + + deinit { + queue.cancelAllOperations() + queue.suspended = false + } + + // MARK: - NSURLSessionTaskDelegate + + // MARK: Override Closures + + var taskWillPerformHTTPRedirection: ((NSURLSession, NSURLSessionTask, NSHTTPURLResponse, NSURLRequest) -> NSURLRequest?)? + var taskDidReceiveChallenge: ((NSURLSession, NSURLSessionTask, NSURLAuthenticationChallenge) -> (NSURLSessionAuthChallengeDisposition, NSURLCredential?))? + var taskNeedNewBodyStream: ((NSURLSession, NSURLSessionTask) -> NSInputStream?)? + var taskDidCompleteWithError: ((NSURLSession, NSURLSessionTask, NSError?) -> Void)? + + // MARK: Delegate Methods + + func URLSession( + session: NSURLSession, + task: NSURLSessionTask, + willPerformHTTPRedirection response: NSHTTPURLResponse, + newRequest request: NSURLRequest, + completionHandler: ((NSURLRequest?) -> Void)) + { + var redirectRequest: NSURLRequest? = request + + if let taskWillPerformHTTPRedirection = taskWillPerformHTTPRedirection { + redirectRequest = taskWillPerformHTTPRedirection(session, task, response, request) + } + + completionHandler(redirectRequest) + } + + func URLSession( + session: NSURLSession, + task: NSURLSessionTask, + didReceiveChallenge challenge: NSURLAuthenticationChallenge, + completionHandler: ((NSURLSessionAuthChallengeDisposition, NSURLCredential?) -> Void)) + { + var disposition: NSURLSessionAuthChallengeDisposition = .PerformDefaultHandling + var credential: NSURLCredential? + + if let taskDidReceiveChallenge = taskDidReceiveChallenge { + (disposition, credential) = taskDidReceiveChallenge(session, task, challenge) + } else if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust { + let host = challenge.protectionSpace.host + + if let + serverTrustPolicy = session.serverTrustPolicyManager?.serverTrustPolicyForHost(host), + serverTrust = challenge.protectionSpace.serverTrust + { + if serverTrustPolicy.evaluateServerTrust(serverTrust, isValidForHost: host) { + disposition = .UseCredential + credential = NSURLCredential(forTrust: serverTrust) + } else { + disposition = .CancelAuthenticationChallenge + } + } + } else { + if challenge.previousFailureCount > 0 { + disposition = .CancelAuthenticationChallenge + } else { + credential = self.credential ?? session.configuration.URLCredentialStorage?.defaultCredentialForProtectionSpace(challenge.protectionSpace) + + if credential != nil { + disposition = .UseCredential + } + } + } + + completionHandler(disposition, credential) + } + + func URLSession( + session: NSURLSession, + task: NSURLSessionTask, + needNewBodyStream completionHandler: ((NSInputStream?) -> Void)) + { + var bodyStream: NSInputStream? + + if let taskNeedNewBodyStream = taskNeedNewBodyStream { + bodyStream = taskNeedNewBodyStream(session, task) + } + + completionHandler(bodyStream) + } + + func URLSession(session: NSURLSession, task: NSURLSessionTask, didCompleteWithError error: NSError?) { + if let taskDidCompleteWithError = taskDidCompleteWithError { + taskDidCompleteWithError(session, task, error) + } else { + if let error = error { + self.error = error + + if let + downloadDelegate = self as? DownloadTaskDelegate, + userInfo = error.userInfo as? [String: AnyObject], + resumeData = userInfo[NSURLSessionDownloadTaskResumeData] as? NSData + { + downloadDelegate.resumeData = resumeData + } + } + + queue.suspended = false + } + } + } + + // MARK: - DataTaskDelegate + + class DataTaskDelegate: TaskDelegate, NSURLSessionDataDelegate { + var dataTask: NSURLSessionDataTask? { return task as? NSURLSessionDataTask } + + private var totalBytesReceived: Int64 = 0 + private var mutableData: NSMutableData + override var data: NSData? { + if dataStream != nil { + return nil + } else { + return mutableData + } + } + + private var expectedContentLength: Int64? + private var dataProgress: ((bytesReceived: Int64, totalBytesReceived: Int64, totalBytesExpectedToReceive: Int64) -> Void)? + private var dataStream: ((data: NSData) -> Void)? + + override init(task: NSURLSessionTask) { + mutableData = NSMutableData() + super.init(task: task) + } + + // MARK: - NSURLSessionDataDelegate + + // MARK: Override Closures + + var dataTaskDidReceiveResponse: ((NSURLSession, NSURLSessionDataTask, NSURLResponse) -> NSURLSessionResponseDisposition)? + var dataTaskDidBecomeDownloadTask: ((NSURLSession, NSURLSessionDataTask, NSURLSessionDownloadTask) -> Void)? + var dataTaskDidReceiveData: ((NSURLSession, NSURLSessionDataTask, NSData) -> Void)? + var dataTaskWillCacheResponse: ((NSURLSession, NSURLSessionDataTask, NSCachedURLResponse) -> NSCachedURLResponse?)? + + // MARK: Delegate Methods + + func URLSession( + session: NSURLSession, + dataTask: NSURLSessionDataTask, + didReceiveResponse response: NSURLResponse, + completionHandler: (NSURLSessionResponseDisposition -> Void)) + { + var disposition: NSURLSessionResponseDisposition = .Allow + + expectedContentLength = response.expectedContentLength + + if let dataTaskDidReceiveResponse = dataTaskDidReceiveResponse { + disposition = dataTaskDidReceiveResponse(session, dataTask, response) + } + + completionHandler(disposition) + } + + func URLSession( + session: NSURLSession, + dataTask: NSURLSessionDataTask, + didBecomeDownloadTask downloadTask: NSURLSessionDownloadTask) + { + dataTaskDidBecomeDownloadTask?(session, dataTask, downloadTask) + } + + func URLSession(session: NSURLSession, dataTask: NSURLSessionDataTask, didReceiveData data: NSData) { + if initialResponseTime == nil { initialResponseTime = CFAbsoluteTimeGetCurrent() } + + if let dataTaskDidReceiveData = dataTaskDidReceiveData { + dataTaskDidReceiveData(session, dataTask, data) + } else { + if let dataStream = dataStream { + dataStream(data: data) + } else { + mutableData.appendData(data) + } + + totalBytesReceived += data.length + let totalBytesExpected = dataTask.response?.expectedContentLength ?? NSURLSessionTransferSizeUnknown + + progress.totalUnitCount = totalBytesExpected + progress.completedUnitCount = totalBytesReceived + + dataProgress?( + bytesReceived: Int64(data.length), + totalBytesReceived: totalBytesReceived, + totalBytesExpectedToReceive: totalBytesExpected + ) + } + } + + func URLSession( + session: NSURLSession, + dataTask: NSURLSessionDataTask, + willCacheResponse proposedResponse: NSCachedURLResponse, + completionHandler: ((NSCachedURLResponse?) -> Void)) + { + var cachedResponse: NSCachedURLResponse? = proposedResponse + + if let dataTaskWillCacheResponse = dataTaskWillCacheResponse { + cachedResponse = dataTaskWillCacheResponse(session, dataTask, proposedResponse) + } + + completionHandler(cachedResponse) + } + } +} + +// MARK: - CustomStringConvertible + +extension Request: CustomStringConvertible { + + /** + The textual representation used when written to an output stream, which includes the HTTP method and URL, as + well as the response status code if a response has been received. + */ + public var description: String { + var components: [String] = [] + + if let HTTPMethod = request?.HTTPMethod { + components.append(HTTPMethod) + } + + if let URLString = request?.URL?.absoluteString { + components.append(URLString) + } + + if let response = response { + components.append("(\(response.statusCode))") + } + + return components.joinWithSeparator(" ") + } +} + +// MARK: - CustomDebugStringConvertible + +extension Request: CustomDebugStringConvertible { + func cURLRepresentation() -> String { + var components = ["$ curl -i"] + + guard let + request = self.request, + URL = request.URL, + host = URL.host + else { + return "$ curl command could not be created" + } + + if let HTTPMethod = request.HTTPMethod where HTTPMethod != "GET" { + components.append("-X \(HTTPMethod)") + } + + if let credentialStorage = self.session.configuration.URLCredentialStorage { + let protectionSpace = NSURLProtectionSpace( + host: host, + port: URL.port?.integerValue ?? 0, + `protocol`: URL.scheme, + realm: host, + authenticationMethod: NSURLAuthenticationMethodHTTPBasic + ) + + if let credentials = credentialStorage.credentialsForProtectionSpace(protectionSpace)?.values { + for credential in credentials { + components.append("-u \(credential.user!):\(credential.password!)") + } + } else { + if let credential = delegate.credential { + components.append("-u \(credential.user!):\(credential.password!)") + } + } + } + + if session.configuration.HTTPShouldSetCookies { + if let + cookieStorage = session.configuration.HTTPCookieStorage, + cookies = cookieStorage.cookiesForURL(URL) where !cookies.isEmpty + { + let string = cookies.reduce("") { $0 + "\($1.name)=\($1.value ?? String());" } + components.append("-b \"\(string.substringToIndex(string.endIndex.predecessor()))\"") + } + } + + if let headerFields = request.allHTTPHeaderFields { + for (field, value) in headerFields { + switch field { + case "Cookie": + continue + default: + components.append("-H \"\(field): \(value)\"") + } + } + } + + if let additionalHeaders = session.configuration.HTTPAdditionalHeaders { + for (field, value) in additionalHeaders { + switch field { + case "Cookie": + continue + default: + components.append("-H \"\(field): \(value)\"") + } + } + } + + if let + HTTPBodyData = request.HTTPBody, + HTTPBody = String(data: HTTPBodyData, encoding: NSUTF8StringEncoding) + { + let escapedBody = HTTPBody.stringByReplacingOccurrencesOfString("\"", withString: "\\\"") + components.append("-d \"\(escapedBody)\"") + } + + components.append("\"\(URL.absoluteString)\"") + + return components.joinWithSeparator(" \\\n\t") + } + + /// The textual representation used when written to an output stream, in the form of a cURL command. + public var debugDescription: String { + return cURLRepresentation() + } +} diff --git a/Pods/Alamofire/Source/Response.swift b/Pods/Alamofire/Source/Response.swift new file mode 100644 index 0000000..153eda5 --- /dev/null +++ b/Pods/Alamofire/Source/Response.swift @@ -0,0 +1,95 @@ +// Response.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +/// Used to store all response data returned from a completed `Request`. +public struct Response { + /// The URL request sent to the server. + public let request: NSURLRequest? + + /// The server's response to the URL request. + public let response: NSHTTPURLResponse? + + /// The data returned by the server. + public let data: NSData? + + /// The result of response serialization. + public let result: Result + + /// The timeline of the complete lifecycle of the `Request`. + public let timeline: Timeline + + /** + Initializes the `Response` instance with the specified URL request, URL response, server data and response + serialization result. + + - parameter request: The URL request sent to the server. + - parameter response: The server's response to the URL request. + - parameter data: The data returned by the server. + - parameter result: The result of response serialization. + - parameter timeline: The timeline of the complete lifecycle of the `Request`. Defaults to `Timeline()`. + + - returns: the new `Response` instance. + */ + public init( + request: NSURLRequest?, + response: NSHTTPURLResponse?, + data: NSData?, + result: Result, + timeline: Timeline = Timeline()) + { + self.request = request + self.response = response + self.data = data + self.result = result + self.timeline = timeline + } +} + +// MARK: - CustomStringConvertible + +extension Response: CustomStringConvertible { + /// The textual representation used when written to an output stream, which includes whether the result was a + /// success or failure. + public var description: String { + return result.debugDescription + } +} + +// MARK: - CustomDebugStringConvertible + +extension Response: CustomDebugStringConvertible { + /// The debug textual representation used when written to an output stream, which includes the URL request, the URL + /// response, the server data and the response serialization result. + public var debugDescription: String { + var output: [String] = [] + + output.append(request != nil ? "[Request]: \(request!)" : "[Request]: nil") + output.append(response != nil ? "[Response]: \(response!)" : "[Response]: nil") + output.append("[Data]: \(data?.length ?? 0) bytes") + output.append("[Result]: \(result.debugDescription)") + output.append("[Timeline]: \(timeline.debugDescription)") + + return output.joinWithSeparator("\n") + } +} diff --git a/Pods/Alamofire/Source/ResponseSerialization.swift b/Pods/Alamofire/Source/ResponseSerialization.swift new file mode 100644 index 0000000..71289f2 --- /dev/null +++ b/Pods/Alamofire/Source/ResponseSerialization.swift @@ -0,0 +1,366 @@ +// ResponseSerialization.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +// MARK: ResponseSerializer + +/** + The type in which all response serializers must conform to in order to serialize a response. +*/ +public protocol ResponseSerializerType { + /// The type of serialized object to be created by this `ResponseSerializerType`. + typealias SerializedObject + + /// The type of error to be created by this `ResponseSerializer` if serialization fails. + typealias ErrorObject: ErrorType + + /** + A closure used by response handlers that takes a request, response, data and error and returns a result. + */ + var serializeResponse: (NSURLRequest?, NSHTTPURLResponse?, NSData?, NSError?) -> Result { get } +} + +// MARK: - + +/** + A generic `ResponseSerializerType` used to serialize a request, response, and data into a serialized object. +*/ +public struct ResponseSerializer: ResponseSerializerType { + /// The type of serialized object to be created by this `ResponseSerializer`. + public typealias SerializedObject = Value + + /// The type of error to be created by this `ResponseSerializer` if serialization fails. + public typealias ErrorObject = Error + + /** + A closure used by response handlers that takes a request, response, data and error and returns a result. + */ + public var serializeResponse: (NSURLRequest?, NSHTTPURLResponse?, NSData?, NSError?) -> Result + + /** + Initializes the `ResponseSerializer` instance with the given serialize response closure. + + - parameter serializeResponse: The closure used to serialize the response. + + - returns: The new generic response serializer instance. + */ + public init(serializeResponse: (NSURLRequest?, NSHTTPURLResponse?, NSData?, NSError?) -> Result) { + self.serializeResponse = serializeResponse + } +} + +// MARK: - Default + +extension Request { + + /** + Adds a handler to be called once the request has finished. + + - parameter queue: The queue on which the completion handler is dispatched. + - parameter completionHandler: The code to be executed once the request has finished. + + - returns: The request. + */ + public func response( + queue queue: dispatch_queue_t? = nil, + completionHandler: (NSURLRequest?, NSHTTPURLResponse?, NSData?, NSError?) -> Void) + -> Self + { + delegate.queue.addOperationWithBlock { + dispatch_async(queue ?? dispatch_get_main_queue()) { + completionHandler(self.request, self.response, self.delegate.data, self.delegate.error) + } + } + + return self + } + + /** + Adds a handler to be called once the request has finished. + + - parameter queue: The queue on which the completion handler is dispatched. + - parameter responseSerializer: The response serializer responsible for serializing the request, response, + and data. + - parameter completionHandler: The code to be executed once the request has finished. + + - returns: The request. + */ + public func response( + queue queue: dispatch_queue_t? = nil, + responseSerializer: T, + completionHandler: Response -> Void) + -> Self + { + delegate.queue.addOperationWithBlock { + let result = responseSerializer.serializeResponse( + self.request, + self.response, + self.delegate.data, + self.delegate.error + ) + + let requestCompletedTime = self.endTime ?? CFAbsoluteTimeGetCurrent() + let initialResponseTime = self.delegate.initialResponseTime ?? requestCompletedTime + + let timeline = Timeline( + requestStartTime: self.startTime ?? CFAbsoluteTimeGetCurrent(), + initialResponseTime: initialResponseTime, + requestCompletedTime: requestCompletedTime, + serializationCompletedTime: CFAbsoluteTimeGetCurrent() + ) + + let response = Response( + request: self.request, + response: self.response, + data: self.delegate.data, + result: result, + timeline: timeline + ) + + dispatch_async(queue ?? dispatch_get_main_queue()) { completionHandler(response) } + } + + return self + } +} + +// MARK: - Data + +extension Request { + + /** + Creates a response serializer that returns the associated data as-is. + + - returns: A data response serializer. + */ + public static func dataResponseSerializer() -> ResponseSerializer { + return ResponseSerializer { _, response, data, error in + guard error == nil else { return .Failure(error!) } + + if let response = response where response.statusCode == 204 { return .Success(NSData()) } + + guard let validData = data else { + let failureReason = "Data could not be serialized. Input data was nil." + let error = Error.errorWithCode(.DataSerializationFailed, failureReason: failureReason) + return .Failure(error) + } + + return .Success(validData) + } + } + + /** + Adds a handler to be called once the request has finished. + + - parameter completionHandler: The code to be executed once the request has finished. + + - returns: The request. + */ + public func responseData(completionHandler: Response -> Void) -> Self { + return response(responseSerializer: Request.dataResponseSerializer(), completionHandler: completionHandler) + } +} + +// MARK: - String + +extension Request { + + /** + Creates a response serializer that returns a string initialized from the response data with the specified + string encoding. + + - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the server + response, falling back to the default HTTP default character set, ISO-8859-1. + + - returns: A string response serializer. + */ + public static func stringResponseSerializer( + encoding encoding: NSStringEncoding? = nil) + -> ResponseSerializer + { + return ResponseSerializer { _, response, data, error in + guard error == nil else { return .Failure(error!) } + + if let response = response where response.statusCode == 204 { return .Success("") } + + guard let validData = data else { + let failureReason = "String could not be serialized. Input data was nil." + let error = Error.errorWithCode(.StringSerializationFailed, failureReason: failureReason) + return .Failure(error) + } + + var convertedEncoding = encoding + + if let encodingName = response?.textEncodingName where convertedEncoding == nil { + convertedEncoding = CFStringConvertEncodingToNSStringEncoding( + CFStringConvertIANACharSetNameToEncoding(encodingName) + ) + } + + let actualEncoding = convertedEncoding ?? NSISOLatin1StringEncoding + + if let string = String(data: validData, encoding: actualEncoding) { + return .Success(string) + } else { + let failureReason = "String could not be serialized with encoding: \(actualEncoding)" + let error = Error.errorWithCode(.StringSerializationFailed, failureReason: failureReason) + return .Failure(error) + } + } + } + + /** + Adds a handler to be called once the request has finished. + + - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the + server response, falling back to the default HTTP default character set, + ISO-8859-1. + - parameter completionHandler: A closure to be executed once the request has finished. + + - returns: The request. + */ + public func responseString( + encoding encoding: NSStringEncoding? = nil, + completionHandler: Response -> Void) + -> Self + { + return response( + responseSerializer: Request.stringResponseSerializer(encoding: encoding), + completionHandler: completionHandler + ) + } +} + +// MARK: - JSON + +extension Request { + + /** + Creates a response serializer that returns a JSON object constructed from the response data using + `NSJSONSerialization` with the specified reading options. + + - parameter options: The JSON serialization reading options. `.AllowFragments` by default. + + - returns: A JSON object response serializer. + */ + public static func JSONResponseSerializer( + options options: NSJSONReadingOptions = .AllowFragments) + -> ResponseSerializer + { + return ResponseSerializer { _, response, data, error in + guard error == nil else { return .Failure(error!) } + + if let response = response where response.statusCode == 204 { return .Success(NSNull()) } + + guard let validData = data where validData.length > 0 else { + let failureReason = "JSON could not be serialized. Input data was nil or zero length." + let error = Error.errorWithCode(.JSONSerializationFailed, failureReason: failureReason) + return .Failure(error) + } + + do { + let JSON = try NSJSONSerialization.JSONObjectWithData(validData, options: options) + return .Success(JSON) + } catch { + return .Failure(error as NSError) + } + } + } + + /** + Adds a handler to be called once the request has finished. + + - parameter options: The JSON serialization reading options. `.AllowFragments` by default. + - parameter completionHandler: A closure to be executed once the request has finished. + + - returns: The request. + */ + public func responseJSON( + options options: NSJSONReadingOptions = .AllowFragments, + completionHandler: Response -> Void) + -> Self + { + return response( + responseSerializer: Request.JSONResponseSerializer(options: options), + completionHandler: completionHandler + ) + } +} + +// MARK: - Property List + +extension Request { + + /** + Creates a response serializer that returns an object constructed from the response data using + `NSPropertyListSerialization` with the specified reading options. + + - parameter options: The property list reading options. `NSPropertyListReadOptions()` by default. + + - returns: A property list object response serializer. + */ + public static func propertyListResponseSerializer( + options options: NSPropertyListReadOptions = NSPropertyListReadOptions()) + -> ResponseSerializer + { + return ResponseSerializer { _, response, data, error in + guard error == nil else { return .Failure(error!) } + + if let response = response where response.statusCode == 204 { return .Success(NSNull()) } + + guard let validData = data where validData.length > 0 else { + let failureReason = "Property list could not be serialized. Input data was nil or zero length." + let error = Error.errorWithCode(.PropertyListSerializationFailed, failureReason: failureReason) + return .Failure(error) + } + + do { + let plist = try NSPropertyListSerialization.propertyListWithData(validData, options: options, format: nil) + return .Success(plist) + } catch { + return .Failure(error as NSError) + } + } + } + + /** + Adds a handler to be called once the request has finished. + + - parameter options: The property list reading options. `0` by default. + - parameter completionHandler: A closure to be executed once the request has finished. The closure takes 3 + arguments: the URL request, the URL response, the server data and the result + produced while creating the property list. + + - returns: The request. + */ + public func responsePropertyList( + options options: NSPropertyListReadOptions = NSPropertyListReadOptions(), + completionHandler: Response -> Void) + -> Self + { + return response( + responseSerializer: Request.propertyListResponseSerializer(options: options), + completionHandler: completionHandler + ) + } +} diff --git a/Pods/Alamofire/Source/Result.swift b/Pods/Alamofire/Source/Result.swift new file mode 100644 index 0000000..a8557ca --- /dev/null +++ b/Pods/Alamofire/Source/Result.swift @@ -0,0 +1,101 @@ +// Result.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +/** + Used to represent whether a request was successful or encountered an error. + + - Success: The request and all post processing operations were successful resulting in the serialization of the + provided associated value. + - Failure: The request encountered an error resulting in a failure. The associated values are the original data + provided by the server as well as the error that caused the failure. +*/ +public enum Result { + case Success(Value) + case Failure(Error) + + /// Returns `true` if the result is a success, `false` otherwise. + public var isSuccess: Bool { + switch self { + case .Success: + return true + case .Failure: + return false + } + } + + /// Returns `true` if the result is a failure, `false` otherwise. + public var isFailure: Bool { + return !isSuccess + } + + /// Returns the associated value if the result is a success, `nil` otherwise. + public var value: Value? { + switch self { + case .Success(let value): + return value + case .Failure: + return nil + } + } + + /// Returns the associated error value if the result is a failure, `nil` otherwise. + public var error: Error? { + switch self { + case .Success: + return nil + case .Failure(let error): + return error + } + } +} + +// MARK: - CustomStringConvertible + +extension Result: CustomStringConvertible { + /// The textual representation used when written to an output stream, which includes whether the result was a + /// success or failure. + public var description: String { + switch self { + case .Success: + return "SUCCESS" + case .Failure: + return "FAILURE" + } + } +} + +// MARK: - CustomDebugStringConvertible + +extension Result: CustomDebugStringConvertible { + /// The debug textual representation used when written to an output stream, which includes whether the result was a + /// success or failure in addition to the value or error. + public var debugDescription: String { + switch self { + case .Success(let value): + return "SUCCESS: \(value)" + case .Failure(let error): + return "FAILURE: \(error)" + } + } +} diff --git a/Pods/Alamofire/Source/ServerTrustPolicy.swift b/Pods/Alamofire/Source/ServerTrustPolicy.swift new file mode 100644 index 0000000..07cd848 --- /dev/null +++ b/Pods/Alamofire/Source/ServerTrustPolicy.swift @@ -0,0 +1,302 @@ +// ServerTrustPolicy.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +/// Responsible for managing the mapping of `ServerTrustPolicy` objects to a given host. +public class ServerTrustPolicyManager { + /// The dictionary of policies mapped to a particular host. + public let policies: [String: ServerTrustPolicy] + + /** + Initializes the `ServerTrustPolicyManager` instance with the given policies. + + Since different servers and web services can have different leaf certificates, intermediate and even root + certficates, it is important to have the flexibility to specify evaluation policies on a per host basis. This + allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key + pinning for host3 and disabling evaluation for host4. + + - parameter policies: A dictionary of all policies mapped to a particular host. + + - returns: The new `ServerTrustPolicyManager` instance. + */ + public init(policies: [String: ServerTrustPolicy]) { + self.policies = policies + } + + /** + Returns the `ServerTrustPolicy` for the given host if applicable. + + By default, this method will return the policy that perfectly matches the given host. Subclasses could override + this method and implement more complex mapping implementations such as wildcards. + + - parameter host: The host to use when searching for a matching policy. + + - returns: The server trust policy for the given host if found. + */ + public func serverTrustPolicyForHost(host: String) -> ServerTrustPolicy? { + return policies[host] + } +} + +// MARK: - + +extension NSURLSession { + private struct AssociatedKeys { + static var ManagerKey = "NSURLSession.ServerTrustPolicyManager" + } + + var serverTrustPolicyManager: ServerTrustPolicyManager? { + get { + return objc_getAssociatedObject(self, &AssociatedKeys.ManagerKey) as? ServerTrustPolicyManager + } + set (manager) { + objc_setAssociatedObject(self, &AssociatedKeys.ManagerKey, manager, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) + } + } +} + +// MARK: - ServerTrustPolicy + +/** + The `ServerTrustPolicy` evaluates the server trust generally provided by an `NSURLAuthenticationChallenge` when + connecting to a server over a secure HTTPS connection. The policy configuration then evaluates the server trust + with a given set of criteria to determine whether the server trust is valid and the connection should be made. + + Using pinned certificates or public keys for evaluation helps prevent man-in-the-middle (MITM) attacks and other + vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged + to route all communication over an HTTPS connection with pinning enabled. + + - PerformDefaultEvaluation: Uses the default server trust evaluation while allowing you to control whether to + validate the host provided by the challenge. Applications are encouraged to always + validate the host in production environments to guarantee the validity of the server's + certificate chain. + + - PinCertificates: Uses the pinned certificates to validate the server trust. The server trust is + considered valid if one of the pinned certificates match one of the server certificates. + By validating both the certificate chain and host, certificate pinning provides a very + secure form of server trust validation mitigating most, if not all, MITM attacks. + Applications are encouraged to always validate the host and require a valid certificate + chain in production environments. + + - PinPublicKeys: Uses the pinned public keys to validate the server trust. The server trust is considered + valid if one of the pinned public keys match one of the server certificate public keys. + By validating both the certificate chain and host, public key pinning provides a very + secure form of server trust validation mitigating most, if not all, MITM attacks. + Applications are encouraged to always validate the host and require a valid certificate + chain in production environments. + + - DisableEvaluation: Disables all evaluation which in turn will always consider any server trust as valid. + + - CustomEvaluation: Uses the associated closure to evaluate the validity of the server trust. +*/ +public enum ServerTrustPolicy { + case PerformDefaultEvaluation(validateHost: Bool) + case PinCertificates(certificates: [SecCertificate], validateCertificateChain: Bool, validateHost: Bool) + case PinPublicKeys(publicKeys: [SecKey], validateCertificateChain: Bool, validateHost: Bool) + case DisableEvaluation + case CustomEvaluation((serverTrust: SecTrust, host: String) -> Bool) + + // MARK: - Bundle Location + + /** + Returns all certificates within the given bundle with a `.cer` file extension. + + - parameter bundle: The bundle to search for all `.cer` files. + + - returns: All certificates within the given bundle. + */ + public static func certificatesInBundle(bundle: NSBundle = NSBundle.mainBundle()) -> [SecCertificate] { + var certificates: [SecCertificate] = [] + + let paths = Set([".cer", ".CER", ".crt", ".CRT", ".der", ".DER"].map { fileExtension in + bundle.pathsForResourcesOfType(fileExtension, inDirectory: nil) + }.flatten()) + + for path in paths { + if let + certificateData = NSData(contentsOfFile: path), + certificate = SecCertificateCreateWithData(nil, certificateData) + { + certificates.append(certificate) + } + } + + return certificates + } + + /** + Returns all public keys within the given bundle with a `.cer` file extension. + + - parameter bundle: The bundle to search for all `*.cer` files. + + - returns: All public keys within the given bundle. + */ + public static func publicKeysInBundle(bundle: NSBundle = NSBundle.mainBundle()) -> [SecKey] { + var publicKeys: [SecKey] = [] + + for certificate in certificatesInBundle(bundle) { + if let publicKey = publicKeyForCertificate(certificate) { + publicKeys.append(publicKey) + } + } + + return publicKeys + } + + // MARK: - Evaluation + + /** + Evaluates whether the server trust is valid for the given host. + + - parameter serverTrust: The server trust to evaluate. + - parameter host: The host of the challenge protection space. + + - returns: Whether the server trust is valid. + */ + public func evaluateServerTrust(serverTrust: SecTrust, isValidForHost host: String) -> Bool { + var serverTrustIsValid = false + + switch self { + case let .PerformDefaultEvaluation(validateHost): + let policy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil) + SecTrustSetPolicies(serverTrust, [policy]) + + serverTrustIsValid = trustIsValid(serverTrust) + case let .PinCertificates(pinnedCertificates, validateCertificateChain, validateHost): + if validateCertificateChain { + let policy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil) + SecTrustSetPolicies(serverTrust, [policy]) + + SecTrustSetAnchorCertificates(serverTrust, pinnedCertificates) + SecTrustSetAnchorCertificatesOnly(serverTrust, true) + + serverTrustIsValid = trustIsValid(serverTrust) + } else { + let serverCertificatesDataArray = certificateDataForTrust(serverTrust) + let pinnedCertificatesDataArray = certificateDataForCertificates(pinnedCertificates) + + outerLoop: for serverCertificateData in serverCertificatesDataArray { + for pinnedCertificateData in pinnedCertificatesDataArray { + if serverCertificateData.isEqualToData(pinnedCertificateData) { + serverTrustIsValid = true + break outerLoop + } + } + } + } + case let .PinPublicKeys(pinnedPublicKeys, validateCertificateChain, validateHost): + var certificateChainEvaluationPassed = true + + if validateCertificateChain { + let policy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil) + SecTrustSetPolicies(serverTrust, [policy]) + + certificateChainEvaluationPassed = trustIsValid(serverTrust) + } + + if certificateChainEvaluationPassed { + outerLoop: for serverPublicKey in ServerTrustPolicy.publicKeysForTrust(serverTrust) as [AnyObject] { + for pinnedPublicKey in pinnedPublicKeys as [AnyObject] { + if serverPublicKey.isEqual(pinnedPublicKey) { + serverTrustIsValid = true + break outerLoop + } + } + } + } + case .DisableEvaluation: + serverTrustIsValid = true + case let .CustomEvaluation(closure): + serverTrustIsValid = closure(serverTrust: serverTrust, host: host) + } + + return serverTrustIsValid + } + + // MARK: - Private - Trust Validation + + private func trustIsValid(trust: SecTrust) -> Bool { + var isValid = false + + var result = SecTrustResultType(kSecTrustResultInvalid) + let status = SecTrustEvaluate(trust, &result) + + if status == errSecSuccess { + let unspecified = SecTrustResultType(kSecTrustResultUnspecified) + let proceed = SecTrustResultType(kSecTrustResultProceed) + + isValid = result == unspecified || result == proceed + } + + return isValid + } + + // MARK: - Private - Certificate Data + + private func certificateDataForTrust(trust: SecTrust) -> [NSData] { + var certificates: [SecCertificate] = [] + + for index in 0.. [NSData] { + return certificates.map { SecCertificateCopyData($0) as NSData } + } + + // MARK: - Private - Public Key Extraction + + private static func publicKeysForTrust(trust: SecTrust) -> [SecKey] { + var publicKeys: [SecKey] = [] + + for index in 0.. SecKey? { + var publicKey: SecKey? + + let policy = SecPolicyCreateBasicX509() + var trust: SecTrust? + let trustCreationStatus = SecTrustCreateWithCertificates(certificate, policy, &trust) + + if let trust = trust where trustCreationStatus == errSecSuccess { + publicKey = SecTrustCopyPublicKey(trust) + } + + return publicKey + } +} diff --git a/Pods/Alamofire/Source/Stream.swift b/Pods/Alamofire/Source/Stream.swift new file mode 100644 index 0000000..905e522 --- /dev/null +++ b/Pods/Alamofire/Source/Stream.swift @@ -0,0 +1,180 @@ +// Stream.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +#if !os(watchOS) + +@available(iOS 9.0, OSX 10.11, tvOS 9.0, *) +extension Manager { + private enum Streamable { + case Stream(String, Int) + case NetService(NSNetService) + } + + private func stream(streamable: Streamable) -> Request { + var streamTask: NSURLSessionStreamTask! + + switch streamable { + case .Stream(let hostName, let port): + dispatch_sync(queue) { + streamTask = self.session.streamTaskWithHostName(hostName, port: port) + } + case .NetService(let netService): + dispatch_sync(queue) { + streamTask = self.session.streamTaskWithNetService(netService) + } + } + + let request = Request(session: session, task: streamTask) + + delegate[request.delegate.task] = request.delegate + + if startRequestsImmediately { + request.resume() + } + + return request + } + + /** + Creates a request for bidirectional streaming with the given hostname and port. + + - parameter hostName: The hostname of the server to connect to. + - parameter port: The port of the server to connect to. + + :returns: The created stream request. + */ + public func stream(hostName hostName: String, port: Int) -> Request { + return stream(.Stream(hostName, port)) + } + + /** + Creates a request for bidirectional streaming with the given `NSNetService`. + + - parameter netService: The net service used to identify the endpoint. + + - returns: The created stream request. + */ + public func stream(netService netService: NSNetService) -> Request { + return stream(.NetService(netService)) + } +} + +// MARK: - + +@available(iOS 9.0, OSX 10.11, tvOS 9.0, *) +extension Manager.SessionDelegate: NSURLSessionStreamDelegate { + + // MARK: Override Closures + + /// Overrides default behavior for NSURLSessionStreamDelegate method `URLSession:readClosedForStreamTask:`. + public var streamTaskReadClosed: ((NSURLSession, NSURLSessionStreamTask) -> Void)? { + get { + return _streamTaskReadClosed as? (NSURLSession, NSURLSessionStreamTask) -> Void + } + set { + _streamTaskReadClosed = newValue + } + } + + /// Overrides default behavior for NSURLSessionStreamDelegate method `URLSession:writeClosedForStreamTask:`. + public var streamTaskWriteClosed: ((NSURLSession, NSURLSessionStreamTask) -> Void)? { + get { + return _streamTaskWriteClosed as? (NSURLSession, NSURLSessionStreamTask) -> Void + } + set { + _streamTaskWriteClosed = newValue + } + } + + /// Overrides default behavior for NSURLSessionStreamDelegate method `URLSession:betterRouteDiscoveredForStreamTask:`. + public var streamTaskBetterRouteDiscovered: ((NSURLSession, NSURLSessionStreamTask) -> Void)? { + get { + return _streamTaskBetterRouteDiscovered as? (NSURLSession, NSURLSessionStreamTask) -> Void + } + set { + _streamTaskBetterRouteDiscovered = newValue + } + } + + /// Overrides default behavior for NSURLSessionStreamDelegate method `URLSession:streamTask:didBecomeInputStream:outputStream:`. + public var streamTaskDidBecomeInputStream: ((NSURLSession, NSURLSessionStreamTask, NSInputStream, NSOutputStream) -> Void)? { + get { + return _streamTaskDidBecomeInputStream as? (NSURLSession, NSURLSessionStreamTask, NSInputStream, NSOutputStream) -> Void + } + set { + _streamTaskDidBecomeInputStream = newValue + } + } + + // MARK: Delegate Methods + + /** + Tells the delegate that the read side of the connection has been closed. + + - parameter session: The session. + - parameter streamTask: The stream task. + */ + public func URLSession(session: NSURLSession, readClosedForStreamTask streamTask: NSURLSessionStreamTask) { + streamTaskReadClosed?(session, streamTask) + } + + /** + Tells the delegate that the write side of the connection has been closed. + + - parameter session: The session. + - parameter streamTask: The stream task. + */ + public func URLSession(session: NSURLSession, writeClosedForStreamTask streamTask: NSURLSessionStreamTask) { + streamTaskWriteClosed?(session, streamTask) + } + + /** + Tells the delegate that the system has determined that a better route to the host is available. + + - parameter session: The session. + - parameter streamTask: The stream task. + */ + public func URLSession(session: NSURLSession, betterRouteDiscoveredForStreamTask streamTask: NSURLSessionStreamTask) { + streamTaskBetterRouteDiscovered?(session, streamTask) + } + + /** + Tells the delegate that the stream task has been completed and provides the unopened stream objects. + + - parameter session: The session. + - parameter streamTask: The stream task. + - parameter inputStream: The new input stream. + - parameter outputStream: The new output stream. + */ + public func URLSession( + session: NSURLSession, + streamTask: NSURLSessionStreamTask, + didBecomeInputStream inputStream: NSInputStream, + outputStream: NSOutputStream) + { + streamTaskDidBecomeInputStream?(session, streamTask, inputStream, outputStream) + } +} + +#endif diff --git a/Pods/Alamofire/Source/Timeline.swift b/Pods/Alamofire/Source/Timeline.swift new file mode 100644 index 0000000..0b7ab5d --- /dev/null +++ b/Pods/Alamofire/Source/Timeline.swift @@ -0,0 +1,123 @@ +// Timeline.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +/// Responsible for computing the timing metrics for the complete lifecycle of a `Request`. +public struct Timeline { + /// The time the request was initialized. + public let requestStartTime: CFAbsoluteTime + + /// The time the first bytes were received from or sent to the server. + public let initialResponseTime: CFAbsoluteTime + + /// The time when the request was completed. + public let requestCompletedTime: CFAbsoluteTime + + /// The time when the response serialization was completed. + public let serializationCompletedTime: CFAbsoluteTime + + /// The time interval in seconds from the time the request started to the initial response from the server. + public let latency: NSTimeInterval + + /// The time interval in seconds from the time the request started to the time the request completed. + public let requestDuration: NSTimeInterval + + /// The time interval in seconds from the time the request completed to the time response serialization completed. + public let serializationDuration: NSTimeInterval + + /// The time interval in seconds from the time the request started to the time response serialization completed. + public let totalDuration: NSTimeInterval + + /** + Creates a new `Timeline` instance with the specified request times. + + - parameter requestStartTime: The time the request was initialized. Defaults to `0.0`. + - parameter initialResponseTime: The time the first bytes were received from or sent to the server. + Defaults to `0.0`. + - parameter requestCompletedTime: The time when the request was completed. Defaults to `0.0`. + - parameter serializationCompletedTime: The time when the response serialization was completed. Defaults + to `0.0`. + + - returns: The new `Timeline` instance. + */ + public init( + requestStartTime: CFAbsoluteTime = 0.0, + initialResponseTime: CFAbsoluteTime = 0.0, + requestCompletedTime: CFAbsoluteTime = 0.0, + serializationCompletedTime: CFAbsoluteTime = 0.0) + { + self.requestStartTime = requestStartTime + self.initialResponseTime = initialResponseTime + self.requestCompletedTime = requestCompletedTime + self.serializationCompletedTime = serializationCompletedTime + + self.latency = initialResponseTime - requestStartTime + self.requestDuration = requestCompletedTime - requestStartTime + self.serializationDuration = serializationCompletedTime - requestCompletedTime + self.totalDuration = serializationCompletedTime - requestStartTime + } +} + +// MARK: - CustomStringConvertible + +extension Timeline: CustomStringConvertible { + /// The textual representation used when written to an output stream, which includes the latency, the request + /// duration and the total duration. + public var description: String { + let latency = String(format: "%.3f", self.latency) + let requestDuration = String(format: "%.3f", self.requestDuration) + let serializationDuration = String(format: "%.3f", self.serializationDuration) + let totalDuration = String(format: "%.3f", self.totalDuration) + + let timings = [ + "\"Latency\": \(latency) secs", + "\"Request Duration\": \(requestDuration) secs", + "\"Serialization Duration\": \(serializationDuration) secs", + "\"Total Duration\": \(totalDuration) secs" + ] + + return "Timeline: { \(timings.joinWithSeparator(", ")) }" + } +} + +// MARK: - CustomDebugStringConvertible + +extension Timeline: CustomDebugStringConvertible { + /// The textual representation used when written to an output stream, which includes the request start time, the + /// initial response time, the request completed time, the serialization completed time, the latency, the request + /// duration and the total duration. + public var debugDescription: String { + let timings = [ + "\"Request Start Time\": \(requestStartTime)", + "\"Initial Response Time\": \(initialResponseTime)", + "\"Request Completed Time\": \(requestCompletedTime)", + "\"Serialization Completed Time\": \(serializationCompletedTime)", + "\"Latency\": \(latency) secs", + "\"Request Duration\": \(requestDuration) secs", + "\"Serialization Duration\": \(serializationDuration) secs", + "\"Total Duration\": \(totalDuration) secs" + ] + + return "Timeline: { \(timings.joinWithSeparator(", ")) }" + } +} diff --git a/Pods/Alamofire/Source/Upload.swift b/Pods/Alamofire/Source/Upload.swift new file mode 100644 index 0000000..78b3072 --- /dev/null +++ b/Pods/Alamofire/Source/Upload.swift @@ -0,0 +1,374 @@ +// Upload.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +extension Manager { + private enum Uploadable { + case Data(NSURLRequest, NSData) + case File(NSURLRequest, NSURL) + case Stream(NSURLRequest, NSInputStream) + } + + private func upload(uploadable: Uploadable) -> Request { + var uploadTask: NSURLSessionUploadTask! + var HTTPBodyStream: NSInputStream? + + switch uploadable { + case .Data(let request, let data): + dispatch_sync(queue) { + uploadTask = self.session.uploadTaskWithRequest(request, fromData: data) + } + case .File(let request, let fileURL): + dispatch_sync(queue) { + uploadTask = self.session.uploadTaskWithRequest(request, fromFile: fileURL) + } + case .Stream(let request, let stream): + dispatch_sync(queue) { + uploadTask = self.session.uploadTaskWithStreamedRequest(request) + } + + HTTPBodyStream = stream + } + + let request = Request(session: session, task: uploadTask) + + if HTTPBodyStream != nil { + request.delegate.taskNeedNewBodyStream = { _, _ in + return HTTPBodyStream + } + } + + delegate[request.delegate.task] = request.delegate + + if startRequestsImmediately { + request.resume() + } + + return request + } + + // MARK: File + + /** + Creates a request for uploading a file to the specified URL request. + + If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + + - parameter URLRequest: The URL request + - parameter file: The file to upload + + - returns: The created upload request. + */ + public func upload(URLRequest: URLRequestConvertible, file: NSURL) -> Request { + return upload(.File(URLRequest.URLRequest, file)) + } + + /** + Creates a request for uploading a file to the specified URL request. + + If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + + - parameter method: The HTTP method. + - parameter URLString: The URL string. + - parameter headers: The HTTP headers. `nil` by default. + - parameter file: The file to upload + + - returns: The created upload request. + */ + public func upload( + method: Method, + _ URLString: URLStringConvertible, + headers: [String: String]? = nil, + file: NSURL) + -> Request + { + let mutableURLRequest = URLRequest(method, URLString, headers: headers) + return upload(mutableURLRequest, file: file) + } + + // MARK: Data + + /** + Creates a request for uploading data to the specified URL request. + + If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + + - parameter URLRequest: The URL request. + - parameter data: The data to upload. + + - returns: The created upload request. + */ + public func upload(URLRequest: URLRequestConvertible, data: NSData) -> Request { + return upload(.Data(URLRequest.URLRequest, data)) + } + + /** + Creates a request for uploading data to the specified URL request. + + If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + + - parameter method: The HTTP method. + - parameter URLString: The URL string. + - parameter headers: The HTTP headers. `nil` by default. + - parameter data: The data to upload + + - returns: The created upload request. + */ + public func upload( + method: Method, + _ URLString: URLStringConvertible, + headers: [String: String]? = nil, + data: NSData) + -> Request + { + let mutableURLRequest = URLRequest(method, URLString, headers: headers) + + return upload(mutableURLRequest, data: data) + } + + // MARK: Stream + + /** + Creates a request for uploading a stream to the specified URL request. + + If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + + - parameter URLRequest: The URL request. + - parameter stream: The stream to upload. + + - returns: The created upload request. + */ + public func upload(URLRequest: URLRequestConvertible, stream: NSInputStream) -> Request { + return upload(.Stream(URLRequest.URLRequest, stream)) + } + + /** + Creates a request for uploading a stream to the specified URL request. + + If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + + - parameter method: The HTTP method. + - parameter URLString: The URL string. + - parameter headers: The HTTP headers. `nil` by default. + - parameter stream: The stream to upload. + + - returns: The created upload request. + */ + public func upload( + method: Method, + _ URLString: URLStringConvertible, + headers: [String: String]? = nil, + stream: NSInputStream) + -> Request + { + let mutableURLRequest = URLRequest(method, URLString, headers: headers) + + return upload(mutableURLRequest, stream: stream) + } + + // MARK: MultipartFormData + + /// Default memory threshold used when encoding `MultipartFormData`. + public static let MultipartFormDataEncodingMemoryThreshold: UInt64 = 10 * 1024 * 1024 + + /** + Defines whether the `MultipartFormData` encoding was successful and contains result of the encoding as + associated values. + + - Success: Represents a successful `MultipartFormData` encoding and contains the new `Request` along with + streaming information. + - Failure: Used to represent a failure in the `MultipartFormData` encoding and also contains the encoding + error. + */ + public enum MultipartFormDataEncodingResult { + case Success(request: Request, streamingFromDisk: Bool, streamFileURL: NSURL?) + case Failure(ErrorType) + } + + /** + Encodes the `MultipartFormData` and creates a request to upload the result to the specified URL request. + + It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative + payload is small, encoding the data in-memory and directly uploading to a server is the by far the most + efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to + be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory + footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be + used for larger payloads such as video content. + + The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory + or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`, + encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk + during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding + technique was used. + + If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + + - parameter method: The HTTP method. + - parameter URLString: The URL string. + - parameter headers: The HTTP headers. `nil` by default. + - parameter multipartFormData: The closure used to append body parts to the `MultipartFormData`. + - parameter encodingMemoryThreshold: The encoding memory threshold in bytes. + `MultipartFormDataEncodingMemoryThreshold` by default. + - parameter encodingCompletion: The closure called when the `MultipartFormData` encoding is complete. + */ + public func upload( + method: Method, + _ URLString: URLStringConvertible, + headers: [String: String]? = nil, + multipartFormData: MultipartFormData -> Void, + encodingMemoryThreshold: UInt64 = Manager.MultipartFormDataEncodingMemoryThreshold, + encodingCompletion: (MultipartFormDataEncodingResult -> Void)?) + { + let mutableURLRequest = URLRequest(method, URLString, headers: headers) + + return upload( + mutableURLRequest, + multipartFormData: multipartFormData, + encodingMemoryThreshold: encodingMemoryThreshold, + encodingCompletion: encodingCompletion + ) + } + + /** + Encodes the `MultipartFormData` and creates a request to upload the result to the specified URL request. + + It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative + payload is small, encoding the data in-memory and directly uploading to a server is the by far the most + efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to + be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory + footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be + used for larger payloads such as video content. + + The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory + or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`, + encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk + during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding + technique was used. + + If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. + + - parameter URLRequest: The URL request. + - parameter multipartFormData: The closure used to append body parts to the `MultipartFormData`. + - parameter encodingMemoryThreshold: The encoding memory threshold in bytes. + `MultipartFormDataEncodingMemoryThreshold` by default. + - parameter encodingCompletion: The closure called when the `MultipartFormData` encoding is complete. + */ + public func upload( + URLRequest: URLRequestConvertible, + multipartFormData: MultipartFormData -> Void, + encodingMemoryThreshold: UInt64 = Manager.MultipartFormDataEncodingMemoryThreshold, + encodingCompletion: (MultipartFormDataEncodingResult -> Void)?) + { + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) { + let formData = MultipartFormData() + multipartFormData(formData) + + let URLRequestWithContentType = URLRequest.URLRequest + URLRequestWithContentType.setValue(formData.contentType, forHTTPHeaderField: "Content-Type") + + let isBackgroundSession = self.session.configuration.identifier != nil + + if formData.contentLength < encodingMemoryThreshold && !isBackgroundSession { + do { + let data = try formData.encode() + let encodingResult = MultipartFormDataEncodingResult.Success( + request: self.upload(URLRequestWithContentType, data: data), + streamingFromDisk: false, + streamFileURL: nil + ) + + dispatch_async(dispatch_get_main_queue()) { + encodingCompletion?(encodingResult) + } + } catch { + dispatch_async(dispatch_get_main_queue()) { + encodingCompletion?(.Failure(error as NSError)) + } + } + } else { + let fileManager = NSFileManager.defaultManager() + let tempDirectoryURL = NSURL(fileURLWithPath: NSTemporaryDirectory()) + let directoryURL = tempDirectoryURL.URLByAppendingPathComponent("com.alamofire.manager/multipart.form.data") + let fileName = NSUUID().UUIDString + let fileURL = directoryURL.URLByAppendingPathComponent(fileName) + + do { + try fileManager.createDirectoryAtURL(directoryURL, withIntermediateDirectories: true, attributes: nil) + try formData.writeEncodedDataToDisk(fileURL) + + dispatch_async(dispatch_get_main_queue()) { + let encodingResult = MultipartFormDataEncodingResult.Success( + request: self.upload(URLRequestWithContentType, file: fileURL), + streamingFromDisk: true, + streamFileURL: fileURL + ) + encodingCompletion?(encodingResult) + } + } catch { + dispatch_async(dispatch_get_main_queue()) { + encodingCompletion?(.Failure(error as NSError)) + } + } + } + } + } +} + +// MARK: - + +extension Request { + + // MARK: - UploadTaskDelegate + + class UploadTaskDelegate: DataTaskDelegate { + var uploadTask: NSURLSessionUploadTask? { return task as? NSURLSessionUploadTask } + var uploadProgress: ((Int64, Int64, Int64) -> Void)! + + // MARK: - NSURLSessionTaskDelegate + + // MARK: Override Closures + + var taskDidSendBodyData: ((NSURLSession, NSURLSessionTask, Int64, Int64, Int64) -> Void)? + + // MARK: Delegate Methods + + func URLSession( + session: NSURLSession, + task: NSURLSessionTask, + didSendBodyData bytesSent: Int64, + totalBytesSent: Int64, + totalBytesExpectedToSend: Int64) + { + if initialResponseTime == nil { initialResponseTime = CFAbsoluteTimeGetCurrent() } + + if let taskDidSendBodyData = taskDidSendBodyData { + taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend) + } else { + progress.totalUnitCount = totalBytesExpectedToSend + progress.completedUnitCount = totalBytesSent + + uploadProgress?(bytesSent, totalBytesSent, totalBytesExpectedToSend) + } + } + } +} diff --git a/Pods/Alamofire/Source/Validation.swift b/Pods/Alamofire/Source/Validation.swift new file mode 100644 index 0000000..71d21e1 --- /dev/null +++ b/Pods/Alamofire/Source/Validation.swift @@ -0,0 +1,189 @@ +// Validation.swift +// +// Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation + +extension Request { + + /** + Used to represent whether validation was successful or encountered an error resulting in a failure. + + - Success: The validation was successful. + - Failure: The validation failed encountering the provided error. + */ + public enum ValidationResult { + case Success + case Failure(NSError) + } + + /** + A closure used to validate a request that takes a URL request and URL response, and returns whether the + request was valid. + */ + public typealias Validation = (NSURLRequest?, NSHTTPURLResponse) -> ValidationResult + + /** + Validates the request, using the specified closure. + + If validation fails, subsequent calls to response handlers will have an associated error. + + - parameter validation: A closure to validate the request. + + - returns: The request. + */ + public func validate(validation: Validation) -> Self { + delegate.queue.addOperationWithBlock { + if let + response = self.response where self.delegate.error == nil, + case let .Failure(error) = validation(self.request, response) + { + self.delegate.error = error + } + } + + return self + } + + // MARK: - Status Code + + /** + Validates that the response has a status code in the specified range. + + If validation fails, subsequent calls to response handlers will have an associated error. + + - parameter range: The range of acceptable status codes. + + - returns: The request. + */ + public func validate(statusCode acceptableStatusCode: S) -> Self { + return validate { _, response in + if acceptableStatusCode.contains(response.statusCode) { + return .Success + } else { + let failureReason = "Response status code was unacceptable: \(response.statusCode)" + return .Failure(Error.errorWithCode(.StatusCodeValidationFailed, failureReason: failureReason)) + } + } + } + + // MARK: - Content-Type + + private struct MIMEType { + let type: String + let subtype: String + + init?(_ string: String) { + let components: [String] = { + let stripped = string.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()) + let split = stripped.substringToIndex(stripped.rangeOfString(";")?.startIndex ?? stripped.endIndex) + return split.componentsSeparatedByString("/") + }() + + if let + type = components.first, + subtype = components.last + { + self.type = type + self.subtype = subtype + } else { + return nil + } + } + + func matches(MIME: MIMEType) -> Bool { + switch (type, subtype) { + case (MIME.type, MIME.subtype), (MIME.type, "*"), ("*", MIME.subtype), ("*", "*"): + return true + default: + return false + } + } + } + + /** + Validates that the response has a content type in the specified array. + + If validation fails, subsequent calls to response handlers will have an associated error. + + - parameter contentType: The acceptable content types, which may specify wildcard types and/or subtypes. + + - returns: The request. + */ + public func validate(contentType acceptableContentTypes: S) -> Self { + return validate { _, response in + guard let validData = self.delegate.data where validData.length > 0 else { return .Success } + + if let + responseContentType = response.MIMEType, + responseMIMEType = MIMEType(responseContentType) + { + for contentType in acceptableContentTypes { + if let acceptableMIMEType = MIMEType(contentType) where acceptableMIMEType.matches(responseMIMEType) { + return .Success + } + } + } else { + for contentType in acceptableContentTypes { + if let MIMEType = MIMEType(contentType) where MIMEType.type == "*" && MIMEType.subtype == "*" { + return .Success + } + } + } + + let failureReason: String + + if let responseContentType = response.MIMEType { + failureReason = ( + "Response content type \"\(responseContentType)\" does not match any acceptable " + + "content types: \(acceptableContentTypes)" + ) + } else { + failureReason = "Response content type was missing and acceptable content type does not match \"*/*\"" + } + + return .Failure(Error.errorWithCode(.ContentTypeValidationFailed, failureReason: failureReason)) + } + } + + // MARK: - Automatic + + /** + Validates that the response has a status code in the default acceptable range of 200...299, and that the content + type matches any specified in the Accept HTTP header field. + + If validation fails, subsequent calls to response handlers will have an associated error. + + - returns: The request. + */ + public func validate() -> Self { + let acceptableStatusCodes: Range = 200..<300 + let acceptableContentTypes: [String] = { + if let accept = request?.valueForHTTPHeaderField("Accept") { + return accept.componentsSeparatedByString(",") + } + + return ["*/*"] + }() + + return validate(statusCode: acceptableStatusCodes).validate(contentType: acceptableContentTypes) + } +} diff --git a/Pods/Drip/Drip/Component.swift b/Pods/Drip/Drip/Component.swift new file mode 100644 index 0000000..07308ac --- /dev/null +++ b/Pods/Drip/Drip/Component.swift @@ -0,0 +1,6 @@ + +/// Base class for components. Functionality provided by `ComponentType`. +public class Component: ComponentType { + public let registry = Registry() + public required init() {} +} \ No newline at end of file diff --git a/Pods/Drip/Drip/ComponentType.swift b/Pods/Drip/Drip/ComponentType.swift new file mode 100644 index 0000000..88742fd --- /dev/null +++ b/Pods/Drip/Drip/ComponentType.swift @@ -0,0 +1,179 @@ +/** + Classes conforming to `ComponentType` are a container for a set of dependencies, + declared in `Modules`, and are the principal mechanism for scoping dependencies + to particular part of the application. + + A `ComponentType` owns modules, which can be registered through the chainable + method `module`. +*/ +public protocol ComponentType: class { + /** + The `registry` is used as the component's backing store. Conformance to + `ComponentType` only requires that the implementer declare storage for and + construct a registry. + */ + var registry: Registry { get } +} + +// MARK: Parents +public extension ComponentType { + /** + Retrieves a registered parent component. If the parent component is not yet + registerd, this method raises an exception. + + - Returns: A pre-registered parent of type `P` + */ + func parent() -> P { + do { + return try registry.get() + } catch Error.ComponentNotFound(let type) { + terminate("failed to find parent: \(type)") + } catch { + terminate() + } + } + + /** + Registers a parent component of type `P`. This component can be retrieved through + the `parent` accessor method. + + - Parameter initializer: A closure called immediately that returns or initializes + the parent, which is then discarded. + + - Returns: This component for chaining + */ + func parent(initializer: () -> P) -> Self { + registry.set(initializer()) + return self + } +} + +// MARK: Modules +public extension ComponentType { + /** + Retrieves the module registered for the module type `M`. If no module has been + registerd for `M`, this method raises an exception. + + `M` must decare this component as it's `Owner`. + + - Parameter key: A key used to match the correct module; defaults to `M.self` + - Returns: A pre-registered module of type `M` + */ + func module(key: KeyConvertible = Key(M.self)) -> M { + do { + return try registry.get(key) + } catch Error.ModuleNotFound(let type) { + terminate("failed to find module \(type)") + } catch { + terminate() + } + } + + /** + Registers a module of type `M`. This module can be retrieved through the `module` + accessor method. + + - Parameter type: The supertype (or the type itself) of the module to register + - Parameter initializer: A closure called immediately that returns or initializes + the module, which is then discarded. Passed this component as its only parameter. + + - Returns: This component for chaining + */ + func module(type: M.Type, initializer: Self -> M) -> Self { + return self.module(Key(type), initializer: initializer) + } + + /** + Registers a module of type `M`. This module can be retrieved through the `module` + accessor method. + + - Parameter key: A key used to match the correct module; defaults to the `M.self` + - Parameter initializer: A closure called immediately that returns or initializes + the module, which is then discarded. Passed this component as its only parameter. + + - Returns: This component for chaining + */ + func module(key: KeyConvertible = Key(M.self), initializer: Self -> M) -> Self { + registry.set(key, value: initializer(self)) + return self + } +} + +// MARK: Generators +public extension ComponentType { + /** + Note: should only be used to implement of custom generators. + + Resolves an instance of `T`. The generator used to resolve `T` is lazily evaluated, + and if none exists the parameterized `generator` is stored for future resolution. + + - Parameter key: A key used to match the correct dependency; defaults to the `T.self` + - Parameter generator: The generator of `T` to use if none is registered + + - Returns: An instance of `T` + */ + func resolve(key: KeyConvertible = Key(T.self), generator: Self -> T) -> T { + return lazyMatchFor(key, generator: generator)(self) + } +} + +extension ComponentType { + func lazyMatchFor(key: KeyConvertible, generator: Self -> T) -> Self -> T { + var result: Self -> T + + if let match: Self -> T = registry.get(key) { + result = match + } else { + result = generator + registry.set(key, value: generator) + } + + return result + } +} + +// MARK: Overrides +public extension ComponentType { + /** + Overrides the registered generator of type `T` to return a single instance. + + - Parameter instance: The instance to return whenever a `T` is injected + - Returns: This component for chaining + */ + func override(instance: T) -> Self { + return override(Key(T.self), instance) + } + + /** + Overrides the registered generator of type `T` to return a single instance. + + - Parameter key: A key used to match the correct dependency + - Parameter instance: The instance to return whenever a `T` is injected + + - Returns: This component for chaining + */ + func override(key: KeyConvertible, _ instance: T) -> Self { + return override(key) { _ in instance } + } + + /** + Overrides the registered generator of type `T`. Instances are generated by + calling the `generator`. + + - Parameter key: A key used to match the correct dependency; defaults to the `T.self` + - Parameter generator: The function to call whenever a `T` is injected + + - Returns: This component for chaining + */ + func override(key: KeyConvertible = Key(T.self), generator: Self -> T) -> Self { + registry.set(key, value: generator) + return self + } +} + +// MARK: Errors +extension ComponentType { + @noreturn func terminate(message: String = "unknown error") { + fatalError("[component: \(self)] \(message)") + } +} \ No newline at end of file diff --git a/Pods/Drip/Drip/Module.swift b/Pods/Drip/Drip/Module.swift new file mode 100644 index 0000000..c19b118 --- /dev/null +++ b/Pods/Drip/Drip/Module.swift @@ -0,0 +1,9 @@ + +/// Base class for modules. Functionality provided by `ModuleType`. +public class Module: ModuleType { + public typealias Owner = C + public weak var component: C! + public required init(_ component: C) { + self.component = component + } +} \ No newline at end of file diff --git a/Pods/Drip/Drip/ModuleType.swift b/Pods/Drip/Drip/ModuleType.swift new file mode 100644 index 0000000..bf98114 --- /dev/null +++ b/Pods/Drip/Drip/ModuleType.swift @@ -0,0 +1,93 @@ +/** + A module encapsulates a subset of a component's provide dependencies. Modules + are registered to a component, and must conform to `ModuleType`. + + Dependencies are declared as methods, and should register a generator using the + `single`, `transient` or a custom helper to control the dependency's scope. + + A base implementation is provided by the type `Module`. +*/ +public protocol ModuleType { + /// The type of the component that manages this module + associatedtype Owner: ComponentType + + /** + The component that owns this module, passed to the module through its + initializer. + */ + weak var component: Owner! { get } + + /** + The required initializer for all `ModuleType`s. Implementers should store the + paramterized component so that dependencies can be correctly resolved. + + - Parameter component: The component owning this module. + */ + init(_ component: Owner) +} + +extension ModuleType { + /** + Registers a dependency. The dependency is lazily evaluated, and only one instance + will be constructed per component. + + - Parameter key: A key used to match the correct dependency; defaults to `T.self` + - Parameter generator: A closure that returns an instance of the dependency + + - Returns: An instance of the dependency + */ + public func single(key: KeyConvertible = Key(T.self), generator: () -> T) -> T { + return single(key) { (_: Owner) in generator() } + } + + /** + Registers a dependency. The dependency is lazily evaluated, and only one instance + will be constructed per component. + + - Parameter key: A key used to match the correct dependency; defaults to the `T.self` + - Parameter generator: A closure that returns an instance of the dependency and + is passed the owning component to resolve child dependencies. + + - Returns: An instance of the dependency + */ + public func single(key: KeyConvertible = Key(T.self), generator: Owner -> T) -> T { + return component.resolve(key, generator: cache(generator)) + } + + /** + Registers a dependency. The dependency is lazily evaluated, and is created + on-demand each time it's requested. + + - Parameter key: A key used to match the correct dependency; defaults to the `T.self` + - Parameter generator: A closure that returns an instance of the dependency + + - Returns: An instance of the dependency + */ + public func transient(key: KeyConvertible = Key(T.self), generator: () -> T) -> T { + return transient(key) { (_: Owner) in generator() } + } + + /** + Registers a dependency. The dependency is lazily evaluated, and is created + on-demand each time it's requested. + + - Parameter key: A key used to match the correct dependency; defaults to the `T.self` + - Parameter generator: A closure that returns an instance of the dependency and + is passed the owning component to resolve child dependencies. + + - Returns: An instance of the dependency + */ + public func transient(key: KeyConvertible = Key(T.self), generator: Owner -> T) -> T { + return component.resolve(key, generator: generator) + } + + /** + Registers a placeholder dependency. If this dependency is requested, it throws a + fatal error instead. + + - Returns: An application crash + */ + public func abstract() -> T { + fatalError("Failed to implement abstract generator of \(T.self)") + } +} \ No newline at end of file diff --git a/Pods/Drip/Drip/Registry/Key.swift b/Pods/Drip/Drip/Registry/Key.swift new file mode 100644 index 0000000..55d918c --- /dev/null +++ b/Pods/Drip/Drip/Registry/Key.swift @@ -0,0 +1,49 @@ +/** + Note: should only be referenced when implementing of custom generators + + Type used to match dependencies. A `Hashable` or `Any.Type` can be used to construct + keys. Keys should have a 1-1 relationship to a dependency, but uniqueness is not + enforced. +*/ +public struct Key { + private let value: Int + + /** + Initializes a `Key` from a type. + + - Parameter type: a type to consturct the key from + - Returns: A new key + */ + public init(_ type: Any.Type) { + self.init(String(type)) + } + + /** + Initializes a key from a `Hashable`. + + - Parameter hashable: a `Hashable` object to construct the key from + - Returns: A new key + */ + public init(_ hashable: H) { + value = hashable.hashValue + } +} + +// MARK: Hashable +extension Key: Hashable { + public var hashValue: Int { + return value + } +} + +// MARK: Equatable +public func ==(lhs: Key, rhs: Key) -> Bool { + return lhs.value == rhs.value +} + +// MARK: KeyConvertible +extension Key: KeyConvertible { + public func key() -> Key { + return self + } +} \ No newline at end of file diff --git a/Pods/Drip/Drip/Registry/KeyConvertible.swift b/Pods/Drip/Drip/Registry/KeyConvertible.swift new file mode 100644 index 0000000..6e094bf --- /dev/null +++ b/Pods/Drip/Drip/Registry/KeyConvertible.swift @@ -0,0 +1,24 @@ +/** + Types conforming to `KeyConvertible` must be able to construct a `key` used + to match dependencies. + + Default conformance for `String` and `Key` types is provided. + + See: `Key` for more documentation on their usage. +*/ +public protocol KeyConvertible { + /** + Constructs a `Key` used to match dependencies. + - Returns: A key instance corresponding to this object + */ + func key() -> Key +} + +public extension Hashable where Self: KeyConvertible { + func key() -> Key { + return Key(self) + } +} + +extension String: KeyConvertible { +} \ No newline at end of file diff --git a/Pods/Drip/Drip/Registry/Registry.swift b/Pods/Drip/Drip/Registry/Registry.swift new file mode 100644 index 0000000..3654909 --- /dev/null +++ b/Pods/Drip/Drip/Registry/Registry.swift @@ -0,0 +1,54 @@ +/** + Registry encapsulating a component's storage. Classes conforming to `ComponentType` + should declare and instantiate a registry, i.e. + + `let registry = Registry()` +*/ +public class Registry { + private var modules = [Key: Any]() + private var parents = [Key: Any]() + private var generators = [Key: Any]() + + public init() {} +} + +// MARK: Parents +extension Registry { + func get() throws -> C { + guard let parent = parents[Key(C.self)] as? C else { + throw Error.ComponentNotFound(type: C.self) + } + + return parent + } + + func set(value: C?) { + parents[Key(C.self)] = value + } +} + +// MARK: Modules +extension Registry { + func get(key: KeyConvertible) throws -> M { + guard let module = modules[key.key()] as? M else { + throw Error.ModuleNotFound(type: M.self) + } + + return module + } + + func set(key: KeyConvertible, value: M?) { + modules[key.key()] = value + } +} + +// MARK: Generators +extension Registry { + func get(key: KeyConvertible) -> (C -> T)? { + return generators[key.key()] as? C -> T + } + + func set(key: KeyConvertible, value: C -> T) { + generators[key.key()] = value + } +} \ No newline at end of file diff --git a/Pods/Drip/Drip/Support/Error.swift b/Pods/Drip/Drip/Support/Error.swift new file mode 100644 index 0000000..a262dd1 --- /dev/null +++ b/Pods/Drip/Drip/Support/Error.swift @@ -0,0 +1,5 @@ + +enum Error: ErrorType { + case ModuleNotFound(type: Any.Type) + case ComponentNotFound(type: Any.Type) +} \ No newline at end of file diff --git a/Pods/Drip/Drip/Support/Functions.swift b/Pods/Drip/Drip/Support/Functions.swift new file mode 100644 index 0000000..8f7f97c --- /dev/null +++ b/Pods/Drip/Drip/Support/Functions.swift @@ -0,0 +1,9 @@ + +func cache(function: I -> O) -> I -> O { + var memo: O? + + return { input in + memo = memo ?? function(input) + return memo! + } +} \ No newline at end of file diff --git a/Pods/Drip/LICENSE b/Pods/Drip/LICENSE new file mode 100644 index 0000000..1eadc49 --- /dev/null +++ b/Pods/Drip/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2016 Devmynd + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Pods/Drip/README.md b/Pods/Drip/README.md new file mode 100644 index 0000000..42819b1 --- /dev/null +++ b/Pods/Drip/README.md @@ -0,0 +1,77 @@ +# Drip + +A lightweight, dagger-ish dependency injection framework for Swift. May `sharedInstance` blot your vision nevermore. + +Dependencies are resolved through type inference whenever possible. Two types, `Components` and `Modules`, compose the dependency container. At a high level, a `Module` provides specific dependencies, and a `Component` both contains a set of `Modules` and constrains their scope. + +### Modules + +A module provides, and is a logical grouping of, related dependencies. For example, in your application you might define a `ServiceModule` that provides a set of `Api` objects. + +A module is a class conforming to `ModuleType`, but typically subclassing `Module`. A module is coupled to a specific component, and it must specify that component in its type declaration. + +``` +import Drip + +class ViewModule: Module { + required init(_ component: ViewComponent) { + super.init(component) + } +} +``` + +A module declares methods describing the strategy to resolve individual dependencies. At present, modules have two built-in strategies (exposed as instance methods on the module) for resolving dependencies: + +- `single`: Only one instance is created per-component. +- `transient`: A new instance is created per-resolution. + +Each strategy method receives the component as its only parameter. In the event that a dependency depends on other types provided by the module's component, you to inject them using this component reference. + +``` +func inject() -> Api { + return transient { Api() } +} + +func inject() -> ViewModel { + return single { c in + ViewModel(api: c.core.inject()) + } +} +``` + +### Components + +A `Component` constrains the scope for a set of modules, and is the container for the modules' dependencies. Components have no built-in lifecycle, but are instead owned by (and match the lifecycle of) a member of your application. A component serves dependencies appropriate for the scope of its owning object. + +For example, an `Application` object might own an `ApplicationComponent` that serves application-wide dependencies like a `Repository` and a `Configuration`. + +A component is a class conforming to `ComponentType`, but typically subclassing `Component`. + +``` +import Drip + +final class ViewComponent: Component { + var root: ApplicationComponent { return parent() } + var core: ViewModule { return module() } +} +``` + +A component declares accessors for referencing its modules (the `module` method will automatically resolve the correct instance). + +``` +var core: ViewModule { return module() } +``` + +A component may also declare accessors for referencing parent components (the `parent` method will automatically resolve the correct instance). This is useful when declaring a component with a narrower scope that requires dependencies provided by a wider-scoped component. + +``` +var root: ApplicationComponent { return parent() } +``` + +Components are constrcuted through chainable methods that register its modules (and optionally parents). The type of parents is inferred, but the type of modules must be specified explicitly. + +``` +lazy var component: ViewComponent = ViewComponent() + .parent { self.app.component } + .module(ViewModule.self) { ViewModule($0) } +``` diff --git a/Pods/Local Podspecs/Drip.podspec.json b/Pods/Local Podspecs/Drip.podspec.json new file mode 100644 index 0000000..95048c4 --- /dev/null +++ b/Pods/Local Podspecs/Drip.podspec.json @@ -0,0 +1,25 @@ +{ + "name": "Drip", + "version": "0.1.0", + "summary": "Lightweight dependency injection for Swift", + "platforms": { + "osx": "10.9", + "ios": "8.0" + }, + "description": "A lightweight, dagger-ish Swift DI library. Provides mechanisms for scoping dependencies\nand eliminating the singleton pattern. Relies on type inference to resolve injected dependencies,\nrather than require types be passed explicitly.", + "homepage": "https://github.com/devmynd/Drip", + "license": { + "type": "MIT", + "file": "LICENSE" + }, + "authors": { + "Ty Cobb": "ty.cobb.m@gmail.com" + }, + "social_media_url": "http://twitter.com/wzrad", + "source": { + "git": "https://github.com/devmynd/drip.git", + "tag": "v0.1.0" + }, + "source_files": "Drip/**/*.swift", + "requires_arc": true +} diff --git a/Pods/Manifest.lock b/Pods/Manifest.lock new file mode 100644 index 0000000..50f39c8 --- /dev/null +++ b/Pods/Manifest.lock @@ -0,0 +1,21 @@ +PODS: + - Alamofire (3.2.1) + - Drip (0.1.0) + - Nimble (4.0.1) + - Quick (0.9.1) + +DEPENDENCIES: + - Alamofire (~> 3.0) + - Drip (~> 0.1) + - Nimble (~> 4.0) + - Quick (~> 0.9) + +SPEC CHECKSUMS: + Alamofire: f11d8624a05f5d39e0c99309b3e600a3ba64298a + Drip: b499d3537bbe35630bde86a95a0d6521520c7625 + Nimble: 0f3c8b8b084cda391209c3c5efbb48bedeeb920a + Quick: a5221fc21788b6aeda934805e68b061839bc3165 + +PODFILE CHECKSUM: 48a24fdf9dc6683748ff23878c99f0e521ea7b97 + +COCOAPODS: 1.0.0 diff --git a/Pods/Nimble/LICENSE.md b/Pods/Nimble/LICENSE.md new file mode 100644 index 0000000..0f3eb71 --- /dev/null +++ b/Pods/Nimble/LICENSE.md @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2014 Quick Team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Pods/Nimble/README.md b/Pods/Nimble/README.md new file mode 100644 index 0000000..0e42d27 --- /dev/null +++ b/Pods/Nimble/README.md @@ -0,0 +1,1234 @@ +# Nimble + +Use Nimble to express the expected outcomes of Swift +or Objective-C expressions. Inspired by +[Cedar](https://github.com/pivotal/cedar). + +```swift +// Swift + +expect(1 + 1).to(equal(2)) +expect(1.2).to(beCloseTo(1.1, within: 0.1)) +expect(3) > 2 +expect("seahorse").to(contain("sea")) +expect(["Atlantic", "Pacific"]).toNot(contain("Mississippi")) +expect(ocean.isClean).toEventually(beTruthy()) +``` + +# How to Use Nimble + + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [Some Background: Expressing Outcomes Using Assertions in XCTest](#some-background-expressing-outcomes-using-assertions-in-xctest) +- [Nimble: Expectations Using `expect(...).to`](#nimble-expectations-using-expectto) + - [Custom Failure Messages](#custom-failure-messages) + - [Type Checking](#type-checking) + - [Operator Overloads](#operator-overloads) + - [Lazily Computed Values](#lazily-computed-values) + - [C Primitives](#c-primitives) + - [Asynchronous Expectations](#asynchronous-expectations) + - [Objective-C Support](#objective-c-support) + - [Disabling Objective-C Shorthand](#disabling-objective-c-shorthand) +- [Built-in Matcher Functions](#built-in-matcher-functions) + - [Equivalence](#equivalence) + - [Identity](#identity) + - [Comparisons](#comparisons) + - [Types/Classes](#typesclasses) + - [Truthiness](#truthiness) + - [Swift Error Handling](#swift-error-handling) + - [Exceptions](#exceptions) + - [Collection Membership](#collection-membership) + - [Strings](#strings) + - [Checking if all elements of a collection pass a condition](#checking-if-all-elements-of-a-collection-pass-a-condition) + - [Verify collection count](#verify-collection-count) + - [Matching a value to any of a group of matchers](#matching-a-value-to-any-of-a-group-of-matchers) +- [Writing Your Own Matchers](#writing-your-own-matchers) + - [Lazy Evaluation](#lazy-evaluation) + - [Type Checking via Swift Generics](#type-checking-via-swift-generics) + - [Customizing Failure Messages](#customizing-failure-messages) + - [Supporting Objective-C](#supporting-objective-c) + - [Properly Handling `nil` in Objective-C Matchers](#properly-handling-nil-in-objective-c-matchers) +- [Installing Nimble](#installing-nimble) + - [Installing Nimble as a Submodule](#installing-nimble-as-a-submodule) + - [Installing Nimble via CocoaPods](#installing-nimble-via-cocoapods) + - [Using Nimble without XCTest](#using-nimble-without-xctest) + + + +# Some Background: Expressing Outcomes Using Assertions in XCTest + +Apple's Xcode includes the XCTest framework, which provides +assertion macros to test whether code behaves properly. +For example, to assert that `1 + 1 = 2`, XCTest has you write: + +```swift +// Swift + +XCTAssertEqual(1 + 1, 2, "expected one plus one to equal two") +``` + +Or, in Objective-C: + +```objc +// Objective-C + +XCTAssertEqual(1 + 1, 2, @"expected one plus one to equal two"); +``` + +XCTest assertions have a couple of drawbacks: + +1. **Not enough macros.** There's no easy way to assert that a string + contains a particular substring, or that a number is less than or + equal to another. +2. **It's hard to write asynchronous tests.** XCTest forces you to write + a lot of boilerplate code. + +Nimble addresses these concerns. + +# Nimble: Expectations Using `expect(...).to` + +Nimble allows you to express expectations using a natural, +easily understood language: + +```swift +// Swift + +import Nimble + +expect(seagull.squawk).to(equal("Squee!")) +``` + +```objc +// Objective-C + +@import Nimble; + +expect(seagull.squawk).to(equal(@"Squee!")); +``` + +> The `expect` function autocompletes to include `file:` and `line:`, + but these parameters are optional. Use the default values to have + Xcode highlight the correct line when an expectation is not met. + +To perform the opposite expectation--to assert something is *not* +equal--use `toNot` or `notTo`: + +```swift +// Swift + +import Nimble + +expect(seagull.squawk).toNot(equal("Oh, hello there!")) +expect(seagull.squawk).notTo(equal("Oh, hello there!")) +``` + +```objc +// Objective-C + +@import Nimble; + +expect(seagull.squawk).toNot(equal(@"Oh, hello there!")); +expect(seagull.squawk).notTo(equal(@"Oh, hello there!")); +``` + +## Custom Failure Messages + +Would you like to add more information to the test's failure messages? Use the `description` optional argument to add your own text: + +```swift +// Swift + +expect(1 + 1).to(equal(3)) +// failed - expected to equal <3>, got <2> + +expect(1 + 1).to(equal(3), description: "Make sure libKindergartenMath is loaded") +// failed - Make sure libKindergartenMath is loaded +// expected to equal <3>, got <2> +``` + +Or the *WithDescription version in Objective-C: + +```objc +// Objective-C + +@import Nimble; + +expect(@(1+1)).to(equal(@3)); +// failed - expected to equal <3.0000>, got <2.0000> + +expect(@(1+1)).toWithDescription(equal(@3), @"Make sure libKindergartenMath is loaded"); +// failed - Make sure libKindergartenMath is loaded +// expected to equal <3.0000>, got <2.0000> +``` + +## Type Checking + +Nimble makes sure you don't compare two types that don't match: + +```swift +// Swift + +// Does not compile: +expect(1 + 1).to(equal("Squee!")) +``` + +> Nimble uses generics--only available in Swift--to ensure + type correctness. That means type checking is + not available when using Nimble in Objective-C. :sob: + +## Operator Overloads + +Tired of so much typing? With Nimble, you can use overloaded operators +like `==` for equivalence, or `>` for comparisons: + +```swift +// Swift + +// Passes if squawk does not equal "Hi!": +expect(seagull.squawk) != "Hi!" + +// Passes if 10 is greater than 2: +expect(10) > 2 +``` + +> Operator overloads are only available in Swift, so you won't be able + to use this syntax in Objective-C. :broken_heart: + +## Lazily Computed Values + +The `expect` function doesn't evaluate the value it's given until it's +time to match. So Nimble can test whether an expression raises an +exception once evaluated: + +```swift +// Swift + +// Note: Swift currently doesn't have exceptions. +// Only Objective-C code can raise exceptions +// that Nimble will catch. +// (see https://github.com/Quick/Nimble/issues/220#issuecomment-172667064) +let exception = NSException( + name: NSInternalInconsistencyException, + reason: "Not enough fish in the sea.", + userInfo: ["something": "is fishy"]) +expect { exception.raise() }.to(raiseException()) + +// Also, you can customize raiseException to be more specific +expect { exception.raise() }.to(raiseException(named: NSInternalInconsistencyException)) +expect { exception.raise() }.to(raiseException( + named: NSInternalInconsistencyException, + reason: "Not enough fish in the sea")) +expect { exception.raise() }.to(raiseException( + named: NSInternalInconsistencyException, + reason: "Not enough fish in the sea", + userInfo: ["something": "is fishy"])) +``` + +Objective-C works the same way, but you must use the `expectAction` +macro when making an expectation on an expression that has no return +value: + +```objc +// Objective-C + +NSException *exception = [NSException exceptionWithName:NSInternalInconsistencyException + reason:@"Not enough fish in the sea." + userInfo:nil]; +expectAction(^{ [exception raise]; }).to(raiseException()); + +// Use the property-block syntax to be more specific. +expectAction(^{ [exception raise]; }).to(raiseException().named(NSInternalInconsistencyException)); +expectAction(^{ [exception raise]; }).to(raiseException(). + named(NSInternalInconsistencyException). + reason("Not enough fish in the sea")); +expectAction(^{ [exception raise]; }).to(raiseException(). + named(NSInternalInconsistencyException). + reason("Not enough fish in the sea"). + userInfo(@{@"something": @"is fishy"})); + +// You can also pass a block for custom matching of the raised exception +expectAction(exception.raise()).to(raiseException().satisfyingBlock(^(NSException *exception) { + expect(exception.name).to(beginWith(NSInternalInconsistencyException)); +})); +``` + +## C Primitives + +Some testing frameworks make it hard to test primitive C values. +In Nimble, it just works: + +```swift +// Swift + +let actual: CInt = 1 +let expectedValue: CInt = 1 +expect(actual).to(equal(expectedValue)) +``` + +In fact, Nimble uses type inference, so you can write the above +without explicitly specifying both types: + +```swift +// Swift + +expect(1 as CInt).to(equal(1)) +``` + +> In Objective-C, Nimble only supports Objective-C objects. To + make expectations on primitive C values, wrap then in an object + literal: + + ```objc + expect(@(1 + 1)).to(equal(@2)); + ``` + +## Asynchronous Expectations + +In Nimble, it's easy to make expectations on values that are updated +asynchronously. Just use `toEventually` or `toEventuallyNot`: + +```swift +// Swift + +dispatch_async(dispatch_get_main_queue()) { + ocean.add("dolphins") + ocean.add("whales") +} +expect(ocean).toEventually(contain("dolphins", "whales")) +``` + + +```objc +// Objective-C +dispatch_async(dispatch_get_main_queue(), ^{ + [ocean add:@"dolphins"]; + [ocean add:@"whales"]; +}); +expect(ocean).toEventually(contain(@"dolphins", @"whales")); +``` + +Note: toEventually triggers its polls on the main thread. Blocking the main +thread will cause Nimble to stop the run loop. This can cause test pollution +for whatever incomplete code that was running on the main thread. Blocking the +main thread can be caused by blocking IO, calls to sleep(), deadlocks, and +synchronous IPC. + +In the above example, `ocean` is constantly re-evaluated. If it ever +contains dolphins and whales, the expectation passes. If `ocean` still +doesn't contain them, even after being continuously re-evaluated for one +whole second, the expectation fails. + +Sometimes it takes more than a second for a value to update. In those +cases, use the `timeout` parameter: + +```swift +// Swift + +// Waits three seconds for ocean to contain "starfish": +expect(ocean).toEventually(contain("starfish"), timeout: 3) +``` + +```objc +// Objective-C + +// Waits three seconds for ocean to contain "starfish": +expect(ocean).withTimeout(3).toEventually(contain(@"starfish")); +``` + +You can also provide a callback by using the `waitUntil` function: + +```swift +// Swift + +waitUntil { done in + // do some stuff that takes a while... + NSThread.sleepForTimeInterval(0.5) + done() +} +``` + +```objc +// Objective-C + +waitUntil(^(void (^done)(void)){ + // do some stuff that takes a while... + [NSThread sleepForTimeInterval:0.5]; + done(); +}); +``` + +`waitUntil` also optionally takes a timeout parameter: + +```swift +// Swift + +waitUntil(timeout: 10) { done in + // do some stuff that takes a while... + NSThread.sleepForTimeInterval(1) + done() +} +``` + +```objc +// Objective-C + +waitUntilTimeout(10, ^(void (^done)(void)){ + // do some stuff that takes a while... + [NSThread sleepForTimeInterval:1]; + done(); +}); +``` + +Note: waitUntil triggers its timeout code on the main thread. Blocking the main +thread will cause Nimble to stop the run loop to continue. This can cause test +pollution for whatever incomplete code that was running on the main thread. +Blocking the main thread can be caused by blocking IO, calls to sleep(), +deadlocks, and synchronous IPC. + +In some cases (e.g. when running on slower machines) it can be useful to modify +the default timeout and poll interval values. This can be done as follows: + +```swift +// Swift + +// Increase the global timeout to 5 seconds: +Nimble.AsyncDefaults.Timeout = 5 + +// Slow the polling interval to 0.1 seconds: +Nimble.AsyncDefaults.PollInterval = 0.1 +``` + +## Objective-C Support + +Nimble has full support for Objective-C. However, there are two things +to keep in mind when using Nimble in Objective-C: + +1. All parameters passed to the `expect` function, as well as matcher + functions like `equal`, must be Objective-C objects: + + ```objc + // Objective-C + + @import Nimble; + + expect(@(1 + 1)).to(equal(@2)); + expect(@"Hello world").to(contain(@"world")); + ``` + +2. To make an expectation on an expression that does not return a value, + such as `-[NSException raise]`, use `expectAction` instead of + `expect`: + + ```objc + // Objective-C + + expectAction(^{ [exception raise]; }).to(raiseException()); + ``` + +## Disabling Objective-C Shorthand + +Nimble provides a shorthand for expressing expectations using the +`expect` function. To disable this shorthand in Objective-C, define the +`NIMBLE_DISABLE_SHORT_SYNTAX` macro somewhere in your code before +importing Nimble: + +```objc +#define NIMBLE_DISABLE_SHORT_SYNTAX 1 + +@import Nimble; + +NMB_expect(^{ return seagull.squawk; }, __FILE__, __LINE__).to(NMB_equal(@"Squee!")); +``` + +> Disabling the shorthand is useful if you're testing functions with + names that conflict with Nimble functions, such as `expect` or + `equal`. If that's not the case, there's no point in disabling the + shorthand. + +# Built-in Matcher Functions + +Nimble includes a wide variety of matcher functions. + +## Equivalence + +```swift +// Swift + +// Passes if actual is equivalent to expected: +expect(actual).to(equal(expected)) +expect(actual) == expected + +// Passes if actual is not equivalent to expected: +expect(actual).toNot(equal(expected)) +expect(actual) != expected +``` + +```objc +// Objective-C + +// Passes if actual is equivalent to expected: +expect(actual).to(equal(expected)) + +// Passes if actual is not equivalent to expected: +expect(actual).toNot(equal(expected)) +``` + +Values must be `Equatable`, `Comparable`, or subclasses of `NSObject`. +`equal` will always fail when used to compare one or more `nil` values. + +## Identity + +```swift +// Swift + +// Passes if actual has the same pointer address as expected: +expect(actual).to(beIdenticalTo(expected)) +expect(actual) === expected + +// Passes if actual does not have the same pointer address as expected: +expect(actual).toNot(beIdenticalTo(expected)) +expect(actual) !== expected +``` + +```objc +// Objective-C + +// Passes if actual has the same pointer address as expected: +expect(actual).to(beIdenticalTo(expected)); + +// Passes if actual does not have the same pointer address as expected: +expect(actual).toNot(beIdenticalTo(expected)); +``` + +## Comparisons + +```swift +// Swift + +expect(actual).to(beLessThan(expected)) +expect(actual) < expected + +expect(actual).to(beLessThanOrEqualTo(expected)) +expect(actual) <= expected + +expect(actual).to(beGreaterThan(expected)) +expect(actual) > expected + +expect(actual).to(beGreaterThanOrEqualTo(expected)) +expect(actual) >= expected +``` + +```objc +// Objective-C + +expect(actual).to(beLessThan(expected)); +expect(actual).to(beLessThanOrEqualTo(expected)); +expect(actual).to(beGreaterThan(expected)); +expect(actual).to(beGreaterThanOrEqualTo(expected)); +``` + +> Values given to the comparison matchers above must implement + `Comparable`. + +Because of how computers represent floating point numbers, assertions +that two floating point numbers be equal will sometimes fail. To express +that two numbers should be close to one another within a certain margin +of error, use `beCloseTo`: + +```swift +// Swift + +expect(actual).to(beCloseTo(expected, within: delta)) +``` + +```objc +// Objective-C + +expect(actual).to(beCloseTo(expected).within(delta)); +``` + +For example, to assert that `10.01` is close to `10`, you can write: + +```swift +// Swift + +expect(10.01).to(beCloseTo(10, within: 0.1)) +``` + +```objc +// Objective-C + +expect(@(10.01)).to(beCloseTo(@10).within(0.1)); +``` + +There is also an operator shortcut available in Swift: + +```swift +// Swift + +expect(actual) ≈ expected +expect(actual) ≈ (expected, delta) + +``` +(Type Option-x to get ≈ on a U.S. keyboard) + +The former version uses the default delta of 0.0001. Here is yet another way to do this: + +```swift +// Swift + +expect(actual) ≈ expected ± delta +expect(actual) == expected ± delta + +``` +(Type Option-Shift-= to get ± on a U.S. keyboard) + +If you are comparing arrays of floating point numbers, you'll find the following useful: + +```swift +// Swift + +expect([0.0, 2.0]) ≈ [0.0001, 2.0001] +expect([0.0, 2.0]).to(beCloseTo([0.1, 2.1], within: 0.1)) + +``` + +> Values given to the `beCloseTo` matcher must be coercable into a + `Double`. + +## Types/Classes + +```swift +// Swift + +// Passes if instance is an instance of aClass: +expect(instance).to(beAnInstanceOf(aClass)) + +// Passes if instance is an instance of aClass or any of its subclasses: +expect(instance).to(beAKindOf(aClass)) +``` + +```objc +// Objective-C + +// Passes if instance is an instance of aClass: +expect(instance).to(beAnInstanceOf(aClass)); + +// Passes if instance is an instance of aClass or any of its subclasses: +expect(instance).to(beAKindOf(aClass)); +``` + +> Instances must be Objective-C objects: subclasses of `NSObject`, + or Swift objects bridged to Objective-C with the `@objc` prefix. + +For example, to assert that `dolphin` is a kind of `Mammal`: + +```swift +// Swift + +expect(dolphin).to(beAKindOf(Mammal)) +``` + +```objc +// Objective-C + +expect(dolphin).to(beAKindOf([Mammal class])); +``` + +> `beAnInstanceOf` uses the `-[NSObject isMemberOfClass:]` method to + test membership. `beAKindOf` uses `-[NSObject isKindOfClass:]`. + +## Truthiness + +```swift +// Passes if actual is not nil, true, or an object with a boolean value of true: +expect(actual).to(beTruthy()) + +// Passes if actual is only true (not nil or an object conforming to BooleanType true): +expect(actual).to(beTrue()) + +// Passes if actual is nil, false, or an object with a boolean value of false: +expect(actual).to(beFalsy()) + +// Passes if actual is only false (not nil or an object conforming to BooleanType false): +expect(actual).to(beFalse()) + +// Passes if actual is nil: +expect(actual).to(beNil()) +``` + +```objc +// Objective-C + +// Passes if actual is not nil, true, or an object with a boolean value of true: +expect(actual).to(beTruthy()); + +// Passes if actual is only true (not nil or an object conforming to BooleanType true): +expect(actual).to(beTrue()); + +// Passes if actual is nil, false, or an object with a boolean value of false: +expect(actual).to(beFalsy()); + +// Passes if actual is only false (not nil or an object conforming to BooleanType false): +expect(actual).to(beFalse()); + +// Passes if actual is nil: +expect(actual).to(beNil()); +``` + +## Swift Error Handling + +If you're using Swift 2.0+, you can use the `throwError` matcher to check if an error is thrown. + +```swift +// Swift + +// Passes if somethingThatThrows() throws an ErrorType: +expect{ try somethingThatThrows() }.to(throwError()) + +// Passes if somethingThatThrows() throws an error with a given domain: +expect{ try somethingThatThrows() }.to(throwError { (error: ErrorType) in + expect(error._domain).to(equal(NSCocoaErrorDomain)) +}) + +// Passes if somethingThatThrows() throws an error with a given case: +expect{ try somethingThatThrows() }.to(throwError(NSCocoaError.PropertyListReadCorruptError)) + +// Passes if somethingThatThrows() throws an error with a given type: +expect{ try somethingThatThrows() }.to(throwError(errorType: MyError.self)) +``` + +If you are working directly with `ErrorType` values, as is sometimes the case when using `Result` or `Promise` types, you can use the `matchError` matcher to check if the error is the same error is is supposed to be, without requiring explicit casting. + +```swift +// Swift + +let actual: ErrorType = … + +// Passes if actual contains any error value from the MyErrorEnum type: +expect(actual).to(matchError(MyErrorEnum)) + +// Passes if actual contains the Timeout value from the MyErrorEnum type: +expect(actual).to(matchError(MyErrorEnum.Timeout)) + +// Passes if actual contains an NSError equal to the given one: +expect(actual).to(matchError(NSError(domain: "err", code: 123, userInfo: nil))) +``` + +Note: This feature is only available in Swift. + +## Exceptions + +```swift +// Swift + +// Passes if actual, when evaluated, raises an exception: +expect(actual).to(raiseException()) + +// Passes if actual raises an exception with the given name: +expect(actual).to(raiseException(named: name)) + +// Passes if actual raises an exception with the given name and reason: +expect(actual).to(raiseException(named: name, reason: reason)) + +// Passes if actual raises an exception and it passes expectations in the block +// (in this case, if name begins with 'a r') +expect { exception.raise() }.to(raiseException { (exception: NSException) in + expect(exception.name).to(beginWith("a r")) +}) +``` + +```objc +// Objective-C + +// Passes if actual, when evaluated, raises an exception: +expect(actual).to(raiseException()) + +// Passes if actual raises an exception with the given name +expect(actual).to(raiseException().named(name)) + +// Passes if actual raises an exception with the given name and reason: +expect(actual).to(raiseException().named(name).reason(reason)) + +// Passes if actual raises an exception and it passes expectations in the block +// (in this case, if name begins with 'a r') +expect(actual).to(raiseException().satisfyingBlock(^(NSException *exception) { + expect(exception.name).to(beginWith(@"a r")); +})); +``` + +Note: Swift currently doesn't have exceptions (see [#220](https://github.com/Quick/Nimble/issues/220#issuecomment-172667064)). Only Objective-C code can raise +exceptions that Nimble will catch. + +## Collection Membership + +```swift +// Swift + +// Passes if all of the expected values are members of actual: +expect(actual).to(contain(expected...)) + +// Passes if actual is an empty collection (it contains no elements): +expect(actual).to(beEmpty()) +``` + +```objc +// Objective-C + +// Passes if expected is a member of actual: +expect(actual).to(contain(expected)); + +// Passes if actual is an empty collection (it contains no elements): +expect(actual).to(beEmpty()); +``` + +> In Swift `contain` takes any number of arguments. The expectation + passes if all of them are members of the collection. In Objective-C, + `contain` only takes one argument [for now](https://github.com/Quick/Nimble/issues/27). + +For example, to assert that a list of sea creature names contains +"dolphin" and "starfish": + +```swift +// Swift + +expect(["whale", "dolphin", "starfish"]).to(contain("dolphin", "starfish")) +``` + +```objc +// Objective-C + +expect(@[@"whale", @"dolphin", @"starfish"]).to(contain(@"dolphin")); +expect(@[@"whale", @"dolphin", @"starfish"]).to(contain(@"starfish")); +``` + +> `contain` and `beEmpty` expect collections to be instances of + `NSArray`, `NSSet`, or a Swift collection composed of `Equatable` elements. + +To test whether a set of elements is present at the beginning or end of +an ordered collection, use `beginWith` and `endWith`: + +```swift +// Swift + +// Passes if the elements in expected appear at the beginning of actual: +expect(actual).to(beginWith(expected...)) + +// Passes if the the elements in expected come at the end of actual: +expect(actual).to(endWith(expected...)) +``` + +```objc +// Objective-C + +// Passes if the elements in expected appear at the beginning of actual: +expect(actual).to(beginWith(expected)); + +// Passes if the the elements in expected come at the end of actual: +expect(actual).to(endWith(expected)); +``` + +> `beginWith` and `endWith` expect collections to be instances of + `NSArray`, or ordered Swift collections composed of `Equatable` + elements. + + Like `contain`, in Objective-C `beginWith` and `endWith` only support + a single argument [for now](https://github.com/Quick/Nimble/issues/27). + +## Strings + +```swift +// Swift + +// Passes if actual contains substring expected: +expect(actual).to(contain(expected)) + +// Passes if actual begins with substring: +expect(actual).to(beginWith(expected)) + +// Passes if actual ends with substring: +expect(actual).to(endWith(expected)) + +// Passes if actual is an empty string, "": +expect(actual).to(beEmpty()) + +// Passes if actual matches the regular expression defined in expected: +expect(actual).to(match(expected)) +``` + +```objc +// Objective-C + +// Passes if actual contains substring expected: +expect(actual).to(contain(expected)); + +// Passes if actual begins with substring: +expect(actual).to(beginWith(expected)); + +// Passes if actual ends with substring: +expect(actual).to(endWith(expected)); + +// Passes if actual is an empty string, "": +expect(actual).to(beEmpty()); + +// Passes if actual matches the regular expression defined in expected: +expect(actual).to(match(expected)) +``` + +## Checking if all elements of a collection pass a condition + +```swift +// Swift + +// with a custom function: +expect([1,2,3,4]).to(allPass({$0 < 5})) + +// with another matcher: +expect([1,2,3,4]).to(allPass(beLessThan(5))) +``` + +```objc +// Objective-C + +expect(@[@1, @2, @3,@4]).to(allPass(beLessThan(@5))); +``` + +For Swift the actual value has to be a SequenceType, e.g. an array, a set or a custom seqence type. + +For Objective-C the actual value has to be a NSFastEnumeration, e.g. NSArray and NSSet, of NSObjects and only the variant which +uses another matcher is available here. + +## Verify collection count + +```swift +// passes if actual collection's count is equal to expected +expect(actual).to(haveCount(expected)) + +// passes if actual collection's count is not equal to expected +expect(actual).notTo(haveCount(expected)) +``` + +```objc +// passes if actual collection's count is equal to expected +expect(actual).to(haveCount(expected)) + +// passes if actual collection's count is not equal to expected +expect(actual).notTo(haveCount(expected)) +``` + +For Swift the actual value must be a `CollectionType` such as array, dictionary or set. + +For Objective-C the actual value has to be one of the following classes `NSArray`, `NSDictionary`, `NSSet`, `NSHashTable` or one of their subclasses. + +## Matching a value to any of a group of matchers + +```swift +// passes if actual is either less than 10 or greater than 20 +expect(actual).to(satisfyAnyOf(beLessThan(10), beGreaterThan(20))) + +// can include any number of matchers -- the following will pass +// **be careful** -- too many matchers can be the sign of an unfocused test +expect(6).to(satisfyAnyOf(equal(2), equal(3), equal(4), equal(5), equal(6), equal(7))) + +// in Swift you also have the option to use the || operator to achieve a similar function +expect(82).to(beLessThan(50) || beGreaterThan(80)) +``` + +```objc +// passes if actual is either less than 10 or greater than 20 +expect(actual).to(satisfyAnyOf(beLessThan(@10), beGreaterThan(@20))) + +// can include any number of matchers -- the following will pass +// **be careful** -- too many matchers can be the sign of an unfocused test +expect(@6).to(satisfyAnyOf(equal(@2), equal(@3), equal(@4), equal(@5), equal(@6), equal(@7))) +``` + +Note: This matcher allows you to chain any number of matchers together. This provides flexibility, + but if you find yourself chaining many matchers together in one test, consider whether you + could instead refactor that single test into multiple, more precisely focused tests for + better coverage. + +# Writing Your Own Matchers + +In Nimble, matchers are Swift functions that take an expected +value and return a `MatcherFunc` closure. Take `equal`, for example: + +```swift +// Swift + +public func equal(expectedValue: T?) -> MatcherFunc { + return MatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "equal <\(expectedValue)>" + return actualExpression.evaluate() == expectedValue + } +} +``` + +The return value of a `MatcherFunc` closure is a `Bool` that indicates +whether the actual value matches the expectation: `true` if it does, or +`false` if it doesn't. + +> The actual `equal` matcher function does not match when either + `actual` or `expected` are nil; the example above has been edited for + brevity. + +Since matchers are just Swift functions, you can define them anywhere: +at the top of your test file, in a file shared by all of your tests, or +in an Xcode project you distribute to others. + +> If you write a matcher you think everyone can use, consider adding it + to Nimble's built-in set of matchers by sending a pull request! Or + distribute it yourself via GitHub. + +For examples of how to write your own matchers, just check out the +[`Matchers` directory](https://github.com/Quick/Nimble/tree/master/Nimble/Matchers) +to see how Nimble's built-in set of matchers are implemented. You can +also check out the tips below. + +## Lazy Evaluation + +`actualExpression` is a lazy, memoized closure around the value provided to the +`expect` function. The expression can either be a closure or a value directly +passed to `expect(...)`. In order to determine whether that value matches, +custom matchers should call `actualExpression.evaluate()`: + +```swift +// Swift + +public func beNil() -> MatcherFunc { + return MatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be nil" + return actualExpression.evaluate() == nil + } +} +``` + +In the above example, `actualExpression` is not `nil`--it is a closure +that returns a value. The value it returns, which is accessed via the +`evaluate()` method, may be `nil`. If that value is `nil`, the `beNil` +matcher function returns `true`, indicating that the expectation passed. + +Use `expression.isClosure` to determine if the expression will be invoking +a closure to produce its value. + +## Type Checking via Swift Generics + +Using Swift's generics, matchers can constrain the type of the actual value +passed to the `expect` function by modifying the return type. + +For example, the following matcher, `haveDescription`, only accepts actual +values that implement the `Printable` protocol. It checks their `description` +against the one provided to the matcher function, and passes if they are the same: + +```swift +// Swift + +public func haveDescription(description: String) -> MatcherFunc { + return MatcherFunc { actual, failureMessage in + return actual.evaluate().description == description + } +} +``` + +## Customizing Failure Messages + +By default, Nimble outputs the following failure message when an +expectation fails: + +``` +expected to match, got <\(actual)> +``` + +You can customize this message by modifying the `failureMessage` struct +from within your `MatcherFunc` closure. To change the verb "match" to +something else, update the `postfixMessage` property: + +```swift +// Swift + +// Outputs: expected to be under the sea, got <\(actual)> +failureMessage.postfixMessage = "be under the sea" +``` + +You can change how the `actual` value is displayed by updating +`failureMessage.actualValue`. Or, to remove it altogether, set it to +`nil`: + +```swift +// Swift + +// Outputs: expected to be under the sea +failureMessage.actualValue = nil +failureMessage.postfixMessage = "be under the sea" +``` + +## Supporting Objective-C + +To use a custom matcher written in Swift from Objective-C, you'll have +to extend the `NMBObjCMatcher` class, adding a new class method for your +custom matcher. The example below defines the class method +`+[NMBObjCMatcher beNilMatcher]`: + +```swift +// Swift + +extension NMBObjCMatcher { + public class func beNilMatcher() -> NMBObjCMatcher { + return NMBObjCMatcher { actualBlock, failureMessage, location in + let block = ({ actualBlock() as NSObject? }) + let expr = Expression(expression: block, location: location) + return beNil().matches(expr, failureMessage: failureMessage) + } + } +} +``` + +The above allows you to use the matcher from Objective-C: + +```objc +// Objective-C + +expect(actual).to([NMBObjCMatcher beNilMatcher]()); +``` + +To make the syntax easier to use, define a C function that calls the +class method: + +```objc +// Objective-C + +FOUNDATION_EXPORT id beNil() { + return [NMBObjCMatcher beNilMatcher]; +} +``` + +### Properly Handling `nil` in Objective-C Matchers + +When supporting Objective-C, make sure you handle `nil` appropriately. +Like [Cedar](https://github.com/pivotal/cedar/issues/100), +**most matchers do not match with nil**. This is to bring prevent test +writers from being surprised by `nil` values where they did not expect +them. + +Nimble provides the `beNil` matcher function for test writer that want +to make expectations on `nil` objects: + +```objc +// Objective-C + +expect(nil).to(equal(nil)); // fails +expect(nil).to(beNil()); // passes +``` + +If your matcher does not want to match with nil, you use `NonNilMatcherFunc` +and the `canMatchNil` constructor on `NMBObjCMatcher`. Using both types will +automatically generate expected value failure messages when they're nil. + +```swift + +public func beginWith(startingElement: T) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "begin with <\(startingElement)>" + if let actualValue = actualExpression.evaluate() { + var actualGenerator = actualValue.generate() + return actualGenerator.next() == startingElement + } + return false + } +} + +extension NMBObjCMatcher { + public class func beginWithMatcher(expected: AnyObject) -> NMBObjCMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + let actual = actualExpression.evaluate() + let expr = actualExpression.cast { $0 as? NMBOrderedCollection } + return beginWith(expected).matches(expr, failureMessage: failureMessage) + } + } +} +``` + +# Installing Nimble + +> Nimble can be used on its own, or in conjunction with its sister + project, [Quick](https://github.com/Quick/Quick). To install both + Quick and Nimble, follow [the installation instructions in the Quick + README](https://github.com/Quick/Quick#how-to-install-quick). + +Nimble can currently be installed in one of two ways: using CocoaPods, or with +git submodules. + +## Installing Nimble as a Submodule + +To use Nimble as a submodule to test your iOS or OS X applications, follow these +4 easy steps: + +1. Clone the Nimble repository +2. Add Nimble.xcodeproj to the Xcode workspace for your project +3. Link Nimble.framework to your test target +4. Start writing expectations! + +For more detailed instructions on each of these steps, +read [How to Install Quick](https://github.com/Quick/Quick#how-to-install-quick). +Ignore the steps involving adding Quick to your project in order to +install just Nimble. + +## Installing Nimble via CocoaPods + +To use Nimble in CocoaPods to test your iOS or OS X applications, add Nimble to +your podfile and add the ```use_frameworks!``` line to enable Swift support for +CocoaPods. + +```ruby +platform :ios, '8.0' + +source 'https://github.com/CocoaPods/Specs.git' + +# Whatever pods you need for your app go here + +target 'YOUR_APP_NAME_HERE_Tests', :exclusive => true do + use_frameworks! + pod 'Nimble', '~> 4.0.0' +end +``` + +Finally run `pod install`. + +## Using Nimble without XCTest + +Nimble is integrated with XCTest to allow it work well when used in Xcode test +bundles, however it can also be used in a standalone app. After installing +Nimble using one of the above methods, there are two additional steps required +to make this work. + +1. Create a custom assertion handler and assign an instance of it to the + global `NimbleAssertionHandler` variable. For example: + +```swift +class MyAssertionHandler : AssertionHandler { + func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) { + if (!assertion) { + print("Expectation failed: \(message.stringValue)") + } + } +} +``` +```swift +// Somewhere before you use any assertions +NimbleAssertionHandler = MyAssertionHandler() +``` + +2. Add a post-build action to fix an issue with the Swift XCTest support + library being unnecessarily copied into your app + * Edit your scheme in Xcode, and navigate to Build -> Post-actions + * Click the "+" icon and select "New Run Script Action" + * Open the "Provide build settings from" dropdown and select your target + * Enter the following script contents: +``` +rm "${SWIFT_STDLIB_TOOL_DESTINATION_DIR}/libswiftXCTest.dylib" +``` + +You can now use Nimble assertions in your code and handle failures as you see +fit. diff --git a/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift b/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift new file mode 100644 index 0000000..306d4ce --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift @@ -0,0 +1,17 @@ +import Foundation + +/// Protocol for the assertion handler that Nimble uses for all expectations. +public protocol AssertionHandler { + func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) +} + +/// Global backing interface for assertions that Nimble creates. +/// Defaults to a private test handler that passes through to XCTest. +/// +/// If XCTest is not available, you must assign your own assertion handler +/// before using any matchers, otherwise Nimble will abort the program. +/// +/// @see AssertionHandler +public var NimbleAssertionHandler: AssertionHandler = { () -> AssertionHandler in + return isXCTestAvailable() ? NimbleXCTestHandler() : NimbleXCTestUnavailableHandler() +}() diff --git a/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift b/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift new file mode 100644 index 0000000..09caf2a --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift @@ -0,0 +1,20 @@ + +/// AssertionDispatcher allows multiple AssertionHandlers to receive +/// assertion messages. +/// +/// @warning Does not fully dispatch if one of the handlers raises an exception. +/// This is possible with XCTest-based assertion handlers. +/// +public class AssertionDispatcher: AssertionHandler { + let handlers: [AssertionHandler] + + public init(handlers: [AssertionHandler]) { + self.handlers = handlers + } + + public func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) { + for handler in handlers { + handler.assert(assertion, message: message, location: location) + } + } +} diff --git a/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift b/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift new file mode 100644 index 0000000..a1615a7 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift @@ -0,0 +1,100 @@ +import Foundation + +/// A data structure that stores information about an assertion when +/// AssertionRecorder is set as the Nimble assertion handler. +/// +/// @see AssertionRecorder +/// @see AssertionHandler +public struct AssertionRecord: CustomStringConvertible { + /// Whether the assertion succeeded or failed + public let success: Bool + /// The failure message the assertion would display on failure. + public let message: FailureMessage + /// The source location the expectation occurred on. + public let location: SourceLocation + + public var description: String { + return "AssertionRecord { success=\(success), message='\(message.stringValue)', location=\(location) }" + } +} + +/// An AssertionHandler that silently records assertions that Nimble makes. +/// This is useful for testing failure messages for matchers. +/// +/// @see AssertionHandler +public class AssertionRecorder : AssertionHandler { + /// All the assertions that were captured by this recorder + public var assertions = [AssertionRecord]() + + public init() {} + + public func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) { + assertions.append( + AssertionRecord( + success: assertion, + message: message, + location: location)) + } +} + +/// Allows you to temporarily replace the current Nimble assertion handler with +/// the one provided for the scope of the closure. +/// +/// Once the closure finishes, then the original Nimble assertion handler is restored. +/// +/// @see AssertionHandler +public func withAssertionHandler(tempAssertionHandler: AssertionHandler, closure: () throws -> Void) { + let environment = NimbleEnvironment.activeInstance + let oldRecorder = environment.assertionHandler + let capturer = NMBExceptionCapture(handler: nil, finally: ({ + environment.assertionHandler = oldRecorder + })) + environment.assertionHandler = tempAssertionHandler + capturer.tryBlock { + try! closure() + } +} + +/// Captures expectations that occur in the given closure. Note that all +/// expectations will still go through to the default Nimble handler. +/// +/// This can be useful if you want to gather information about expectations +/// that occur within a closure. +/// +/// @param silently expectations are no longer send to the default Nimble +/// assertion handler when this is true. Defaults to false. +/// +/// @see gatherFailingExpectations +public func gatherExpectations(silently silently: Bool = false, closure: () -> Void) -> [AssertionRecord] { + let previousRecorder = NimbleEnvironment.activeInstance.assertionHandler + let recorder = AssertionRecorder() + let handlers: [AssertionHandler] + + if silently { + handlers = [recorder] + } else { + handlers = [recorder, previousRecorder] + } + + let dispatcher = AssertionDispatcher(handlers: handlers) + withAssertionHandler(dispatcher, closure: closure) + return recorder.assertions +} + +/// Captures failed expectations that occur in the given closure. Note that all +/// expectations will still go through to the default Nimble handler. +/// +/// This can be useful if you want to gather information about failed +/// expectations that occur within a closure. +/// +/// @param silently expectations are no longer send to the default Nimble +/// assertion handler when this is true. Defaults to false. +/// +/// @see gatherExpectations +/// @see raiseException source for an example use case. +public func gatherFailingExpectations(silently silently: Bool = false, closure: () -> Void) -> [AssertionRecord] { + let assertions = gatherExpectations(silently: silently, closure: closure) + return assertions.filter { assertion in + !assertion.success + } +} diff --git a/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift b/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift new file mode 100644 index 0000000..27cdac9 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift @@ -0,0 +1,38 @@ +import Foundation + +/// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this +/// class' existance +internal class NimbleEnvironment { + static var activeInstance: NimbleEnvironment { + get { + let env = NSThread.currentThread().threadDictionary["NimbleEnvironment"] + if let env = env as? NimbleEnvironment { + return env + } else { + let newEnv = NimbleEnvironment() + self.activeInstance = newEnv + return newEnv + } + } + set { + NSThread.currentThread().threadDictionary["NimbleEnvironment"] = newValue + } + } + + // TODO: eventually migrate the global to this environment value + var assertionHandler: AssertionHandler { + get { return NimbleAssertionHandler } + set { NimbleAssertionHandler = newValue } + } + +#if _runtime(_ObjC) + var awaiter: Awaiter + + init() { + awaiter = Awaiter( + waitLock: AssertionWaitLock(), + asyncQueue: dispatch_get_main_queue(), + timeoutQueue: dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0)) + } +#endif +} diff --git a/Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift b/Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift new file mode 100644 index 0000000..7d84f45 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift @@ -0,0 +1,77 @@ +import Foundation +import XCTest + +/// Default handler for Nimble. This assertion handler passes failures along to +/// XCTest. +public class NimbleXCTestHandler : AssertionHandler { + public func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) { + if !assertion { + recordFailure("\(message.stringValue)\n", location: location) + } + } +} + +/// Alternative handler for Nimble. This assertion handler passes failures along +/// to XCTest by attempting to reduce the failure message size. +public class NimbleShortXCTestHandler: AssertionHandler { + public func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) { + if !assertion { + let msg: String + if let actual = message.actualValue { + msg = "got: \(actual) \(message.postfixActual)" + } else { + msg = "expected \(message.to) \(message.postfixMessage)" + } + recordFailure("\(msg)\n", location: location) + } + } +} + +/// Fallback handler in case XCTest is unavailable. This assertion handler will abort +/// the program if it is invoked. +class NimbleXCTestUnavailableHandler : AssertionHandler { + func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) { + fatalError("XCTest is not available and no custom assertion handler was configured. Aborting.") + } +} + +#if _runtime(_ObjC) + /// Helper class providing access to the currently executing XCTestCase instance, if any +@objc final internal class CurrentTestCaseTracker: NSObject, XCTestObservation { + @objc static let sharedInstance = CurrentTestCaseTracker() + + private(set) var currentTestCase: XCTestCase? + + @objc func testCaseWillStart(testCase: XCTestCase) { + currentTestCase = testCase + } + + @objc func testCaseDidFinish(testCase: XCTestCase) { + currentTestCase = nil + } +} +#endif + + +func isXCTestAvailable() -> Bool { +#if _runtime(_ObjC) + // XCTest is weakly linked and so may not be present + return NSClassFromString("XCTestCase") != nil +#else + return true +#endif +} + +private func recordFailure(message: String, location: SourceLocation) { +#if _runtime(_ObjC) + if let testCase = CurrentTestCaseTracker.sharedInstance.currentTestCase { + testCase.recordFailureWithDescription(message, inFile: location.file, atLine: location.line, expected: true) + } else { + let msg = "Attempted to report a test failure to XCTest while no test case was running. " + + "The failure was:\n\"\(message)\"\nIt occurred at: \(location.file):\(location.line)" + NSException(name: NSInternalInconsistencyException, reason: msg, userInfo: nil).raise() + } +#else + XCTFail("\(message)\n", file: location.file, line: location.line) +#endif +} diff --git a/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/CurrentTestCaseTracker.h b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/CurrentTestCaseTracker.h new file mode 100644 index 0000000..5d416e4 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/CurrentTestCaseTracker.h @@ -0,0 +1,9 @@ +#import +#import + +SWIFT_CLASS("_TtC6Nimble22CurrentTestCaseTracker") +@interface CurrentTestCaseTracker : NSObject ++ (CurrentTestCaseTracker *)sharedInstance; +@end + +@interface CurrentTestCaseTracker (Register) @end diff --git a/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/DSL.h b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/DSL.h new file mode 100644 index 0000000..a499059 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/DSL.h @@ -0,0 +1,145 @@ +#import + +@class NMBExpectation; +@class NMBObjCBeCloseToMatcher; +@class NMBObjCRaiseExceptionMatcher; +@protocol NMBMatcher; + + +#define NIMBLE_EXPORT FOUNDATION_EXPORT + +#ifdef NIMBLE_DISABLE_SHORT_SYNTAX +#define NIMBLE_SHORT(PROTO, ORIGINAL) +#else +#define NIMBLE_SHORT(PROTO, ORIGINAL) FOUNDATION_STATIC_INLINE PROTO { return (ORIGINAL); } +#endif + +NIMBLE_EXPORT NMBExpectation *NMB_expect(id(^actualBlock)(), NSString *file, NSUInteger line); +NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(), NSString *file, NSUInteger line); + +NIMBLE_EXPORT id NMB_equal(id expectedValue); +NIMBLE_SHORT(id equal(id expectedValue), + NMB_equal(expectedValue)); + +NIMBLE_EXPORT id NMB_haveCount(id expectedValue); +NIMBLE_SHORT(id haveCount(id expectedValue), + NMB_haveCount(expectedValue)); + +NIMBLE_EXPORT NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue); +NIMBLE_SHORT(NMBObjCBeCloseToMatcher *beCloseTo(id expectedValue), + NMB_beCloseTo(expectedValue)); + +NIMBLE_EXPORT id NMB_beAnInstanceOf(Class expectedClass); +NIMBLE_SHORT(id beAnInstanceOf(Class expectedClass), + NMB_beAnInstanceOf(expectedClass)); + +NIMBLE_EXPORT id NMB_beAKindOf(Class expectedClass); +NIMBLE_SHORT(id beAKindOf(Class expectedClass), + NMB_beAKindOf(expectedClass)); + +NIMBLE_EXPORT id NMB_beginWith(id itemElementOrSubstring); +NIMBLE_SHORT(id beginWith(id itemElementOrSubstring), + NMB_beginWith(itemElementOrSubstring)); + +NIMBLE_EXPORT id NMB_beGreaterThan(NSNumber *expectedValue); +NIMBLE_SHORT(id beGreaterThan(NSNumber *expectedValue), + NMB_beGreaterThan(expectedValue)); + +NIMBLE_EXPORT id NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue); +NIMBLE_SHORT(id beGreaterThanOrEqualTo(NSNumber *expectedValue), + NMB_beGreaterThanOrEqualTo(expectedValue)); + +NIMBLE_EXPORT id NMB_beIdenticalTo(id expectedInstance); +NIMBLE_SHORT(id beIdenticalTo(id expectedInstance), + NMB_beIdenticalTo(expectedInstance)); + +NIMBLE_EXPORT id NMB_be(id expectedInstance); +NIMBLE_SHORT(id be(id expectedInstance), + NMB_be(expectedInstance)); + +NIMBLE_EXPORT id NMB_beLessThan(NSNumber *expectedValue); +NIMBLE_SHORT(id beLessThan(NSNumber *expectedValue), + NMB_beLessThan(expectedValue)); + +NIMBLE_EXPORT id NMB_beLessThanOrEqualTo(NSNumber *expectedValue); +NIMBLE_SHORT(id beLessThanOrEqualTo(NSNumber *expectedValue), + NMB_beLessThanOrEqualTo(expectedValue)); + +NIMBLE_EXPORT id NMB_beTruthy(void); +NIMBLE_SHORT(id beTruthy(void), + NMB_beTruthy()); + +NIMBLE_EXPORT id NMB_beFalsy(void); +NIMBLE_SHORT(id beFalsy(void), + NMB_beFalsy()); + +NIMBLE_EXPORT id NMB_beTrue(void); +NIMBLE_SHORT(id beTrue(void), + NMB_beTrue()); + +NIMBLE_EXPORT id NMB_beFalse(void); +NIMBLE_SHORT(id beFalse(void), + NMB_beFalse()); + +NIMBLE_EXPORT id NMB_beNil(void); +NIMBLE_SHORT(id beNil(void), + NMB_beNil()); + +NIMBLE_EXPORT id NMB_beEmpty(void); +NIMBLE_SHORT(id beEmpty(void), + NMB_beEmpty()); + +NIMBLE_EXPORT id NMB_containWithNilTermination(id itemOrSubstring, ...) NS_REQUIRES_NIL_TERMINATION; +#define NMB_contain(...) NMB_containWithNilTermination(__VA_ARGS__, nil) +#ifndef NIMBLE_DISABLE_SHORT_SYNTAX +#define contain(...) NMB_contain(__VA_ARGS__) +#endif + +NIMBLE_EXPORT id NMB_endWith(id itemElementOrSubstring); +NIMBLE_SHORT(id endWith(id itemElementOrSubstring), + NMB_endWith(itemElementOrSubstring)); + +NIMBLE_EXPORT NMBObjCRaiseExceptionMatcher *NMB_raiseException(void); +NIMBLE_SHORT(NMBObjCRaiseExceptionMatcher *raiseException(void), + NMB_raiseException()); + +NIMBLE_EXPORT id NMB_match(id expectedValue); +NIMBLE_SHORT(id match(id expectedValue), + NMB_match(expectedValue)); + +NIMBLE_EXPORT id NMB_allPass(id matcher); +NIMBLE_SHORT(id allPass(id matcher), + NMB_allPass(matcher)); + +NIMBLE_EXPORT id NMB_satisfyAnyOfWithMatchers(id matchers); +#define NMB_satisfyAnyOf(...) NMB_satisfyAnyOfWithMatchers(@[__VA_ARGS__]) +#ifndef NIMBLE_DISABLE_SHORT_SYNTAX +#define satisfyAnyOf(...) NMB_satisfyAnyOf(__VA_ARGS__) +#endif + +// In order to preserve breakpoint behavior despite using macros to fill in __FILE__ and __LINE__, +// define a builder that populates __FILE__ and __LINE__, and returns a block that takes timeout +// and action arguments. See https://github.com/Quick/Quick/pull/185 for details. +typedef void (^NMBWaitUntilTimeoutBlock)(NSTimeInterval timeout, void (^action)(void (^)(void))); +typedef void (^NMBWaitUntilBlock)(void (^action)(void (^)(void))); + +NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line); + +NIMBLE_EXPORT NMBWaitUntilTimeoutBlock NMB_waitUntilTimeoutBuilder(NSString *file, NSUInteger line); +NIMBLE_EXPORT NMBWaitUntilBlock NMB_waitUntilBuilder(NSString *file, NSUInteger line); + +NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line); + +#define NMB_waitUntilTimeout NMB_waitUntilTimeoutBuilder(@(__FILE__), __LINE__) +#define NMB_waitUntil NMB_waitUntilBuilder(@(__FILE__), __LINE__) + +#ifndef NIMBLE_DISABLE_SHORT_SYNTAX +#define expect(...) NMB_expect(^id{ return (__VA_ARGS__); }, @(__FILE__), __LINE__) +#define expectAction(BLOCK) NMB_expectAction((BLOCK), @(__FILE__), __LINE__) +#define failWithMessage(msg) NMB_failWithMessage(msg, @(__FILE__), __LINE__) +#define fail() failWithMessage(@"fail() always fails") + + +#define waitUntilTimeout NMB_waitUntilTimeout +#define waitUntil NMB_waitUntil +#endif diff --git a/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/DSL.m b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/DSL.m new file mode 100644 index 0000000..2170238 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/DSL.m @@ -0,0 +1,150 @@ +#import +#import + +SWIFT_CLASS("_TtC6Nimble7NMBWait") +@interface NMBWait : NSObject + ++ (void)untilTimeout:(NSTimeInterval)timeout file:(NSString *)file line:(NSUInteger)line action:(void(^)())action; ++ (void)untilFile:(NSString *)file line:(NSUInteger)line action:(void(^)())action; + +@end + +NIMBLE_EXPORT NMBExpectation *NMB_expect(id(^actualBlock)(), NSString *file, NSUInteger line) { + return [[NMBExpectation alloc] initWithActualBlock:actualBlock + negative:NO + file:file + line:line]; +} + +NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(), NSString *file, NSUInteger line) { + return NMB_expect(^id{ + actualBlock(); + return nil; + }, file, line); +} + +NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line) { + return [NMBExpectation failWithMessage:msg file:file line:line]; +} + +NIMBLE_EXPORT id NMB_beAnInstanceOf(Class expectedClass) { + return [NMBObjCMatcher beAnInstanceOfMatcher:expectedClass]; +} + +NIMBLE_EXPORT id NMB_beAKindOf(Class expectedClass) { + return [NMBObjCMatcher beAKindOfMatcher:expectedClass]; +} + +NIMBLE_EXPORT NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue) { + return [NMBObjCMatcher beCloseToMatcher:expectedValue within:0.001]; +} + +NIMBLE_EXPORT id NMB_beginWith(id itemElementOrSubstring) { + return [NMBObjCMatcher beginWithMatcher:itemElementOrSubstring]; +} + +NIMBLE_EXPORT id NMB_beGreaterThan(NSNumber *expectedValue) { + return [NMBObjCMatcher beGreaterThanMatcher:expectedValue]; +} + +NIMBLE_EXPORT id NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue) { + return [NMBObjCMatcher beGreaterThanOrEqualToMatcher:expectedValue]; +} + +NIMBLE_EXPORT id NMB_beIdenticalTo(id expectedInstance) { + return [NMBObjCMatcher beIdenticalToMatcher:expectedInstance]; +} + +NIMBLE_EXPORT id NMB_be(id expectedInstance) { + return [NMBObjCMatcher beIdenticalToMatcher:expectedInstance]; +} + +NIMBLE_EXPORT id NMB_beLessThan(NSNumber *expectedValue) { + return [NMBObjCMatcher beLessThanMatcher:expectedValue]; +} + +NIMBLE_EXPORT id NMB_beLessThanOrEqualTo(NSNumber *expectedValue) { + return [NMBObjCMatcher beLessThanOrEqualToMatcher:expectedValue]; +} + +NIMBLE_EXPORT id NMB_beTruthy() { + return [NMBObjCMatcher beTruthyMatcher]; +} + +NIMBLE_EXPORT id NMB_beFalsy() { + return [NMBObjCMatcher beFalsyMatcher]; +} + +NIMBLE_EXPORT id NMB_beTrue() { + return [NMBObjCMatcher beTrueMatcher]; +} + +NIMBLE_EXPORT id NMB_beFalse() { + return [NMBObjCMatcher beFalseMatcher]; +} + +NIMBLE_EXPORT id NMB_beNil() { + return [NMBObjCMatcher beNilMatcher]; +} + +NIMBLE_EXPORT id NMB_beEmpty() { + return [NMBObjCMatcher beEmptyMatcher]; +} + +NIMBLE_EXPORT id NMB_containWithNilTermination(id itemOrSubstring, ...) { + NSMutableArray *itemOrSubstringArray = [NSMutableArray array]; + + if (itemOrSubstring) { + [itemOrSubstringArray addObject:itemOrSubstring]; + + va_list args; + va_start(args, itemOrSubstring); + id next; + while ((next = va_arg(args, id))) { + [itemOrSubstringArray addObject:next]; + } + va_end(args); + } + + return [NMBObjCMatcher containMatcher:itemOrSubstringArray]; +} + +NIMBLE_EXPORT id NMB_endWith(id itemElementOrSubstring) { + return [NMBObjCMatcher endWithMatcher:itemElementOrSubstring]; +} + +NIMBLE_EXPORT id NMB_equal(id expectedValue) { + return [NMBObjCMatcher equalMatcher:expectedValue]; +} + +NIMBLE_EXPORT id NMB_haveCount(id expectedValue) { + return [NMBObjCMatcher haveCountMatcher:expectedValue]; +} + +NIMBLE_EXPORT id NMB_match(id expectedValue) { + return [NMBObjCMatcher matchMatcher:expectedValue]; +} + +NIMBLE_EXPORT id NMB_allPass(id expectedValue) { + return [NMBObjCMatcher allPassMatcher:expectedValue]; +} + +NIMBLE_EXPORT id NMB_satisfyAnyOfWithMatchers(id matchers) { + return [NMBObjCMatcher satisfyAnyOfMatcher:matchers]; +} + +NIMBLE_EXPORT NMBObjCRaiseExceptionMatcher *NMB_raiseException() { + return [NMBObjCMatcher raiseExceptionMatcher]; +} + +NIMBLE_EXPORT NMBWaitUntilTimeoutBlock NMB_waitUntilTimeoutBuilder(NSString *file, NSUInteger line) { + return ^(NSTimeInterval timeout, void (^action)(void (^)(void))) { + [NMBWait untilTimeout:timeout file:file line:line action:action]; + }; +} + +NIMBLE_EXPORT NMBWaitUntilBlock NMB_waitUntilBuilder(NSString *file, NSUInteger line) { + return ^(void (^action)(void (^)(void))) { + [NMBWait untilFile:file line:line action:action]; + }; +} diff --git a/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBExceptionCapture.h b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBExceptionCapture.h new file mode 100644 index 0000000..7e5fb07 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBExceptionCapture.h @@ -0,0 +1,11 @@ +#import +#import + +@interface NMBExceptionCapture : NSObject + +- (id)initWithHandler:(void(^)(NSException *))handler finally:(void(^)())finally; +- (void)tryBlock:(void(^)())unsafeBlock; + +@end + +typedef void(^NMBSourceCallbackBlock)(BOOL successful); diff --git a/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBExceptionCapture.m b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBExceptionCapture.m new file mode 100644 index 0000000..48f5739 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBExceptionCapture.m @@ -0,0 +1,35 @@ +#import "NMBExceptionCapture.h" + +@interface NMBExceptionCapture () +@property (nonatomic, copy) void(^handler)(NSException *exception); +@property (nonatomic, copy) void(^finally)(); +@end + +@implementation NMBExceptionCapture + +- (id)initWithHandler:(void(^)(NSException *))handler finally:(void(^)())finally { + self = [super init]; + if (self) { + self.handler = handler; + self.finally = finally; + } + return self; +} + +- (void)tryBlock:(void(^)())unsafeBlock { + @try { + unsafeBlock(); + } + @catch (NSException *exception) { + if (self.handler) { + self.handler(exception); + } + } + @finally { + if (self.finally) { + self.finally(); + } + } +} + +@end \ No newline at end of file diff --git a/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBExpectation.swift b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBExpectation.swift new file mode 100644 index 0000000..3f18d06 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBExpectation.swift @@ -0,0 +1,131 @@ +import Foundation + +#if _runtime(_ObjC) + +internal struct ObjCMatcherWrapper : Matcher { + let matcher: NMBMatcher + + func matches(actualExpression: Expression, failureMessage: FailureMessage) -> Bool { + return matcher.matches( + ({ try! actualExpression.evaluate() }), + failureMessage: failureMessage, + location: actualExpression.location) + } + + func doesNotMatch(actualExpression: Expression, failureMessage: FailureMessage) -> Bool { + return matcher.doesNotMatch( + ({ try! actualExpression.evaluate() }), + failureMessage: failureMessage, + location: actualExpression.location) + } +} + +// Equivalent to Expectation, but for Nimble's Objective-C interface +public class NMBExpectation : NSObject { + internal let _actualBlock: () -> NSObject! + internal var _negative: Bool + internal let _file: FileString + internal let _line: UInt + internal var _timeout: NSTimeInterval = 1.0 + + public init(actualBlock: () -> NSObject!, negative: Bool, file: FileString, line: UInt) { + self._actualBlock = actualBlock + self._negative = negative + self._file = file + self._line = line + } + + private var expectValue: Expectation { + return expect(_file, line: _line){ + self._actualBlock() as NSObject? + } + } + + public var withTimeout: (NSTimeInterval) -> NMBExpectation { + return ({ timeout in self._timeout = timeout + return self + }) + } + + public var to: (NMBMatcher) -> Void { + return ({ matcher in + self.expectValue.to(ObjCMatcherWrapper(matcher: matcher)) + }) + } + + public var toWithDescription: (NMBMatcher, String) -> Void { + return ({ matcher, description in + self.expectValue.to(ObjCMatcherWrapper(matcher: matcher), description: description) + }) + } + + public var toNot: (NMBMatcher) -> Void { + return ({ matcher in + self.expectValue.toNot( + ObjCMatcherWrapper(matcher: matcher) + ) + }) + } + + public var toNotWithDescription: (NMBMatcher, String) -> Void { + return ({ matcher, description in + self.expectValue.toNot( + ObjCMatcherWrapper(matcher: matcher), description: description + ) + }) + } + + public var notTo: (NMBMatcher) -> Void { return toNot } + + public var notToWithDescription: (NMBMatcher, String) -> Void { return toNotWithDescription } + + public var toEventually: (NMBMatcher) -> Void { + return ({ matcher in + self.expectValue.toEventually( + ObjCMatcherWrapper(matcher: matcher), + timeout: self._timeout, + description: nil + ) + }) + } + + public var toEventuallyWithDescription: (NMBMatcher, String) -> Void { + return ({ matcher, description in + self.expectValue.toEventually( + ObjCMatcherWrapper(matcher: matcher), + timeout: self._timeout, + description: description + ) + }) + } + + public var toEventuallyNot: (NMBMatcher) -> Void { + return ({ matcher in + self.expectValue.toEventuallyNot( + ObjCMatcherWrapper(matcher: matcher), + timeout: self._timeout, + description: nil + ) + }) + } + + public var toEventuallyNotWithDescription: (NMBMatcher, String) -> Void { + return ({ matcher, description in + self.expectValue.toEventuallyNot( + ObjCMatcherWrapper(matcher: matcher), + timeout: self._timeout, + description: description + ) + }) + } + + public var toNotEventually: (NMBMatcher) -> Void { return toEventuallyNot } + + public var toNotEventuallyWithDescription: (NMBMatcher, String) -> Void { return toEventuallyNotWithDescription } + + public class func failWithMessage(message: String, file: FileString, line: UInt) { + fail(message, location: SourceLocation(file: file, line: line)) + } +} + +#endif diff --git a/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBObjCMatcher.swift b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBObjCMatcher.swift new file mode 100644 index 0000000..9f31d42 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBObjCMatcher.swift @@ -0,0 +1,81 @@ +import Foundation + +#if _runtime(_ObjC) + +public typealias MatcherBlock = (actualExpression: Expression, failureMessage: FailureMessage) -> Bool +public typealias FullMatcherBlock = (actualExpression: Expression, failureMessage: FailureMessage, shouldNotMatch: Bool) -> Bool + +public class NMBObjCMatcher : NSObject, NMBMatcher { + let _match: MatcherBlock + let _doesNotMatch: MatcherBlock + let canMatchNil: Bool + + public init(canMatchNil: Bool, matcher: MatcherBlock, notMatcher: MatcherBlock) { + self.canMatchNil = canMatchNil + self._match = matcher + self._doesNotMatch = notMatcher + } + + public convenience init(matcher: MatcherBlock) { + self.init(canMatchNil: true, matcher: matcher) + } + + public convenience init(canMatchNil: Bool, matcher: MatcherBlock) { + self.init(canMatchNil: canMatchNil, matcher: matcher, notMatcher: ({ actualExpression, failureMessage in + return !matcher(actualExpression: actualExpression, failureMessage: failureMessage) + })) + } + + public convenience init(matcher: FullMatcherBlock) { + self.init(canMatchNil: true, matcher: matcher) + } + + public convenience init(canMatchNil: Bool, matcher: FullMatcherBlock) { + self.init(canMatchNil: canMatchNil, matcher: ({ actualExpression, failureMessage in + return matcher(actualExpression: actualExpression, failureMessage: failureMessage, shouldNotMatch: false) + }), notMatcher: ({ actualExpression, failureMessage in + return matcher(actualExpression: actualExpression, failureMessage: failureMessage, shouldNotMatch: true) + })) + } + + private func canMatch(actualExpression: Expression, failureMessage: FailureMessage) -> Bool { + do { + if !canMatchNil { + if try actualExpression.evaluate() == nil { + failureMessage.postfixActual = " (use beNil() to match nils)" + return false + } + } + } catch let error { + failureMessage.actualValue = "an unexpected error thrown: \(error)" + return false + } + return true + } + + public func matches(actualBlock: () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { + let expr = Expression(expression: actualBlock, location: location) + let result = _match( + actualExpression: expr, + failureMessage: failureMessage) + if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) { + return result + } else { + return false + } + } + + public func doesNotMatch(actualBlock: () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { + let expr = Expression(expression: actualBlock, location: location) + let result = _doesNotMatch( + actualExpression: expr, + failureMessage: failureMessage) + if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) { + return result + } else { + return false + } + } +} + +#endif diff --git a/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBStringify.h b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBStringify.h new file mode 100644 index 0000000..e5d5ddd --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBStringify.h @@ -0,0 +1,18 @@ +@class NSString; + +/** + * Returns a string appropriate for displaying in test output + * from the provided value. + * + * @param value A value that will show up in a test's output. + * + * @return The string that is returned can be + * customized per type by conforming a type to the `TestOutputStringConvertible` + * protocol. When stringifying a non-`TestOutputStringConvertible` type, this + * function will return the value's debug description and then its + * normal description if available and in that order. Otherwise it + * will return the result of constructing a string from the value. + * + * @see `TestOutputStringConvertible` + */ +extern NSString *_Nonnull NMBStringify(id _Nullable anyObject) __attribute__((warn_unused_result)); diff --git a/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBStringify.m b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBStringify.m new file mode 100644 index 0000000..329d39a --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/NMBStringify.m @@ -0,0 +1,6 @@ +#import "NMBStringify.h" +#import + +NSString *_Nonnull NMBStringify(id _Nullable anyObject) { + return [NMBStringer stringify:anyObject]; +} diff --git a/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/XCTestObservationCenter+Register.m b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/XCTestObservationCenter+Register.m new file mode 100644 index 0000000..35f26fd --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Adapters/ObjectiveC/XCTestObservationCenter+Register.m @@ -0,0 +1,78 @@ +#import "CurrentTestCaseTracker.h" +#import +#import + +#pragma mark - Method Swizzling + +/// Swaps the implementations between two instance methods. +/// +/// @param class The class containing `originalSelector`. +/// @param originalSelector Original method to replace. +/// @param replacementSelector Replacement method. +void swizzleSelectors(Class class, SEL originalSelector, SEL replacementSelector) { + Method originalMethod = class_getInstanceMethod(class, originalSelector); + Method replacementMethod = class_getInstanceMethod(class, replacementSelector); + + BOOL didAddMethod = + class_addMethod(class, + originalSelector, + method_getImplementation(replacementMethod), + method_getTypeEncoding(replacementMethod)); + + if (didAddMethod) { + class_replaceMethod(class, + replacementSelector, + method_getImplementation(originalMethod), + method_getTypeEncoding(originalMethod)); + } else { + method_exchangeImplementations(originalMethod, replacementMethod); + } +} + +#pragma mark - Private + +@interface XCTestObservationCenter (Private) +- (void)_addLegacyTestObserver:(id)observer; +@end + +@implementation XCTestObservationCenter (Register) + +/// Uses objc method swizzling to register `CurrentTestCaseTracker` as a test observer. This is necessary +/// because Xcode 7.3 introduced timing issues where if a custom `XCTestObservation` is registered too early +/// it suppresses all console output (generated by `XCTestLog`), breaking any tools that depend on this output. +/// This approach waits to register our custom test observer until XCTest adds its first "legacy" observer, +/// falling back to registering after the first normal observer if this private method ever changes. ++ (void)load { + if (class_getInstanceMethod([self class], @selector(_addLegacyTestObserver:))) { + // Swizzle -_addLegacyTestObserver: + swizzleSelectors([self class], @selector(_addLegacyTestObserver:), @selector(NMB_original__addLegacyTestObserver:)); + } else { + // Swizzle -addTestObserver:, only if -_addLegacyTestObserver: is not implemented + swizzleSelectors([self class], @selector(addTestObserver:), @selector(NMB_original_addTestObserver:)); + } +} + +#pragma mark - Replacement Methods + +/// Registers `CurrentTestCaseTracker` as a test observer after `XCTestLog` has been added. +- (void)NMB_original__addLegacyTestObserver:(id)observer { + [self NMB_original__addLegacyTestObserver:observer]; + + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + [self addTestObserver:[CurrentTestCaseTracker sharedInstance]]; + }); +} + +/// Registers `CurrentTestCaseTracker` as a test observer after `XCTestLog` has been added. +/// This method is only used if `-_addLegacyTestObserver:` is not impelemented. (added in Xcode 7.3) +- (void)NMB_original_addTestObserver:(id)observer { + [self NMB_original_addTestObserver:observer]; + + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + [self NMB_original_addTestObserver:[CurrentTestCaseTracker sharedInstance]]; + }); +} + +@end diff --git a/Pods/Nimble/Sources/Nimble/DSL+Wait.swift b/Pods/Nimble/Sources/Nimble/DSL+Wait.swift new file mode 100644 index 0000000..9124964 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/DSL+Wait.swift @@ -0,0 +1,93 @@ +import Foundation + +#if _runtime(_ObjC) +private enum ErrorResult { + case Exception(NSException) + case Error(ErrorType) + case None +} + +/// Only classes, protocols, methods, properties, and subscript declarations can be +/// bridges to Objective-C via the @objc keyword. This class encapsulates callback-style +/// asynchronous waiting logic so that it may be called from Objective-C and Swift. +internal class NMBWait: NSObject { + internal class func until( + timeout timeout: NSTimeInterval, + file: FileString = #file, + line: UInt = #line, + action: (() -> Void) -> Void) -> Void { + return throwableUntil(timeout: timeout, file: file, line: line) { (done: () -> Void) throws -> Void in + action() { done() } + } + } + + // Using a throwable closure makes this method not objc compatible. + internal class func throwableUntil( + timeout timeout: NSTimeInterval, + file: FileString = #file, + line: UInt = #line, + action: (() -> Void) throws -> Void) -> Void { + let awaiter = NimbleEnvironment.activeInstance.awaiter + let leeway = timeout / 2.0 + let result = awaiter.performBlock { (done: (ErrorResult) -> Void) throws -> Void in + dispatch_async(dispatch_get_main_queue()) { + let capture = NMBExceptionCapture( + handler: ({ exception in + done(.Exception(exception)) + }), + finally: ({ }) + ) + capture.tryBlock { + do { + try action() { + done(.None) + } + } catch let e { + done(.Error(e)) + } + } + } + }.timeout(timeout, forcefullyAbortTimeout: leeway).wait("waitUntil(...)", file: file, line: line) + + switch result { + case .Incomplete: internalError("Reached .Incomplete state for waitUntil(...).") + case .BlockedRunLoop: + fail(blockedRunLoopErrorMessageFor("-waitUntil()", leeway: leeway), + file: file, line: line) + case .TimedOut: + let pluralize = (timeout == 1 ? "" : "s") + fail("Waited more than \(timeout) second\(pluralize)", file: file, line: line) + case let .RaisedException(exception): + fail("Unexpected exception raised: \(exception)") + case let .ErrorThrown(error): + fail("Unexpected error thrown: \(error)") + case .Completed(.Exception(let exception)): + fail("Unexpected exception raised: \(exception)") + case .Completed(.Error(let error)): + fail("Unexpected error thrown: \(error)") + case .Completed(.None): // success + break + } + } + + @objc(untilFile:line:action:) + internal class func until(file: FileString = #file, line: UInt = #line, action: (() -> Void) -> Void) -> Void { + until(timeout: 1, file: file, line: line, action: action) + } +} + +internal func blockedRunLoopErrorMessageFor(fnName: String, leeway: NSTimeInterval) -> String { + return "\(fnName) timed out but was unable to run the timeout handler because the main thread is unresponsive (\(leeway) seconds is allow after the wait times out). Conditions that may cause this include processing blocking IO on the main thread, calls to sleep(), deadlocks, and synchronous IPC. Nimble forcefully stopped run loop which may cause future failures in test run." +} + +/// Wait asynchronously until the done closure is called or the timeout has been reached. +/// +/// @discussion +/// Call the done() closure to indicate the waiting has completed. +/// +/// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function +/// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. +public func waitUntil(timeout timeout: NSTimeInterval = 1, file: FileString = #file, line: UInt = #line, action: (() -> Void) -> Void) -> Void { + NMBWait.until(timeout: timeout, file: file, line: line, action: action) +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/DSL.swift b/Pods/Nimble/Sources/Nimble/DSL.swift new file mode 100644 index 0000000..b43a933 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/DSL.swift @@ -0,0 +1,68 @@ +import Foundation + +/// Make an expectation on a given actual value. The value given is lazily evaluated. +@warn_unused_result(message="Follow 'expect(…)' with '.to(…)', '.toNot(…)', 'toEventually(…)', '==', etc.") +public func expect(@autoclosure(escaping) expression: () throws -> T?, file: FileString = #file, line: UInt = #line) -> Expectation { + return Expectation( + expression: Expression( + expression: expression, + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Make an expectation on a given actual value. The closure is lazily invoked. +@warn_unused_result(message="Follow 'expect(…)' with '.to(…)', '.toNot(…)', 'toEventually(…)', '==', etc.") +public func expect(file: FileString = #file, line: UInt = #line, expression: () throws -> T?) -> Expectation { + return Expectation( + expression: Expression( + expression: expression, + location: SourceLocation(file: file, line: line), + isClosure: true)) +} + +/// Always fails the test with a message and a specified location. +public func fail(message: String, location: SourceLocation) { + let handler = NimbleEnvironment.activeInstance.assertionHandler + handler.assert(false, message: FailureMessage(stringValue: message), location: location) +} + +/// Always fails the test with a message. +public func fail(message: String, file: FileString = #file, line: UInt = #line) { + fail(message, location: SourceLocation(file: file, line: line)) +} + +/// Always fails the test. +public func fail(file: FileString = #file, line: UInt = #line) { + fail("fail() always fails", file: file, line: line) +} + +/// Like Swift's precondition(), but raises NSExceptions instead of sigaborts +internal func nimblePrecondition( + @autoclosure expr: () -> Bool, + @autoclosure _ name: () -> String, + @autoclosure _ message: () -> String, + file: StaticString = #file, + line: UInt = #line) -> Bool { + let result = expr() + if !result { +#if _runtime(_ObjC) + let e = NSException( + name: name(), + reason: message(), + userInfo: nil) + e.raise() +#else + preconditionFailure("\(name()) - \(message())", file: file, line: line) +#endif + } + return result +} + +@noreturn +internal func internalError(msg: String, file: FileString = #file, line: UInt = #line) { + fatalError( + "Nimble Bug Found: \(msg) at \(file):\(line).\n" + + "Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the " + + "code snippet that caused this error." + ) +} \ No newline at end of file diff --git a/Pods/Nimble/Sources/Nimble/Expectation.swift b/Pods/Nimble/Sources/Nimble/Expectation.swift new file mode 100644 index 0000000..520902d --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Expectation.swift @@ -0,0 +1,65 @@ +import Foundation + +internal func expressionMatches(expression: Expression, matcher: U, to: String, description: String?) -> (Bool, FailureMessage) { + let msg = FailureMessage() + msg.userDescription = description + msg.to = to + do { + let pass = try matcher.matches(expression, failureMessage: msg) + if msg.actualValue == "" { + msg.actualValue = "<\(stringify(try expression.evaluate()))>" + } + return (pass, msg) + } catch let error { + msg.actualValue = "an unexpected error thrown: <\(error)>" + return (false, msg) + } +} + +internal func expressionDoesNotMatch(expression: Expression, matcher: U, toNot: String, description: String?) -> (Bool, FailureMessage) { + let msg = FailureMessage() + msg.userDescription = description + msg.to = toNot + do { + let pass = try matcher.doesNotMatch(expression, failureMessage: msg) + if msg.actualValue == "" { + msg.actualValue = "<\(stringify(try expression.evaluate()))>" + } + return (pass, msg) + } catch let error { + msg.actualValue = "an unexpected error thrown: <\(error)>" + return (false, msg) + } +} + +public struct Expectation { + let expression: Expression + + public func verify(pass: Bool, _ message: FailureMessage) { + let handler = NimbleEnvironment.activeInstance.assertionHandler + handler.assert(pass, message: message, location: expression.location) + } + + /// Tests the actual value using a matcher to match. + public func to(matcher: U, description: String? = nil) { + let (pass, msg) = expressionMatches(expression, matcher: matcher, to: "to", description: description) + verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match. + public func toNot(matcher: U, description: String? = nil) { + let (pass, msg) = expressionDoesNotMatch(expression, matcher: matcher, toNot: "to not", description: description) + verify(pass, msg) + } + + /// Tests the actual value using a matcher to not match. + /// + /// Alias to toNot(). + public func notTo(matcher: U, description: String? = nil) { + toNot(matcher, description: description) + } + + // see: + // - AsyncMatcherWrapper for extension + // - NMBExpectation for Objective-C interface +} diff --git a/Pods/Nimble/Sources/Nimble/Expression.swift b/Pods/Nimble/Sources/Nimble/Expression.swift new file mode 100644 index 0000000..f64ee24 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Expression.swift @@ -0,0 +1,90 @@ +import Foundation + +// Memoizes the given closure, only calling the passed +// closure once; even if repeat calls to the returned closure +internal func memoizedClosure(closure: () throws -> T) -> (Bool) throws -> T { + var cache: T? + return ({ withoutCaching in + if (withoutCaching || cache == nil) { + cache = try closure() + } + return cache! + }) +} + +/// Expression represents the closure of the value inside expect(...). +/// Expressions are memoized by default. This makes them safe to call +/// evaluate() multiple times without causing a re-evaluation of the underlying +/// closure. +/// +/// @warning Since the closure can be any code, Objective-C code may choose +/// to raise an exception. Currently, Expression does not memoize +/// exception raising. +/// +/// This provides a common consumable API for matchers to utilize to allow +/// Nimble to change internals to how the captured closure is managed. +public struct Expression { + internal let _expression: (Bool) throws -> T? + internal let _withoutCaching: Bool + public let location: SourceLocation + public let isClosure: Bool + + /// Creates a new expression struct. Normally, expect(...) will manage this + /// creation process. The expression is memoized. + /// + /// @param expression The closure that produces a given value. + /// @param location The source location that this closure originates from. + /// @param isClosure A bool indicating if the captured expression is a + /// closure or internally produced closure. Some matchers + /// may require closures. For example, toEventually() + /// requires an explicit closure. This gives Nimble + /// flexibility if @autoclosure behavior changes between + /// Swift versions. Nimble internals always sets this true. + public init(expression: () throws -> T?, location: SourceLocation, isClosure: Bool = true) { + self._expression = memoizedClosure(expression) + self.location = location + self._withoutCaching = false + self.isClosure = isClosure + } + + /// Creates a new expression struct. Normally, expect(...) will manage this + /// creation process. + /// + /// @param expression The closure that produces a given value. + /// @param location The source location that this closure originates from. + /// @param withoutCaching Indicates if the struct should memoize the given + /// closure's result. Subsequent evaluate() calls will + /// not call the given closure if this is true. + /// @param isClosure A bool indicating if the captured expression is a + /// closure or internally produced closure. Some matchers + /// may require closures. For example, toEventually() + /// requires an explicit closure. This gives Nimble + /// flexibility if @autoclosure behavior changes between + /// Swift versions. Nimble internals always sets this true. + public init(memoizedExpression: (Bool) throws -> T?, location: SourceLocation, withoutCaching: Bool, isClosure: Bool = true) { + self._expression = memoizedExpression + self.location = location + self._withoutCaching = withoutCaching + self.isClosure = isClosure + } + + /// Returns a new Expression from the given expression. Identical to a map() + /// on this type. This should be used only to typecast the Expression's + /// closure value. + /// + /// The returned expression will preserve location and isClosure. + /// + /// @param block The block that can cast the current Expression value to a + /// new type. + public func cast(block: (T?) throws -> U?) -> Expression { + return Expression(expression: ({ try block(self.evaluate()) }), location: self.location, isClosure: self.isClosure) + } + + public func evaluate() throws -> T? { + return try self._expression(_withoutCaching) + } + + public func withoutCaching() -> Expression { + return Expression(memoizedExpression: self._expression, location: location, withoutCaching: true, isClosure: isClosure) + } +} diff --git a/Pods/Nimble/Sources/Nimble/FailureMessage.swift b/Pods/Nimble/Sources/Nimble/FailureMessage.swift new file mode 100644 index 0000000..4d23bc8 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/FailureMessage.swift @@ -0,0 +1,56 @@ +import Foundation + +/// Encapsulates the failure message that matchers can report to the end user. +/// +/// This is shared state between Nimble and matchers that mutate this value. +public class FailureMessage: NSObject { + public var expected: String = "expected" + public var actualValue: String? = "" // empty string -> use default; nil -> exclude + public var to: String = "to" + public var postfixMessage: String = "match" + public var postfixActual: String = "" + public var userDescription: String? = nil + + public var stringValue: String { + get { + if let value = _stringValueOverride { + return value + } else { + return computeStringValue() + } + } + set { + _stringValueOverride = newValue + } + } + + internal var _stringValueOverride: String? + + public override init() { + } + + public init(stringValue: String) { + _stringValueOverride = stringValue + } + + internal func stripNewlines(str: String) -> String { + var lines: [String] = NSString(string: str).componentsSeparatedByString("\n") as [String] + let whitespace = NSCharacterSet.whitespaceAndNewlineCharacterSet() + lines = lines.map { line in NSString(string: line).stringByTrimmingCharactersInSet(whitespace) } + return lines.joinWithSeparator("") + } + + internal func computeStringValue() -> String { + var value = "\(expected) \(to) \(postfixMessage)" + if let actualValue = actualValue { + value = "\(expected) \(to) \(postfixMessage), got \(actualValue)\(postfixActual)" + } + value = stripNewlines(value) + + if let userDescription = userDescription { + return "\(userDescription)\n\(value)" + } + + return value + } +} \ No newline at end of file diff --git a/Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift b/Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift new file mode 100644 index 0000000..d67714b --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift @@ -0,0 +1,92 @@ +import Foundation + +public func allPass + (passFunc: (T?) -> Bool) -> NonNilMatcherFunc { + return allPass("pass a condition", passFunc) +} + +public func allPass + (passName: String, _ passFunc: (T?) -> Bool) -> NonNilMatcherFunc { + return createAllPassMatcher() { + expression, failureMessage in + failureMessage.postfixMessage = passName + return passFunc(try expression.evaluate()) + } +} + +public func allPass + (matcher: V) -> NonNilMatcherFunc { + return createAllPassMatcher() { + try matcher.matches($0, failureMessage: $1) + } +} + +private func createAllPassMatcher + (elementEvaluator:(Expression, FailureMessage) throws -> Bool) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.actualValue = nil + if let actualValue = try actualExpression.evaluate() { + for currentElement in actualValue { + let exp = Expression( + expression: {currentElement}, location: actualExpression.location) + if try !elementEvaluator(exp, failureMessage) { + failureMessage.postfixMessage = + "all \(failureMessage.postfixMessage)," + + " but failed first at element <\(stringify(currentElement))>" + + " in <\(stringify(actualValue))>" + return false + } + } + failureMessage.postfixMessage = "all \(failureMessage.postfixMessage)" + } else { + failureMessage.postfixMessage = "all pass (use beNil() to match nils)" + return false + } + + return true + } +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func allPassMatcher(matcher: NMBObjCMatcher) -> NMBObjCMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + let location = actualExpression.location + let actualValue = try! actualExpression.evaluate() + var nsObjects = [NSObject]() + + var collectionIsUsable = true + if let value = actualValue as? NSFastEnumeration { + let generator = NSFastGenerator(value) + while let obj:AnyObject = generator.next() { + if let nsObject = obj as? NSObject { + nsObjects.append(nsObject) + } else { + collectionIsUsable = false + break + } + } + } else { + collectionIsUsable = false + } + + if !collectionIsUsable { + failureMessage.postfixMessage = + "allPass only works with NSFastEnumeration (NSArray, NSSet, ...) of NSObjects" + failureMessage.expected = "" + failureMessage.to = "" + return false + } + + let expr = Expression(expression: ({ nsObjects }), location: location) + let elementEvaluator: (Expression, FailureMessage) -> Bool = { + expression, failureMessage in + return matcher.matches( + {try! expression.evaluate()}, failureMessage: failureMessage, location: expr.location) + } + return try! createAllPassMatcher(elementEvaluator).matches( + expr, failureMessage: failureMessage) + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift b/Pods/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift new file mode 100644 index 0000000..3df6eb6 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift @@ -0,0 +1,140 @@ +import Foundation + +#if _runtime(_ObjC) + +public struct AsyncDefaults { + public static var Timeout: NSTimeInterval = 1 + public static var PollInterval: NSTimeInterval = 0.01 +} + +internal struct AsyncMatcherWrapper: Matcher { + let fullMatcher: U + let timeoutInterval: NSTimeInterval + let pollInterval: NSTimeInterval + + init(fullMatcher: U, timeoutInterval: NSTimeInterval = AsyncDefaults.Timeout, pollInterval: NSTimeInterval = AsyncDefaults.PollInterval) { + self.fullMatcher = fullMatcher + self.timeoutInterval = timeoutInterval + self.pollInterval = pollInterval + } + + func matches(actualExpression: Expression, failureMessage: FailureMessage) -> Bool { + let uncachedExpression = actualExpression.withoutCaching() + let fnName = "expect(...).toEventually(...)" + let result = pollBlock( + pollInterval: pollInterval, + timeoutInterval: timeoutInterval, + file: actualExpression.location.file, + line: actualExpression.location.line, + fnName: fnName) { + try self.fullMatcher.matches(uncachedExpression, failureMessage: failureMessage) + } + switch (result) { + case let .Completed(isSuccessful): return isSuccessful + case .TimedOut: return false + case let .ErrorThrown(error): + failureMessage.actualValue = "an unexpected error thrown: <\(error)>" + return false + case let .RaisedException(exception): + failureMessage.actualValue = "an unexpected exception thrown: <\(exception)>" + return false + case .BlockedRunLoop: + failureMessage.postfixMessage += " (timed out, but main thread was unresponsive)." + return false + case .Incomplete: + internalError("Reached .Incomplete state for toEventually(...).") + } + } + + func doesNotMatch(actualExpression: Expression, failureMessage: FailureMessage) -> Bool { + let uncachedExpression = actualExpression.withoutCaching() + let result = pollBlock( + pollInterval: pollInterval, + timeoutInterval: timeoutInterval, + file: actualExpression.location.file, + line: actualExpression.location.line, + fnName: "expect(...).toEventuallyNot(...)") { + try self.fullMatcher.doesNotMatch(uncachedExpression, failureMessage: failureMessage) + } + switch (result) { + case let .Completed(isSuccessful): return isSuccessful + case .TimedOut: return false + case let .ErrorThrown(error): + failureMessage.actualValue = "an unexpected error thrown: <\(error)>" + return false + case let .RaisedException(exception): + failureMessage.actualValue = "an unexpected exception thrown: <\(exception)>" + return false + case .BlockedRunLoop: + failureMessage.postfixMessage += " (timed out, but main thread was unresponsive)." + return false + case .Incomplete: + internalError("Reached .Incomplete state for toEventuallyNot(...).") + } + } +} + +private let toEventuallyRequiresClosureError = FailureMessage(stringValue: "expect(...).toEventually(...) requires an explicit closure (eg - expect { ... }.toEventually(...) )\nSwift 1.2 @autoclosure behavior has changed in an incompatible way for Nimble to function") + + +extension Expectation { + /// Tests the actual value using a matcher to match by checking continuously + /// at each pollInterval until the timeout is reached. + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + public func toEventually(matcher: U, timeout: NSTimeInterval = AsyncDefaults.Timeout, pollInterval: NSTimeInterval = AsyncDefaults.PollInterval, description: String? = nil) { + if expression.isClosure { + let (pass, msg) = expressionMatches( + expression, + matcher: AsyncMatcherWrapper( + fullMatcher: matcher, + timeoutInterval: timeout, + pollInterval: pollInterval), + to: "to eventually", + description: description + ) + verify(pass, msg) + } else { + verify(false, toEventuallyRequiresClosureError) + } + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + public func toEventuallyNot(matcher: U, timeout: NSTimeInterval = AsyncDefaults.Timeout, pollInterval: NSTimeInterval = AsyncDefaults.PollInterval, description: String? = nil) { + if expression.isClosure { + let (pass, msg) = expressionDoesNotMatch( + expression, + matcher: AsyncMatcherWrapper( + fullMatcher: matcher, + timeoutInterval: timeout, + pollInterval: pollInterval), + toNot: "to eventually not", + description: description + ) + verify(pass, msg) + } else { + verify(false, toEventuallyRequiresClosureError) + } + } + + /// Tests the actual value using a matcher to not match by checking + /// continuously at each pollInterval until the timeout is reached. + /// + /// Alias of toEventuallyNot() + /// + /// @discussion + /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function + /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. + public func toNotEventually(matcher: U, timeout: NSTimeInterval = AsyncDefaults.Timeout, pollInterval: NSTimeInterval = AsyncDefaults.PollInterval, description: String? = nil) { + return toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, description: description) + } +} + +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift new file mode 100644 index 0000000..d1f3737 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift @@ -0,0 +1,38 @@ +import Foundation + +#if _runtime(_ObjC) + +// A Nimble matcher that catches attempts to use beAKindOf with non Objective-C types +public func beAKindOf(expectedClass: Any) -> NonNilMatcherFunc { + return NonNilMatcherFunc {actualExpression, failureMessage in + failureMessage.stringValue = "beAKindOf only works on Objective-C types since" + + " the Swift compiler will automatically type check Swift-only types." + + " This expectation is redundant." + return false + } +} + +/// A Nimble matcher that succeeds when the actual value is an instance of the given class. +/// @see beAnInstanceOf if you want to match against the exact class +public func beAKindOf(expectedClass: AnyClass) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + let instance = try actualExpression.evaluate() + if let validInstance = instance { + failureMessage.actualValue = "<\(classAsString(validInstance.dynamicType)) instance>" + } else { + failureMessage.actualValue = "" + } + failureMessage.postfixMessage = "be a kind of \(classAsString(expectedClass))" + return instance != nil && instance!.isKindOfClass(expectedClass) + } +} + +extension NMBObjCMatcher { + public class func beAKindOfMatcher(expected: AnyClass) -> NMBMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + return try! beAKindOf(expected).matches(actualExpression, failureMessage: failureMessage) + } + } +} + +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift new file mode 100644 index 0000000..32477dd --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift @@ -0,0 +1,40 @@ +import Foundation + +// A Nimble matcher that catches attempts to use beAnInstanceOf with non Objective-C types +public func beAnInstanceOf(expectedClass: Any) -> NonNilMatcherFunc { + return NonNilMatcherFunc {actualExpression, failureMessage in + failureMessage.stringValue = "beAnInstanceOf only works on Objective-C types since" + + " the Swift compiler will automatically type check Swift-only types." + + " This expectation is redundant." + return false + } +} + +/// A Nimble matcher that succeeds when the actual value is an instance of the given class. +/// @see beAKindOf if you want to match against subclasses +public func beAnInstanceOf(expectedClass: AnyClass) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + let instance = try actualExpression.evaluate() + if let validInstance = instance { + failureMessage.actualValue = "<\(classAsString(validInstance.dynamicType)) instance>" + } else { + failureMessage.actualValue = "" + } + failureMessage.postfixMessage = "be an instance of \(classAsString(expectedClass))" +#if _runtime(_ObjC) + return instance != nil && instance!.isMemberOfClass(expectedClass) +#else + return instance != nil && instance!.dynamicType == expectedClass +#endif + } +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func beAnInstanceOfMatcher(expected: AnyClass) -> NMBMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + return try! beAnInstanceOf(expected).matches(actualExpression, failureMessage: failureMessage) + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift new file mode 100644 index 0000000..1a3dc11 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift @@ -0,0 +1,124 @@ +#if os(Linux) +import Glibc +#endif +import Foundation + +internal let DefaultDelta = 0.0001 + +internal func isCloseTo(actualValue: NMBDoubleConvertible?, expectedValue: NMBDoubleConvertible, delta: Double, failureMessage: FailureMessage) -> Bool { + failureMessage.postfixMessage = "be close to <\(stringify(expectedValue))> (within \(stringify(delta)))" + failureMessage.actualValue = "<\(stringify(actualValue))>" + return actualValue != nil && abs(actualValue!.doubleValue - expectedValue.doubleValue) < delta +} + +/// A Nimble matcher that succeeds when a value is close to another. This is used for floating +/// point values which can have imprecise results when doing arithmetic on them. +/// +/// @see equal +public func beCloseTo(expectedValue: Double, within delta: Double = DefaultDelta) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + return isCloseTo(try actualExpression.evaluate(), expectedValue: expectedValue, delta: delta, failureMessage: failureMessage) + } +} + +/// A Nimble matcher that succeeds when a value is close to another. This is used for floating +/// point values which can have imprecise results when doing arithmetic on them. +/// +/// @see equal +public func beCloseTo(expectedValue: NMBDoubleConvertible, within delta: Double = DefaultDelta) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + return isCloseTo(try actualExpression.evaluate(), expectedValue: expectedValue, delta: delta, failureMessage: failureMessage) + } +} + +#if _runtime(_ObjC) +public class NMBObjCBeCloseToMatcher : NSObject, NMBMatcher { + var _expected: NSNumber + var _delta: CDouble + init(expected: NSNumber, within: CDouble) { + _expected = expected + _delta = within + } + + public func matches(actualExpression: () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { + let actualBlock: () -> NMBDoubleConvertible? = ({ + return actualExpression() as? NMBDoubleConvertible + }) + let expr = Expression(expression: actualBlock, location: location) + let matcher = beCloseTo(self._expected, within: self._delta) + return try! matcher.matches(expr, failureMessage: failureMessage) + } + + public func doesNotMatch(actualExpression: () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { + let actualBlock: () -> NMBDoubleConvertible? = ({ + return actualExpression() as? NMBDoubleConvertible + }) + let expr = Expression(expression: actualBlock, location: location) + let matcher = beCloseTo(self._expected, within: self._delta) + return try! matcher.doesNotMatch(expr, failureMessage: failureMessage) + } + + public var within: (CDouble) -> NMBObjCBeCloseToMatcher { + return ({ delta in + return NMBObjCBeCloseToMatcher(expected: self._expected, within: delta) + }) + } +} + +extension NMBObjCMatcher { + public class func beCloseToMatcher(expected: NSNumber, within: CDouble) -> NMBObjCBeCloseToMatcher { + return NMBObjCBeCloseToMatcher(expected: expected, within: within) + } +} +#endif + +public func beCloseTo(expectedValues: [Double], within delta: Double = DefaultDelta) -> NonNilMatcherFunc <[Double]> { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be close to <\(stringify(expectedValues))> (each within \(stringify(delta)))" + if let actual = try actualExpression.evaluate() { + failureMessage.actualValue = "<\(stringify(actual))>" + + if actual.count != expectedValues.count { + return false + } else { + for (index, actualItem) in actual.enumerate() { + if fabs(actualItem - expectedValues[index]) > delta { + return false + } + } + return true + } + } + return false + } +} + +// MARK: - Operators + +infix operator ≈ { + associativity none + precedence 130 +} + +public func ≈(lhs: Expectation<[Double]>, rhs: [Double]) { + lhs.to(beCloseTo(rhs)) +} + +public func ≈(lhs: Expectation, rhs: Double) { + lhs.to(beCloseTo(rhs)) +} + +public func ≈(lhs: Expectation, rhs: (expected: Double, delta: Double)) { + lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) +} + +public func ==(lhs: Expectation, rhs: (expected: Double, delta: Double)) { + lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) +} + +// make this higher precedence than exponents so the Doubles either end aren't pulled in +// unexpectantly +infix operator ± { precedence 170 } +public func ±(lhs: Double, rhs: Double) -> (expected: Double, delta: Double) { + return (expected: lhs, delta: rhs) +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeEmpty.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeEmpty.swift new file mode 100644 index 0000000..cebd82d --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeEmpty.swift @@ -0,0 +1,92 @@ +import Foundation + + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be empty" + let actualSeq = try actualExpression.evaluate() + if actualSeq == nil { + return true + } + var generator = actualSeq!.generate() + return generator.next() == nil + } +} + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be empty" + let actualString = try actualExpression.evaluate() + return actualString == nil || NSString(string: actualString!).length == 0 + } +} + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For NSString instances, it is an empty string. +public func beEmpty() -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be empty" + let actualString = try actualExpression.evaluate() + return actualString == nil || actualString!.length == 0 + } +} + +// Without specific overrides, beEmpty() is ambiguous for NSDictionary, NSArray, +// etc, since they conform to SequenceType as well as NMBCollection. + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be empty" + let actualDictionary = try actualExpression.evaluate() + return actualDictionary == nil || actualDictionary!.count == 0 + } +} + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be empty" + let actualArray = try actualExpression.evaluate() + return actualArray == nil || actualArray!.count == 0 + } +} + +/// A Nimble matcher that succeeds when a value is "empty". For collections, this +/// means the are no items in that collection. For strings, it is an empty string. +public func beEmpty() -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be empty" + let actual = try actualExpression.evaluate() + return actual == nil || actual!.count == 0 + } +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func beEmptyMatcher() -> NMBObjCMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + let location = actualExpression.location + let actualValue = try! actualExpression.evaluate() + failureMessage.postfixMessage = "be empty" + if let value = actualValue as? NMBCollection { + let expr = Expression(expression: ({ value as NMBCollection }), location: location) + return try! beEmpty().matches(expr, failureMessage: failureMessage) + } else if let value = actualValue as? NSString { + let expr = Expression(expression: ({ value as String }), location: location) + return try! beEmpty().matches(expr, failureMessage: failureMessage) + } else if let actualValue = actualValue { + failureMessage.postfixMessage = "be empty (only works for NSArrays, NSSets, NSIndexSets, NSDictionaries, NSHashTables, and NSStrings)" + failureMessage.actualValue = "\(classAsString(actualValue.dynamicType)) type" + } + return false + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift new file mode 100644 index 0000000..0f24ab5 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift @@ -0,0 +1,39 @@ +import Foundation + + +/// A Nimble matcher that succeeds when the actual value is greater than the expected value. +public func beGreaterThan(expectedValue: T?) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be greater than <\(stringify(expectedValue))>" + return try actualExpression.evaluate() > expectedValue + } +} + +/// A Nimble matcher that succeeds when the actual value is greater than the expected value. +public func beGreaterThan(expectedValue: NMBComparable?) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be greater than <\(stringify(expectedValue))>" + let actualValue = try actualExpression.evaluate() + let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == NSComparisonResult.OrderedDescending + return matches + } +} + +public func >(lhs: Expectation, rhs: T) { + lhs.to(beGreaterThan(rhs)) +} + +public func >(lhs: Expectation, rhs: NMBComparable?) { + lhs.to(beGreaterThan(rhs)) +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func beGreaterThanMatcher(expected: NMBComparable?) -> NMBObjCMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + let expr = actualExpression.cast { $0 as? NMBComparable } + return try! beGreaterThan(expected).matches(expr, failureMessage: failureMessage) + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift new file mode 100644 index 0000000..c89ff07 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift @@ -0,0 +1,41 @@ +import Foundation + +/// A Nimble matcher that succeeds when the actual value is greater than +/// or equal to the expected value. +public func beGreaterThanOrEqualTo(expectedValue: T?) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" + let actualValue = try actualExpression.evaluate() + return actualValue >= expectedValue + } +} + +/// A Nimble matcher that succeeds when the actual value is greater than +/// or equal to the expected value. +public func beGreaterThanOrEqualTo(expectedValue: T?) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" + let actualValue = try actualExpression.evaluate() + let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) != NSComparisonResult.OrderedAscending + return matches + } +} + +public func >=(lhs: Expectation, rhs: T) { + lhs.to(beGreaterThanOrEqualTo(rhs)) +} + +public func >=(lhs: Expectation, rhs: T) { + lhs.to(beGreaterThanOrEqualTo(rhs)) +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func beGreaterThanOrEqualToMatcher(expected: NMBComparable?) -> NMBObjCMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + let expr = actualExpression.cast { $0 as? NMBComparable } + return try! beGreaterThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift new file mode 100644 index 0000000..a369501 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift @@ -0,0 +1,39 @@ +import Foundation + + +/// A Nimble matcher that succeeds when the actual value is the same instance +/// as the expected instance. +public func beIdenticalTo(expected: AnyObject?) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + let actual = try actualExpression.evaluate() + failureMessage.actualValue = "\(identityAsString(actual))" + failureMessage.postfixMessage = "be identical to \(identityAsString(expected))" + return actual === expected && actual !== nil + } +} + +public func ===(lhs: Expectation, rhs: AnyObject?) { + lhs.to(beIdenticalTo(rhs)) +} +public func !==(lhs: Expectation, rhs: AnyObject?) { + lhs.toNot(beIdenticalTo(rhs)) +} + +/// A Nimble matcher that succeeds when the actual value is the same instance +/// as the expected instance. +/// +/// Alias for "beIdenticalTo". +public func be(expected: AnyObject?) -> NonNilMatcherFunc { + return beIdenticalTo(expected) +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func beIdenticalToMatcher(expected: NSObject?) -> NMBObjCMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + let aExpr = actualExpression.cast { $0 as AnyObject? } + return try! beIdenticalTo(expected).matches(aExpr, failureMessage: failureMessage) + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift new file mode 100644 index 0000000..ea4725b --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift @@ -0,0 +1,38 @@ +import Foundation + +/// A Nimble matcher that succeeds when the actual value is less than the expected value. +public func beLessThan(expectedValue: T?) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" + return try actualExpression.evaluate() < expectedValue + } +} + +/// A Nimble matcher that succeeds when the actual value is less than the expected value. +public func beLessThan(expectedValue: NMBComparable?) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" + let actualValue = try actualExpression.evaluate() + let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == NSComparisonResult.OrderedAscending + return matches + } +} + +public func <(lhs: Expectation, rhs: T) { + lhs.to(beLessThan(rhs)) +} + +public func <(lhs: Expectation, rhs: NMBComparable?) { + lhs.to(beLessThan(rhs)) +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func beLessThanMatcher(expected: NMBComparable?) -> NMBObjCMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + let expr = actualExpression.cast { $0 as! NMBComparable? } + return try! beLessThan(expected).matches(expr, failureMessage: failureMessage) + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift new file mode 100644 index 0000000..a24cf8c --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift @@ -0,0 +1,39 @@ +import Foundation + +/// A Nimble matcher that succeeds when the actual value is less than +/// or equal to the expected value. +public func beLessThanOrEqualTo(expectedValue: T?) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" + return try actualExpression.evaluate() <= expectedValue + } +} + +/// A Nimble matcher that succeeds when the actual value is less than +/// or equal to the expected value. +public func beLessThanOrEqualTo(expectedValue: T?) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" + let actualValue = try actualExpression.evaluate() + return actualValue != nil && actualValue!.NMB_compare(expectedValue) != NSComparisonResult.OrderedDescending + } +} + +public func <=(lhs: Expectation, rhs: T) { + lhs.to(beLessThanOrEqualTo(rhs)) +} + +public func <=(lhs: Expectation, rhs: T) { + lhs.to(beLessThanOrEqualTo(rhs)) +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func beLessThanOrEqualToMatcher(expected: NMBComparable?) -> NMBObjCMatcher { + return NMBObjCMatcher(canMatchNil:false) { actualExpression, failureMessage in + let expr = actualExpression.cast { $0 as? NMBComparable } + return try! beLessThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeLogical.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeLogical.swift new file mode 100644 index 0000000..ac729b2 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeLogical.swift @@ -0,0 +1,89 @@ +import Foundation + +internal func matcherWithFailureMessage(matcher: NonNilMatcherFunc, postprocessor: (FailureMessage) -> Void) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + defer { postprocessor(failureMessage) } + return try matcher.matcher(actualExpression, failureMessage) + } +} + +// MARK: beTrue() / beFalse() + +/// A Nimble matcher that succeeds when the actual value is exactly true. +/// This matcher will not match against nils. +public func beTrue() -> NonNilMatcherFunc { + return matcherWithFailureMessage(equal(true)) { failureMessage in + failureMessage.postfixMessage = "be true" + } +} + +/// A Nimble matcher that succeeds when the actual value is exactly false. +/// This matcher will not match against nils. +public func beFalse() -> NonNilMatcherFunc { + return matcherWithFailureMessage(equal(false)) { failureMessage in + failureMessage.postfixMessage = "be false" + } +} + +// MARK: beTruthy() / beFalsy() + +/// A Nimble matcher that succeeds when the actual value is not logically false. +public func beTruthy() -> MatcherFunc { + return MatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be truthy" + let actualValue = try actualExpression.evaluate() + if let actualValue = actualValue { + if let actualValue = actualValue as? BooleanType { + return actualValue.boolValue == true + } + } + return actualValue != nil + } +} + +/// A Nimble matcher that succeeds when the actual value is logically false. +/// This matcher will match against nils. +public func beFalsy() -> MatcherFunc { + return MatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be falsy" + let actualValue = try actualExpression.evaluate() + if let actualValue = actualValue { + if let actualValue = actualValue as? BooleanType { + return actualValue.boolValue != true + } + } + return actualValue == nil + } +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func beTruthyMatcher() -> NMBObjCMatcher { + return NMBObjCMatcher { actualExpression, failureMessage in + let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false as BooleanType? } + return try! beTruthy().matches(expr, failureMessage: failureMessage) + } + } + + public class func beFalsyMatcher() -> NMBObjCMatcher { + return NMBObjCMatcher { actualExpression, failureMessage in + let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false as BooleanType? } + return try! beFalsy().matches(expr, failureMessage: failureMessage) + } + } + + public class func beTrueMatcher() -> NMBObjCMatcher { + return NMBObjCMatcher { actualExpression, failureMessage in + let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false as Bool? } + return try! beTrue().matches(expr, failureMessage: failureMessage) + } + } + + public class func beFalseMatcher() -> NMBObjCMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false as Bool? } + return try! beFalse().matches(expr, failureMessage: failureMessage) + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift new file mode 100644 index 0000000..a6fb31f --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift @@ -0,0 +1,20 @@ +import Foundation + +/// A Nimble matcher that succeeds when the actual value is nil. +public func beNil() -> MatcherFunc { + return MatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be nil" + let actualValue = try actualExpression.evaluate() + return actualValue == nil + } +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func beNilMatcher() -> NMBObjCMatcher { + return NMBObjCMatcher { actualExpression, failureMessage in + return try! beNil().matches(actualExpression, failureMessage: failureMessage) + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift new file mode 100644 index 0000000..8f86265 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift @@ -0,0 +1,18 @@ +import Foundation + +/// A Nimble matcher that succeeds when the actual value is Void. +public func beVoid() -> MatcherFunc<()> { + return MatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "be void" + let actualValue: ()? = try actualExpression.evaluate() + return actualValue != nil + } +} + +public func ==(lhs: Expectation<()>, rhs: ()) { + lhs.to(beVoid()) +} + +public func !=(lhs: Expectation<()>, rhs: ()) { + lhs.toNot(beVoid()) +} \ No newline at end of file diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift new file mode 100644 index 0000000..0b5e0e1 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift @@ -0,0 +1,55 @@ +import Foundation + + +/// A Nimble matcher that succeeds when the actual sequence's first element +/// is equal to the expected value. +public func beginWith(startingElement: T) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "begin with <\(startingElement)>" + if let actualValue = try actualExpression.evaluate() { + var actualGenerator = actualValue.generate() + return actualGenerator.next() == startingElement + } + return false + } +} + +/// A Nimble matcher that succeeds when the actual collection's first element +/// is equal to the expected object. +public func beginWith(startingElement: AnyObject) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "begin with <\(startingElement)>" + let collection = try actualExpression.evaluate() + return collection != nil && collection!.indexOfObject(startingElement) == 0 + } +} + +/// A Nimble matcher that succeeds when the actual string contains expected substring +/// where the expected substring's location is zero. +public func beginWith(startingSubstring: String) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "begin with <\(startingSubstring)>" + if let actual = try actualExpression.evaluate() { + let range = actual.rangeOfString(startingSubstring) + return range != nil && range!.startIndex == actual.startIndex + } + return false + } +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func beginWithMatcher(expected: AnyObject) -> NMBObjCMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + let actual = try! actualExpression.evaluate() + if let _ = actual as? String { + let expr = actualExpression.cast { $0 as? String } + return try! beginWith(expected as! String).matches(expr, failureMessage: failureMessage) + } else { + let expr = actualExpression.cast { $0 as? NMBOrderedCollection } + return try! beginWith(expected).matches(expr, failureMessage: failureMessage) + } + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/Contain.swift b/Pods/Nimble/Sources/Nimble/Matchers/Contain.swift new file mode 100644 index 0000000..bdac2d5 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/Contain.swift @@ -0,0 +1,92 @@ +import Foundation + +/// A Nimble matcher that succeeds when the actual sequence contains the expected value. +public func contain(items: T...) -> NonNilMatcherFunc { + return contain(items) +} + +private func contain(items: [T]) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "contain <\(arrayAsString(items))>" + if let actual = try actualExpression.evaluate() { + return items.all { + return actual.contains($0) + } + } + return false + } +} + +/// A Nimble matcher that succeeds when the actual string contains the expected substring. +public func contain(substrings: String...) -> NonNilMatcherFunc { + return contain(substrings) +} + +private func contain(substrings: [String]) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "contain <\(arrayAsString(substrings))>" + if let actual = try actualExpression.evaluate() { + return substrings.all { + let range = actual.rangeOfString($0) + return range != nil && !range!.isEmpty + } + } + return false + } +} + +/// A Nimble matcher that succeeds when the actual string contains the expected substring. +public func contain(substrings: NSString...) -> NonNilMatcherFunc { + return contain(substrings) +} + +private func contain(substrings: [NSString]) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "contain <\(arrayAsString(substrings))>" + if let actual = try actualExpression.evaluate() { + return substrings.all { actual.rangeOfString($0.description).length != 0 } + } + return false + } +} + +/// A Nimble matcher that succeeds when the actual collection contains the expected object. +public func contain(items: AnyObject?...) -> NonNilMatcherFunc { + return contain(items) +} + +private func contain(items: [AnyObject?]) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "contain <\(arrayAsString(items))>" + guard let actual = try actualExpression.evaluate() else { return false } + return items.all { item in + return item != nil && actual.containsObject(item!) + } + } +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func containMatcher(expected: [NSObject]) -> NMBObjCMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + let location = actualExpression.location + let actualValue = try! actualExpression.evaluate() + if let value = actualValue as? NMBContainer { + let expr = Expression(expression: ({ value as NMBContainer }), location: location) + + // A straightforward cast on the array causes this to crash, so we have to cast the individual items + let expectedOptionals: [AnyObject?] = expected.map({ $0 as AnyObject? }) + return try! contain(expectedOptionals).matches(expr, failureMessage: failureMessage) + } else if let value = actualValue as? NSString { + let expr = Expression(expression: ({ value as String }), location: location) + return try! contain(expected as! [String]).matches(expr, failureMessage: failureMessage) + } else if actualValue != nil { + failureMessage.postfixMessage = "contain <\(arrayAsString(expected))> (only works for NSArrays, NSSets, NSHashTables, and NSStrings)" + } else { + failureMessage.postfixMessage = "contain <\(arrayAsString(expected))>" + } + return false + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift b/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift new file mode 100644 index 0000000..ff2bd9e --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift @@ -0,0 +1,65 @@ +import Foundation + + +/// A Nimble matcher that succeeds when the actual sequence's last element +/// is equal to the expected value. +public func endWith(endingElement: T) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "end with <\(endingElement)>" + + if let actualValue = try actualExpression.evaluate() { + var actualGenerator = actualValue.generate() + var lastItem: T? + var item: T? + repeat { + lastItem = item + item = actualGenerator.next() + } while(item != nil) + + return lastItem == endingElement + } + return false + } +} + +/// A Nimble matcher that succeeds when the actual collection's last element +/// is equal to the expected object. +public func endWith(endingElement: AnyObject) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "end with <\(endingElement)>" + let collection = try actualExpression.evaluate() + return collection != nil && collection!.indexOfObject(endingElement) == collection!.count - 1 + } +} + + +/// A Nimble matcher that succeeds when the actual string contains the expected substring +/// where the expected substring's location is the actual string's length minus the +/// expected substring's length. +public func endWith(endingSubstring: String) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "end with <\(endingSubstring)>" + if let collection = try actualExpression.evaluate() { + let range = collection.rangeOfString(endingSubstring) + return range != nil && range!.endIndex == collection.endIndex + } + return false + } +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func endWithMatcher(expected: AnyObject) -> NMBObjCMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + let actual = try! actualExpression.evaluate() + if let _ = actual as? String { + let expr = actualExpression.cast { $0 as? String } + return try! endWith(expected as! String).matches(expr, failureMessage: failureMessage) + } else { + let expr = actualExpression.cast { $0 as? NMBOrderedCollection } + return try! endWith(expected).matches(expr, failureMessage: failureMessage) + } + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/Equal.swift b/Pods/Nimble/Sources/Nimble/Matchers/Equal.swift new file mode 100644 index 0000000..6373d8c --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/Equal.swift @@ -0,0 +1,181 @@ +import Foundation + +/// A Nimble matcher that succeeds when the actual value is equal to the expected value. +/// Values can support equal by supporting the Equatable protocol. +/// +/// @see beCloseTo if you want to match imprecise types (eg - floats, doubles). +public func equal(expectedValue: T?) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>" + let actualValue = try actualExpression.evaluate() + let matches = actualValue == expectedValue && expectedValue != nil + if expectedValue == nil || actualValue == nil { + if expectedValue == nil { + failureMessage.postfixActual = " (use beNil() to match nils)" + } + return false + } + return matches + } +} + +/// A Nimble matcher that succeeds when the actual value is equal to the expected value. +/// Values can support equal by supporting the Equatable protocol. +/// +/// @see beCloseTo if you want to match imprecise types (eg - floats, doubles). +public func equal(expectedValue: [T: C]?) -> NonNilMatcherFunc<[T: C]> { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>" + let actualValue = try actualExpression.evaluate() + if expectedValue == nil || actualValue == nil { + if expectedValue == nil { + failureMessage.postfixActual = " (use beNil() to match nils)" + } + return false + } + return expectedValue! == actualValue! + } +} + +/// A Nimble matcher that succeeds when the actual collection is equal to the expected collection. +/// Items must implement the Equatable protocol. +public func equal(expectedValue: [T]?) -> NonNilMatcherFunc<[T]> { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>" + let actualValue = try actualExpression.evaluate() + if expectedValue == nil || actualValue == nil { + if expectedValue == nil { + failureMessage.postfixActual = " (use beNil() to match nils)" + } + return false + } + return expectedValue! == actualValue! + } +} + +/// A Nimble matcher allowing comparison of collection with optional type +public func equal(expectedValue: [T?]) -> NonNilMatcherFunc<[T?]> { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>" + if let actualValue = try actualExpression.evaluate() { + if expectedValue.count != actualValue.count { + return false + } + + for (index, item) in actualValue.enumerate() { + let otherItem = expectedValue[index] + if item == nil && otherItem == nil { + continue + } else if item == nil && otherItem != nil { + return false + } else if item != nil && otherItem == nil { + return false + } else if item! != otherItem! { + return false + } + } + + return true + } else { + failureMessage.postfixActual = " (use beNil() to match nils)" + } + + return false + } +} + +/// A Nimble matcher that succeeds when the actual set is equal to the expected set. +public func equal(expectedValue: Set?) -> NonNilMatcherFunc> { + return equal(expectedValue, stringify: stringify) +} + +/// A Nimble matcher that succeeds when the actual set is equal to the expected set. +public func equal(expectedValue: Set?) -> NonNilMatcherFunc> { + return equal(expectedValue, stringify: { + if let set = $0 { + return stringify(Array(set).sort { $0 < $1 }) + } else { + return "nil" + } + }) +} + +private func equal(expectedValue: Set?, stringify: Set? -> String) -> NonNilMatcherFunc> { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>" + + if let expectedValue = expectedValue { + if let actualValue = try actualExpression.evaluate() { + failureMessage.actualValue = "<\(stringify(actualValue))>" + + if expectedValue == actualValue { + return true + } + + let missing = expectedValue.subtract(actualValue) + if missing.count > 0 { + failureMessage.postfixActual += ", missing <\(stringify(missing))>" + } + + let extra = actualValue.subtract(expectedValue) + if extra.count > 0 { + failureMessage.postfixActual += ", extra <\(stringify(extra))>" + } + } + } else { + failureMessage.postfixActual = " (use beNil() to match nils)" + } + + return false + } +} + +public func ==(lhs: Expectation, rhs: T?) { + lhs.to(equal(rhs)) +} + +public func !=(lhs: Expectation, rhs: T?) { + lhs.toNot(equal(rhs)) +} + +public func ==(lhs: Expectation<[T]>, rhs: [T]?) { + lhs.to(equal(rhs)) +} + +public func !=(lhs: Expectation<[T]>, rhs: [T]?) { + lhs.toNot(equal(rhs)) +} + +public func ==(lhs: Expectation>, rhs: Set?) { + lhs.to(equal(rhs)) +} + +public func !=(lhs: Expectation>, rhs: Set?) { + lhs.toNot(equal(rhs)) +} + +public func ==(lhs: Expectation>, rhs: Set?) { + lhs.to(equal(rhs)) +} + +public func !=(lhs: Expectation>, rhs: Set?) { + lhs.toNot(equal(rhs)) +} + +public func ==(lhs: Expectation<[T: C]>, rhs: [T: C]?) { + lhs.to(equal(rhs)) +} + +public func !=(lhs: Expectation<[T: C]>, rhs: [T: C]?) { + lhs.toNot(equal(rhs)) +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func equalMatcher(expected: NSObject) -> NMBMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + return try! equal(expected).matches(actualExpression, failureMessage: failureMessage) + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift b/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift new file mode 100644 index 0000000..a17cca2 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift @@ -0,0 +1,50 @@ +import Foundation + +/// A Nimble matcher that succeeds when the actual CollectionType's count equals +/// the expected value +public func haveCount(expectedValue: T.Index.Distance) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + if let actualValue = try actualExpression.evaluate() { + failureMessage.postfixMessage = "have \(stringify(actualValue)) with count \(stringify(expectedValue))" + let result = expectedValue == actualValue.count + failureMessage.actualValue = "\(actualValue.count)" + return result + } else { + return false + } + } +} + +/// A Nimble matcher that succeeds when the actual collection's count equals +/// the expected value +public func haveCount(expectedValue: Int) -> MatcherFunc { + return MatcherFunc { actualExpression, failureMessage in + if let actualValue = try actualExpression.evaluate() { + failureMessage.postfixMessage = "have \(stringify(actualValue)) with count \(stringify(expectedValue))" + let result = expectedValue == actualValue.count + failureMessage.actualValue = "\(actualValue.count)" + return result + } else { + return false + } + } +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func haveCountMatcher(expected: NSNumber) -> NMBObjCMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + let location = actualExpression.location + let actualValue = try! actualExpression.evaluate() + if let value = actualValue as? NMBCollection { + let expr = Expression(expression: ({ value as NMBCollection}), location: location) + return try! haveCount(expected.integerValue).matches(expr, failureMessage: failureMessage) + } else if let actualValue = actualValue { + failureMessage.postfixMessage = "get type of NSArray, NSSet, NSDictionary, or NSHashTable" + failureMessage.actualValue = "\(classAsString(actualValue.dynamicType))" + } + return false + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/Match.swift b/Pods/Nimble/Sources/Nimble/Matchers/Match.swift new file mode 100644 index 0000000..586e616 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/Match.swift @@ -0,0 +1,30 @@ +import Foundation + +#if _runtime(_ObjC) + +/// A Nimble matcher that succeeds when the actual string satisfies the regular expression +/// described by the expected string. +public func match(expectedValue: String?) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + failureMessage.postfixMessage = "match <\(stringify(expectedValue))>" + + if let actual = try actualExpression.evaluate() { + if let regexp = expectedValue { + return actual.rangeOfString(regexp, options: .RegularExpressionSearch) != nil + } + } + + return false + } +} + +extension NMBObjCMatcher { + public class func matchMatcher(expected: NSString) -> NMBMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + let actual = actualExpression.cast { $0 as? String } + return try! match(expected.description).matches(actual, failureMessage: failureMessage) + } + } +} + +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift b/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift new file mode 100644 index 0000000..cba70c2 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift @@ -0,0 +1,26 @@ +import Foundation + +/// A Nimble matcher that succeeds when the actual expression evaluates to an +/// error from the specified case. +/// +/// Errors are tried to be compared by their implementation of Equatable, +/// otherwise they fallback to comparision by _domain and _code. +public func matchError(error: T) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + let actualError: ErrorType? = try actualExpression.evaluate() + + setFailureMessageForError(failureMessage, postfixMessageVerb: "match", actualError: actualError, error: error) + return errorMatchesNonNilFieldsOrClosure(actualError, error: error) + } +} + +/// A Nimble matcher that succeeds when the actual expression evaluates to an +/// error of the specified type +public func matchError(errorType: T.Type) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + let actualError: ErrorType? = try actualExpression.evaluate() + + setFailureMessageForError(failureMessage, postfixMessageVerb: "match", actualError: actualError, errorType: errorType) + return errorMatchesNonNilFieldsOrClosure(actualError, errorType: errorType) + } +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift b/Pods/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift new file mode 100644 index 0000000..c8a9217 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift @@ -0,0 +1,69 @@ +/// A convenience API to build matchers that don't need special negation +/// behavior. The toNot() behavior is the negation of to(). +/// +/// @see NonNilMatcherFunc if you prefer to have this matcher fail when nil +/// values are recieved in an expectation. +/// +/// You may use this when implementing your own custom matchers. +/// +/// Use the Matcher protocol instead of this type to accept custom matchers as +/// input parameters. +/// @see allPass for an example that uses accepts other matchers as input. +public struct MatcherFunc: Matcher { + public let matcher: (Expression, FailureMessage) throws -> Bool + + public init(_ matcher: (Expression, FailureMessage) throws -> Bool) { + self.matcher = matcher + } + + public func matches(actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool { + return try matcher(actualExpression, failureMessage) + } + + public func doesNotMatch(actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool { + return try !matcher(actualExpression, failureMessage) + } +} + +/// A convenience API to build matchers that don't need special negation +/// behavior. The toNot() behavior is the negation of to(). +/// +/// Unlike MatcherFunc, this will always fail if an expectation contains nil. +/// This applies regardless of using to() or toNot(). +/// +/// You may use this when implementing your own custom matchers. +/// +/// Use the Matcher protocol instead of this type to accept custom matchers as +/// input parameters. +/// @see allPass for an example that uses accepts other matchers as input. +public struct NonNilMatcherFunc: Matcher { + public let matcher: (Expression, FailureMessage) throws -> Bool + + public init(_ matcher: (Expression, FailureMessage) throws -> Bool) { + self.matcher = matcher + } + + public func matches(actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool { + let pass = try matcher(actualExpression, failureMessage) + if try attachNilErrorIfNeeded(actualExpression, failureMessage: failureMessage) { + return false + } + return pass + } + + public func doesNotMatch(actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool { + let pass = try !matcher(actualExpression, failureMessage) + if try attachNilErrorIfNeeded(actualExpression, failureMessage: failureMessage) { + return false + } + return pass + } + + internal func attachNilErrorIfNeeded(actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool { + if try actualExpression.evaluate() == nil { + failureMessage.postfixActual = " (use beNil() to match nils)" + return true + } + return false + } +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift b/Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift new file mode 100644 index 0000000..978d54c --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift @@ -0,0 +1,143 @@ +import Foundation + +/// Implement this protocol to implement a custom matcher for Swift +public protocol Matcher { + associatedtype ValueType + func matches(actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool + func doesNotMatch(actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool +} + +#if _runtime(_ObjC) +/// Objective-C interface to the Swift variant of Matcher. +@objc public protocol NMBMatcher { + func matches(actualBlock: () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool + func doesNotMatch(actualBlock: () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool +} +#endif + +#if _runtime(_ObjC) +/// Protocol for types that support contain() matcher. +@objc public protocol NMBContainer { + func containsObject(object: AnyObject!) -> Bool +} + +extension NSHashTable : NMBContainer {} // Corelibs Foundation does not include this class yet +#else +public protocol NMBContainer { + func containsObject(object: AnyObject) -> Bool +} +#endif + +extension NSArray : NMBContainer {} +extension NSSet : NMBContainer {} + +#if _runtime(_ObjC) +/// Protocol for types that support only beEmpty(), haveCount() matchers +@objc public protocol NMBCollection { + var count: Int { get } +} + +extension NSHashTable : NMBCollection {} // Corelibs Foundation does not include these classes yet +extension NSMapTable : NMBCollection {} +#else +public protocol NMBCollection { + var count: Int { get } +} +#endif + +extension NSSet : NMBCollection {} +extension NSIndexSet : NMBCollection {} +extension NSDictionary : NMBCollection {} + +#if _runtime(_ObjC) +/// Protocol for types that support beginWith(), endWith(), beEmpty() matchers +@objc public protocol NMBOrderedCollection : NMBCollection { + func indexOfObject(object: AnyObject!) -> Int +} +#else +public protocol NMBOrderedCollection : NMBCollection { + func indexOfObject(object: AnyObject) -> Int +} +#endif + +extension NSArray : NMBOrderedCollection {} + +#if _runtime(_ObjC) +/// Protocol for types to support beCloseTo() matcher +@objc public protocol NMBDoubleConvertible { + var doubleValue: CDouble { get } +} +#else +public protocol NMBDoubleConvertible { + var doubleValue: CDouble { get } +} + +extension Double : NMBDoubleConvertible { + public var doubleValue: CDouble { + get { + return self + } + } +} + +extension Float : NMBDoubleConvertible { + public var doubleValue: CDouble { + get { + return CDouble(self) + } + } +} +#endif + +extension NSNumber : NMBDoubleConvertible { +} + +private let dateFormatter: NSDateFormatter = { + let formatter = NSDateFormatter() + formatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSS" + formatter.locale = NSLocale(localeIdentifier: "en_US_POSIX") + + return formatter +}() + +#if _runtime(_ObjC) +extension NSDate: NMBDoubleConvertible { + public var doubleValue: CDouble { + get { + return self.timeIntervalSinceReferenceDate + } + } +} +#endif + +extension NSDate: TestOutputStringConvertible { + public var testDescription: String { + return dateFormatter.stringFromDate(self) + } +} + +/// Protocol for types to support beLessThan(), beLessThanOrEqualTo(), +/// beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers. +/// +/// Types that conform to Swift's Comparable protocol will work implicitly too +#if _runtime(_ObjC) +@objc public protocol NMBComparable { + func NMB_compare(otherObject: NMBComparable!) -> NSComparisonResult +} +#else +// This should become obsolete once Corelibs Foundation adds Comparable conformance to NSNumber +public protocol NMBComparable { + func NMB_compare(otherObject: NMBComparable!) -> NSComparisonResult +} +#endif + +extension NSNumber : NMBComparable { + public func NMB_compare(otherObject: NMBComparable!) -> NSComparisonResult { + return compare(otherObject as! NSNumber) + } +} +extension NSString : NMBComparable { + public func NMB_compare(otherObject: NMBComparable!) -> NSComparisonResult { + return compare(otherObject as! String) + } +} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift b/Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift new file mode 100644 index 0000000..0191f88 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift @@ -0,0 +1,66 @@ +import Foundation + +internal class NotificationCollector { + private(set) var observedNotifications: [NSNotification] + private let notificationCenter: NSNotificationCenter + #if _runtime(_ObjC) + private var token: AnyObject? + #else + private var token: NSObjectProtocol? + #endif + + required init(notificationCenter: NSNotificationCenter) { + self.notificationCenter = notificationCenter + self.observedNotifications = [] + } + + func startObserving() { + self.token = self.notificationCenter.addObserverForName(nil, object: nil, queue: nil) { + // linux-swift gets confused by .append(n) + [weak self] n in self?.observedNotifications += [n] + } + } + + deinit { + #if _runtime(_ObjC) + if let token = self.token { + self.notificationCenter.removeObserver(token) + } + #else + if let token = self.token as? AnyObject { + self.notificationCenter.removeObserver(token) + } + #endif + } +} + +private let mainThread = pthread_self() + +public func postNotifications( + notificationsMatcher: T, + fromNotificationCenter center: NSNotificationCenter = NSNotificationCenter.defaultCenter()) + -> MatcherFunc { + let _ = mainThread // Force lazy-loading of this value + let collector = NotificationCollector(notificationCenter: center) + collector.startObserving() + var once: Bool = false + return MatcherFunc { actualExpression, failureMessage in + let collectorNotificationsExpression = Expression(memoizedExpression: { _ in + return collector.observedNotifications + }, location: actualExpression.location, withoutCaching: true) + + assert(pthread_equal(mainThread, pthread_self()) != 0, "Only expecting closure to be evaluated on main thread.") + if !once { + once = true + try actualExpression.evaluate() + } + + let match = try notificationsMatcher.matches(collectorNotificationsExpression, failureMessage: failureMessage) + if collector.observedNotifications.isEmpty { + failureMessage.actualValue = "no notifications" + } else { + failureMessage.actualValue = "<\(stringify(collector.observedNotifications))>" + } + return match + } +} \ No newline at end of file diff --git a/Pods/Nimble/Sources/Nimble/Matchers/RaisesException.swift b/Pods/Nimble/Sources/Nimble/Matchers/RaisesException.swift new file mode 100644 index 0000000..ff6b74a --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/RaisesException.swift @@ -0,0 +1,182 @@ +import Foundation + +// This matcher requires the Objective-C, and being built by Xcode rather than the Swift Package Manager +#if _runtime(_ObjC) && !SWIFT_PACKAGE + +/// A Nimble matcher that succeeds when the actual expression raises an +/// exception with the specified name, reason, and/or userInfo. +/// +/// Alternatively, you can pass a closure to do any arbitrary custom matching +/// to the raised exception. The closure only gets called when an exception +/// is raised. +/// +/// nil arguments indicates that the matcher should not attempt to match against +/// that parameter. +public func raiseException( + named named: String? = nil, + reason: String? = nil, + userInfo: NSDictionary? = nil, + closure: ((NSException) -> Void)? = nil) -> MatcherFunc { + return MatcherFunc { actualExpression, failureMessage in + + var exception: NSException? + let capture = NMBExceptionCapture(handler: ({ e in + exception = e + }), finally: nil) + + capture.tryBlock { + try! actualExpression.evaluate() + return + } + + setFailureMessageForException(failureMessage, exception: exception, named: named, reason: reason, userInfo: userInfo, closure: closure) + return exceptionMatchesNonNilFieldsOrClosure(exception, named: named, reason: reason, userInfo: userInfo, closure: closure) + } +} + +internal func setFailureMessageForException( + failureMessage: FailureMessage, + exception: NSException?, + named: String?, + reason: String?, + userInfo: NSDictionary?, + closure: ((NSException) -> Void)?) { + failureMessage.postfixMessage = "raise exception" + + if let named = named { + failureMessage.postfixMessage += " with name <\(named)>" + } + if let reason = reason { + failureMessage.postfixMessage += " with reason <\(reason)>" + } + if let userInfo = userInfo { + failureMessage.postfixMessage += " with userInfo <\(userInfo)>" + } + if let _ = closure { + failureMessage.postfixMessage += " that satisfies block" + } + if named == nil && reason == nil && userInfo == nil && closure == nil { + failureMessage.postfixMessage = "raise any exception" + } + + if let exception = exception { + failureMessage.actualValue = "\(classAsString(exception.dynamicType)) { name=\(exception.name), reason='\(stringify(exception.reason))', userInfo=\(stringify(exception.userInfo)) }" + } else { + failureMessage.actualValue = "no exception" + } +} + +internal func exceptionMatchesNonNilFieldsOrClosure( + exception: NSException?, + named: String?, + reason: String?, + userInfo: NSDictionary?, + closure: ((NSException) -> Void)?) -> Bool { + var matches = false + + if let exception = exception { + matches = true + + if named != nil && exception.name != named { + matches = false + } + if reason != nil && exception.reason != reason { + matches = false + } + if userInfo != nil && exception.userInfo != userInfo { + matches = false + } + if let closure = closure { + let assertions = gatherFailingExpectations { + closure(exception) + } + let messages = assertions.map { $0.message } + if messages.count > 0 { + matches = false + } + } + } + + return matches +} + +public class NMBObjCRaiseExceptionMatcher : NSObject, NMBMatcher { + internal var _name: String? + internal var _reason: String? + internal var _userInfo: NSDictionary? + internal var _block: ((NSException) -> Void)? + + internal init(name: String?, reason: String?, userInfo: NSDictionary?, block: ((NSException) -> Void)?) { + _name = name + _reason = reason + _userInfo = userInfo + _block = block + } + + public func matches(actualBlock: () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { + let block: () -> Any? = ({ actualBlock(); return nil }) + let expr = Expression(expression: block, location: location) + + return try! raiseException( + named: _name, + reason: _reason, + userInfo: _userInfo, + closure: _block + ).matches(expr, failureMessage: failureMessage) + } + + public func doesNotMatch(actualBlock: () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { + return !matches(actualBlock, failureMessage: failureMessage, location: location) + } + + public var named: (name: String) -> NMBObjCRaiseExceptionMatcher { + return ({ name in + return NMBObjCRaiseExceptionMatcher( + name: name, + reason: self._reason, + userInfo: self._userInfo, + block: self._block + ) + }) + } + + public var reason: (reason: String?) -> NMBObjCRaiseExceptionMatcher { + return ({ reason in + return NMBObjCRaiseExceptionMatcher( + name: self._name, + reason: reason, + userInfo: self._userInfo, + block: self._block + ) + }) + } + + public var userInfo: (userInfo: NSDictionary?) -> NMBObjCRaiseExceptionMatcher { + return ({ userInfo in + return NMBObjCRaiseExceptionMatcher( + name: self._name, + reason: self._reason, + userInfo: userInfo, + block: self._block + ) + }) + } + + public var satisfyingBlock: (block: ((NSException) -> Void)?) -> NMBObjCRaiseExceptionMatcher { + return ({ block in + return NMBObjCRaiseExceptionMatcher( + name: self._name, + reason: self._reason, + userInfo: self._userInfo, + block: block + ) + }) + } +} + +extension NMBObjCMatcher { + public class func raiseExceptionMatcher() -> NMBObjCRaiseExceptionMatcher { + return NMBObjCRaiseExceptionMatcher(name: nil, reason: nil, userInfo: nil, block: nil) + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift b/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift new file mode 100644 index 0000000..d383a31 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift @@ -0,0 +1,61 @@ +import Foundation + +/// A Nimble matcher that succeeds when the actual value matches with any of the matchers +/// provided in the variable list of matchers. +public func satisfyAnyOf(matchers: U...) -> NonNilMatcherFunc { + return satisfyAnyOf(matchers) +} + +internal func satisfyAnyOf(matchers: [U]) -> NonNilMatcherFunc { + return NonNilMatcherFunc { actualExpression, failureMessage in + let postfixMessages = NSMutableArray() + var matches = false + for matcher in matchers { + if try matcher.matches(actualExpression, failureMessage: failureMessage) { + matches = true + } + postfixMessages.addObject(NSString(string: "{\(failureMessage.postfixMessage)}")) + } + + failureMessage.postfixMessage = "match one of: " + postfixMessages.componentsJoinedByString(", or ") + if let actualValue = try actualExpression.evaluate() { + failureMessage.actualValue = "\(actualValue)" + } + + return matches + } +} + +public func ||(left: NonNilMatcherFunc, right: NonNilMatcherFunc) -> NonNilMatcherFunc { + return satisfyAnyOf(left, right) +} + +public func ||(left: MatcherFunc, right: MatcherFunc) -> NonNilMatcherFunc { + return satisfyAnyOf(left, right) +} + +#if _runtime(_ObjC) +extension NMBObjCMatcher { + public class func satisfyAnyOfMatcher(matchers: [NMBObjCMatcher]) -> NMBObjCMatcher { + return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in + if matchers.isEmpty { + failureMessage.stringValue = "satisfyAnyOf must be called with at least one matcher" + return false + } + + var elementEvaluators = [NonNilMatcherFunc]() + for matcher in matchers { + let elementEvaluator: (Expression, FailureMessage) -> Bool = { + expression, failureMessage in + return matcher.matches( + {try! expression.evaluate()}, failureMessage: failureMessage, location: actualExpression.location) + } + + elementEvaluators.append(NonNilMatcherFunc(elementEvaluator)) + } + + return try! satisfyAnyOf(elementEvaluators).matches(actualExpression, failureMessage: failureMessage) + } + } +} +#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/ThrowError.swift b/Pods/Nimble/Sources/Nimble/Matchers/ThrowError.swift new file mode 100644 index 0000000..9563565 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Matchers/ThrowError.swift @@ -0,0 +1,53 @@ +import Foundation + +/// A Nimble matcher that succeeds when the actual expression throws an +/// error of the specified type or from the specified case. +/// +/// Errors are tried to be compared by their implementation of Equatable, +/// otherwise they fallback to comparision by _domain and _code. +/// +/// Alternatively, you can pass a closure to do any arbitrary custom matching +/// to the thrown error. The closure only gets called when an error was thrown. +/// +/// nil arguments indicates that the matcher should not attempt to match against +/// that parameter. +public func throwError( + error: T? = nil, + errorType: T.Type? = nil, + closure: ((T) -> Void)? = nil) -> MatcherFunc { + return MatcherFunc { actualExpression, failureMessage in + + var actualError: ErrorType? + do { + try actualExpression.evaluate() + } catch let catchedError { + actualError = catchedError + } + + setFailureMessageForError(failureMessage, actualError: actualError, error: error, errorType: errorType, closure: closure) + return errorMatchesNonNilFieldsOrClosure(actualError, error: error, errorType: errorType, closure: closure) + } +} + +/// A Nimble matcher that succeeds when the actual expression throws any +/// error or when the passed closures' arbitrary custom matching succeeds. +/// +/// This duplication to it's generic adequate is required to allow to receive +/// values of the existential type ErrorType in the closure. +/// +/// The closure only gets called when an error was thrown. +public func throwError( + closure closure: ((ErrorType) -> Void)? = nil) -> MatcherFunc { + return MatcherFunc { actualExpression, failureMessage in + + var actualError: ErrorType? + do { + try actualExpression.evaluate() + } catch let catchedError { + actualError = catchedError + } + + setFailureMessageForError(failureMessage, actualError: actualError, closure: closure) + return errorMatchesNonNilFieldsOrClosure(actualError, closure: closure) + } +} diff --git a/Pods/Nimble/Sources/Nimble/Nimble.h b/Pods/Nimble/Sources/Nimble/Nimble.h new file mode 100644 index 0000000..c1d0ebc --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Nimble.h @@ -0,0 +1,7 @@ +#import +#import "NMBExceptionCapture.h" +#import "NMBStringify.h" +#import "DSL.h" + +FOUNDATION_EXPORT double NimbleVersionNumber; +FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; \ No newline at end of file diff --git a/Pods/Nimble/Sources/Nimble/Utils/Async.swift b/Pods/Nimble/Sources/Nimble/Utils/Async.swift new file mode 100644 index 0000000..8f1a6de --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Utils/Async.swift @@ -0,0 +1,358 @@ +import Foundation + +#if _runtime(_ObjC) +import Dispatch + +private let timeoutLeeway: UInt64 = NSEC_PER_MSEC +private let pollLeeway: UInt64 = NSEC_PER_MSEC + +/// Stores debugging information about callers +internal struct WaitingInfo: CustomStringConvertible { + let name: String + let file: FileString + let lineNumber: UInt + + var description: String { + return "\(name) at \(file):\(lineNumber)" + } +} + +internal protocol WaitLock { + func acquireWaitingLock(fnName: String, file: FileString, line: UInt) + func releaseWaitingLock() + func isWaitingLocked() -> Bool +} + +internal class AssertionWaitLock: WaitLock { + private var currentWaiter: WaitingInfo? = nil + init() { } + + func acquireWaitingLock(fnName: String, file: FileString, line: UInt) { + let info = WaitingInfo(name: fnName, file: file, lineNumber: line) + nimblePrecondition( + NSThread.isMainThread(), + "InvalidNimbleAPIUsage", + "\(fnName) can only run on the main thread." + ) + nimblePrecondition( + currentWaiter == nil, + "InvalidNimbleAPIUsage", + "Nested async expectations are not allowed to avoid creating flaky tests.\n\n" + + "The call to\n\t\(info)\n" + + "triggered this exception because\n\t\(currentWaiter!)\n" + + "is currently managing the main run loop." + ) + currentWaiter = info + } + + func isWaitingLocked() -> Bool { + return currentWaiter != nil + } + + func releaseWaitingLock() { + currentWaiter = nil + } +} + +internal enum AwaitResult { + /// Incomplete indicates None (aka - this value hasn't been fulfilled yet) + case Incomplete + /// TimedOut indicates the result reached its defined timeout limit before returning + case TimedOut + /// BlockedRunLoop indicates the main runloop is too busy processing other blocks to trigger + /// the timeout code. + /// + /// This may also mean the async code waiting upon may have never actually ran within the + /// required time because other timers & sources are running on the main run loop. + case BlockedRunLoop + /// The async block successfully executed and returned a given result + case Completed(T) + /// When a Swift Error is thrown + case ErrorThrown(ErrorType) + /// When an Objective-C Exception is raised + case RaisedException(NSException) + + func isIncomplete() -> Bool { + switch self { + case .Incomplete: return true + default: return false + } + } + + func isCompleted() -> Bool { + switch self { + case .Completed(_): return true + default: return false + } + } +} + +/// Holds the resulting value from an asynchronous expectation. +/// This class is thread-safe at receiving an "response" to this promise. +internal class AwaitPromise { + private(set) internal var asyncResult: AwaitResult = .Incomplete + private var signal: dispatch_semaphore_t + + init() { + signal = dispatch_semaphore_create(1) + } + + /// Resolves the promise with the given result if it has not been resolved. Repeated calls to + /// this method will resolve in a no-op. + /// + /// @returns a Bool that indicates if the async result was accepted or rejected because another + /// value was recieved first. + func resolveResult(result: AwaitResult) -> Bool { + if dispatch_semaphore_wait(signal, DISPATCH_TIME_NOW) == 0 { + self.asyncResult = result + return true + } else { + return false + } + } +} + +internal struct AwaitTrigger { + let timeoutSource: dispatch_source_t + let actionSource: dispatch_source_t? + let start: () throws -> Void +} + +/// Factory for building fully configured AwaitPromises and waiting for their results. +/// +/// This factory stores all the state for an async expectation so that Await doesn't +/// doesn't have to manage it. +internal class AwaitPromiseBuilder { + let awaiter: Awaiter + let waitLock: WaitLock + let trigger: AwaitTrigger + let promise: AwaitPromise + + internal init( + awaiter: Awaiter, + waitLock: WaitLock, + promise: AwaitPromise, + trigger: AwaitTrigger) { + self.awaiter = awaiter + self.waitLock = waitLock + self.promise = promise + self.trigger = trigger + } + + func timeout(timeoutInterval: NSTimeInterval, forcefullyAbortTimeout: NSTimeInterval) -> Self { + // = Discussion = + // + // There's a lot of technical decisions here that is useful to elaborate on. This is + // definitely more lower-level than the previous NSRunLoop based implementation. + // + // + // Why Dispatch Source? + // + // + // We're using a dispatch source to have better control of the run loop behavior. + // A timer source gives us deferred-timing control without having to rely as much on + // a run loop's traditional dispatching machinery (eg - NSTimers, DefaultRunLoopMode, etc.) + // which is ripe for getting corrupted by application code. + // + // And unlike dispatch_async(), we can control how likely our code gets prioritized to + // executed (see leeway parameter) + DISPATCH_TIMER_STRICT. + // + // This timer is assumed to run on the HIGH priority queue to ensure it maintains the + // highest priority over normal application / test code when possible. + // + // + // Run Loop Management + // + // In order to properly interrupt the waiting behavior performed by this factory class, + // this timer stops the main run loop to tell the waiter code that the result should be + // checked. + // + // In addition, stopping the run loop is used to halt code executed on the main run loop. + dispatch_source_set_timer( + trigger.timeoutSource, + dispatch_time(DISPATCH_TIME_NOW, Int64(timeoutInterval * Double(NSEC_PER_SEC))), + DISPATCH_TIME_FOREVER, + timeoutLeeway + ) + dispatch_source_set_event_handler(trigger.timeoutSource) { + guard self.promise.asyncResult.isIncomplete() else { return } + let timedOutSem = dispatch_semaphore_create(0) + let semTimedOutOrBlocked = dispatch_semaphore_create(0) + dispatch_semaphore_signal(semTimedOutOrBlocked) + let runLoop = CFRunLoopGetMain() + CFRunLoopPerformBlock(runLoop, kCFRunLoopDefaultMode) { + if dispatch_semaphore_wait(semTimedOutOrBlocked, DISPATCH_TIME_NOW) == 0 { + dispatch_semaphore_signal(timedOutSem) + dispatch_semaphore_signal(semTimedOutOrBlocked) + if self.promise.resolveResult(.TimedOut) { + CFRunLoopStop(CFRunLoopGetMain()) + } + } + } + // potentially interrupt blocking code on run loop to let timeout code run + CFRunLoopStop(runLoop) + let now = dispatch_time(DISPATCH_TIME_NOW, Int64(forcefullyAbortTimeout * Double(NSEC_PER_SEC))) + let didNotTimeOut = dispatch_semaphore_wait(timedOutSem, now) != 0 + let timeoutWasNotTriggered = dispatch_semaphore_wait(semTimedOutOrBlocked, 0) == 0 + if didNotTimeOut && timeoutWasNotTriggered { + if self.promise.resolveResult(.BlockedRunLoop) { + CFRunLoopStop(CFRunLoopGetMain()) + } + } + } + return self + } + + /// Blocks for an asynchronous result. + /// + /// @discussion + /// This function must be executed on the main thread and cannot be nested. This is because + /// this function (and it's related methods) coordinate through the main run loop. Tampering + /// with the run loop can cause undesireable behavior. + /// + /// This method will return an AwaitResult in the following cases: + /// + /// - The main run loop is blocked by other operations and the async expectation cannot be + /// be stopped. + /// - The async expectation timed out + /// - The async expectation succeeded + /// - The async expectation raised an unexpected exception (objc) + /// - The async expectation raised an unexpected error (swift) + /// + /// The returned AwaitResult will NEVER be .Incomplete. + func wait(fnName: String = #function, file: FileString = #file, line: UInt = #line) -> AwaitResult { + waitLock.acquireWaitingLock( + fnName, + file: file, + line: line) + + let capture = NMBExceptionCapture(handler: ({ exception in + self.promise.resolveResult(.RaisedException(exception)) + }), finally: ({ + self.waitLock.releaseWaitingLock() + })) + capture.tryBlock { + do { + try self.trigger.start() + } catch let error { + self.promise.resolveResult(.ErrorThrown(error)) + } + dispatch_resume(self.trigger.timeoutSource) + while self.promise.asyncResult.isIncomplete() { + // Stopping the run loop does not work unless we run only 1 mode + NSRunLoop.currentRunLoop().runMode(NSDefaultRunLoopMode, beforeDate: NSDate.distantFuture()) + } + dispatch_suspend(self.trigger.timeoutSource) + dispatch_source_cancel(self.trigger.timeoutSource) + if let asyncSource = self.trigger.actionSource { + dispatch_source_cancel(asyncSource) + } + } + + return promise.asyncResult + } +} + +internal class Awaiter { + let waitLock: WaitLock + let timeoutQueue: dispatch_queue_t + let asyncQueue: dispatch_queue_t + + internal init( + waitLock: WaitLock, + asyncQueue: dispatch_queue_t, + timeoutQueue: dispatch_queue_t) { + self.waitLock = waitLock + self.asyncQueue = asyncQueue + self.timeoutQueue = timeoutQueue + } + + private func createTimerSource(queue: dispatch_queue_t) -> dispatch_source_t { + return dispatch_source_create( + DISPATCH_SOURCE_TYPE_TIMER, + 0, + DISPATCH_TIMER_STRICT, + queue + ) + } + + func performBlock( + closure: ((T) -> Void) throws -> Void) -> AwaitPromiseBuilder { + let promise = AwaitPromise() + let timeoutSource = createTimerSource(timeoutQueue) + var completionCount = 0 + let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: nil) { + try closure() { + completionCount += 1 + nimblePrecondition( + completionCount < 2, + "InvalidNimbleAPIUsage", + "Done closure's was called multiple times. waitUntil(..) expects its " + + "completion closure to only be called once.") + if promise.resolveResult(.Completed($0)) { + CFRunLoopStop(CFRunLoopGetMain()) + } + } + } + + return AwaitPromiseBuilder( + awaiter: self, + waitLock: waitLock, + promise: promise, + trigger: trigger) + } + + func poll(pollInterval: NSTimeInterval, closure: () throws -> T?) -> AwaitPromiseBuilder { + let promise = AwaitPromise() + let timeoutSource = createTimerSource(timeoutQueue) + let asyncSource = createTimerSource(asyncQueue) + let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: asyncSource) { + let interval = UInt64(pollInterval * Double(NSEC_PER_SEC)) + dispatch_source_set_timer(asyncSource, DISPATCH_TIME_NOW, interval, pollLeeway) + dispatch_source_set_event_handler(asyncSource) { + do { + if let result = try closure() { + if promise.resolveResult(.Completed(result)) { + CFRunLoopStop(CFRunLoopGetCurrent()) + } + } + } catch let error { + if promise.resolveResult(.ErrorThrown(error)) { + CFRunLoopStop(CFRunLoopGetCurrent()) + } + } + } + dispatch_resume(asyncSource) + } + + return AwaitPromiseBuilder( + awaiter: self, + waitLock: waitLock, + promise: promise, + trigger: trigger) + } +} + +internal func pollBlock( + pollInterval pollInterval: NSTimeInterval, + timeoutInterval: NSTimeInterval, + file: FileString, + line: UInt, + fnName: String = #function, + expression: () throws -> Bool) -> AwaitResult { + let awaiter = NimbleEnvironment.activeInstance.awaiter + let result = awaiter.poll(pollInterval) { () throws -> Bool? in + do { + if try expression() { + return true + } + return nil + } catch let error { + throw error + } + }.timeout(timeoutInterval, forcefullyAbortTimeout: timeoutInterval / 2.0).wait(fnName, file: file, line: line) + + return result +} + +#endif diff --git a/Pods/Nimble/Sources/Nimble/Utils/Errors.swift b/Pods/Nimble/Sources/Nimble/Utils/Errors.swift new file mode 100644 index 0000000..29c4723 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Utils/Errors.swift @@ -0,0 +1,133 @@ +import Foundation + +// Generic + +internal func setFailureMessageForError( + failureMessage: FailureMessage, + postfixMessageVerb: String = "throw", + actualError: ErrorType?, + error: T? = nil, + errorType: T.Type? = nil, + closure: ((T) -> Void)? = nil) { + failureMessage.postfixMessage = "\(postfixMessageVerb) error" + + if let error = error { + if let error = error as? CustomDebugStringConvertible { + failureMessage.postfixMessage += " <\(error.debugDescription)>" + } else { + failureMessage.postfixMessage += " <\(error)>" + } + } else if errorType != nil || closure != nil { + failureMessage.postfixMessage += " from type <\(T.self)>" + } + if let _ = closure { + failureMessage.postfixMessage += " that satisfies block" + } + if error == nil && errorType == nil && closure == nil { + failureMessage.postfixMessage = "\(postfixMessageVerb) any error" + } + + if let actualError = actualError { + failureMessage.actualValue = "<\(actualError)>" + } else { + failureMessage.actualValue = "no error" + } +} + +internal func errorMatchesExpectedError( + actualError: ErrorType, + expectedError: T) -> Bool { + return actualError._domain == expectedError._domain + && actualError._code == expectedError._code +} + +internal func errorMatchesExpectedError( + actualError: ErrorType, + expectedError: T) -> Bool { + if let actualError = actualError as? T { + return actualError == expectedError + } + return false +} + +internal func errorMatchesNonNilFieldsOrClosure( + actualError: ErrorType?, + error: T? = nil, + errorType: T.Type? = nil, + closure: ((T) -> Void)? = nil) -> Bool { + var matches = false + + if let actualError = actualError { + matches = true + + if let error = error { + if !errorMatchesExpectedError(actualError, expectedError: error) { + matches = false + } + } + if let actualError = actualError as? T { + if let closure = closure { + let assertions = gatherFailingExpectations { + closure(actualError as T) + } + let messages = assertions.map { $0.message } + if messages.count > 0 { + matches = false + } + } + } else if errorType != nil && closure != nil { + // The closure expects another ErrorType as argument, so this + // is _supposed_ to fail, so that it becomes more obvious. + let assertions = gatherExpectations { + expect(actualError is T).to(equal(true)) + } + precondition(assertions.map { $0.message }.count > 0) + matches = false + } + } + + return matches +} + +// Non-generic + +internal func setFailureMessageForError( + failureMessage: FailureMessage, + actualError: ErrorType?, + closure: ((ErrorType) -> Void)?) { + failureMessage.postfixMessage = "throw error" + + if let _ = closure { + failureMessage.postfixMessage += " that satisfies block" + } else { + failureMessage.postfixMessage = "throw any error" + } + + if let actualError = actualError { + failureMessage.actualValue = "<\(actualError)>" + } else { + failureMessage.actualValue = "no error" + } +} + +internal func errorMatchesNonNilFieldsOrClosure( + actualError: ErrorType?, + closure: ((ErrorType) -> Void)?) -> Bool { + var matches = false + + if let actualError = actualError { + matches = true + + if let closure = closure { + let assertions = gatherFailingExpectations { + closure(actualError) + } + let messages = assertions.map { $0.message } + if messages.count > 0 { + matches = false + } + } + } + + return matches +} diff --git a/Pods/Nimble/Sources/Nimble/Utils/Functional.swift b/Pods/Nimble/Sources/Nimble/Utils/Functional.swift new file mode 100644 index 0000000..e85c755 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Utils/Functional.swift @@ -0,0 +1,12 @@ +import Foundation + +extension SequenceType { + internal func all(fn: Generator.Element -> Bool) -> Bool { + for item in self { + if !fn(item) { + return false + } + } + return true + } +} diff --git a/Pods/Nimble/Sources/Nimble/Utils/SourceLocation.swift b/Pods/Nimble/Sources/Nimble/Utils/SourceLocation.swift new file mode 100644 index 0000000..a7279aa --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Utils/SourceLocation.swift @@ -0,0 +1,31 @@ +import Foundation + +// Ideally we would always use `StaticString` as the type for tracking the file name +// that expectations originate from, for consistency with `assert` etc. from the +// stdlib, and because recent versions of the XCTest overlay require `StaticString` +// when calling `XCTFail`. Under the Objective-C runtime (i.e. building on Mac), we +// have to use `String` instead because StaticString can't be generated from Objective-C +#if _runtime(_ObjC) +public typealias FileString = String +#else +public typealias FileString = StaticString +#endif + +public final class SourceLocation : NSObject { + public let file: FileString + public let line: UInt + + override init() { + file = "Unknown File" + line = 0 + } + + init(file: FileString, line: UInt) { + self.file = file + self.line = line + } + + override public var description: String { + return "\(file):\(line)" + } +} diff --git a/Pods/Nimble/Sources/Nimble/Utils/Stringers.swift b/Pods/Nimble/Sources/Nimble/Utils/Stringers.swift new file mode 100644 index 0000000..4edead3 --- /dev/null +++ b/Pods/Nimble/Sources/Nimble/Utils/Stringers.swift @@ -0,0 +1,171 @@ +import Foundation + + +internal func identityAsString(value: AnyObject?) -> String { + if let value = value { + return NSString(format: "<%p>", unsafeBitCast(value, Int.self)).description + } else { + return "nil" + } +} + +internal func classAsString(cls: AnyClass) -> String { +#if _runtime(_ObjC) + return NSStringFromClass(cls) +#else + return String(cls) +#endif +} + +internal func arrayAsString(items: [T], joiner: String = ", ") -> String { + return items.reduce("") { accum, item in + let prefix = (accum.isEmpty ? "" : joiner) + return accum + prefix + "\(stringify(item))" + } +} + +/// A type with a customized test output text representation. +/// +/// This textual representation is produced when values will be +/// printed in test runs, and may be useful when producing +/// error messages in custom matchers. +/// +/// - SeeAlso: `CustomDebugStringConvertible` +public protocol TestOutputStringConvertible { + var testDescription: String { get } +} + +extension Double: TestOutputStringConvertible { + public var testDescription: String { + return NSNumber(double: self).testDescription + } +} + +extension Float: TestOutputStringConvertible { + public var testDescription: String { + return NSNumber(float: self).testDescription + } +} + +extension NSNumber: TestOutputStringConvertible { + // This is using `NSString(format:)` instead of + // `String(format:)` because the latter somehow breaks + // the travis CI build on linux. + public var testDescription: String { + let description = self.description + + if description.containsString(".") { + // Travis linux swiftpm build doesn't like casting String to NSString, + // which is why this annoying nested initializer thing is here. + // Maybe this will change in a future snapshot. + let decimalPlaces = NSString(string: NSString(string: description) + .componentsSeparatedByString(".")[1]) + + if decimalPlaces.length > 4 { + return NSString(format: "%0.4f", self.doubleValue).description + } + } + return self.description + } +} + +extension Array: TestOutputStringConvertible { + public var testDescription: String { + let list = self.map(Nimble.stringify).joinWithSeparator(", ") + return "[\(list)]" + } +} + +extension AnySequence: TestOutputStringConvertible { + public var testDescription: String { + let generator = self.generate() + var strings = [String]() + var value: AnySequence.Generator.Element? + + repeat { + value = generator.next() + if let value = value { + strings.append(stringify(value)) + } + } while value != nil + + let list = strings.joinWithSeparator(", ") + return "[\(list)]" + } +} + +extension NSArray: TestOutputStringConvertible { + public var testDescription: String { + let list = Array(self).map(Nimble.stringify).joinWithSeparator(", ") + return "(\(list))" + } +} + +extension NSIndexSet: TestOutputStringConvertible { + public var testDescription: String { + let list = Array(self).map(Nimble.stringify).joinWithSeparator(", ") + return "(\(list))" + } +} + +extension String: TestOutputStringConvertible { + public var testDescription: String { + return self + } +} + +extension NSData: TestOutputStringConvertible { + public var testDescription: String { + #if os(Linux) + // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11-16) + return "NSData" + #else + return "NSData" + #endif + } +} + +/// +/// Returns a string appropriate for displaying in test output +/// from the provided value. +/// +/// - parameter value: A value that will show up in a test's output. +/// +/// - returns: The string that is returned can be +/// customized per type by conforming a type to the `TestOutputStringConvertible` +/// protocol. When stringifying a non-`TestOutputStringConvertible` type, this +/// function will return the value's debug description and then its +/// normal description if available and in that order. Otherwise it +/// will return the result of constructing a string from the value. +/// +/// - SeeAlso: `TestOutputStringConvertible` +@warn_unused_result +public func stringify(value: T) -> String { + if let value = value as? TestOutputStringConvertible { + return value.testDescription + } + + if let value = value as? CustomDebugStringConvertible { + return value.debugDescription + } + + return String(value) +} + +/// -SeeAlso: `stringify(value: T)` +@warn_unused_result +public func stringify(value: T?) -> String { + if let unboxed = value { + return stringify(unboxed) + } + return "nil" +} + +#if _runtime(_ObjC) +@objc public class NMBStringer: NSObject { + @warn_unused_result + @objc public class func stringify(obj: AnyObject?) -> String { + return Nimble.stringify(obj) + } +} +#endif diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj new file mode 100644 index 0000000..bcaa6f2 --- /dev/null +++ b/Pods/Pods.xcodeproj/project.pbxproj @@ -0,0 +1,1867 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 075F28105E1A8E22843E83D3D0F0C070 /* BeEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA65CD97D65A096D85D89CF5B3CB80E6 /* BeEmpty.swift */; }; + 0B89B16D2C597257F89D94DE2162411F /* BeLessThan.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8845F9989AC93F8506CE46EA4F6A222C /* BeLessThan.swift */; }; + 109BB58C1D195F18FB91C32C79D948F6 /* CurrentTestCaseTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 495AE1EE44312328995F1F67DC4FBFEE /* CurrentTestCaseTracker.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 161BCC2087D1DE3BEF9E6696AFA50D8B /* Contain.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE38032F4981C217CEF4B67190234985 /* Contain.swift */; }; + 16DC1C78892961862F590440617395B5 /* ModuleType.swift in Sources */ = {isa = PBXBuildFile; fileRef = E527CA7D456B242AB3170A4DE64D4FC4 /* ModuleType.swift */; }; + 179BCB11833E91E87D1D2D3D9A35F5C4 /* Alamofire-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 10423D62D01C2F1757A84102D80DDD29 /* Alamofire-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 196556115ADCC76626D133AAE405A143 /* BeNil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A2A18CDB81CD0E48FB478535AA20381 /* BeNil.swift */; }; + 1E26879350C25330CC7E37ECA0A03F48 /* Match.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF78ED04C0FBAB4FF6831AF848BB0566 /* Match.swift */; }; + 1F732076F83E4E2678150141426F35C5 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63098961705BDDC8582CCEB8FBB955F9 /* XCTest.framework */; }; + 2112D363BA94BC1852A38368C97E8F6E /* Equal.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5D0BA81842E9420FD7E80741A96F6CD /* Equal.swift */; }; + 21BCCE21B7B9973E4200772AF5E9D86A /* NMBObjCMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86E90D58F379F6EABED3C4BF326183B8 /* NMBObjCMatcher.swift */; }; + 228A3971377921306666C6157E104788 /* Pods-Harbor-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D569365AFE25C35B9A0CBB83471712B /* Pods-Harbor-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 22DFAF35C947A2B04AE7D96CB221A281 /* QuickSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A742507973AD8C74567FA29F5D30403 /* QuickSpec.m */; }; + 26D1E713401F903BAFBB8BCAAAE5D695 /* Pods-Harbor-HarborTests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = C64AE65FCDCA47402F5F4901ED5894BA /* Pods-Harbor-HarborTests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2773C1490D28172B17FEBD4CC2206B25 /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F00F4497E6144A06F3519FDD6FC0B43 /* Error.swift */; }; + 28F68DB7F37C2376D41FBE40D8C36CD1 /* DSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B8C204E163D95812DFBA5A07BCF7B33 /* DSL.swift */; }; + 2ACB9CB8A26879036699DB9978EF738A /* ExampleHooks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D2A2BF72538B619B5759C577625A661 /* ExampleHooks.swift */; }; + 2BFAEB4B70F0F463E6A16AD58E3D5B5B /* Expression.swift in Sources */ = {isa = PBXBuildFile; fileRef = C81D8D31CDE25670C501B737DCD2A865 /* Expression.swift */; }; + 2D69A1D3B76194A0B7BCE8FEDD61E549 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41EED3E0E03A762BB990D4361CEC2AE6 /* Result.swift */; }; + 2D8AF35C7641514E5F8FBB9974361D8E /* Callsite.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C89C71A8403840A0BB64CB95919A70D /* Callsite.swift */; }; + 314890F485CA976FC7828866DAE0424B /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A95353F125C756B84B5E440064DAD52E /* Cocoa.framework */; }; + 3177B0D0B6992E070B3CD6CEBA36EAD8 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A95353F125C756B84B5E440064DAD52E /* Cocoa.framework */; }; + 32F4DB08C2ABBCC7175ACD85E4F120BF /* DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CD0BCF6DFE76BC3E2407EBBA4E700F9 /* DSL.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 358B36BA80110B363CF1AA9F770BE388 /* String+FileName.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE3CB8BBCA054EB1F11790885808534B /* String+FileName.swift */; }; + 367C38327141B05FB962430CACA58C39 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3219944ED4F255798AF34C5F00BDED90 /* MatcherFunc.swift */; }; + 3A89284DBC735A0B24C462E44F5C4CD5 /* NMBExceptionCapture.m in Sources */ = {isa = PBXBuildFile; fileRef = CDD7417FD62307D4863D6E23001694BC /* NMBExceptionCapture.m */; }; + 3AD8042722070A5B70147470DADAFDA6 /* ResponseSerialization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28F19051FDC7ACCF8F69E018937CC19B /* ResponseSerialization.swift */; }; + 3CC0FC09924A0C77FE018338665C2CA1 /* NSString+QCKSelectorName.m in Sources */ = {isa = PBXBuildFile; fileRef = D0BA72DDA5CD0E3A4CB0921CC0A82F99 /* NSString+QCKSelectorName.m */; }; + 3D2B235152D7964F438ADC9F5098B6D4 /* Nimble-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 57A4738F6BBF22846D08E31FA6D5B2AA /* Nimble-dummy.m */; }; + 403C427FFDECF2C50FC4F5389BB52762 /* Manager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E124AD2F8C71E5916D4FD522161B54BA /* Manager.swift */; }; + 43A4ABB1D106D02F54E1050080CD5B11 /* QCKDSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E7E8756DA98AB34195A84652B88D8F0 /* QCKDSL.m */; }; + 44B814612343317858F3CFD05D649D37 /* World.h in Headers */ = {isa = PBXBuildFile; fileRef = 1338EF30A5F8D50C58E592C93EA75A8C /* World.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 48FFBA8DFE01FB181B25270EB6995B09 /* ThrowError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E0CDD9BCD7916809AC6F305B48FE568 /* ThrowError.swift */; }; + 4C2B51BA7586DCFE3613118CF2EA4B46 /* Module.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2E69F593D5DCFA2650E695FAB5FA09D /* Module.swift */; }; + 4D0FFA03BB28F4F45A760ECC597895C5 /* ParameterEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28FB6AF27BE255686BD1AFA57073EAA4 /* ParameterEncoding.swift */; }; + 5216BFCFA74D54E0F9CB7F608562594C /* NimbleEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE9154705C2BE5F38A5DB8D9582DF07F /* NimbleEnvironment.swift */; }; + 5578D8407F8DC97E22E1B73FF48CEFA6 /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6014A88120411C189202BA27080742F /* Error.swift */; }; + 577C807BE1266678AB3552646513EDB9 /* NSString+QCKSelectorName.h in Headers */ = {isa = PBXBuildFile; fileRef = 99F1D57124A1ABB9194EC6DF7A6D3F86 /* NSString+QCKSelectorName.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 57B0AFBF2C374DBD4C2EDA9034B8C8F1 /* Drip-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F4AA4748ED11A05CBA5D57EB3196AC1 /* Drip-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 59642D5E95DEA7275F8FA53433E1DC89 /* NMBStringify.m in Sources */ = {isa = PBXBuildFile; fileRef = E8C100281E2EC3CF760237FFF26090CA /* NMBStringify.m */; }; + 5A0357A7597C437B7E1A3C3EE7B02A59 /* Filter.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEDFABFA70784CAB8125B8DBF3035430 /* Filter.swift */; }; + 5B00A0231CAA6677F190FA487D0AF119 /* AssertionDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DA0B2450807443EC033440B03991E34 /* AssertionDispatcher.swift */; }; + 5B7EC1CC142D1D0C2032380C607CCBCD /* EndWith.swift in Sources */ = {isa = PBXBuildFile; fileRef = F978017D37AC68B0FA3434989617E3F0 /* EndWith.swift */; }; + 5E582577049DB198C70F130D8B760B28 /* SuiteHooks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2468F4A5E7BF51D3B795B1307ADF1010 /* SuiteHooks.swift */; }; + 604AC2A8EDCFC2D2DA7B42412D62593A /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0F9E01C2737784204D68DE9364D168 /* Response.swift */; }; + 65C4902958E77355D2329B02B3CFF3DC /* Functions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94D17F98116FBF4081C6C9E896245BF9 /* Functions.swift */; }; + 65D6B53558097D62629681DA1ADE51E9 /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0943E1E7A5136DABE18B984F151A25E /* MatcherProtocols.swift */; }; + 6843AD2E5ED4BEA296B29C67FADD7355 /* ServerTrustPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD9C76066AF90F59F666A93E4C3DB23B /* ServerTrustPolicy.swift */; }; + 68AE2AE4B7FC7BA8C855605AD0722A93 /* QuickConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 265F3D51B0F37035512D7E64B7572F14 /* QuickConfiguration.m */; }; + 6A44A219B116FCBBBB2CC031F91F44AA /* Pods-Harbor-HarborTests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = CAC5CC8DEA461646D8D32DFCB1718C63 /* Pods-Harbor-HarborTests-dummy.m */; }; + 6C6EA2295328EDEBF622876216F69E92 /* NMBExceptionCapture.h in Headers */ = {isa = PBXBuildFile; fileRef = F8E25D4AA9FD338C8558DEF409773F8D /* NMBExceptionCapture.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 6D7C2A218F927C3CE2A49ED5F55FDE3E /* Alamofire-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 85BCE327961EB286FBCCC0CA61D0FC0A /* Alamofire-dummy.m */; }; + 6F4ECB2EA5A02047EE910B492EAB3439 /* AdapterProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC239F00451843C10B1884909FB6DC83 /* AdapterProtocols.swift */; }; + 72302926D92372DF5ED2ACEE2892497D /* World+DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = FC32BBF28C10D9595AE37A913E122026 /* World+DSL.h */; settings = {ATTRIBUTES = (Project, ); }; }; + 7344D7241D30291EDEC12EB513A1F90F /* BeCloseTo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77D643F4CF8D04E90A69E68A3FC11DEC /* BeCloseTo.swift */; }; + 74D462DF9537880701EA41FB6AFE70D2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A95353F125C756B84B5E440064DAD52E /* Cocoa.framework */; }; + 75E0337B84CD42D0B99D231D8FF67BD0 /* Nimble.h in Headers */ = {isa = PBXBuildFile; fileRef = 440CE46595C0399689409632411BC10B /* Nimble.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 78BAA96B95C46E5D9788B90C0F661BB5 /* BeGreaterThan.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5CCADBDA46C939B707E0F03CFABA5A5 /* BeGreaterThan.swift */; }; + 7B6EE6EEA1E882534927E9C82F19DCBC /* QuickConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 458CEB9B89EED6F11374E5AEBC1F5F7F /* QuickConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7C87D019545C5B28FF9485378EA526FB /* Nimble-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 121FED2F5528102F434E1A27E41593D3 /* Nimble-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7D2F56765E1ABA3C2E3DFB6FD902943A /* Pods-Harbor-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = CA49ABDD8591527117CCFAE2B27B94AA /* Pods-Harbor-dummy.m */; }; + 7E20C0534C5F7193DC222A8FD04C01DF /* NimbleXCTestHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0B381DE8947BF8FBE4B96E7CC1CB8F7 /* NimbleXCTestHandler.swift */; }; + 8311C8D2119149754BA0A8008BBADE6F /* Upload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E461BC3E88F17D1A9098DB9AB5F7F06 /* Upload.swift */; }; + 839C50FCF12B5F7485BE3D00A106ED55 /* NMBExpectation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E5AB013292AC10ABA780EE1FCB172EC /* NMBExpectation.swift */; }; + 86543673C46E9857381FA5B04D2363AE /* XCTestObservationCenter+Register.m in Sources */ = {isa = PBXBuildFile; fileRef = F6327AAE6465E2EEC38F3E3552338636 /* XCTestObservationCenter+Register.m */; }; + 88AD249C129E8E9E33B6D964E2E42267 /* MultipartFormData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8624C00865D48D2EB1EBDF231C9E5A46 /* MultipartFormData.swift */; }; + 8B30FA48E7E71BB2758FA4F3894D0DDA /* QuickSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = D4D7F976C6BF46F8392148154531C479 /* QuickSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 92568591EFAAE72FFE8106C67591095D /* XCTestSuite+QuickTestSuiteBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = 68907ECA473D929ED84CA2D373A2E079 /* XCTestSuite+QuickTestSuiteBuilder.m */; }; + 9332B9B171F7327A4E9ED5B24C890586 /* NetworkReachabilityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F080787983D415A9F6AA4B8D38273201 /* NetworkReachabilityManager.swift */; }; + 940BB4E7794C7F86316B278C68A5B282 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A95353F125C756B84B5E440064DAD52E /* Cocoa.framework */; }; + 974690EB3A304E56198D368B73E001A0 /* DSL+Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE55F2B4FA30DCDCECFB52869DF2C69F /* DSL+Wait.swift */; }; + 9E43E4F947F2F33A0017FBFA82211AF4 /* BeginWith.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C5C94988917F2650DE151A1CD6F93D2 /* BeginWith.swift */; }; + 9FF60F30C86C1A87BCDE9C4569210367 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A95353F125C756B84B5E440064DAD52E /* Cocoa.framework */; }; + A476AAF1B3C982C6C4E755D00D9D6326 /* AllPass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7157B44B56FC49DDA4BBDA37BD42E6 /* AllPass.swift */; }; + A47DC2C1E8DBD55F4F2A4C2EDBF01DAC /* ExampleMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CBD5A10B0222D10A391900585B3472F /* ExampleMetadata.swift */; }; + A566113AACC724968ECC46145180BE25 /* Timeline.swift in Sources */ = {isa = PBXBuildFile; fileRef = 026ABF79B9FD4435D735977B1FCFF699 /* Timeline.swift */; }; + AB9FC86AF8F62DBA78574BFF5BF9941C /* BeAnInstanceOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B56CFF5015CFC6163A4705CA5E9F858 /* BeAnInstanceOf.swift */; }; + AC05C274E5425174CA414F455D0E5D67 /* Registry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 359C91F6B7A55CD3526F02DAEC66E7BE /* Registry.swift */; }; + AD8BB984EB14E08DA975D54FB1AAACC1 /* KeyConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64D58A22979A4D927FCD7A7DC0E0AA98 /* KeyConvertible.swift */; }; + AEB50A58345DA54B95DD796B0C255ECC /* DSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = C117E928AA722C852F127E43219E8172 /* DSL.swift */; }; + AFD2269DD816FE757B2DCBC33EAC72DF /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = E40BDD807AF8570578A42AA287682687 /* Notifications.swift */; }; + B1F4F81BC2336B8988682B84E0255F77 /* ErrorUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 694349CCE897A01E187C45E9703B8A36 /* ErrorUtility.swift */; }; + B28AA224BFD0EF6B0B567957FC895C71 /* BeLogical.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA18B2034E4F838D89D1D8AA9BC2B6ED /* BeLogical.swift */; }; + B3A05C14ADDFC32FD933712C304DAEBB /* MatchError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6637A35C4A26012E2F48E93F9758BD4D /* MatchError.swift */; }; + B53214E7AA63B8AF2AE808920D7B0CD1 /* Expectation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8499FA51EE64CC8AFB98E3E8079F035C /* Expectation.swift */; }; + B8360BB6A6312C35A61269F2FA0CFCC8 /* Drip-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BB3FA921A6FFD62FF2FA7C95F8DD2F9 /* Drip-dummy.m */; }; + B8E3AB1BED4EFA90B6C95BDDC81F10FC /* Download.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7D667D3A80A30808037AAEA5604F646 /* Download.swift */; }; + BA677E5F25A70188FE220FF5B1ADCF11 /* Key.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B74D4B3F26045ECBC343B1B3803E74A /* Key.swift */; }; + BA7C58094F7FAA3070D09C817735970F /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9F25934A146074E8376A784EEA04EA3 /* SourceLocation.swift */; }; + BBFEA0AACBF8FAE356C80BD187457B35 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 086EDD09E2D87FAB4318B4DB104DD9D1 /* RaisesException.swift */; }; + BDCE4264022C723EE1B8821543FBCEC2 /* Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEC84717A923630DF3840ADCAFBABF47 /* Alamofire.swift */; }; + BE6AC5C2CEC681A80DAD817263FA06B1 /* NMBStringify.h in Headers */ = {isa = PBXBuildFile; fileRef = CC59BD62028BA039FD9272A40B1A7B58 /* NMBStringify.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BEF949A7A436658AFEEDAC6595C993DF /* Validation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C28A7BCDBC04D638C3759F777D78F4A /* Validation.swift */; }; + BF2956C22305FC4D7BEC2EF4D1B95CA6 /* BeLessThanOrEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ECFB951F0348F4317CE933D91BC9028 /* BeLessThanOrEqual.swift */; }; + C02183449F74878BE6B1C9537E162A36 /* Stream.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC188AA6309C48AE0D288EE82D2005C /* Stream.swift */; }; + C28675B0CD8F3BAFADE96CA8CF9616D7 /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0914FA00CA9014A5386E361779806555 /* Configuration.swift */; }; + C651484D0BC15626865DBB44789BE033 /* BeIdenticalTo.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54DD25210BF00B158EF0296F043059C /* BeIdenticalTo.swift */; }; + C756B3974E579D9764182919E1509235 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 105E4821ACD5F11C05C2B62664F2800B /* Async.swift */; }; + C8E2D40D7D44DF3C6E4CE767CC1A4A14 /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A0937F0B6DF412BB3C6B7DED95EA2B1 /* Errors.swift */; }; + C959DB4EE887E4B43CFD2483064F2E21 /* QCKDSL.h in Headers */ = {isa = PBXBuildFile; fileRef = ED8DC06806A41137E3F1EC135C3E7BA4 /* QCKDSL.h */; settings = {ATTRIBUTES = (Public, ); }; }; + CB83D9847C81D1422BD9E9E6EE985BE8 /* Component.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85AA7F3F16F78357A3A86B448FF7BFC6 /* Component.swift */; }; + CE6A6C47A4E532DB10E0065230E83883 /* BeAKindOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EA9BE70A22571D0000AC22ADBB4A67F /* BeAKindOf.swift */; }; + D052B655FE63493EE95908DF7A85E40B /* Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17CBF9DDBF8B5E4679A467601F237467 /* Example.swift */; }; + D251440D3CFB8FAF21668C29DCDAE6D5 /* DSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B1D0714223D1BA21E4DF159D4A3E859 /* DSL.m */; }; + D3C0C46B72361F51027A32F960C26BC9 /* ComponentType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7393BF2EA37A451A80887DCF7DB45D1 /* ComponentType.swift */; }; + D4481D648EE8CDF60132F3890393CCAC /* World+DSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FFED529618912452D9D1BB0BBD7BF5B /* World+DSL.swift */; }; + D7642FC5BB937DBD4040656BA125BCD7 /* Quick.h in Headers */ = {isa = PBXBuildFile; fileRef = DC087B79ECB5D3BEDE9143441BFC7012 /* Quick.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D7D01A2178D23684AB9C9862B191CC81 /* Stringers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376FAE36B2DD314CA6F9531CDC36E17D /* Stringers.swift */; }; + DF5C77A89BFC2F6F3083DEAA6DF039B5 /* SatisfyAnyOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F5D001CE7EE5829B62EA454EBB4E080 /* SatisfyAnyOf.swift */; }; + DFF854AD1C8F35C20C7F860852006275 /* QuickSelectedTestSuiteBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A733A4B5DF46376209A11E848203AAB /* QuickSelectedTestSuiteBuilder.swift */; }; + E23E3933061E230DA89F751856B3E739 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A95353F125C756B84B5E440064DAD52E /* Cocoa.framework */; }; + E27D1376AB13211EB6CEA9B2242D5FC0 /* Quick-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = F9907DC6CF53E838EFCB2EDE9D459FFC /* Quick-dummy.m */; }; + E33844F843442A08EFAC800D80D5209B /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = B79706C6477D71B92734362A526F87A0 /* Request.swift */; }; + E5F20A5E751A4FCC4C0FC34C4E3D435C /* HaveCount.swift in Sources */ = {isa = PBXBuildFile; fileRef = F34B87C9CC6BD02E06A4029001ED7655 /* HaveCount.swift */; }; + E6F3AF2C99EC2D138AFDDAD09621A4E4 /* ExampleGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78CA2F9E3A877F1B9BB102EADB84A0FE /* ExampleGroup.swift */; }; + E7204BD667436FC5E97575180BCF8840 /* HooksPhase.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAFCC22565EECAC2EDE963A46066508B /* HooksPhase.swift */; }; + EB1FD1BA75E278CA8A7D5FA9919A8C23 /* Closures.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE7A2A20C78648B9DEBB4B22399B317C /* Closures.swift */; }; + ED5709A67E240471FEE0D3C07D8531A8 /* FailureMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BFF8A0C284F85614F90B396B3628F0 /* FailureMessage.swift */; }; + EEF3B566B7C59B8C5231ABDDC3DB70A6 /* PostNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3541B29464CBF1CB8FD56B5E05BF95DF /* PostNotification.swift */; }; + EFC734F3D9A6827BF79E2688C029A677 /* Quick-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 5952CB66AD60AE3C66D66F0B027AF929 /* Quick-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F12E2D8A8006DE25EF9DC1D30826D6F0 /* AsyncMatcherWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE82C7835724E3971E565C7E32C6902D /* AsyncMatcherWrapper.swift */; }; + F1F5DADE21E9F72A08E97761EDD001D9 /* World.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67A638A8A0DFAF5AD9FA87FF78BDC757 /* World.swift */; }; + F582E62E8EBF109FE2F51F69E8329A10 /* BeGreaterThanOrEqualTo.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E1D82773DAA1A552498226139204C7 /* BeGreaterThanOrEqualTo.swift */; }; + FB63F631C2771B7CAFB5CB29249F9C29 /* QuickTestSuite.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5F65524E7AEA2DE6665A42D7DDFF464 /* QuickTestSuite.swift */; }; + FC23FEAFA43F04A91A0C081444943CED /* Functional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FED89D8CDE565610E458A1C7FB0311D /* Functional.swift */; }; + FD87771144938D7D5CC55AE5B9FED403 /* NSBundle+CurrentTestBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FFA5C56D87882E1B52C85DAC9C47327 /* NSBundle+CurrentTestBundle.swift */; }; + FE98D212BF396D1E94464344B9F37FF3 /* AssertionRecorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC9983681F505967623D08AB3851CF7 /* AssertionRecorder.swift */; }; + FFC5ECA743A6F3F1B98B3080029668BD /* BeVoid.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07A6D56A141E07B72B43C5470D00D56F /* BeVoid.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 00254BF1C6C76413208898090E75FCF3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2A93D8D1E1FB9CDEEEC9AE11C3DDDF9A; + remoteInfo = Quick; + }; + 0A37DD6D3BAC9C5DAA78F81EAD2C8009 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = C618C5B1AEDEB14F21A2BF4D9A06C986; + remoteInfo = Drip; + }; + 14BB197FA60F00671C516085A7CB3E0F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4BE42DB6DF6A3DE525D05F5B914C4918; + remoteInfo = Alamofire; + }; + 83403177958E3000340FEFF9A87CD753 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 58FC8A7F2A7317B6E5EA88C861638367; + remoteInfo = Nimble; + }; + 847D36CB4868B6776B67C7C44E073B74 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4BE42DB6DF6A3DE525D05F5B914C4918; + remoteInfo = Alamofire; + }; + A9F2C5EB10D0933DE70FE0D72D76864E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = C618C5B1AEDEB14F21A2BF4D9A06C986; + remoteInfo = Drip; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 0213AF2493D1FC2D9C3E5C8B458B675E /* Pods-Harbor-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Harbor-frameworks.sh"; sourceTree = ""; }; + 026ABF79B9FD4435D735977B1FCFF699 /* Timeline.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Timeline.swift; path = Source/Timeline.swift; sourceTree = ""; }; + 03BE457F992E7F608E26702EB45E7A50 /* Pods-Harbor.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-Harbor.modulemap"; sourceTree = ""; }; + 077152A0DD72AF883AF6484386DEF9EB /* Pods-Harbor-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Harbor-resources.sh"; sourceTree = ""; }; + 07A6D56A141E07B72B43C5470D00D56F /* BeVoid.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeVoid.swift; path = Sources/Nimble/Matchers/BeVoid.swift; sourceTree = ""; }; + 086EDD09E2D87FAB4318B4DB104DD9D1 /* RaisesException.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RaisesException.swift; path = Sources/Nimble/Matchers/RaisesException.swift; sourceTree = ""; }; + 0914FA00CA9014A5386E361779806555 /* Configuration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Configuration.swift; path = Sources/Quick/Configuration/Configuration.swift; sourceTree = ""; }; + 0A0937F0B6DF412BB3C6B7DED95EA2B1 /* Errors.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Errors.swift; path = Sources/Nimble/Utils/Errors.swift; sourceTree = ""; }; + 0F5D001CE7EE5829B62EA454EBB4E080 /* SatisfyAnyOf.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SatisfyAnyOf.swift; path = Sources/Nimble/Matchers/SatisfyAnyOf.swift; sourceTree = ""; }; + 10423D62D01C2F1757A84102D80DDD29 /* Alamofire-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Alamofire-umbrella.h"; sourceTree = ""; }; + 105E4821ACD5F11C05C2B62664F2800B /* Async.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Async.swift; path = Sources/Nimble/Utils/Async.swift; sourceTree = ""; }; + 11AC5FB21BE270A67D23D4E02F64D8CD /* Drip.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Drip.modulemap; sourceTree = ""; }; + 121FED2F5528102F434E1A27E41593D3 /* Nimble-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Nimble-umbrella.h"; sourceTree = ""; }; + 1259C813D4A8CD872EE7D795DFC7A201 /* Pods-Harbor.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Harbor.test.xcconfig"; sourceTree = ""; }; + 1338EF30A5F8D50C58E592C93EA75A8C /* World.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = World.h; path = Sources/Quick/World.h; sourceTree = ""; }; + 177CD98890C9EC0B998A319A1983C77F /* Pods-Harbor-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Harbor-acknowledgements.plist"; sourceTree = ""; }; + 17CBF9DDBF8B5E4679A467601F237467 /* Example.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Example.swift; path = Sources/Quick/Example.swift; sourceTree = ""; }; + 1A742507973AD8C74567FA29F5D30403 /* QuickSpec.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = QuickSpec.m; path = Sources/Quick/QuickSpec.m; sourceTree = ""; }; + 1B8C204E163D95812DFBA5A07BCF7B33 /* DSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DSL.swift; path = Sources/Quick/DSL/DSL.swift; sourceTree = ""; }; + 1ECFB951F0348F4317CE933D91BC9028 /* BeLessThanOrEqual.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeLessThanOrEqual.swift; path = Sources/Nimble/Matchers/BeLessThanOrEqual.swift; sourceTree = ""; }; + 228873E21DE0F3D89324BAC41E96ED49 /* Drip.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Drip.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 23E60803B3673E452128097187EA4426 /* Pods-Harbor-HarborTests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-Harbor-HarborTests.modulemap"; sourceTree = ""; }; + 2468F4A5E7BF51D3B795B1307ADF1010 /* SuiteHooks.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SuiteHooks.swift; path = Sources/Quick/Hooks/SuiteHooks.swift; sourceTree = ""; }; + 265F3D51B0F37035512D7E64B7572F14 /* QuickConfiguration.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = QuickConfiguration.m; path = Sources/Quick/Configuration/QuickConfiguration.m; sourceTree = ""; }; + 28F19051FDC7ACCF8F69E018937CC19B /* ResponseSerialization.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ResponseSerialization.swift; path = Source/ResponseSerialization.swift; sourceTree = ""; }; + 28FB6AF27BE255686BD1AFA57073EAA4 /* ParameterEncoding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ParameterEncoding.swift; path = Source/ParameterEncoding.swift; sourceTree = ""; }; + 2A733A4B5DF46376209A11E848203AAB /* QuickSelectedTestSuiteBuilder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = QuickSelectedTestSuiteBuilder.swift; path = Sources/Quick/QuickSelectedTestSuiteBuilder.swift; sourceTree = ""; }; + 2BB3FA921A6FFD62FF2FA7C95F8DD2F9 /* Drip-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Drip-dummy.m"; sourceTree = ""; }; + 2C3E885A74690ECFA6C19ACCE38C149C /* Pods_Harbor_HarborTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Harbor_HarborTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2CBD5A10B0222D10A391900585B3472F /* ExampleMetadata.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExampleMetadata.swift; path = Sources/Quick/ExampleMetadata.swift; sourceTree = ""; }; + 2D569365AFE25C35B9A0CBB83471712B /* Pods-Harbor-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Harbor-umbrella.h"; sourceTree = ""; }; + 2DA0B2450807443EC033440B03991E34 /* AssertionDispatcher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AssertionDispatcher.swift; path = Sources/Nimble/Adapters/AssertionDispatcher.swift; sourceTree = ""; }; + 2E0CDD9BCD7916809AC6F305B48FE568 /* ThrowError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ThrowError.swift; path = Sources/Nimble/Matchers/ThrowError.swift; sourceTree = ""; }; + 2E5D06D58C9C0723A74BC14FFB94A9C1 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2EA9BE70A22571D0000AC22ADBB4A67F /* BeAKindOf.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeAKindOf.swift; path = Sources/Nimble/Matchers/BeAKindOf.swift; sourceTree = ""; }; + 2F729EE662A36F0C087B972DE377A70E /* Pods_Harbor.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Harbor.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 3219944ED4F255798AF34C5F00BDED90 /* MatcherFunc.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MatcherFunc.swift; path = Sources/Nimble/Matchers/MatcherFunc.swift; sourceTree = ""; }; + 3541B29464CBF1CB8FD56B5E05BF95DF /* PostNotification.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PostNotification.swift; path = Sources/Nimble/Matchers/PostNotification.swift; sourceTree = ""; }; + 359C91F6B7A55CD3526F02DAEC66E7BE /* Registry.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Registry.swift; path = Drip/Registry/Registry.swift; sourceTree = ""; }; + 376FAE36B2DD314CA6F9531CDC36E17D /* Stringers.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Stringers.swift; path = Sources/Nimble/Utils/Stringers.swift; sourceTree = ""; }; + 383D0B89E85749C2656A8976611647FD /* Nimble.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Nimble.xcconfig; sourceTree = ""; }; + 3B56CFF5015CFC6163A4705CA5E9F858 /* BeAnInstanceOf.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeAnInstanceOf.swift; path = Sources/Nimble/Matchers/BeAnInstanceOf.swift; sourceTree = ""; }; + 3C5C94988917F2650DE151A1CD6F93D2 /* BeginWith.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeginWith.swift; path = Sources/Nimble/Matchers/BeginWith.swift; sourceTree = ""; }; + 41EED3E0E03A762BB990D4361CEC2AE6 /* Result.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Result.swift; path = Source/Result.swift; sourceTree = ""; }; + 440CE46595C0399689409632411BC10B /* Nimble.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Nimble.h; path = Sources/Nimble/Nimble.h; sourceTree = ""; }; + 4421E1638FC46B715E29255140F56A14 /* Pods-Harbor-HarborTests.test.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Harbor-HarborTests.test.xcconfig"; sourceTree = ""; }; + 458CEB9B89EED6F11374E5AEBC1F5F7F /* QuickConfiguration.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = QuickConfiguration.h; path = Sources/Quick/Configuration/QuickConfiguration.h; sourceTree = ""; }; + 495AE1EE44312328995F1F67DC4FBFEE /* CurrentTestCaseTracker.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = CurrentTestCaseTracker.h; path = Sources/Nimble/Adapters/ObjectiveC/CurrentTestCaseTracker.h; sourceTree = ""; }; + 4E461BC3E88F17D1A9098DB9AB5F7F06 /* Upload.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Upload.swift; path = Source/Upload.swift; sourceTree = ""; }; + 4FED89D8CDE565610E458A1C7FB0311D /* Functional.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Functional.swift; path = Sources/Nimble/Utils/Functional.swift; sourceTree = ""; }; + 573B831DFF0EE477A618D216E8FE4CFA /* Pods-Harbor-HarborTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Harbor-HarborTests.debug.xcconfig"; sourceTree = ""; }; + 57A4738F6BBF22846D08E31FA6D5B2AA /* Nimble-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Nimble-dummy.m"; sourceTree = ""; }; + 5952CB66AD60AE3C66D66F0B027AF929 /* Quick-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Quick-umbrella.h"; sourceTree = ""; }; + 59A85063093282255DE48E95E7B8A5BF /* Pods-Harbor-HarborTests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Harbor-HarborTests-frameworks.sh"; sourceTree = ""; }; + 5C34996EB7947C3CE4D62280C4F749E1 /* Pods-Harbor-HarborTests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Harbor-HarborTests-resources.sh"; sourceTree = ""; }; + 5E5AB013292AC10ABA780EE1FCB172EC /* NMBExpectation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NMBExpectation.swift; path = Sources/Nimble/Adapters/ObjectiveC/NMBExpectation.swift; sourceTree = ""; }; + 5E7157B44B56FC49DDA4BBDA37BD42E6 /* AllPass.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AllPass.swift; path = Sources/Nimble/Matchers/AllPass.swift; sourceTree = ""; }; + 5E7E8756DA98AB34195A84652B88D8F0 /* QCKDSL.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = QCKDSL.m; path = Sources/Quick/DSL/QCKDSL.m; sourceTree = ""; }; + 63098961705BDDC8582CCEB8FBB955F9 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; + 64D58A22979A4D927FCD7A7DC0E0AA98 /* KeyConvertible.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KeyConvertible.swift; path = Drip/Registry/KeyConvertible.swift; sourceTree = ""; }; + 6637A35C4A26012E2F48E93F9758BD4D /* MatchError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MatchError.swift; path = Sources/Nimble/Matchers/MatchError.swift; sourceTree = ""; }; + 673659F5722A4DCCF1A49F780239792B /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 67A638A8A0DFAF5AD9FA87FF78BDC757 /* World.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = World.swift; path = Sources/Quick/World.swift; sourceTree = ""; }; + 68907ECA473D929ED84CA2D373A2E079 /* XCTestSuite+QuickTestSuiteBuilder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "XCTestSuite+QuickTestSuiteBuilder.m"; path = "Sources/Quick/XCTestSuite+QuickTestSuiteBuilder.m"; sourceTree = ""; }; + 694349CCE897A01E187C45E9703B8A36 /* ErrorUtility.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ErrorUtility.swift; path = Sources/Quick/ErrorUtility.swift; sourceTree = ""; }; + 6B74D4B3F26045ECBC343B1B3803E74A /* Key.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Key.swift; path = Drip/Registry/Key.swift; sourceTree = ""; }; + 6C351B9FB0C9AB12F51FF049468CABD6 /* Quick.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Quick.modulemap; sourceTree = ""; }; + 6FC56C4F52A02A18BB4B49158B6BA728 /* Alamofire.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Alamofire.xcconfig; sourceTree = ""; }; + 6FFA5C56D87882E1B52C85DAC9C47327 /* NSBundle+CurrentTestBundle.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSBundle+CurrentTestBundle.swift"; path = "Sources/Quick/NSBundle+CurrentTestBundle.swift"; sourceTree = ""; }; + 73BFF8A0C284F85614F90B396B3628F0 /* FailureMessage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FailureMessage.swift; path = Sources/Nimble/FailureMessage.swift; sourceTree = ""; }; + 77D643F4CF8D04E90A69E68A3FC11DEC /* BeCloseTo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeCloseTo.swift; path = Sources/Nimble/Matchers/BeCloseTo.swift; sourceTree = ""; }; + 78CA2F9E3A877F1B9BB102EADB84A0FE /* ExampleGroup.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExampleGroup.swift; path = Sources/Quick/ExampleGroup.swift; sourceTree = ""; }; + 7B0981FD91BD87324BC7A55F1DA2B2B2 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 7BCA308767BCA6B3B19240325FEEA464 /* Pods-Harbor.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Harbor.release.xcconfig"; sourceTree = ""; }; + 7C89C71A8403840A0BB64CB95919A70D /* Callsite.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Callsite.swift; path = Sources/Quick/Callsite.swift; sourceTree = ""; }; + 8499FA51EE64CC8AFB98E3E8079F035C /* Expectation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Expectation.swift; path = Sources/Nimble/Expectation.swift; sourceTree = ""; }; + 8555892C0FE97F176945A27F9768C5C4 /* Quick.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Quick.xcconfig; sourceTree = ""; }; + 85AA7F3F16F78357A3A86B448FF7BFC6 /* Component.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Component.swift; path = Drip/Component.swift; sourceTree = ""; }; + 85BCE327961EB286FBCCC0CA61D0FC0A /* Alamofire-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Alamofire-dummy.m"; sourceTree = ""; }; + 8624C00865D48D2EB1EBDF231C9E5A46 /* MultipartFormData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MultipartFormData.swift; path = Source/MultipartFormData.swift; sourceTree = ""; }; + 86E90D58F379F6EABED3C4BF326183B8 /* NMBObjCMatcher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NMBObjCMatcher.swift; path = Sources/Nimble/Adapters/ObjectiveC/NMBObjCMatcher.swift; sourceTree = ""; }; + 8845F9989AC93F8506CE46EA4F6A222C /* BeLessThan.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeLessThan.swift; path = Sources/Nimble/Matchers/BeLessThan.swift; sourceTree = ""; }; + 8A2A18CDB81CD0E48FB478535AA20381 /* BeNil.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeNil.swift; path = Sources/Nimble/Matchers/BeNil.swift; sourceTree = ""; }; + 8B1D0714223D1BA21E4DF159D4A3E859 /* DSL.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = DSL.m; path = Sources/Nimble/Adapters/ObjectiveC/DSL.m; sourceTree = ""; }; + 8D2A2BF72538B619B5759C577625A661 /* ExampleHooks.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExampleHooks.swift; path = Sources/Quick/Hooks/ExampleHooks.swift; sourceTree = ""; }; + 8D59B8A2E4D7DC50A348CD73EE3A8EB2 /* Nimble.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Nimble.modulemap; sourceTree = ""; }; + 8F00F4497E6144A06F3519FDD6FC0B43 /* Error.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Error.swift; path = Source/Error.swift; sourceTree = ""; }; + 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 94D17F98116FBF4081C6C9E896245BF9 /* Functions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Functions.swift; path = Drip/Support/Functions.swift; sourceTree = ""; }; + 962F471B801B7CFE249A6E7284D91012 /* Pods-Harbor.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Harbor.debug.xcconfig"; sourceTree = ""; }; + 99F1D57124A1ABB9194EC6DF7A6D3F86 /* NSString+QCKSelectorName.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSString+QCKSelectorName.h"; path = "Sources/Quick/NSString+QCKSelectorName.h"; sourceTree = ""; }; + 9C28A7BCDBC04D638C3759F777D78F4A /* Validation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Validation.swift; path = Source/Validation.swift; sourceTree = ""; }; + 9CD0BCF6DFE76BC3E2407EBBA4E700F9 /* DSL.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = DSL.h; path = Sources/Nimble/Adapters/ObjectiveC/DSL.h; sourceTree = ""; }; + 9F0F9E01C2737784204D68DE9364D168 /* Response.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Response.swift; path = Source/Response.swift; sourceTree = ""; }; + 9F4AA4748ED11A05CBA5D57EB3196AC1 /* Drip-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Drip-umbrella.h"; sourceTree = ""; }; + 9FD19F2E7D603F56A85FAD91750B7DF0 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 9FFED529618912452D9D1BB0BBD7BF5B /* World+DSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "World+DSL.swift"; path = "Sources/Quick/DSL/World+DSL.swift"; sourceTree = ""; }; + A4E7FA62E5B3E349168CD60140A67B82 /* Alamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Alamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + A7393BF2EA37A451A80887DCF7DB45D1 /* ComponentType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ComponentType.swift; path = Drip/ComponentType.swift; sourceTree = ""; }; + A95353F125C756B84B5E440064DAD52E /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; + AACBF9E3519F0006461957869165FBCB /* Quick.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Quick.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + AAFCC22565EECAC2EDE963A46066508B /* HooksPhase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HooksPhase.swift; path = Sources/Quick/Hooks/HooksPhase.swift; sourceTree = ""; }; + AF122FF41E748EE5F0B2286768701AFF /* Drip.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Drip.xcconfig; sourceTree = ""; }; + AFC6112CF190BFDBBC221C54A7FB3B1E /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B0943E1E7A5136DABE18B984F151A25E /* MatcherProtocols.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MatcherProtocols.swift; path = Sources/Nimble/Matchers/MatcherProtocols.swift; sourceTree = ""; }; + B54DD25210BF00B158EF0296F043059C /* BeIdenticalTo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeIdenticalTo.swift; path = Sources/Nimble/Matchers/BeIdenticalTo.swift; sourceTree = ""; }; + B79706C6477D71B92734362A526F87A0 /* Request.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Request.swift; path = Source/Request.swift; sourceTree = ""; }; + B9F25934A146074E8376A784EEA04EA3 /* SourceLocation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SourceLocation.swift; path = Sources/Nimble/Utils/SourceLocation.swift; sourceTree = ""; }; + BA15BF8F7656A9C605A80A8730C6234A /* Nimble.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + BBDEB6E746E8B0DF921D5586890540A2 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + BC239F00451843C10B1884909FB6DC83 /* AdapterProtocols.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AdapterProtocols.swift; path = Sources/Nimble/Adapters/AdapterProtocols.swift; sourceTree = ""; }; + BDA550E37D3003F7AE6BB9C2FB1DF658 /* Pods-Harbor-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Harbor-acknowledgements.markdown"; sourceTree = ""; }; + BE38032F4981C217CEF4B67190234985 /* Contain.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Contain.swift; path = Sources/Nimble/Matchers/Contain.swift; sourceTree = ""; }; + BE3CB8BBCA054EB1F11790885808534B /* String+FileName.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "String+FileName.swift"; path = "Sources/Quick/String+FileName.swift"; sourceTree = ""; }; + BEDFABFA70784CAB8125B8DBF3035430 /* Filter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Filter.swift; path = Sources/Quick/Filter.swift; sourceTree = ""; }; + BF78ED04C0FBAB4FF6831AF848BB0566 /* Match.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Match.swift; path = Sources/Nimble/Matchers/Match.swift; sourceTree = ""; }; + C01E669A9F717B58950D5273A7ECA63A /* Quick-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Quick-prefix.pch"; sourceTree = ""; }; + C117E928AA722C852F127E43219E8172 /* DSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DSL.swift; path = Sources/Nimble/DSL.swift; sourceTree = ""; }; + C2E69F593D5DCFA2650E695FAB5FA09D /* Module.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Module.swift; path = Drip/Module.swift; sourceTree = ""; }; + C3E1D82773DAA1A552498226139204C7 /* BeGreaterThanOrEqualTo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeGreaterThanOrEqualTo.swift; path = Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift; sourceTree = ""; }; + C502609F4CC9B02786C7E6FA0C262548 /* Pods-Harbor-HarborTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Harbor-HarborTests.release.xcconfig"; sourceTree = ""; }; + C64AE65FCDCA47402F5F4901ED5894BA /* Pods-Harbor-HarborTests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Harbor-HarborTests-umbrella.h"; sourceTree = ""; }; + C7D667D3A80A30808037AAEA5604F646 /* Download.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Download.swift; path = Source/Download.swift; sourceTree = ""; }; + C81D8D31CDE25670C501B737DCD2A865 /* Expression.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Expression.swift; path = Sources/Nimble/Expression.swift; sourceTree = ""; }; + CA49ABDD8591527117CCFAE2B27B94AA /* Pods-Harbor-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Harbor-dummy.m"; sourceTree = ""; }; + CAC5CC8DEA461646D8D32DFCB1718C63 /* Pods-Harbor-HarborTests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Harbor-HarborTests-dummy.m"; sourceTree = ""; }; + CC02CFD48359081AD1A459455B72DDE7 /* Nimble-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Nimble-prefix.pch"; sourceTree = ""; }; + CC59BD62028BA039FD9272A40B1A7B58 /* NMBStringify.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = NMBStringify.h; path = Sources/Nimble/Adapters/ObjectiveC/NMBStringify.h; sourceTree = ""; }; + CD9C76066AF90F59F666A93E4C3DB23B /* ServerTrustPolicy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ServerTrustPolicy.swift; path = Source/ServerTrustPolicy.swift; sourceTree = ""; }; + CDD7417FD62307D4863D6E23001694BC /* NMBExceptionCapture.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = NMBExceptionCapture.m; path = Sources/Nimble/Adapters/ObjectiveC/NMBExceptionCapture.m; sourceTree = ""; }; + D0BA72DDA5CD0E3A4CB0921CC0A82F99 /* NSString+QCKSelectorName.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSString+QCKSelectorName.m"; path = "Sources/Quick/NSString+QCKSelectorName.m"; sourceTree = ""; }; + D4D7F976C6BF46F8392148154531C479 /* QuickSpec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = QuickSpec.h; path = Sources/Quick/QuickSpec.h; sourceTree = ""; }; + D5CCADBDA46C939B707E0F03CFABA5A5 /* BeGreaterThan.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeGreaterThan.swift; path = Sources/Nimble/Matchers/BeGreaterThan.swift; sourceTree = ""; }; + D8D4C6E6795369D3C010DD8A1375A545 /* Pods-Harbor-HarborTests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Harbor-HarborTests-acknowledgements.markdown"; sourceTree = ""; }; + DA18B2034E4F838D89D1D8AA9BC2B6ED /* BeLogical.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeLogical.swift; path = Sources/Nimble/Matchers/BeLogical.swift; sourceTree = ""; }; + DA65CD97D65A096D85D89CF5B3CB80E6 /* BeEmpty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeEmpty.swift; path = Sources/Nimble/Matchers/BeEmpty.swift; sourceTree = ""; }; + DB244EEACE4A5AB961A4E7B0F4CB95EF /* Drip-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Drip-prefix.pch"; sourceTree = ""; }; + DC087B79ECB5D3BEDE9143441BFC7012 /* Quick.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Quick.h; path = Sources/Quick/Quick.h; sourceTree = ""; }; + DE55F2B4FA30DCDCECFB52869DF2C69F /* DSL+Wait.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DSL+Wait.swift"; path = "Sources/Nimble/DSL+Wait.swift"; sourceTree = ""; }; + E0578392631560F068D905130997FE66 /* Alamofire.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Alamofire.modulemap; sourceTree = ""; }; + E0B381DE8947BF8FBE4B96E7CC1CB8F7 /* NimbleXCTestHandler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NimbleXCTestHandler.swift; path = Sources/Nimble/Adapters/NimbleXCTestHandler.swift; sourceTree = ""; }; + E124AD2F8C71E5916D4FD522161B54BA /* Manager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Manager.swift; path = Source/Manager.swift; sourceTree = ""; }; + E40BDD807AF8570578A42AA287682687 /* Notifications.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Notifications.swift; path = Source/Notifications.swift; sourceTree = ""; }; + E527CA7D456B242AB3170A4DE64D4FC4 /* ModuleType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ModuleType.swift; path = Drip/ModuleType.swift; sourceTree = ""; }; + E5D0BA81842E9420FD7E80741A96F6CD /* Equal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Equal.swift; path = Sources/Nimble/Matchers/Equal.swift; sourceTree = ""; }; + E5F65524E7AEA2DE6665A42D7DDFF464 /* QuickTestSuite.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = QuickTestSuite.swift; path = Sources/Quick/QuickTestSuite.swift; sourceTree = ""; }; + E6AEB3AFDC976C511D6A9566F78C5CEC /* Alamofire-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Alamofire-prefix.pch"; sourceTree = ""; }; + E8C100281E2EC3CF760237FFF26090CA /* NMBStringify.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = NMBStringify.m; path = Sources/Nimble/Adapters/ObjectiveC/NMBStringify.m; sourceTree = ""; }; + ED8DC06806A41137E3F1EC135C3E7BA4 /* QCKDSL.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = QCKDSL.h; path = Sources/Quick/DSL/QCKDSL.h; sourceTree = ""; }; + EE7A2A20C78648B9DEBB4B22399B317C /* Closures.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Closures.swift; path = Sources/Quick/Hooks/Closures.swift; sourceTree = ""; }; + EEC84717A923630DF3840ADCAFBABF47 /* Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Alamofire.swift; path = Source/Alamofire.swift; sourceTree = ""; }; + F080787983D415A9F6AA4B8D38273201 /* NetworkReachabilityManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NetworkReachabilityManager.swift; path = Source/NetworkReachabilityManager.swift; sourceTree = ""; }; + F34B87C9CC6BD02E06A4029001ED7655 /* HaveCount.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HaveCount.swift; path = Sources/Nimble/Matchers/HaveCount.swift; sourceTree = ""; }; + F5969534034DB0E79C87529B435ABADC /* Pods-Harbor-HarborTests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Harbor-HarborTests-acknowledgements.plist"; sourceTree = ""; }; + F6014A88120411C189202BA27080742F /* Error.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Error.swift; path = Drip/Support/Error.swift; sourceTree = ""; }; + F6327AAE6465E2EEC38F3E3552338636 /* XCTestObservationCenter+Register.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "XCTestObservationCenter+Register.m"; path = "Sources/Nimble/Adapters/ObjectiveC/XCTestObservationCenter+Register.m"; sourceTree = ""; }; + F8E25D4AA9FD338C8558DEF409773F8D /* NMBExceptionCapture.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = NMBExceptionCapture.h; path = Sources/Nimble/Adapters/ObjectiveC/NMBExceptionCapture.h; sourceTree = ""; }; + F978017D37AC68B0FA3434989617E3F0 /* EndWith.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = EndWith.swift; path = Sources/Nimble/Matchers/EndWith.swift; sourceTree = ""; }; + F9907DC6CF53E838EFCB2EDE9D459FFC /* Quick-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Quick-dummy.m"; sourceTree = ""; }; + FAC188AA6309C48AE0D288EE82D2005C /* Stream.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Stream.swift; path = Source/Stream.swift; sourceTree = ""; }; + FAC9983681F505967623D08AB3851CF7 /* AssertionRecorder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AssertionRecorder.swift; path = Sources/Nimble/Adapters/AssertionRecorder.swift; sourceTree = ""; }; + FC32BBF28C10D9595AE37A913E122026 /* World+DSL.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "World+DSL.h"; path = "Sources/Quick/DSL/World+DSL.h"; sourceTree = ""; }; + FE82C7835724E3971E565C7E32C6902D /* AsyncMatcherWrapper.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncMatcherWrapper.swift; path = Sources/Nimble/Matchers/AsyncMatcherWrapper.swift; sourceTree = ""; }; + FE9154705C2BE5F38A5DB8D9582DF07F /* NimbleEnvironment.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NimbleEnvironment.swift; path = Sources/Nimble/Adapters/NimbleEnvironment.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 0BABFD353329948118154E22EDDD7C42 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E23E3933061E230DA89F751856B3E739 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5C00BCDEDEF87C48C2D63198922E08C6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 74D462DF9537880701EA41FB6AFE70D2 /* Cocoa.framework in Frameworks */, + 1F732076F83E4E2678150141426F35C5 /* XCTest.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8C4B2667AA813596C6ADD06AC2FC98D8 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3177B0D0B6992E070B3CD6CEBA36EAD8 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A9FF92D4D2E66EBB3ECBEC6E97270C22 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 314890F485CA976FC7828866DAE0424B /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BCD12FF136D18D739111A4DF2DFF221F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 940BB4E7794C7F86316B278C68A5B282 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C9838A043E61A557F94CE55FCAA754DA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9FF60F30C86C1A87BCDE9C4569210367 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 1D4A5C6F212B96F7E56315CB5C031699 /* Nimble */ = { + isa = PBXGroup; + children = ( + BC239F00451843C10B1884909FB6DC83 /* AdapterProtocols.swift */, + 5E7157B44B56FC49DDA4BBDA37BD42E6 /* AllPass.swift */, + 2DA0B2450807443EC033440B03991E34 /* AssertionDispatcher.swift */, + FAC9983681F505967623D08AB3851CF7 /* AssertionRecorder.swift */, + 105E4821ACD5F11C05C2B62664F2800B /* Async.swift */, + FE82C7835724E3971E565C7E32C6902D /* AsyncMatcherWrapper.swift */, + 2EA9BE70A22571D0000AC22ADBB4A67F /* BeAKindOf.swift */, + 3B56CFF5015CFC6163A4705CA5E9F858 /* BeAnInstanceOf.swift */, + 77D643F4CF8D04E90A69E68A3FC11DEC /* BeCloseTo.swift */, + DA65CD97D65A096D85D89CF5B3CB80E6 /* BeEmpty.swift */, + 3C5C94988917F2650DE151A1CD6F93D2 /* BeginWith.swift */, + D5CCADBDA46C939B707E0F03CFABA5A5 /* BeGreaterThan.swift */, + C3E1D82773DAA1A552498226139204C7 /* BeGreaterThanOrEqualTo.swift */, + B54DD25210BF00B158EF0296F043059C /* BeIdenticalTo.swift */, + 8845F9989AC93F8506CE46EA4F6A222C /* BeLessThan.swift */, + 1ECFB951F0348F4317CE933D91BC9028 /* BeLessThanOrEqual.swift */, + DA18B2034E4F838D89D1D8AA9BC2B6ED /* BeLogical.swift */, + 8A2A18CDB81CD0E48FB478535AA20381 /* BeNil.swift */, + 07A6D56A141E07B72B43C5470D00D56F /* BeVoid.swift */, + BE38032F4981C217CEF4B67190234985 /* Contain.swift */, + 495AE1EE44312328995F1F67DC4FBFEE /* CurrentTestCaseTracker.h */, + 9CD0BCF6DFE76BC3E2407EBBA4E700F9 /* DSL.h */, + 8B1D0714223D1BA21E4DF159D4A3E859 /* DSL.m */, + C117E928AA722C852F127E43219E8172 /* DSL.swift */, + DE55F2B4FA30DCDCECFB52869DF2C69F /* DSL+Wait.swift */, + F978017D37AC68B0FA3434989617E3F0 /* EndWith.swift */, + E5D0BA81842E9420FD7E80741A96F6CD /* Equal.swift */, + 0A0937F0B6DF412BB3C6B7DED95EA2B1 /* Errors.swift */, + 8499FA51EE64CC8AFB98E3E8079F035C /* Expectation.swift */, + C81D8D31CDE25670C501B737DCD2A865 /* Expression.swift */, + 73BFF8A0C284F85614F90B396B3628F0 /* FailureMessage.swift */, + 4FED89D8CDE565610E458A1C7FB0311D /* Functional.swift */, + F34B87C9CC6BD02E06A4029001ED7655 /* HaveCount.swift */, + BF78ED04C0FBAB4FF6831AF848BB0566 /* Match.swift */, + 3219944ED4F255798AF34C5F00BDED90 /* MatcherFunc.swift */, + B0943E1E7A5136DABE18B984F151A25E /* MatcherProtocols.swift */, + 6637A35C4A26012E2F48E93F9758BD4D /* MatchError.swift */, + 440CE46595C0399689409632411BC10B /* Nimble.h */, + FE9154705C2BE5F38A5DB8D9582DF07F /* NimbleEnvironment.swift */, + E0B381DE8947BF8FBE4B96E7CC1CB8F7 /* NimbleXCTestHandler.swift */, + F8E25D4AA9FD338C8558DEF409773F8D /* NMBExceptionCapture.h */, + CDD7417FD62307D4863D6E23001694BC /* NMBExceptionCapture.m */, + 5E5AB013292AC10ABA780EE1FCB172EC /* NMBExpectation.swift */, + 86E90D58F379F6EABED3C4BF326183B8 /* NMBObjCMatcher.swift */, + CC59BD62028BA039FD9272A40B1A7B58 /* NMBStringify.h */, + E8C100281E2EC3CF760237FFF26090CA /* NMBStringify.m */, + 3541B29464CBF1CB8FD56B5E05BF95DF /* PostNotification.swift */, + 086EDD09E2D87FAB4318B4DB104DD9D1 /* RaisesException.swift */, + 0F5D001CE7EE5829B62EA454EBB4E080 /* SatisfyAnyOf.swift */, + B9F25934A146074E8376A784EEA04EA3 /* SourceLocation.swift */, + 376FAE36B2DD314CA6F9531CDC36E17D /* Stringers.swift */, + 2E0CDD9BCD7916809AC6F305B48FE568 /* ThrowError.swift */, + F6327AAE6465E2EEC38F3E3552338636 /* XCTestObservationCenter+Register.m */, + EB99D318B113DDF2EC3334028060758A /* Support Files */, + ); + path = Nimble; + sourceTree = ""; + }; + 295712FAD8B7003C7655E17F53121355 /* Targets Support Files */ = { + isa = PBXGroup; + children = ( + DC1E9E9FC474C3AB5485F84E99989A3C /* Pods-Harbor */, + 429C1B3BE1C0E2A961A2B0129181EC17 /* Pods-Harbor-HarborTests */, + ); + name = "Targets Support Files"; + sourceTree = ""; + }; + 2F1952B58E7EA113243EC1F7D300C460 /* Drip */ = { + isa = PBXGroup; + children = ( + 85AA7F3F16F78357A3A86B448FF7BFC6 /* Component.swift */, + A7393BF2EA37A451A80887DCF7DB45D1 /* ComponentType.swift */, + F6014A88120411C189202BA27080742F /* Error.swift */, + 94D17F98116FBF4081C6C9E896245BF9 /* Functions.swift */, + 6B74D4B3F26045ECBC343B1B3803E74A /* Key.swift */, + 64D58A22979A4D927FCD7A7DC0E0AA98 /* KeyConvertible.swift */, + C2E69F593D5DCFA2650E695FAB5FA09D /* Module.swift */, + E527CA7D456B242AB3170A4DE64D4FC4 /* ModuleType.swift */, + 359C91F6B7A55CD3526F02DAEC66E7BE /* Registry.swift */, + C913282B99E1B223DDA464A52B244AA8 /* Support Files */, + ); + path = Drip; + sourceTree = ""; + }; + 429C1B3BE1C0E2A961A2B0129181EC17 /* Pods-Harbor-HarborTests */ = { + isa = PBXGroup; + children = ( + 9FD19F2E7D603F56A85FAD91750B7DF0 /* Info.plist */, + 23E60803B3673E452128097187EA4426 /* Pods-Harbor-HarborTests.modulemap */, + D8D4C6E6795369D3C010DD8A1375A545 /* Pods-Harbor-HarborTests-acknowledgements.markdown */, + F5969534034DB0E79C87529B435ABADC /* Pods-Harbor-HarborTests-acknowledgements.plist */, + CAC5CC8DEA461646D8D32DFCB1718C63 /* Pods-Harbor-HarborTests-dummy.m */, + 59A85063093282255DE48E95E7B8A5BF /* Pods-Harbor-HarborTests-frameworks.sh */, + 5C34996EB7947C3CE4D62280C4F749E1 /* Pods-Harbor-HarborTests-resources.sh */, + C64AE65FCDCA47402F5F4901ED5894BA /* Pods-Harbor-HarborTests-umbrella.h */, + 573B831DFF0EE477A618D216E8FE4CFA /* Pods-Harbor-HarborTests.debug.xcconfig */, + C502609F4CC9B02786C7E6FA0C262548 /* Pods-Harbor-HarborTests.release.xcconfig */, + 4421E1638FC46B715E29255140F56A14 /* Pods-Harbor-HarborTests.test.xcconfig */, + ); + name = "Pods-Harbor-HarborTests"; + path = "Target Support Files/Pods-Harbor-HarborTests"; + sourceTree = ""; + }; + 429DBE4CE5E0BDC32EB1AAC1CB1C7367 /* Products */ = { + isa = PBXGroup; + children = ( + A4E7FA62E5B3E349168CD60140A67B82 /* Alamofire.framework */, + 228873E21DE0F3D89324BAC41E96ED49 /* Drip.framework */, + BA15BF8F7656A9C605A80A8730C6234A /* Nimble.framework */, + 2F729EE662A36F0C087B972DE377A70E /* Pods_Harbor.framework */, + 2C3E885A74690ECFA6C19ACCE38C149C /* Pods_Harbor_HarborTests.framework */, + AACBF9E3519F0006461957869165FBCB /* Quick.framework */, + ); + name = Products; + sourceTree = ""; + }; + 582E511BC52D8CB4803B571EEC4C15C5 /* Alamofire */ = { + isa = PBXGroup; + children = ( + EEC84717A923630DF3840ADCAFBABF47 /* Alamofire.swift */, + C7D667D3A80A30808037AAEA5604F646 /* Download.swift */, + 8F00F4497E6144A06F3519FDD6FC0B43 /* Error.swift */, + E124AD2F8C71E5916D4FD522161B54BA /* Manager.swift */, + 8624C00865D48D2EB1EBDF231C9E5A46 /* MultipartFormData.swift */, + F080787983D415A9F6AA4B8D38273201 /* NetworkReachabilityManager.swift */, + E40BDD807AF8570578A42AA287682687 /* Notifications.swift */, + 28FB6AF27BE255686BD1AFA57073EAA4 /* ParameterEncoding.swift */, + B79706C6477D71B92734362A526F87A0 /* Request.swift */, + 9F0F9E01C2737784204D68DE9364D168 /* Response.swift */, + 28F19051FDC7ACCF8F69E018937CC19B /* ResponseSerialization.swift */, + 41EED3E0E03A762BB990D4361CEC2AE6 /* Result.swift */, + CD9C76066AF90F59F666A93E4C3DB23B /* ServerTrustPolicy.swift */, + FAC188AA6309C48AE0D288EE82D2005C /* Stream.swift */, + 026ABF79B9FD4435D735977B1FCFF699 /* Timeline.swift */, + 4E461BC3E88F17D1A9098DB9AB5F7F06 /* Upload.swift */, + 9C28A7BCDBC04D638C3759F777D78F4A /* Validation.swift */, + F1272225E2751F800294B4383BBB8C10 /* Support Files */, + ); + path = Alamofire; + sourceTree = ""; + }; + 6B9FD7F4396796A37EB1BA9E4CAE0F3B /* Quick */ = { + isa = PBXGroup; + children = ( + 7C89C71A8403840A0BB64CB95919A70D /* Callsite.swift */, + EE7A2A20C78648B9DEBB4B22399B317C /* Closures.swift */, + 0914FA00CA9014A5386E361779806555 /* Configuration.swift */, + 1B8C204E163D95812DFBA5A07BCF7B33 /* DSL.swift */, + 694349CCE897A01E187C45E9703B8A36 /* ErrorUtility.swift */, + 17CBF9DDBF8B5E4679A467601F237467 /* Example.swift */, + 78CA2F9E3A877F1B9BB102EADB84A0FE /* ExampleGroup.swift */, + 8D2A2BF72538B619B5759C577625A661 /* ExampleHooks.swift */, + 2CBD5A10B0222D10A391900585B3472F /* ExampleMetadata.swift */, + BEDFABFA70784CAB8125B8DBF3035430 /* Filter.swift */, + AAFCC22565EECAC2EDE963A46066508B /* HooksPhase.swift */, + 6FFA5C56D87882E1B52C85DAC9C47327 /* NSBundle+CurrentTestBundle.swift */, + 99F1D57124A1ABB9194EC6DF7A6D3F86 /* NSString+QCKSelectorName.h */, + D0BA72DDA5CD0E3A4CB0921CC0A82F99 /* NSString+QCKSelectorName.m */, + ED8DC06806A41137E3F1EC135C3E7BA4 /* QCKDSL.h */, + 5E7E8756DA98AB34195A84652B88D8F0 /* QCKDSL.m */, + DC087B79ECB5D3BEDE9143441BFC7012 /* Quick.h */, + 458CEB9B89EED6F11374E5AEBC1F5F7F /* QuickConfiguration.h */, + 265F3D51B0F37035512D7E64B7572F14 /* QuickConfiguration.m */, + 2A733A4B5DF46376209A11E848203AAB /* QuickSelectedTestSuiteBuilder.swift */, + D4D7F976C6BF46F8392148154531C479 /* QuickSpec.h */, + 1A742507973AD8C74567FA29F5D30403 /* QuickSpec.m */, + E5F65524E7AEA2DE6665A42D7DDFF464 /* QuickTestSuite.swift */, + BE3CB8BBCA054EB1F11790885808534B /* String+FileName.swift */, + 2468F4A5E7BF51D3B795B1307ADF1010 /* SuiteHooks.swift */, + 1338EF30A5F8D50C58E592C93EA75A8C /* World.h */, + 67A638A8A0DFAF5AD9FA87FF78BDC757 /* World.swift */, + FC32BBF28C10D9595AE37A913E122026 /* World+DSL.h */, + 9FFED529618912452D9D1BB0BBD7BF5B /* World+DSL.swift */, + 68907ECA473D929ED84CA2D373A2E079 /* XCTestSuite+QuickTestSuiteBuilder.m */, + DA28D3E42CDC9D0972A6EF8870EA7DAA /* Support Files */, + ); + path = Quick; + sourceTree = ""; + }; + 7DB346D0F39D3F0E887471402A8071AB = { + isa = PBXGroup; + children = ( + 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */, + D648CE86F139C7CCFD55D5B8A03BE74B /* Frameworks */, + FD5824119B7F0030FFDA4F3B2509CFCB /* Pods */, + 429DBE4CE5E0BDC32EB1AAC1CB1C7367 /* Products */, + 295712FAD8B7003C7655E17F53121355 /* Targets Support Files */, + ); + sourceTree = ""; + }; + C913282B99E1B223DDA464A52B244AA8 /* Support Files */ = { + isa = PBXGroup; + children = ( + 11AC5FB21BE270A67D23D4E02F64D8CD /* Drip.modulemap */, + AF122FF41E748EE5F0B2286768701AFF /* Drip.xcconfig */, + 2BB3FA921A6FFD62FF2FA7C95F8DD2F9 /* Drip-dummy.m */, + DB244EEACE4A5AB961A4E7B0F4CB95EF /* Drip-prefix.pch */, + 9F4AA4748ED11A05CBA5D57EB3196AC1 /* Drip-umbrella.h */, + 7B0981FD91BD87324BC7A55F1DA2B2B2 /* Info.plist */, + ); + name = "Support Files"; + path = "../Target Support Files/Drip"; + sourceTree = ""; + }; + D648CE86F139C7CCFD55D5B8A03BE74B /* Frameworks */ = { + isa = PBXGroup; + children = ( + EFC88A1C1EEE4CE3A9BC236092323F93 /* OS X */, + ); + name = Frameworks; + sourceTree = ""; + }; + DA28D3E42CDC9D0972A6EF8870EA7DAA /* Support Files */ = { + isa = PBXGroup; + children = ( + AFC6112CF190BFDBBC221C54A7FB3B1E /* Info.plist */, + 6C351B9FB0C9AB12F51FF049468CABD6 /* Quick.modulemap */, + 8555892C0FE97F176945A27F9768C5C4 /* Quick.xcconfig */, + F9907DC6CF53E838EFCB2EDE9D459FFC /* Quick-dummy.m */, + C01E669A9F717B58950D5273A7ECA63A /* Quick-prefix.pch */, + 5952CB66AD60AE3C66D66F0B027AF929 /* Quick-umbrella.h */, + ); + name = "Support Files"; + path = "../Target Support Files/Quick"; + sourceTree = ""; + }; + DC1E9E9FC474C3AB5485F84E99989A3C /* Pods-Harbor */ = { + isa = PBXGroup; + children = ( + 2E5D06D58C9C0723A74BC14FFB94A9C1 /* Info.plist */, + 03BE457F992E7F608E26702EB45E7A50 /* Pods-Harbor.modulemap */, + BDA550E37D3003F7AE6BB9C2FB1DF658 /* Pods-Harbor-acknowledgements.markdown */, + 177CD98890C9EC0B998A319A1983C77F /* Pods-Harbor-acknowledgements.plist */, + CA49ABDD8591527117CCFAE2B27B94AA /* Pods-Harbor-dummy.m */, + 0213AF2493D1FC2D9C3E5C8B458B675E /* Pods-Harbor-frameworks.sh */, + 077152A0DD72AF883AF6484386DEF9EB /* Pods-Harbor-resources.sh */, + 2D569365AFE25C35B9A0CBB83471712B /* Pods-Harbor-umbrella.h */, + 962F471B801B7CFE249A6E7284D91012 /* Pods-Harbor.debug.xcconfig */, + 7BCA308767BCA6B3B19240325FEEA464 /* Pods-Harbor.release.xcconfig */, + 1259C813D4A8CD872EE7D795DFC7A201 /* Pods-Harbor.test.xcconfig */, + ); + name = "Pods-Harbor"; + path = "Target Support Files/Pods-Harbor"; + sourceTree = ""; + }; + EB99D318B113DDF2EC3334028060758A /* Support Files */ = { + isa = PBXGroup; + children = ( + BBDEB6E746E8B0DF921D5586890540A2 /* Info.plist */, + 8D59B8A2E4D7DC50A348CD73EE3A8EB2 /* Nimble.modulemap */, + 383D0B89E85749C2656A8976611647FD /* Nimble.xcconfig */, + 57A4738F6BBF22846D08E31FA6D5B2AA /* Nimble-dummy.m */, + CC02CFD48359081AD1A459455B72DDE7 /* Nimble-prefix.pch */, + 121FED2F5528102F434E1A27E41593D3 /* Nimble-umbrella.h */, + ); + name = "Support Files"; + path = "../Target Support Files/Nimble"; + sourceTree = ""; + }; + EFC88A1C1EEE4CE3A9BC236092323F93 /* OS X */ = { + isa = PBXGroup; + children = ( + A95353F125C756B84B5E440064DAD52E /* Cocoa.framework */, + 63098961705BDDC8582CCEB8FBB955F9 /* XCTest.framework */, + ); + name = "OS X"; + sourceTree = ""; + }; + F1272225E2751F800294B4383BBB8C10 /* Support Files */ = { + isa = PBXGroup; + children = ( + E0578392631560F068D905130997FE66 /* Alamofire.modulemap */, + 6FC56C4F52A02A18BB4B49158B6BA728 /* Alamofire.xcconfig */, + 85BCE327961EB286FBCCC0CA61D0FC0A /* Alamofire-dummy.m */, + E6AEB3AFDC976C511D6A9566F78C5CEC /* Alamofire-prefix.pch */, + 10423D62D01C2F1757A84102D80DDD29 /* Alamofire-umbrella.h */, + 673659F5722A4DCCF1A49F780239792B /* Info.plist */, + ); + name = "Support Files"; + path = "../Target Support Files/Alamofire"; + sourceTree = ""; + }; + FD5824119B7F0030FFDA4F3B2509CFCB /* Pods */ = { + isa = PBXGroup; + children = ( + 582E511BC52D8CB4803B571EEC4C15C5 /* Alamofire */, + 2F1952B58E7EA113243EC1F7D300C460 /* Drip */, + 1D4A5C6F212B96F7E56315CB5C031699 /* Nimble */, + 6B9FD7F4396796A37EB1BA9E4CAE0F3B /* Quick */, + ); + name = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 15EFAAF5BDA818FF19C6F847BA4B7863 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 179BCB11833E91E87D1D2D3D9A35F5C4 /* Alamofire-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1D0A74C6AEFE3EFAB9F25B215EE84D27 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 109BB58C1D195F18FB91C32C79D948F6 /* CurrentTestCaseTracker.h in Headers */, + 32F4DB08C2ABBCC7175ACD85E4F120BF /* DSL.h in Headers */, + 7C87D019545C5B28FF9485378EA526FB /* Nimble-umbrella.h in Headers */, + 75E0337B84CD42D0B99D231D8FF67BD0 /* Nimble.h in Headers */, + 6C6EA2295328EDEBF622876216F69E92 /* NMBExceptionCapture.h in Headers */, + BE6AC5C2CEC681A80DAD817263FA06B1 /* NMBStringify.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 24F91451C567110111C672283885810A /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 577C807BE1266678AB3552646513EDB9 /* NSString+QCKSelectorName.h in Headers */, + C959DB4EE887E4B43CFD2483064F2E21 /* QCKDSL.h in Headers */, + EFC734F3D9A6827BF79E2688C029A677 /* Quick-umbrella.h in Headers */, + D7642FC5BB937DBD4040656BA125BCD7 /* Quick.h in Headers */, + 7B6EE6EEA1E882534927E9C82F19DCBC /* QuickConfiguration.h in Headers */, + 8B30FA48E7E71BB2758FA4F3894D0DDA /* QuickSpec.h in Headers */, + 72302926D92372DF5ED2ACEE2892497D /* World+DSL.h in Headers */, + 44B814612343317858F3CFD05D649D37 /* World.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + AB2DB227F7B7DAD9A399B23B4F47F565 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 228A3971377921306666C6157E104788 /* Pods-Harbor-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B8F4069FFCFBAB8C53AEA3A032C7B157 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 57B0AFBF2C374DBD4C2EDA9034B8C8F1 /* Drip-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BDE949C286DD6E8FDE6369596A3B2AE4 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 26D1E713401F903BAFBB8BCAAAE5D695 /* Pods-Harbor-HarborTests-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 14459A64F855726235520BE2214B1B16 /* Pods-Harbor-HarborTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1786163EE46B91950FAE6FF7C0D6C1BA /* Build configuration list for PBXNativeTarget "Pods-Harbor-HarborTests" */; + buildPhases = ( + AD19D8DE75D149B5D758C205180DABA3 /* Sources */, + C9838A043E61A557F94CE55FCAA754DA /* Frameworks */, + BDE949C286DD6E8FDE6369596A3B2AE4 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + F8163425A990E47CE9587A46AB707799 /* PBXTargetDependency */, + 9C03BBE9CB38A7B6B798B0974911CA11 /* PBXTargetDependency */, + 0522B06517BAC0FA1F61FAC45E156B65 /* PBXTargetDependency */, + F8874202458F035A100FBC430565DAA6 /* PBXTargetDependency */, + ); + name = "Pods-Harbor-HarborTests"; + productName = "Pods-Harbor-HarborTests"; + productReference = 2C3E885A74690ECFA6C19ACCE38C149C /* Pods_Harbor_HarborTests.framework */; + productType = "com.apple.product-type.framework"; + }; + 2A93D8D1E1FB9CDEEEC9AE11C3DDDF9A /* Quick */ = { + isa = PBXNativeTarget; + buildConfigurationList = 477D312DB60B9FC2B355A6F4134775D8 /* Build configuration list for PBXNativeTarget "Quick" */; + buildPhases = ( + 673B7A52114F2659B3F6AAD934703459 /* Sources */, + 5C00BCDEDEF87C48C2D63198922E08C6 /* Frameworks */, + 24F91451C567110111C672283885810A /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Quick; + productName = Quick; + productReference = AACBF9E3519F0006461957869165FBCB /* Quick.framework */; + productType = "com.apple.product-type.framework"; + }; + 4BE42DB6DF6A3DE525D05F5B914C4918 /* Alamofire */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9AEDD77266A1A789FB750BD7DAEFBD28 /* Build configuration list for PBXNativeTarget "Alamofire" */; + buildPhases = ( + DC089252F9F4F845045727A01C7BF99E /* Sources */, + 0BABFD353329948118154E22EDDD7C42 /* Frameworks */, + 15EFAAF5BDA818FF19C6F847BA4B7863 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Alamofire; + productName = Alamofire; + productReference = A4E7FA62E5B3E349168CD60140A67B82 /* Alamofire.framework */; + productType = "com.apple.product-type.framework"; + }; + 58FC8A7F2A7317B6E5EA88C861638367 /* Nimble */ = { + isa = PBXNativeTarget; + buildConfigurationList = B04F8EE78A10E861E1D8B30FED148646 /* Build configuration list for PBXNativeTarget "Nimble" */; + buildPhases = ( + 882FA63C527FFB96BAAEBF6B4DAEC59D /* Sources */, + 8C4B2667AA813596C6ADD06AC2FC98D8 /* Frameworks */, + 1D0A74C6AEFE3EFAB9F25B215EE84D27 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Nimble; + productName = Nimble; + productReference = BA15BF8F7656A9C605A80A8730C6234A /* Nimble.framework */; + productType = "com.apple.product-type.framework"; + }; + 9B3E140BABA3F003301A5E795BFD4913 /* Pods-Harbor */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6045C94468EAFF2238E3FFAEC5EC121E /* Build configuration list for PBXNativeTarget "Pods-Harbor" */; + buildPhases = ( + 9D24CAADF94D9DE6E5339973AF00AE62 /* Sources */, + BCD12FF136D18D739111A4DF2DFF221F /* Frameworks */, + AB2DB227F7B7DAD9A399B23B4F47F565 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + F276E594E069A5674D4B49B573F17F14 /* PBXTargetDependency */, + E5EFC9D49A5F725179D7F82D4EDEA1F4 /* PBXTargetDependency */, + ); + name = "Pods-Harbor"; + productName = "Pods-Harbor"; + productReference = 2F729EE662A36F0C087B972DE377A70E /* Pods_Harbor.framework */; + productType = "com.apple.product-type.framework"; + }; + C618C5B1AEDEB14F21A2BF4D9A06C986 /* Drip */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3AAF266CCC00DAFDB0DAA548009A35CD /* Build configuration list for PBXNativeTarget "Drip" */; + buildPhases = ( + CADDCE817260F868CEA21A970B9F08B9 /* Sources */, + A9FF92D4D2E66EBB3ECBEC6E97270C22 /* Frameworks */, + B8F4069FFCFBAB8C53AEA3A032C7B157 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Drip; + productName = Drip; + productReference = 228873E21DE0F3D89324BAC41E96ED49 /* Drip.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0730; + LastUpgradeCheck = 0700; + }; + buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 7DB346D0F39D3F0E887471402A8071AB; + productRefGroup = 429DBE4CE5E0BDC32EB1AAC1CB1C7367 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 4BE42DB6DF6A3DE525D05F5B914C4918 /* Alamofire */, + C618C5B1AEDEB14F21A2BF4D9A06C986 /* Drip */, + 58FC8A7F2A7317B6E5EA88C861638367 /* Nimble */, + 9B3E140BABA3F003301A5E795BFD4913 /* Pods-Harbor */, + 14459A64F855726235520BE2214B1B16 /* Pods-Harbor-HarborTests */, + 2A93D8D1E1FB9CDEEEC9AE11C3DDDF9A /* Quick */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 673B7A52114F2659B3F6AAD934703459 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2D8AF35C7641514E5F8FBB9974361D8E /* Callsite.swift in Sources */, + EB1FD1BA75E278CA8A7D5FA9919A8C23 /* Closures.swift in Sources */, + C28675B0CD8F3BAFADE96CA8CF9616D7 /* Configuration.swift in Sources */, + 28F68DB7F37C2376D41FBE40D8C36CD1 /* DSL.swift in Sources */, + B1F4F81BC2336B8988682B84E0255F77 /* ErrorUtility.swift in Sources */, + D052B655FE63493EE95908DF7A85E40B /* Example.swift in Sources */, + E6F3AF2C99EC2D138AFDDAD09621A4E4 /* ExampleGroup.swift in Sources */, + 2ACB9CB8A26879036699DB9978EF738A /* ExampleHooks.swift in Sources */, + A47DC2C1E8DBD55F4F2A4C2EDBF01DAC /* ExampleMetadata.swift in Sources */, + 5A0357A7597C437B7E1A3C3EE7B02A59 /* Filter.swift in Sources */, + E7204BD667436FC5E97575180BCF8840 /* HooksPhase.swift in Sources */, + FD87771144938D7D5CC55AE5B9FED403 /* NSBundle+CurrentTestBundle.swift in Sources */, + 3CC0FC09924A0C77FE018338665C2CA1 /* NSString+QCKSelectorName.m in Sources */, + 43A4ABB1D106D02F54E1050080CD5B11 /* QCKDSL.m in Sources */, + E27D1376AB13211EB6CEA9B2242D5FC0 /* Quick-dummy.m in Sources */, + 68AE2AE4B7FC7BA8C855605AD0722A93 /* QuickConfiguration.m in Sources */, + DFF854AD1C8F35C20C7F860852006275 /* QuickSelectedTestSuiteBuilder.swift in Sources */, + 22DFAF35C947A2B04AE7D96CB221A281 /* QuickSpec.m in Sources */, + FB63F631C2771B7CAFB5CB29249F9C29 /* QuickTestSuite.swift in Sources */, + 358B36BA80110B363CF1AA9F770BE388 /* String+FileName.swift in Sources */, + 5E582577049DB198C70F130D8B760B28 /* SuiteHooks.swift in Sources */, + D4481D648EE8CDF60132F3890393CCAC /* World+DSL.swift in Sources */, + F1F5DADE21E9F72A08E97761EDD001D9 /* World.swift in Sources */, + 92568591EFAAE72FFE8106C67591095D /* XCTestSuite+QuickTestSuiteBuilder.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 882FA63C527FFB96BAAEBF6B4DAEC59D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6F4ECB2EA5A02047EE910B492EAB3439 /* AdapterProtocols.swift in Sources */, + A476AAF1B3C982C6C4E755D00D9D6326 /* AllPass.swift in Sources */, + 5B00A0231CAA6677F190FA487D0AF119 /* AssertionDispatcher.swift in Sources */, + FE98D212BF396D1E94464344B9F37FF3 /* AssertionRecorder.swift in Sources */, + C756B3974E579D9764182919E1509235 /* Async.swift in Sources */, + F12E2D8A8006DE25EF9DC1D30826D6F0 /* AsyncMatcherWrapper.swift in Sources */, + CE6A6C47A4E532DB10E0065230E83883 /* BeAKindOf.swift in Sources */, + AB9FC86AF8F62DBA78574BFF5BF9941C /* BeAnInstanceOf.swift in Sources */, + 7344D7241D30291EDEC12EB513A1F90F /* BeCloseTo.swift in Sources */, + 075F28105E1A8E22843E83D3D0F0C070 /* BeEmpty.swift in Sources */, + 9E43E4F947F2F33A0017FBFA82211AF4 /* BeginWith.swift in Sources */, + 78BAA96B95C46E5D9788B90C0F661BB5 /* BeGreaterThan.swift in Sources */, + F582E62E8EBF109FE2F51F69E8329A10 /* BeGreaterThanOrEqualTo.swift in Sources */, + C651484D0BC15626865DBB44789BE033 /* BeIdenticalTo.swift in Sources */, + 0B89B16D2C597257F89D94DE2162411F /* BeLessThan.swift in Sources */, + BF2956C22305FC4D7BEC2EF4D1B95CA6 /* BeLessThanOrEqual.swift in Sources */, + B28AA224BFD0EF6B0B567957FC895C71 /* BeLogical.swift in Sources */, + 196556115ADCC76626D133AAE405A143 /* BeNil.swift in Sources */, + FFC5ECA743A6F3F1B98B3080029668BD /* BeVoid.swift in Sources */, + 161BCC2087D1DE3BEF9E6696AFA50D8B /* Contain.swift in Sources */, + 974690EB3A304E56198D368B73E001A0 /* DSL+Wait.swift in Sources */, + D251440D3CFB8FAF21668C29DCDAE6D5 /* DSL.m in Sources */, + AEB50A58345DA54B95DD796B0C255ECC /* DSL.swift in Sources */, + 5B7EC1CC142D1D0C2032380C607CCBCD /* EndWith.swift in Sources */, + 2112D363BA94BC1852A38368C97E8F6E /* Equal.swift in Sources */, + C8E2D40D7D44DF3C6E4CE767CC1A4A14 /* Errors.swift in Sources */, + B53214E7AA63B8AF2AE808920D7B0CD1 /* Expectation.swift in Sources */, + 2BFAEB4B70F0F463E6A16AD58E3D5B5B /* Expression.swift in Sources */, + ED5709A67E240471FEE0D3C07D8531A8 /* FailureMessage.swift in Sources */, + FC23FEAFA43F04A91A0C081444943CED /* Functional.swift in Sources */, + E5F20A5E751A4FCC4C0FC34C4E3D435C /* HaveCount.swift in Sources */, + 1E26879350C25330CC7E37ECA0A03F48 /* Match.swift in Sources */, + 367C38327141B05FB962430CACA58C39 /* MatcherFunc.swift in Sources */, + 65D6B53558097D62629681DA1ADE51E9 /* MatcherProtocols.swift in Sources */, + B3A05C14ADDFC32FD933712C304DAEBB /* MatchError.swift in Sources */, + 3D2B235152D7964F438ADC9F5098B6D4 /* Nimble-dummy.m in Sources */, + 5216BFCFA74D54E0F9CB7F608562594C /* NimbleEnvironment.swift in Sources */, + 7E20C0534C5F7193DC222A8FD04C01DF /* NimbleXCTestHandler.swift in Sources */, + 3A89284DBC735A0B24C462E44F5C4CD5 /* NMBExceptionCapture.m in Sources */, + 839C50FCF12B5F7485BE3D00A106ED55 /* NMBExpectation.swift in Sources */, + 21BCCE21B7B9973E4200772AF5E9D86A /* NMBObjCMatcher.swift in Sources */, + 59642D5E95DEA7275F8FA53433E1DC89 /* NMBStringify.m in Sources */, + EEF3B566B7C59B8C5231ABDDC3DB70A6 /* PostNotification.swift in Sources */, + BBFEA0AACBF8FAE356C80BD187457B35 /* RaisesException.swift in Sources */, + DF5C77A89BFC2F6F3083DEAA6DF039B5 /* SatisfyAnyOf.swift in Sources */, + BA7C58094F7FAA3070D09C817735970F /* SourceLocation.swift in Sources */, + D7D01A2178D23684AB9C9862B191CC81 /* Stringers.swift in Sources */, + 48FFBA8DFE01FB181B25270EB6995B09 /* ThrowError.swift in Sources */, + 86543673C46E9857381FA5B04D2363AE /* XCTestObservationCenter+Register.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 9D24CAADF94D9DE6E5339973AF00AE62 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7D2F56765E1ABA3C2E3DFB6FD902943A /* Pods-Harbor-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + AD19D8DE75D149B5D758C205180DABA3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6A44A219B116FCBBBB2CC031F91F44AA /* Pods-Harbor-HarborTests-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + CADDCE817260F868CEA21A970B9F08B9 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CB83D9847C81D1422BD9E9E6EE985BE8 /* Component.swift in Sources */, + D3C0C46B72361F51027A32F960C26BC9 /* ComponentType.swift in Sources */, + B8360BB6A6312C35A61269F2FA0CFCC8 /* Drip-dummy.m in Sources */, + 5578D8407F8DC97E22E1B73FF48CEFA6 /* Error.swift in Sources */, + 65C4902958E77355D2329B02B3CFF3DC /* Functions.swift in Sources */, + BA677E5F25A70188FE220FF5B1ADCF11 /* Key.swift in Sources */, + AD8BB984EB14E08DA975D54FB1AAACC1 /* KeyConvertible.swift in Sources */, + 4C2B51BA7586DCFE3613118CF2EA4B46 /* Module.swift in Sources */, + 16DC1C78892961862F590440617395B5 /* ModuleType.swift in Sources */, + AC05C274E5425174CA414F455D0E5D67 /* Registry.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + DC089252F9F4F845045727A01C7BF99E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6D7C2A218F927C3CE2A49ED5F55FDE3E /* Alamofire-dummy.m in Sources */, + BDCE4264022C723EE1B8821543FBCEC2 /* Alamofire.swift in Sources */, + B8E3AB1BED4EFA90B6C95BDDC81F10FC /* Download.swift in Sources */, + 2773C1490D28172B17FEBD4CC2206B25 /* Error.swift in Sources */, + 403C427FFDECF2C50FC4F5389BB52762 /* Manager.swift in Sources */, + 88AD249C129E8E9E33B6D964E2E42267 /* MultipartFormData.swift in Sources */, + 9332B9B171F7327A4E9ED5B24C890586 /* NetworkReachabilityManager.swift in Sources */, + AFD2269DD816FE757B2DCBC33EAC72DF /* Notifications.swift in Sources */, + 4D0FFA03BB28F4F45A760ECC597895C5 /* ParameterEncoding.swift in Sources */, + E33844F843442A08EFAC800D80D5209B /* Request.swift in Sources */, + 604AC2A8EDCFC2D2DA7B42412D62593A /* Response.swift in Sources */, + 3AD8042722070A5B70147470DADAFDA6 /* ResponseSerialization.swift in Sources */, + 2D69A1D3B76194A0B7BCE8FEDD61E549 /* Result.swift in Sources */, + 6843AD2E5ED4BEA296B29C67FADD7355 /* ServerTrustPolicy.swift in Sources */, + C02183449F74878BE6B1C9537E162A36 /* Stream.swift in Sources */, + A566113AACC724968ECC46145180BE25 /* Timeline.swift in Sources */, + 8311C8D2119149754BA0A8008BBADE6F /* Upload.swift in Sources */, + BEF949A7A436658AFEEDAC6595C993DF /* Validation.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 0522B06517BAC0FA1F61FAC45E156B65 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Nimble; + target = 58FC8A7F2A7317B6E5EA88C861638367 /* Nimble */; + targetProxy = 83403177958E3000340FEFF9A87CD753 /* PBXContainerItemProxy */; + }; + 9C03BBE9CB38A7B6B798B0974911CA11 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Drip; + target = C618C5B1AEDEB14F21A2BF4D9A06C986 /* Drip */; + targetProxy = 0A37DD6D3BAC9C5DAA78F81EAD2C8009 /* PBXContainerItemProxy */; + }; + E5EFC9D49A5F725179D7F82D4EDEA1F4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Drip; + target = C618C5B1AEDEB14F21A2BF4D9A06C986 /* Drip */; + targetProxy = A9F2C5EB10D0933DE70FE0D72D76864E /* PBXContainerItemProxy */; + }; + F276E594E069A5674D4B49B573F17F14 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Alamofire; + target = 4BE42DB6DF6A3DE525D05F5B914C4918 /* Alamofire */; + targetProxy = 14BB197FA60F00671C516085A7CB3E0F /* PBXContainerItemProxy */; + }; + F8163425A990E47CE9587A46AB707799 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Alamofire; + target = 4BE42DB6DF6A3DE525D05F5B914C4918 /* Alamofire */; + targetProxy = 847D36CB4868B6776B67C7C44E073B74 /* PBXContainerItemProxy */; + }; + F8874202458F035A100FBC430565DAA6 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = Quick; + target = 2A93D8D1E1FB9CDEEEC9AE11C3DDDF9A /* Quick */; + targetProxy = 00254BF1C6C76413208898090E75FCF3 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 33C37BAB3652420836F8A87F0DD7C572 /* Test */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 383D0B89E85749C2656A8976611647FD /* Nimble.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/Nimble/Nimble-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Nimble/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/Nimble/Nimble.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_NAME = Nimble; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Test; + }; + 360944012AD0C52E753C4957262CA8B8 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6FC56C4F52A02A18BB4B49158B6BA728 /* Alamofire.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/Alamofire/Alamofire-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Alamofire/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/Alamofire/Alamofire.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_NAME = Alamofire; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 3CA5500207142D1AD0071B8ADF22CC6A /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 573B831DFF0EE477A618D216E8FE4CFA /* Pods-Harbor-HarborTests.debug.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "Target Support Files/Pods-Harbor-HarborTests/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MODULEMAP_FILE = "Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = Pods_Harbor_HarborTests; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 3E5D13B36F4F8472A28EA7C92560A016 /* Test */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4421E1638FC46B715E29255140F56A14 /* Pods-Harbor-HarborTests.test.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "Target Support Files/Pods-Harbor-HarborTests/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MODULEMAP_FILE = "Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = Pods_Harbor_HarborTests; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Test; + }; + 4888EEFBEA04FABA2120470F4B676BBD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PREPROCESSOR_DEFINITIONS = ( + "POD_CONFIGURATION_RELEASE=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + STRIP_INSTALLED_PRODUCT = NO; + SYMROOT = "${SRCROOT}/../build"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 49939C5C7357DD49DA4A904E90CA8620 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6FC56C4F52A02A18BB4B49158B6BA728 /* Alamofire.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/Alamofire/Alamofire-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Alamofire/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/Alamofire/Alamofire.modulemap"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = Alamofire; + SDKROOT = macosx; + SKIP_INSTALL = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 4ABF79E6CCB06D95038E84AEAF60451B /* Test */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AF122FF41E748EE5F0B2286768701AFF /* Drip.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/Drip/Drip-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Drip/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/Drip/Drip.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_NAME = Drip; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Test; + }; + 57C34CF5A3AE77D5BD68FA16656FAC50 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 8555892C0FE97F176945A27F9768C5C4 /* Quick.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/Quick/Quick-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Quick/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/Quick/Quick.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_NAME = Quick; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 5C5A2CD6B57D753B274082590B46AB60 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AF122FF41E748EE5F0B2286768701AFF /* Drip.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/Drip/Drip-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Drip/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/Drip/Drip.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_NAME = Drip; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 611DCADC1D0FF51E0F0AB596DC99D750 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 962F471B801B7CFE249A6E7284D91012 /* Pods-Harbor.debug.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "Target Support Files/Pods-Harbor/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MODULEMAP_FILE = "Target Support Files/Pods-Harbor/Pods-Harbor.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = Pods_Harbor; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 67590B7F77F514A226125760D82CA4E3 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AF122FF41E748EE5F0B2286768701AFF /* Drip.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/Drip/Drip-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Drip/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/Drip/Drip.modulemap"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = Drip; + SDKROOT = macosx; + SKIP_INSTALL = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 6EB56F16AF2EAA6A7D557C63EB8F04C4 /* Test */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "POD_CONFIGURATION_TEST=1", + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + ONLY_ACTIVE_ARCH = YES; + STRIP_INSTALLED_PRODUCT = NO; + }; + name = Test; + }; + 7074BDAE4D9F7B24EFBF1EA62067901A /* Test */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 8555892C0FE97F176945A27F9768C5C4 /* Quick.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/Quick/Quick-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Quick/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/Quick/Quick.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_NAME = Quick; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Test; + }; + 8B23060589766FD404173CB7F0FAD76C /* Test */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6FC56C4F52A02A18BB4B49158B6BA728 /* Alamofire.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/Alamofire/Alamofire-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Alamofire/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/Alamofire/Alamofire.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_NAME = Alamofire; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Test; + }; + 9013B8D31BF365DAC6766DBC32228B4D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 8555892C0FE97F176945A27F9768C5C4 /* Quick.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/Quick/Quick-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Quick/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/Quick/Quick.modulemap"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = Quick; + SDKROOT = macosx; + SKIP_INSTALL = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + BCBE068B235547E700F695D906A5366A /* Test */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1259C813D4A8CD872EE7D795DFC7A201 /* Pods-Harbor.test.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "Target Support Files/Pods-Harbor/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MODULEMAP_FILE = "Target Support Files/Pods-Harbor/Pods-Harbor.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = Pods_Harbor; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Test; + }; + C3138F7A9F71849759E6566EB78EE7DE /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C502609F4CC9B02786C7E6FA0C262548 /* Pods-Harbor-HarborTests.release.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "Target Support Files/Pods-Harbor-HarborTests/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MODULEMAP_FILE = "Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.modulemap"; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = Pods_Harbor_HarborTests; + SDKROOT = macosx; + SKIP_INSTALL = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + DA2E206EB90DF75A25332AE4AA713F31 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "POD_CONFIGURATION_DEBUG=1", + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + ONLY_ACTIVE_ARCH = YES; + STRIP_INSTALLED_PRODUCT = NO; + SYMROOT = "${SRCROOT}/../build"; + }; + name = Debug; + }; + E093C1667675FAB65AA5EFFC5BD1B818 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 383D0B89E85749C2656A8976611647FD /* Nimble.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/Nimble/Nimble-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Nimble/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/Nimble/Nimble.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_NAME = Nimble; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + E847D5E354E865CA263EAED702147B81 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7BCA308767BCA6B3B19240325FEEA464 /* Pods-Harbor.release.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "Target Support Files/Pods-Harbor/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MODULEMAP_FILE = "Target Support Files/Pods-Harbor/Pods-Harbor.modulemap"; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = Pods_Harbor; + SDKROOT = macosx; + SKIP_INSTALL = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + EF4C956F680F98F1F47B7EB5AA2B769F /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 383D0B89E85749C2656A8976611647FD /* Nimble.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + FRAMEWORK_VERSION = A; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/Nimble/Nimble-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Nimble/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/Nimble/Nimble.modulemap"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = Nimble; + SDKROOT = macosx; + SKIP_INSTALL = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1786163EE46B91950FAE6FF7C0D6C1BA /* Build configuration list for PBXNativeTarget "Pods-Harbor-HarborTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3CA5500207142D1AD0071B8ADF22CC6A /* Debug */, + C3138F7A9F71849759E6566EB78EE7DE /* Release */, + 3E5D13B36F4F8472A28EA7C92560A016 /* Test */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DA2E206EB90DF75A25332AE4AA713F31 /* Debug */, + 4888EEFBEA04FABA2120470F4B676BBD /* Release */, + 6EB56F16AF2EAA6A7D557C63EB8F04C4 /* Test */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3AAF266CCC00DAFDB0DAA548009A35CD /* Build configuration list for PBXNativeTarget "Drip" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5C5A2CD6B57D753B274082590B46AB60 /* Debug */, + 67590B7F77F514A226125760D82CA4E3 /* Release */, + 4ABF79E6CCB06D95038E84AEAF60451B /* Test */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 477D312DB60B9FC2B355A6F4134775D8 /* Build configuration list for PBXNativeTarget "Quick" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 57C34CF5A3AE77D5BD68FA16656FAC50 /* Debug */, + 9013B8D31BF365DAC6766DBC32228B4D /* Release */, + 7074BDAE4D9F7B24EFBF1EA62067901A /* Test */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6045C94468EAFF2238E3FFAEC5EC121E /* Build configuration list for PBXNativeTarget "Pods-Harbor" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 611DCADC1D0FF51E0F0AB596DC99D750 /* Debug */, + E847D5E354E865CA263EAED702147B81 /* Release */, + BCBE068B235547E700F695D906A5366A /* Test */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9AEDD77266A1A789FB750BD7DAEFBD28 /* Build configuration list for PBXNativeTarget "Alamofire" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 360944012AD0C52E753C4957262CA8B8 /* Debug */, + 49939C5C7357DD49DA4A904E90CA8620 /* Release */, + 8B23060589766FD404173CB7F0FAD76C /* Test */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B04F8EE78A10E861E1D8B30FED148646 /* Build configuration list for PBXNativeTarget "Nimble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E093C1667675FAB65AA5EFFC5BD1B818 /* Debug */, + EF4C956F680F98F1F47B7EB5AA2B769F /* Release */, + 33C37BAB3652420836F8A87F0DD7C572 /* Test */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; +} diff --git a/Pods/Quick/LICENSE b/Pods/Quick/LICENSE new file mode 100644 index 0000000..e900165 --- /dev/null +++ b/Pods/Quick/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2014, Quick Team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Pods/Quick/README.md b/Pods/Quick/README.md new file mode 100644 index 0000000..f6d6d48 --- /dev/null +++ b/Pods/Quick/README.md @@ -0,0 +1,61 @@ +![](http://f.cl.ly/items/0r1E192C1R0b2g2Q3h2w/QuickLogo_Color.png) + +Quick is a behavior-driven development framework for Swift and Objective-C. +Inspired by [RSpec](https://github.com/rspec/rspec), [Specta](https://github.com/specta/specta), and [Ginkgo](https://github.com/onsi/ginkgo). + +![](https://raw.githubusercontent.com/Quick/Assets/master/Screenshots/QuickSpec%20screenshot.png) + +```swift +// Swift + +import Quick +import Nimble + +class TableOfContentsSpec: QuickSpec { + override func spec() { + describe("the 'Documentation' directory") { + it("has everything you need to get started") { + let sections = Directory("Documentation").sections + expect(sections).to(contain("Organized Tests with Quick Examples and Example Groups")) + expect(sections).to(contain("Installing Quick")) + } + + context("if it doesn't have what you're looking for") { + it("needs to be updated") { + let you = You(awesome: true) + expect{you.submittedAnIssue}.toEventually(beTruthy()) + } + } + } + } +} +``` +#### Nimble +Quick comes together with [Nimble](https://github.com/Quick/Nimble) — a matcher framework for your tests. You can learn why `XCTAssert()` statements make your expectations unclear and how to fix that using Nimble assertions [here](./Documentation/NimbleAssertions.md). + +## Documentation + +All documentation can be found in the [Documentation folder](./Documentation), including [detailed installation instructions](./Documentation/InstallingQuick.md) for CocoaPods, Carthage, Git submodules, and more. For example, you can install Quick and [Nimble](https://github.com/Quick/Nimble) using CocoaPods by adding the following to your Podfile: + +```rb +# Podfile + +use_frameworks! + +def testing_pods + pod 'Quick', '~> 0.9.0' + pod 'Nimble', '3.0.0' +end + +target 'MyTests' do + testing_pods +end + +target 'MyUITests' do + testing_pods +end +``` + +## License + +Apache 2.0 license. See the `LICENSE` file for details. diff --git a/Pods/Quick/Sources/Quick/Callsite.swift b/Pods/Quick/Sources/Quick/Callsite.swift new file mode 100644 index 0000000..53496cd --- /dev/null +++ b/Pods/Quick/Sources/Quick/Callsite.swift @@ -0,0 +1,30 @@ +import Foundation + +/** + An object encapsulating the file and line number at which + a particular example is defined. +*/ +final public class Callsite: NSObject { + /** + The absolute path of the file in which an example is defined. + */ + public let file: String + + /** + The line number on which an example is defined. + */ + public let line: UInt + + internal init(file: String, line: UInt) { + self.file = file + self.line = line + } +} + +/** + Returns a boolean indicating whether two Callsite objects are equal. + If two callsites are in the same file and on the same line, they must be equal. +*/ +public func ==(lhs: Callsite, rhs: Callsite) -> Bool { + return lhs.file == rhs.file && lhs.line == rhs.line +} diff --git a/Pods/Quick/Sources/Quick/Configuration/Configuration.swift b/Pods/Quick/Sources/Quick/Configuration/Configuration.swift new file mode 100644 index 0000000..7b8c2db --- /dev/null +++ b/Pods/Quick/Sources/Quick/Configuration/Configuration.swift @@ -0,0 +1,161 @@ +import Foundation + +/** + A closure that temporarily exposes a Configuration object within + the scope of the closure. +*/ +public typealias QuickConfigurer = (configuration: Configuration) -> () + +/** + A closure that, given metadata about an example, returns a boolean value + indicating whether that example should be run. +*/ +public typealias ExampleFilter = (example: Example) -> Bool + +/** + A configuration encapsulates various options you can use + to configure Quick's behavior. +*/ +final public class Configuration: NSObject { + internal let exampleHooks = ExampleHooks() + internal let suiteHooks = SuiteHooks() + internal var exclusionFilters: [ExampleFilter] = [{ example in + if let pending = example.filterFlags[Filter.pending] { + return pending + } else { + return false + } + }] + internal var inclusionFilters: [ExampleFilter] = [{ example in + if let focused = example.filterFlags[Filter.focused] { + return focused + } else { + return false + } + }] + + /** + Run all examples if none match the configured filters. True by default. + */ + public var runAllWhenEverythingFiltered = true + + /** + Registers an inclusion filter. + + All examples are filtered using all inclusion filters. + The remaining examples are run. If no examples remain, all examples are run. + + - parameter filter: A filter that, given an example, returns a value indicating + whether that example should be included in the examples + that are run. + */ + public func include(filter: ExampleFilter) { + inclusionFilters.append(filter) + } + + /** + Registers an exclusion filter. + + All examples that remain after being filtered by the inclusion filters are + then filtered via all exclusion filters. + + - parameter filter: A filter that, given an example, returns a value indicating + whether that example should be excluded from the examples + that are run. + */ + public func exclude(filter: ExampleFilter) { + exclusionFilters.append(filter) + } + + /** + Identical to Quick.Configuration.beforeEach, except the closure is + provided with metadata on the example that the closure is being run + prior to. + */ +#if _runtime(_ObjC) + @objc(beforeEachWithMetadata:) + public func beforeEach(closure: BeforeExampleWithMetadataClosure) { + exampleHooks.appendBefore(closure) + } +#else + public func beforeEach(closure: BeforeExampleWithMetadataClosure) { + exampleHooks.appendBefore(closure) + } +#endif + + /** + Like Quick.DSL.beforeEach, this configures Quick to execute the + given closure before each example that is run. The closure + passed to this method is executed before each example Quick runs, + globally across the test suite. You may call this method multiple + times across mulitple +[QuickConfigure configure:] methods in order + to define several closures to run before each example. + + Note that, since Quick makes no guarantee as to the order in which + +[QuickConfiguration configure:] methods are evaluated, there is no + guarantee as to the order in which beforeEach closures are evaluated + either. Mulitple beforeEach defined on a single configuration, however, + will be executed in the order they're defined. + + - parameter closure: The closure to be executed before each example + in the test suite. + */ + public func beforeEach(closure: BeforeExampleClosure) { + exampleHooks.appendBefore(closure) + } + + /** + Identical to Quick.Configuration.afterEach, except the closure + is provided with metadata on the example that the closure is being + run after. + */ +#if _runtime(_ObjC) + @objc(afterEachWithMetadata:) + public func afterEach(closure: AfterExampleWithMetadataClosure) { + exampleHooks.appendAfter(closure) + } +#else + public func afterEach(closure: AfterExampleWithMetadataClosure) { + exampleHooks.appendAfter(closure) + } +#endif + + /** + Like Quick.DSL.afterEach, this configures Quick to execute the + given closure after each example that is run. The closure + passed to this method is executed after each example Quick runs, + globally across the test suite. You may call this method multiple + times across mulitple +[QuickConfigure configure:] methods in order + to define several closures to run after each example. + + Note that, since Quick makes no guarantee as to the order in which + +[QuickConfiguration configure:] methods are evaluated, there is no + guarantee as to the order in which afterEach closures are evaluated + either. Mulitple afterEach defined on a single configuration, however, + will be executed in the order they're defined. + + - parameter closure: The closure to be executed before each example + in the test suite. + */ + public func afterEach(closure: AfterExampleClosure) { + exampleHooks.appendAfter(closure) + } + + /** + Like Quick.DSL.beforeSuite, this configures Quick to execute + the given closure prior to any and all examples that are run. + The two methods are functionally equivalent. + */ + public func beforeSuite(closure: BeforeSuiteClosure) { + suiteHooks.appendBefore(closure) + } + + /** + Like Quick.DSL.afterSuite, this configures Quick to execute + the given closure after all examples have been run. + The two methods are functionally equivalent. + */ + public func afterSuite(closure: AfterSuiteClosure) { + suiteHooks.appendAfter(closure) + } +} diff --git a/Pods/Quick/Sources/Quick/Configuration/QuickConfiguration.h b/Pods/Quick/Sources/Quick/Configuration/QuickConfiguration.h new file mode 100644 index 0000000..5646199 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Configuration/QuickConfiguration.h @@ -0,0 +1,30 @@ +#import + +@class Configuration; + +/** + Subclass QuickConfiguration and override the +[QuickConfiguration configure:] + method in order to configure how Quick behaves when running specs, or to define + shared examples that are used across spec files. + */ +@interface QuickConfiguration : NSObject + +/** + This method is executed on each subclass of this class before Quick runs + any examples. You may override this method on as many subclasses as you like, but + there is no guarantee as to the order in which these methods are executed. + + You can override this method in order to: + + 1. Configure how Quick behaves, by modifying properties on the Configuration object. + Setting the same properties in several methods has undefined behavior. + + 2. Define shared examples using `sharedExamples`. + + @param configuration A mutable object that is used to configure how Quick behaves on + a framework level. For details on all the options, see the + documentation in Configuration.swift. + */ ++ (void)configure:(Configuration *)configuration; + +@end diff --git a/Pods/Quick/Sources/Quick/Configuration/QuickConfiguration.m b/Pods/Quick/Sources/Quick/Configuration/QuickConfiguration.m new file mode 100644 index 0000000..937b818 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Configuration/QuickConfiguration.m @@ -0,0 +1,83 @@ +#import "QuickConfiguration.h" +#import "World.h" +#import + +typedef void (^QCKClassEnumerationBlock)(Class klass); + +/** + Finds all direct subclasses of the given class and passes them to the block provided. + The classes are iterated over in the order that objc_getClassList returns them. + + @param klass The base class to find subclasses of. + @param block A block that takes a Class. This block will be executed once for each subclass of klass. + */ +void qck_enumerateSubclasses(Class klass, QCKClassEnumerationBlock block) { + Class *classes = NULL; + int classesCount = objc_getClassList(NULL, 0); + + if (classesCount > 0) { + classes = (Class *)calloc(sizeof(Class), classesCount); + classesCount = objc_getClassList(classes, classesCount); + + Class subclass, superclass; + for(int i = 0; i < classesCount; i++) { + subclass = classes[i]; + superclass = class_getSuperclass(subclass); + if (superclass == klass && block) { + block(subclass); + } + } + + free(classes); + } +} + +@implementation QuickConfiguration + +#pragma mark - Object Lifecycle + +/** + QuickConfiguration is not meant to be instantiated; it merely provides a hook + for users to configure how Quick behaves. Raise an exception if an instance of + QuickConfiguration is created. + */ +- (instancetype)init { + NSString *className = NSStringFromClass([self class]); + NSString *selectorName = NSStringFromSelector(@selector(configure:)); + [NSException raise:NSInternalInconsistencyException + format:@"%@ is not meant to be instantiated; " + @"subclass %@ and override %@ to configure Quick.", + className, className, selectorName]; + return nil; +} + +#pragma mark - NSObject Overrides + +/** + Hook into when QuickConfiguration is initialized in the runtime in order to + call +[QuickConfiguration configure:] on each of its subclasses. + */ ++ (void)initialize { + // Only enumerate over the subclasses of QuickConfiguration, not any of its subclasses. + if ([self class] == [QuickConfiguration class]) { + + // Only enumerate over subclasses once, even if +[QuickConfiguration initialize] + // were to be called several times. This is necessary because +[QuickSpec initialize] + // manually calls +[QuickConfiguration initialize]. + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + qck_enumerateSubclasses([QuickConfiguration class], ^(__unsafe_unretained Class klass) { + [[World sharedWorld] configure:^(Configuration *configuration) { + [klass configure:configuration]; + }]; + }); + [[World sharedWorld] finalizeConfiguration]; + }); + } +} + +#pragma mark - Public Interface + ++ (void)configure:(Configuration *)configuration { } + +@end diff --git a/Pods/Quick/Sources/Quick/DSL/DSL.swift b/Pods/Quick/Sources/Quick/DSL/DSL.swift new file mode 100644 index 0000000..dff2458 --- /dev/null +++ b/Pods/Quick/Sources/Quick/DSL/DSL.swift @@ -0,0 +1,227 @@ +/** + Defines a closure to be run prior to any examples in the test suite. + You may define an unlimited number of these closures, but there is no + guarantee as to the order in which they're run. + + If the test suite crashes before the first example is run, this closure + will not be executed. + + - parameter closure: The closure to be run prior to any examples in the test suite. +*/ +public func beforeSuite(closure: BeforeSuiteClosure) { + World.sharedWorld.beforeSuite(closure) +} + +/** + Defines a closure to be run after all of the examples in the test suite. + You may define an unlimited number of these closures, but there is no + guarantee as to the order in which they're run. + + If the test suite crashes before all examples are run, this closure + will not be executed. + + - parameter closure: The closure to be run after all of the examples in the test suite. +*/ +public func afterSuite(closure: AfterSuiteClosure) { + World.sharedWorld.afterSuite(closure) +} + +/** + Defines a group of shared examples. These examples can be re-used in several locations + by using the `itBehavesLike` function. + + - parameter name: The name of the shared example group. This must be unique across all shared example + groups defined in a test suite. + - parameter closure: A closure containing the examples. This behaves just like an example group defined + using `describe` or `context`--the closure may contain any number of `beforeEach` + and `afterEach` closures, as well as any number of examples (defined using `it`). +*/ +public func sharedExamples(name: String, closure: () -> ()) { + World.sharedWorld.sharedExamples(name, closure: { (NSDictionary) in closure() }) +} + +/** + Defines a group of shared examples. These examples can be re-used in several locations + by using the `itBehavesLike` function. + + - parameter name: The name of the shared example group. This must be unique across all shared example + groups defined in a test suite. + - parameter closure: A closure containing the examples. This behaves just like an example group defined + using `describe` or `context`--the closure may contain any number of `beforeEach` + and `afterEach` closures, as well as any number of examples (defined using `it`). + + The closure takes a SharedExampleContext as an argument. This context is a function + that can be executed to retrieve parameters passed in via an `itBehavesLike` function. +*/ +public func sharedExamples(name: String, closure: SharedExampleClosure) { + World.sharedWorld.sharedExamples(name, closure: closure) +} + +/** + Defines an example group. Example groups are logical groupings of examples. + Example groups can share setup and teardown code. + + - parameter description: An arbitrary string describing the example group. + - parameter closure: A closure that can contain other examples. + - parameter flags: A mapping of string keys to booleans that can be used to filter examples or example groups. +*/ +public func describe(description: String, flags: FilterFlags = [:], closure: () -> ()) { + World.sharedWorld.describe(description, flags: flags, closure: closure) +} + +/** + Defines an example group. Equivalent to `describe`. +*/ +public func context(description: String, flags: FilterFlags = [:], closure: () -> ()) { + World.sharedWorld.context(description, flags: flags, closure: closure) +} + +/** + Defines a closure to be run prior to each example in the current example + group. This closure is not run for pending or otherwise disabled examples. + An example group may contain an unlimited number of beforeEach. They'll be + run in the order they're defined, but you shouldn't rely on that behavior. + + - parameter closure: The closure to be run prior to each example. +*/ +public func beforeEach(closure: BeforeExampleClosure) { + World.sharedWorld.beforeEach(closure) +} + +/** + Identical to Quick.DSL.beforeEach, except the closure is provided with + metadata on the example that the closure is being run prior to. +*/ +public func beforeEach(closure: BeforeExampleWithMetadataClosure) { + World.sharedWorld.beforeEach(closure: closure) +} + +/** + Defines a closure to be run after each example in the current example + group. This closure is not run for pending or otherwise disabled examples. + An example group may contain an unlimited number of afterEach. They'll be + run in the order they're defined, but you shouldn't rely on that behavior. + + - parameter closure: The closure to be run after each example. +*/ +public func afterEach(closure: AfterExampleClosure) { + World.sharedWorld.afterEach(closure) +} + +/** + Identical to Quick.DSL.afterEach, except the closure is provided with + metadata on the example that the closure is being run after. +*/ +public func afterEach(closure: AfterExampleWithMetadataClosure) { + World.sharedWorld.afterEach(closure: closure) +} + +/** + Defines an example. Examples use assertions to demonstrate how code should + behave. These are like "tests" in XCTest. + + - parameter description: An arbitrary string describing what the example is meant to specify. + - parameter closure: A closure that can contain assertions. + - parameter flags: A mapping of string keys to booleans that can be used to filter examples or example groups. + Empty by default. + - parameter file: The absolute path to the file containing the example. A sensible default is provided. + - parameter line: The line containing the example. A sensible default is provided. +*/ +public func it(description: String, flags: FilterFlags = [:], file: String = __FILE__, line: UInt = __LINE__, closure: () -> ()) { + World.sharedWorld.it(description, flags: flags, file: file, line: line, closure: closure) +} + +/** + Inserts the examples defined using a `sharedExamples` function into the current example group. + The shared examples are executed at this location, as if they were written out manually. + + - parameter name: The name of the shared examples group to be executed. This must be identical to the + name of a shared examples group defined using `sharedExamples`. If there are no shared + examples that match the name given, an exception is thrown and the test suite will crash. + - parameter flags: A mapping of string keys to booleans that can be used to filter examples or example groups. + Empty by default. + - parameter file: The absolute path to the file containing the current example group. A sensible default is provided. + - parameter line: The line containing the current example group. A sensible default is provided. +*/ +public func itBehavesLike(name: String, flags: FilterFlags = [:], file: String = __FILE__, line: UInt = __LINE__) { + itBehavesLike(name, flags: flags, file: file, line: line, sharedExampleContext: { return [:] }) +} + +/** + Inserts the examples defined using a `sharedExamples` function into the current example group. + The shared examples are executed at this location, as if they were written out manually. + This function also passes those shared examples a context that can be evaluated to give the shared + examples extra information on the subject of the example. + + - parameter name: The name of the shared examples group to be executed. This must be identical to the + name of a shared examples group defined using `sharedExamples`. If there are no shared + examples that match the name given, an exception is thrown and the test suite will crash. + - parameter sharedExampleContext: A closure that, when evaluated, returns key-value pairs that provide the + shared examples with extra information on the subject of the example. + - parameter flags: A mapping of string keys to booleans that can be used to filter examples or example groups. + Empty by default. + - parameter file: The absolute path to the file containing the current example group. A sensible default is provided. + - parameter line: The line containing the current example group. A sensible default is provided. +*/ +public func itBehavesLike(name: String, flags: FilterFlags = [:], file: String = __FILE__, line: UInt = __LINE__, sharedExampleContext: SharedExampleContext) { + World.sharedWorld.itBehavesLike(name, sharedExampleContext: sharedExampleContext, flags: flags, file: file, line: line) +} + +/** + Defines an example or example group that should not be executed. Use `pending` to temporarily disable + examples or groups that should not be run yet. + + - parameter description: An arbitrary string describing the example or example group. + - parameter closure: A closure that will not be evaluated. +*/ +public func pending(description: String, closure: () -> ()) { + World.sharedWorld.pending(description, closure: closure) +} + +/** + Use this to quickly mark a `describe` closure as pending. + This disables all examples within the closure. +*/ +public func xdescribe(description: String, flags: FilterFlags, closure: () -> ()) { + World.sharedWorld.xdescribe(description, flags: flags, closure: closure) +} + +/** + Use this to quickly mark a `context` closure as pending. + This disables all examples within the closure. +*/ +public func xcontext(description: String, flags: FilterFlags, closure: () -> ()) { + xdescribe(description, flags: flags, closure: closure) +} + +/** + Use this to quickly mark an `it` closure as pending. + This disables the example and ensures the code within the closure is never run. +*/ +public func xit(description: String, flags: FilterFlags = [:], file: String = __FILE__, line: UInt = __LINE__, closure: () -> ()) { + World.sharedWorld.xit(description, flags: flags, file: file, line: line, closure: closure) +} + +/** + Use this to quickly focus a `describe` closure, focusing the examples in the closure. + If any examples in the test suite are focused, only those examples are executed. + This trumps any explicitly focused or unfocused examples within the closure--they are all treated as focused. +*/ +public func fdescribe(description: String, flags: FilterFlags = [:], closure: () -> ()) { + World.sharedWorld.fdescribe(description, flags: flags, closure: closure) +} + +/** + Use this to quickly focus a `context` closure. Equivalent to `fdescribe`. +*/ +public func fcontext(description: String, flags: FilterFlags = [:], closure: () -> ()) { + fdescribe(description, flags: flags, closure: closure) +} + +/** + Use this to quickly focus an `it` closure, focusing the example. + If any examples in the test suite are focused, only those examples are executed. +*/ +public func fit(description: String, flags: FilterFlags = [:], file: String = __FILE__, line: UInt = __LINE__, closure: () -> ()) { + World.sharedWorld.fit(description, flags: flags, file: file, line: line, closure: closure) +} diff --git a/Pods/Quick/Sources/Quick/DSL/QCKDSL.h b/Pods/Quick/Sources/Quick/DSL/QCKDSL.h new file mode 100644 index 0000000..c5f3152 --- /dev/null +++ b/Pods/Quick/Sources/Quick/DSL/QCKDSL.h @@ -0,0 +1,234 @@ +#import + +@class ExampleMetadata; + +/** + Provides a hook for Quick to be configured before any examples are run. + Within this scope, override the +[QuickConfiguration configure:] method + to set properties on a configuration object to customize Quick behavior. + For details, see the documentation for Configuraiton.swift. + + @param name The name of the configuration class. Like any Objective-C + class name, this must be unique to the current runtime + environment. + */ +#define QuickConfigurationBegin(name) \ + @interface name : QuickConfiguration; @end \ + @implementation name \ + + +/** + Marks the end of a Quick configuration. + Make sure you put this after `QuickConfigurationBegin`. + */ +#define QuickConfigurationEnd \ + @end \ + + +/** + Defines a new QuickSpec. Define examples and example groups within the space + between this and `QuickSpecEnd`. + + @param name The name of the spec class. Like any Objective-C class name, this + must be unique to the current runtime environment. + */ +#define QuickSpecBegin(name) \ + @interface name : QuickSpec; @end \ + @implementation name \ + - (void)spec { \ + + +/** + Marks the end of a QuickSpec. Make sure you put this after `QuickSpecBegin`. + */ +#define QuickSpecEnd \ + } \ + @end \ + +typedef NSDictionary *(^QCKDSLSharedExampleContext)(void); +typedef void (^QCKDSLSharedExampleBlock)(QCKDSLSharedExampleContext); +typedef void (^QCKDSLEmptyBlock)(void); +typedef void (^QCKDSLExampleMetadataBlock)(ExampleMetadata *exampleMetadata); + +#define QUICK_EXPORT FOUNDATION_EXPORT + +QUICK_EXPORT void qck_beforeSuite(QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_afterSuite(QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_sharedExamples(NSString *name, QCKDSLSharedExampleBlock closure); +QUICK_EXPORT void qck_describe(NSString *description, QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_context(NSString *description, QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_beforeEach(QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_beforeEachWithMetadata(QCKDSLExampleMetadataBlock closure); +QUICK_EXPORT void qck_afterEach(QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_afterEachWithMetadata(QCKDSLExampleMetadataBlock closure); +QUICK_EXPORT void qck_pending(NSString *description, QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_xdescribe(NSString *description, QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_xcontext(NSString *description, QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_fdescribe(NSString *description, QCKDSLEmptyBlock closure); +QUICK_EXPORT void qck_fcontext(NSString *description, QCKDSLEmptyBlock closure); + +#ifndef QUICK_DISABLE_SHORT_SYNTAX +/** + Defines a closure to be run prior to any examples in the test suite. + You may define an unlimited number of these closures, but there is no + guarantee as to the order in which they're run. + + If the test suite crashes before the first example is run, this closure + will not be executed. + + @param closure The closure to be run prior to any examples in the test suite. + */ +static inline void beforeSuite(QCKDSLEmptyBlock closure) { + qck_beforeSuite(closure); +} + + +/** + Defines a closure to be run after all of the examples in the test suite. + You may define an unlimited number of these closures, but there is no + guarantee as to the order in which they're run. + + If the test suite crashes before all examples are run, this closure + will not be executed. + + @param closure The closure to be run after all of the examples in the test suite. + */ +static inline void afterSuite(QCKDSLEmptyBlock closure) { + qck_afterSuite(closure); +} + +/** + Defines a group of shared examples. These examples can be re-used in several locations + by using the `itBehavesLike` function. + + @param name The name of the shared example group. This must be unique across all shared example + groups defined in a test suite. + @param closure A closure containing the examples. This behaves just like an example group defined + using `describe` or `context`--the closure may contain any number of `beforeEach` + and `afterEach` closures, as well as any number of examples (defined using `it`). + */ +static inline void sharedExamples(NSString *name, QCKDSLSharedExampleBlock closure) { + qck_sharedExamples(name, closure); +} + +/** + Defines an example group. Example groups are logical groupings of examples. + Example groups can share setup and teardown code. + + @param description An arbitrary string describing the example group. + @param closure A closure that can contain other examples. + */ +static inline void describe(NSString *description, QCKDSLEmptyBlock closure) { + qck_describe(description, closure); +} + +/** + Defines an example group. Equivalent to `describe`. + */ +static inline void context(NSString *description, QCKDSLEmptyBlock closure) { + qck_context(description, closure); +} + +/** + Defines a closure to be run prior to each example in the current example + group. This closure is not run for pending or otherwise disabled examples. + An example group may contain an unlimited number of beforeEach. They'll be + run in the order they're defined, but you shouldn't rely on that behavior. + + @param closure The closure to be run prior to each example. + */ +static inline void beforeEach(QCKDSLEmptyBlock closure) { + qck_beforeEach(closure); +} + +/** + Identical to QCKDSL.beforeEach, except the closure is provided with + metadata on the example that the closure is being run prior to. + */ +static inline void beforeEachWithMetadata(QCKDSLExampleMetadataBlock closure) { + qck_beforeEachWithMetadata(closure); +} + +/** + Defines a closure to be run after each example in the current example + group. This closure is not run for pending or otherwise disabled examples. + An example group may contain an unlimited number of afterEach. They'll be + run in the order they're defined, but you shouldn't rely on that behavior. + + @param closure The closure to be run after each example. + */ +static inline void afterEach(QCKDSLEmptyBlock closure) { + qck_afterEach(closure); +} + +/** + Identical to QCKDSL.afterEach, except the closure is provided with + metadata on the example that the closure is being run after. + */ +static inline void afterEachWithMetadata(QCKDSLExampleMetadataBlock closure) { + qck_afterEachWithMetadata(closure); +} + +/** + Defines an example or example group that should not be executed. Use `pending` to temporarily disable + examples or groups that should not be run yet. + + @param description An arbitrary string describing the example or example group. + @param closure A closure that will not be evaluated. + */ +static inline void pending(NSString *description, QCKDSLEmptyBlock closure) { + qck_pending(description, closure); +} + +/** + Use this to quickly mark a `describe` block as pending. + This disables all examples within the block. + */ +static inline void xdescribe(NSString *description, QCKDSLEmptyBlock closure) { + qck_xdescribe(description, closure); +} + +/** + Use this to quickly mark a `context` block as pending. + This disables all examples within the block. + */ +static inline void xcontext(NSString *description, QCKDSLEmptyBlock closure) { + qck_xcontext(description, closure); +} + +/** + Use this to quickly focus a `describe` block, focusing the examples in the block. + If any examples in the test suite are focused, only those examples are executed. + This trumps any explicitly focused or unfocused examples within the block--they are all treated as focused. + */ +static inline void fdescribe(NSString *description, QCKDSLEmptyBlock closure) { + qck_fdescribe(description, closure); +} + +/** + Use this to quickly focus a `context` block. Equivalent to `fdescribe`. + */ +static inline void fcontext(NSString *description, QCKDSLEmptyBlock closure) { + qck_fcontext(description, closure); +} + +#define it qck_it +#define xit qck_xit +#define fit qck_fit +#define itBehavesLike qck_itBehavesLike +#define xitBehavesLike qck_xitBehavesLike +#define fitBehavesLike qck_fitBehavesLike +#endif + +#define qck_it qck_it_builder(@{}, @(__FILE__), __LINE__) +#define qck_xit qck_it_builder(@{Filter.pending: @YES}, @(__FILE__), __LINE__) +#define qck_fit qck_it_builder(@{Filter.focused: @YES}, @(__FILE__), __LINE__) +#define qck_itBehavesLike qck_itBehavesLike_builder(@{}, @(__FILE__), __LINE__) +#define qck_xitBehavesLike qck_itBehavesLike_builder(@{Filter.pending: @YES}, @(__FILE__), __LINE__) +#define qck_fitBehavesLike qck_itBehavesLike_builder(@{Filter.focused: @YES}, @(__FILE__), __LINE__) + +typedef void (^QCKItBlock)(NSString *description, QCKDSLEmptyBlock closure); +typedef void (^QCKItBehavesLikeBlock)(NSString *description, QCKDSLSharedExampleContext context); + +QUICK_EXPORT QCKItBlock qck_it_builder(NSDictionary *flags, NSString *file, NSUInteger line); +QUICK_EXPORT QCKItBehavesLikeBlock qck_itBehavesLike_builder(NSDictionary *flags, NSString *file, NSUInteger line); diff --git a/Pods/Quick/Sources/Quick/DSL/QCKDSL.m b/Pods/Quick/Sources/Quick/DSL/QCKDSL.m new file mode 100644 index 0000000..10e8a3d --- /dev/null +++ b/Pods/Quick/Sources/Quick/DSL/QCKDSL.m @@ -0,0 +1,79 @@ +#import "QCKDSL.h" +#import "World.h" +#import "World+DSL.h" + +void qck_beforeSuite(QCKDSLEmptyBlock closure) { + [[World sharedWorld] beforeSuite:closure]; +} + +void qck_afterSuite(QCKDSLEmptyBlock closure) { + [[World sharedWorld] afterSuite:closure]; +} + +void qck_sharedExamples(NSString *name, QCKDSLSharedExampleBlock closure) { + [[World sharedWorld] sharedExamples:name closure:closure]; +} + +void qck_describe(NSString *description, QCKDSLEmptyBlock closure) { + [[World sharedWorld] describe:description flags:@{} closure:closure]; +} + +void qck_context(NSString *description, QCKDSLEmptyBlock closure) { + qck_describe(description, closure); +} + +void qck_beforeEach(QCKDSLEmptyBlock closure) { + [[World sharedWorld] beforeEach:closure]; +} + +void qck_beforeEachWithMetadata(QCKDSLExampleMetadataBlock closure) { + [[World sharedWorld] beforeEachWithMetadata:closure]; +} + +void qck_afterEach(QCKDSLEmptyBlock closure) { + [[World sharedWorld] afterEach:closure]; +} + +void qck_afterEachWithMetadata(QCKDSLExampleMetadataBlock closure) { + [[World sharedWorld] afterEachWithMetadata:closure]; +} + +QCKItBlock qck_it_builder(NSDictionary *flags, NSString *file, NSUInteger line) { + return ^(NSString *description, QCKDSLEmptyBlock closure) { + [[World sharedWorld] itWithDescription:description + flags:flags + file:file + line:line + closure:closure]; + }; +} + +QCKItBehavesLikeBlock qck_itBehavesLike_builder(NSDictionary *flags, NSString *file, NSUInteger line) { + return ^(NSString *name, QCKDSLSharedExampleContext context) { + [[World sharedWorld] itBehavesLikeSharedExampleNamed:name + sharedExampleContext:context + flags:flags + file:file + line:line]; + }; +} + +void qck_pending(NSString *description, QCKDSLEmptyBlock closure) { + [[World sharedWorld] pending:description closure:closure]; +} + +void qck_xdescribe(NSString *description, QCKDSLEmptyBlock closure) { + [[World sharedWorld] xdescribe:description flags:@{} closure:closure]; +} + +void qck_xcontext(NSString *description, QCKDSLEmptyBlock closure) { + qck_xdescribe(description, closure); +} + +void qck_fdescribe(NSString *description, QCKDSLEmptyBlock closure) { + [[World sharedWorld] fdescribe:description flags:@{} closure:closure]; +} + +void qck_fcontext(NSString *description, QCKDSLEmptyBlock closure) { + qck_fdescribe(description, closure); +} diff --git a/Pods/Quick/Sources/Quick/DSL/World+DSL.h b/Pods/Quick/Sources/Quick/DSL/World+DSL.h new file mode 100644 index 0000000..a3b8524 --- /dev/null +++ b/Pods/Quick/Sources/Quick/DSL/World+DSL.h @@ -0,0 +1,20 @@ +#import + +@interface World (SWIFT_EXTENSION(Quick)) +- (void)beforeSuite:(void (^ __nonnull)(void))closure; +- (void)afterSuite:(void (^ __nonnull)(void))closure; +- (void)sharedExamples:(NSString * __nonnull)name closure:(void (^ __nonnull)(NSDictionary * __nonnull (^ __nonnull)(void)))closure; +- (void)describe:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; +- (void)context:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; +- (void)fdescribe:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; +- (void)xdescribe:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; +- (void)beforeEach:(void (^ __nonnull)(void))closure; +- (void)beforeEachWithMetadata:(void (^ __nonnull)(ExampleMetadata * __nonnull))closure; +- (void)afterEach:(void (^ __nonnull)(void))closure; +- (void)afterEachWithMetadata:(void (^ __nonnull)(ExampleMetadata * __nonnull))closure; +- (void)itWithDescription:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line closure:(void (^ __nonnull)(void))closure; +- (void)fitWithDescription:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line closure:(void (^ __nonnull)(void))closure; +- (void)xitWithDescription:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line closure:(void (^ __nonnull)(void))closure; +- (void)itBehavesLikeSharedExampleNamed:(NSString * __nonnull)name sharedExampleContext:(NSDictionary * __nonnull (^ __nonnull)(void))sharedExampleContext flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line; +- (void)pending:(NSString * __nonnull)description closure:(void (^ __nonnull)(void))closure; +@end diff --git a/Pods/Quick/Sources/Quick/DSL/World+DSL.swift b/Pods/Quick/Sources/Quick/DSL/World+DSL.swift new file mode 100644 index 0000000..027d09c --- /dev/null +++ b/Pods/Quick/Sources/Quick/DSL/World+DSL.swift @@ -0,0 +1,171 @@ +import Foundation + +/** + Adds methods to World to support top-level DSL functions (Swift) and + macros (Objective-C). These functions map directly to the DSL that test + writers use in their specs. +*/ +extension World { + internal func beforeSuite(closure: BeforeSuiteClosure) { + suiteHooks.appendBefore(closure) + } + + internal func afterSuite(closure: AfterSuiteClosure) { + suiteHooks.appendAfter(closure) + } + + internal func sharedExamples(name: String, closure: SharedExampleClosure) { + registerSharedExample(name, closure: closure) + } + + internal func describe(description: String, flags: FilterFlags, closure: () -> ()) { + guard currentExampleMetadata == nil else { + raiseError("'describe' cannot be used inside '\(currentPhase)', 'describe' may only be used inside 'context' or 'describe'. ") + } + guard currentExampleGroup != nil else { + raiseError("Error: example group was not created by its parent QuickSpec spec. Check that describe() or context() was used in QuickSpec.spec() and not a more general context (i.e. an XCTestCase test)") + } + let group = ExampleGroup(description: description, flags: flags) + currentExampleGroup.appendExampleGroup(group) + currentExampleGroup = group + closure() + currentExampleGroup = group.parent + } + + internal func context(description: String, flags: FilterFlags, closure: () -> ()) { + guard currentExampleMetadata == nil else { + raiseError("'context' cannot be used inside '\(currentPhase)', 'context' may only be used inside 'context' or 'describe'. ") + } + self.describe(description, flags: flags, closure: closure) + } + + internal func fdescribe(description: String, flags: FilterFlags, closure: () -> ()) { + var focusedFlags = flags + focusedFlags[Filter.focused] = true + self.describe(description, flags: focusedFlags, closure: closure) + } + + internal func xdescribe(description: String, flags: FilterFlags, closure: () -> ()) { + var pendingFlags = flags + pendingFlags[Filter.pending] = true + self.describe(description, flags: pendingFlags, closure: closure) + } + + internal func beforeEach(closure: BeforeExampleClosure) { + guard currentExampleMetadata == nil else { + raiseError("'beforeEach' cannot be used inside '\(currentPhase)', 'beforeEach' may only be used inside 'context' or 'describe'. ") + } + currentExampleGroup.hooks.appendBefore(closure) + } + +#if _runtime(_ObjC) + @objc(beforeEachWithMetadata:) + internal func beforeEach(closure closure: BeforeExampleWithMetadataClosure) { + currentExampleGroup.hooks.appendBefore(closure) + } +#else + internal func beforeEach(closure closure: BeforeExampleWithMetadataClosure) { + currentExampleGroup.hooks.appendBefore(closure) + } +#endif + + internal func afterEach(closure: AfterExampleClosure) { + guard currentExampleMetadata == nil else { + raiseError("'afterEach' cannot be used inside '\(currentPhase)', 'afterEach' may only be used inside 'context' or 'describe'. ") + } + currentExampleGroup.hooks.appendAfter(closure) + } + +#if _runtime(_ObjC) + @objc(afterEachWithMetadata:) + internal func afterEach(closure closure: AfterExampleWithMetadataClosure) { + currentExampleGroup.hooks.appendAfter(closure) + } +#else + internal func afterEach(closure closure: AfterExampleWithMetadataClosure) { + currentExampleGroup.hooks.appendAfter(closure) + } +#endif + + internal func it(description: String, flags: FilterFlags, file: String, line: UInt, closure: () -> ()) { + if beforesCurrentlyExecuting { + raiseError("'it' cannot be used inside 'beforeEach', 'it' may only be used inside 'context' or 'describe'. ") + } + if aftersCurrentlyExecuting { + raiseError("'it' cannot be used inside 'afterEach', 'it' may only be used inside 'context' or 'describe'. ") + } + guard currentExampleMetadata == nil else { + raiseError("'it' cannot be used inside 'it', 'it' may only be used inside 'context' or 'describe'. ") + } + let callsite = Callsite(file: file, line: line) + let example = Example(description: description, callsite: callsite, flags: flags, closure: closure) + currentExampleGroup.appendExample(example) + } + + internal func fit(description: String, flags: FilterFlags, file: String, line: UInt, closure: () -> ()) { + var focusedFlags = flags + focusedFlags[Filter.focused] = true + self.it(description, flags: focusedFlags, file: file, line: line, closure: closure) + } + + internal func xit(description: String, flags: FilterFlags, file: String, line: UInt, closure: () -> ()) { + var pendingFlags = flags + pendingFlags[Filter.pending] = true + self.it(description, flags: pendingFlags, file: file, line: line, closure: closure) + } + + internal func itBehavesLike(name: String, sharedExampleContext: SharedExampleContext, flags: FilterFlags, file: String, line: UInt) { + guard currentExampleMetadata == nil else { + raiseError("'itBehavesLike' cannot be used inside '\(currentPhase)', 'itBehavesLike' may only be used inside 'context' or 'describe'. ") + } + let callsite = Callsite(file: file, line: line) + let closure = World.sharedWorld.sharedExample(name) + + let group = ExampleGroup(description: name, flags: flags) + currentExampleGroup.appendExampleGroup(group) + currentExampleGroup = group + closure(sharedExampleContext) + currentExampleGroup.walkDownExamples { (example: Example) in + example.isSharedExample = true + example.callsite = callsite + } + + currentExampleGroup = group.parent + } + +#if _runtime(_ObjC) + @objc(itWithDescription:flags:file:line:closure:) + private func objc_it(description: String, flags: FilterFlags, file: String, line: UInt, closure: () -> ()) { + it(description, flags: flags, file: file, line: line, closure: closure) + } + + @objc(fitWithDescription:flags:file:line:closure:) + private func objc_fit(description: String, flags: FilterFlags, file: String, line: UInt, closure: () -> ()) { + fit(description, flags: flags, file: file, line: line, closure: closure) + } + + @objc(xitWithDescription:flags:file:line:closure:) + private func objc_xit(description: String, flags: FilterFlags, file: String, line: UInt, closure: () -> ()) { + xit(description, flags: flags, file: file, line: line, closure: closure) + } + + @objc(itBehavesLikeSharedExampleNamed:sharedExampleContext:flags:file:line:) + private func objc_itBehavesLike(name: String, sharedExampleContext: SharedExampleContext, flags: FilterFlags, file: String, line: UInt) { + itBehavesLike(name, sharedExampleContext: sharedExampleContext, flags: flags, file: file, line: line) + } +#endif + + internal func pending(description: String, closure: () -> ()) { + print("Pending: \(description)") + } + + private var currentPhase: String { + if beforesCurrentlyExecuting { + return "beforeEach" + } else if aftersCurrentlyExecuting { + return "afterEach" + } + + return "it" + } +} diff --git a/Pods/Quick/Sources/Quick/ErrorUtility.swift b/Pods/Quick/Sources/Quick/ErrorUtility.swift new file mode 100644 index 0000000..3c4035a --- /dev/null +++ b/Pods/Quick/Sources/Quick/ErrorUtility.swift @@ -0,0 +1,10 @@ +import Foundation + +@noreturn internal func raiseError(message: String) { +#if _runtime(_ObjC) + NSException(name: NSInternalInconsistencyException, reason: message, userInfo: nil).raise() +#endif + + // This won't be reached when ObjC is available and the exception above is raisd + fatalError(message) +} diff --git a/Pods/Quick/Sources/Quick/Example.swift b/Pods/Quick/Sources/Quick/Example.swift new file mode 100644 index 0000000..6fbfab8 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Example.swift @@ -0,0 +1,113 @@ +import Foundation + +private var numberOfExamplesRun = 0 + +/** + Examples, defined with the `it` function, use assertions to + demonstrate how code should behave. These are like "tests" in XCTest. +*/ +final public class Example: NSObject { + /** + A boolean indicating whether the example is a shared example; + i.e.: whether it is an example defined with `itBehavesLike`. + */ + public var isSharedExample = false + + /** + The site at which the example is defined. + This must be set correctly in order for Xcode to highlight + the correct line in red when reporting a failure. + */ + public var callsite: Callsite + + weak internal var group: ExampleGroup? + + private let internalDescription: String + private let closure: () -> () + private let flags: FilterFlags + + internal init(description: String, callsite: Callsite, flags: FilterFlags, closure: () -> ()) { + self.internalDescription = description + self.closure = closure + self.callsite = callsite + self.flags = flags + } + + public override var description: String { + return internalDescription + } + + /** + The example name. A name is a concatenation of the name of + the example group the example belongs to, followed by the + description of the example itself. + + The example name is used to generate a test method selector + to be displayed in Xcode's test navigator. + */ + public var name: String { + switch group!.name { + case .Some(let groupName): return "\(groupName), \(description)" + case .None: return description + } + } + + /** + Executes the example closure, as well as all before and after + closures defined in the its surrounding example groups. + */ + public func run() { + let world = World.sharedWorld + + if numberOfExamplesRun == 0 { + world.suiteHooks.executeBefores() + } + + let exampleMetadata = ExampleMetadata(example: self, exampleIndex: numberOfExamplesRun) + world.currentExampleMetadata = exampleMetadata + + world.exampleHooks.executeBefores(exampleMetadata) + group!.phase = .BeforesExecuting + for before in group!.befores { + before(exampleMetadata: exampleMetadata) + } + group!.phase = .BeforesFinished + + closure() + + group!.phase = .AftersExecuting + for after in group!.afters { + after(exampleMetadata: exampleMetadata) + } + group!.phase = .AftersFinished + world.exampleHooks.executeAfters(exampleMetadata) + + numberOfExamplesRun += 1 + + if !world.isRunningAdditionalSuites && numberOfExamplesRun >= world.exampleCount { + world.suiteHooks.executeAfters() + } + } + + /** + Evaluates the filter flags set on this example and on the example groups + this example belongs to. Flags set on the example are trumped by flags on + the example group it belongs to. Flags on inner example groups are trumped + by flags on outer example groups. + */ + internal var filterFlags: FilterFlags { + var aggregateFlags = flags + for (key, value) in group!.filterFlags { + aggregateFlags[key] = value + } + return aggregateFlags + } +} + +/** + Returns a boolean indicating whether two Example objects are equal. + If two examples are defined at the exact same callsite, they must be equal. +*/ +public func ==(lhs: Example, rhs: Example) -> Bool { + return lhs.callsite == rhs.callsite +} diff --git a/Pods/Quick/Sources/Quick/ExampleGroup.swift b/Pods/Quick/Sources/Quick/ExampleGroup.swift new file mode 100644 index 0000000..cf2b983 --- /dev/null +++ b/Pods/Quick/Sources/Quick/ExampleGroup.swift @@ -0,0 +1,105 @@ +import Foundation + +/** + Example groups are logical groupings of examples, defined with + the `describe` and `context` functions. Example groups can share + setup and teardown code. +*/ +final public class ExampleGroup: NSObject { + weak internal var parent: ExampleGroup? + internal let hooks = ExampleHooks() + + internal var phase: HooksPhase = .NothingExecuted + + private let internalDescription: String + private let flags: FilterFlags + private let isInternalRootExampleGroup: Bool + private var childGroups = [ExampleGroup]() + private var childExamples = [Example]() + + internal init(description: String, flags: FilterFlags, isInternalRootExampleGroup: Bool = false) { + self.internalDescription = description + self.flags = flags + self.isInternalRootExampleGroup = isInternalRootExampleGroup + } + + public override var description: String { + return internalDescription + } + + /** + Returns a list of examples that belong to this example group, + or to any of its descendant example groups. + */ + public var examples: [Example] { + var examples = childExamples + for group in childGroups { + examples.appendContentsOf(group.examples) + } + return examples + } + + internal var name: String? { + if let parent = parent { + switch(parent.name) { + case .Some(let name): return "\(name), \(description)" + case .None: return description + } + } else { + return isInternalRootExampleGroup ? nil : description + } + } + + internal var filterFlags: FilterFlags { + var aggregateFlags = flags + walkUp() { (group: ExampleGroup) -> () in + for (key, value) in group.flags { + aggregateFlags[key] = value + } + } + return aggregateFlags + } + + internal var befores: [BeforeExampleWithMetadataClosure] { + var closures = Array(hooks.befores.reverse()) + walkUp() { (group: ExampleGroup) -> () in + closures.appendContentsOf(Array(group.hooks.befores.reverse())) + } + return Array(closures.reverse()) + } + + internal var afters: [AfterExampleWithMetadataClosure] { + var closures = hooks.afters + walkUp() { (group: ExampleGroup) -> () in + closures.appendContentsOf(group.hooks.afters) + } + return closures + } + + internal func walkDownExamples(callback: (example: Example) -> ()) { + for example in childExamples { + callback(example: example) + } + for group in childGroups { + group.walkDownExamples(callback) + } + } + + internal func appendExampleGroup(group: ExampleGroup) { + group.parent = self + childGroups.append(group) + } + + internal func appendExample(example: Example) { + example.group = self + childExamples.append(example) + } + + private func walkUp(callback: (group: ExampleGroup) -> ()) { + var group = self + while let parent = group.parent { + callback(group: parent) + group = parent + } + } +} diff --git a/Pods/Quick/Sources/Quick/ExampleMetadata.swift b/Pods/Quick/Sources/Quick/ExampleMetadata.swift new file mode 100644 index 0000000..e7510f7 --- /dev/null +++ b/Pods/Quick/Sources/Quick/ExampleMetadata.swift @@ -0,0 +1,24 @@ +import Foundation + +/** + A class that encapsulates information about an example, + including the index at which the example was executed, as + well as the example itself. +*/ +final public class ExampleMetadata: NSObject { + /** + The example for which this metadata was collected. + */ + public let example: Example + + /** + The index at which this example was executed in the + test suite. + */ + public let exampleIndex: Int + + internal init(example: Example, exampleIndex: Int) { + self.example = example + self.exampleIndex = exampleIndex + } +} diff --git a/Pods/Quick/Sources/Quick/Filter.swift b/Pods/Quick/Sources/Quick/Filter.swift new file mode 100644 index 0000000..d452efe --- /dev/null +++ b/Pods/Quick/Sources/Quick/Filter.swift @@ -0,0 +1,31 @@ +import Foundation + +/** + A mapping of string keys to booleans that can be used to + filter examples or example groups. For example, a "focused" + example would have the flags [Focused: true]. +*/ +public typealias FilterFlags = [String: Bool] + +/** + A namespace for filter flag keys, defined primarily to make the + keys available in Objective-C. +*/ +final public class Filter: NSObject { + /** + Example and example groups with [Focused: true] are included in test runs, + excluding all other examples without this flag. Use this to only run one or + two tests that you're currently focusing on. + */ + public class var focused: String { + return "focused" + } + + /** + Example and example groups with [Pending: true] are excluded from test runs. + Use this to temporarily suspend examples that you know do not pass yet. + */ + public class var pending: String { + return "pending" + } +} diff --git a/Pods/Quick/Sources/Quick/Hooks/Closures.swift b/Pods/Quick/Sources/Quick/Hooks/Closures.swift new file mode 100644 index 0000000..3252bbf --- /dev/null +++ b/Pods/Quick/Sources/Quick/Hooks/Closures.swift @@ -0,0 +1,35 @@ +// MARK: Example Hooks + +/** + A closure executed before an example is run. +*/ +public typealias BeforeExampleClosure = () -> () + +/** + A closure executed before an example is run. The closure is given example metadata, + which contains information about the example that is about to be run. +*/ +public typealias BeforeExampleWithMetadataClosure = (exampleMetadata: ExampleMetadata) -> () + +/** + A closure executed after an example is run. +*/ +public typealias AfterExampleClosure = BeforeExampleClosure + +/** + A closure executed after an example is run. The closure is given example metadata, + which contains information about the example that has just finished running. +*/ +public typealias AfterExampleWithMetadataClosure = BeforeExampleWithMetadataClosure + +// MARK: Suite Hooks + +/** + A closure executed before any examples are run. +*/ +public typealias BeforeSuiteClosure = () -> () + +/** + A closure executed after all examples have finished running. +*/ +public typealias AfterSuiteClosure = BeforeSuiteClosure diff --git a/Pods/Quick/Sources/Quick/Hooks/ExampleHooks.swift b/Pods/Quick/Sources/Quick/Hooks/ExampleHooks.swift new file mode 100644 index 0000000..1d5fa91 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Hooks/ExampleHooks.swift @@ -0,0 +1,42 @@ +/** + A container for closures to be executed before and after each example. +*/ +final internal class ExampleHooks { + internal var befores: [BeforeExampleWithMetadataClosure] = [] + internal var afters: [AfterExampleWithMetadataClosure] = [] + internal var phase: HooksPhase = .NothingExecuted + + internal func appendBefore(closure: BeforeExampleWithMetadataClosure) { + befores.append(closure) + } + + internal func appendBefore(closure: BeforeExampleClosure) { + befores.append { (exampleMetadata: ExampleMetadata) in closure() } + } + + internal func appendAfter(closure: AfterExampleWithMetadataClosure) { + afters.append(closure) + } + + internal func appendAfter(closure: AfterExampleClosure) { + afters.append { (exampleMetadata: ExampleMetadata) in closure() } + } + + internal func executeBefores(exampleMetadata: ExampleMetadata) { + phase = .BeforesExecuting + for before in befores { + before(exampleMetadata: exampleMetadata) + } + + phase = .BeforesFinished + } + + internal func executeAfters(exampleMetadata: ExampleMetadata) { + phase = .AftersExecuting + for after in afters { + after(exampleMetadata: exampleMetadata) + } + + phase = .AftersFinished + } +} diff --git a/Pods/Quick/Sources/Quick/Hooks/HooksPhase.swift b/Pods/Quick/Sources/Quick/Hooks/HooksPhase.swift new file mode 100644 index 0000000..8dc3784 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Hooks/HooksPhase.swift @@ -0,0 +1,11 @@ +/** + A description of the execution cycle of the current example with + respect to the hooks of that example. + */ +internal enum HooksPhase: Int { + case NothingExecuted = 0 + case BeforesExecuting + case BeforesFinished + case AftersExecuting + case AftersFinished +} diff --git a/Pods/Quick/Sources/Quick/Hooks/SuiteHooks.swift b/Pods/Quick/Sources/Quick/Hooks/SuiteHooks.swift new file mode 100644 index 0000000..59bdcf2 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Hooks/SuiteHooks.swift @@ -0,0 +1,32 @@ +/** + A container for closures to be executed before and after all examples. +*/ +final internal class SuiteHooks { + internal var befores: [BeforeSuiteClosure] = [] + internal var afters: [AfterSuiteClosure] = [] + internal var phase: HooksPhase = .NothingExecuted + + internal func appendBefore(closure: BeforeSuiteClosure) { + befores.append(closure) + } + + internal func appendAfter(closure: AfterSuiteClosure) { + afters.append(closure) + } + + internal func executeBefores() { + phase = .BeforesExecuting + for before in befores { + before() + } + phase = .BeforesFinished + } + + internal func executeAfters() { + phase = .AftersExecuting + for after in afters { + after() + } + phase = .AftersFinished + } +} diff --git a/Pods/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift b/Pods/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift new file mode 100644 index 0000000..e8709e0 --- /dev/null +++ b/Pods/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift @@ -0,0 +1,20 @@ +#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) + +import Foundation + +extension NSBundle { + + /** + Locates the first bundle with a '.xctest' file extension. + */ + internal static var currentTestBundle: NSBundle? { + return allBundles().lazy + .filter { + $0.bundlePath.hasSuffix(".xctest") + } + .first + } + +} + +#endif diff --git a/Pods/Quick/Sources/Quick/NSString+QCKSelectorName.h b/Pods/Quick/Sources/Quick/NSString+QCKSelectorName.h new file mode 100644 index 0000000..2da524e --- /dev/null +++ b/Pods/Quick/Sources/Quick/NSString+QCKSelectorName.h @@ -0,0 +1,17 @@ +#import + +/** + QuickSpec converts example names into test methods. + Those test methods need valid selector names, which means no whitespace, + control characters, etc. This category gives NSString objects an easy way + to replace those illegal characters with underscores. + */ +@interface NSString (QCKSelectorName) + +/** + Returns a string with underscores in place of all characters that cannot + be included in a selector (SEL) name. + */ +@property (nonatomic, readonly) NSString *qck_selectorName; + +@end diff --git a/Pods/Quick/Sources/Quick/NSString+QCKSelectorName.m b/Pods/Quick/Sources/Quick/NSString+QCKSelectorName.m new file mode 100644 index 0000000..d374be6 --- /dev/null +++ b/Pods/Quick/Sources/Quick/NSString+QCKSelectorName.m @@ -0,0 +1,37 @@ +#import "NSString+QCKSelectorName.h" + +@implementation NSString (QCKSelectorName) + +- (NSString *)qck_selectorName { + static NSMutableCharacterSet *invalidCharacters = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + invalidCharacters = [NSMutableCharacterSet new]; + + NSCharacterSet *whitespaceCharacterSet = [NSCharacterSet whitespaceCharacterSet]; + NSCharacterSet *newlineCharacterSet = [NSCharacterSet newlineCharacterSet]; + NSCharacterSet *illegalCharacterSet = [NSCharacterSet illegalCharacterSet]; + NSCharacterSet *controlCharacterSet = [NSCharacterSet controlCharacterSet]; + NSCharacterSet *punctuationCharacterSet = [NSCharacterSet punctuationCharacterSet]; + NSCharacterSet *nonBaseCharacterSet = [NSCharacterSet nonBaseCharacterSet]; + NSCharacterSet *symbolCharacterSet = [NSCharacterSet symbolCharacterSet]; + + [invalidCharacters formUnionWithCharacterSet:whitespaceCharacterSet]; + [invalidCharacters formUnionWithCharacterSet:newlineCharacterSet]; + [invalidCharacters formUnionWithCharacterSet:illegalCharacterSet]; + [invalidCharacters formUnionWithCharacterSet:controlCharacterSet]; + [invalidCharacters formUnionWithCharacterSet:punctuationCharacterSet]; + [invalidCharacters formUnionWithCharacterSet:nonBaseCharacterSet]; + [invalidCharacters formUnionWithCharacterSet:symbolCharacterSet]; + }); + + NSArray *validComponents = [self componentsSeparatedByCharactersInSet:invalidCharacters]; + + NSString *result = [validComponents componentsJoinedByString:@"_"]; + + return ([result length] == 0 + ? @"_" + : result); +} + +@end diff --git a/Pods/Quick/Sources/Quick/Quick.h b/Pods/Quick/Sources/Quick/Quick.h new file mode 100644 index 0000000..87dad10 --- /dev/null +++ b/Pods/Quick/Sources/Quick/Quick.h @@ -0,0 +1,11 @@ +#import + +//! Project version number for Quick. +FOUNDATION_EXPORT double QuickVersionNumber; + +//! Project version string for Quick. +FOUNDATION_EXPORT const unsigned char QuickVersionString[]; + +#import "QuickSpec.h" +#import "QCKDSL.h" +#import "QuickConfiguration.h" diff --git a/Pods/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift b/Pods/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift new file mode 100644 index 0000000..5163a4e --- /dev/null +++ b/Pods/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift @@ -0,0 +1,73 @@ +#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) + +/** + Responsible for building a "Selected tests" suite. This corresponds to a single + spec, and all its examples. + */ +internal class QuickSelectedTestSuiteBuilder: QuickTestSuiteBuilder { + + /** + The test spec class to run. + */ + let testCaseClass: AnyClass! + + /** + For Objective-C classes, returns the class name. For Swift classes without, + an explicit Objective-C name, returns a module-namespaced class name + (e.g., "FooTests.FooSpec"). + */ + var testSuiteClassName: String { + return NSStringFromClass(testCaseClass) + } + + /** + Given a test case name: + + FooSpec/testFoo + + Optionally constructs a test suite builder for the named test case class + in the running test bundle. + + If no test bundle can be found, or the test case class can't be found, + initialization fails and returns `nil`. + */ + init?(forTestCaseWithName name: String) { + guard let testCaseClass = testCaseClassForTestCaseWithName(name) else { + self.testCaseClass = nil + return nil + } + + self.testCaseClass = testCaseClass + } + + /** + Returns a `QuickTestSuite` that runs the associated test case class. + */ + func buildTestSuite() -> QuickTestSuite { + return QuickTestSuite(forTestCaseClass: testCaseClass) + } + +} + +/** + Searches `NSBundle.allBundles()` for an xctest bundle, then looks up the named + test case class in that bundle. + + Returns `nil` if a bundle or test case class cannot be found. + */ +private func testCaseClassForTestCaseWithName(name: String) -> AnyClass? { + func extractClassName(name: String) -> String? { + return name.characters.split("/").first.map(String.init) + } + + guard let className = extractClassName(name) else { return nil } + guard let bundle = NSBundle.currentTestBundle else { return nil } + + if let testCaseClass = bundle.classNamed(className) { return testCaseClass } + + guard let moduleName = bundle.bundlePath.fileName else { return nil } + + return NSClassFromString("\(moduleName).\(className)") +} + +#endif diff --git a/Pods/Quick/Sources/Quick/QuickSpec.h b/Pods/Quick/Sources/Quick/QuickSpec.h new file mode 100644 index 0000000..08d0079 --- /dev/null +++ b/Pods/Quick/Sources/Quick/QuickSpec.h @@ -0,0 +1,48 @@ +#import + +/** + QuickSpec is a base class all specs written in Quick inherit from. + They need to inherit from QuickSpec, a subclass of XCTestCase, in + order to be discovered by the XCTest framework. + + XCTest automatically compiles a list of XCTestCase subclasses included + in the test target. It iterates over each class in that list, and creates + a new instance of that class for each test method. It then creates an + "invocation" to execute that test method. The invocation is an instance of + NSInvocation, which represents a single message send in Objective-C. + The invocation is set on the XCTestCase instance, and the test is run. + + Most of the code in QuickSpec is dedicated to hooking into XCTest events. + First, when the spec is first loaded and before it is sent any messages, + the +[NSObject initialize] method is called. QuickSpec overrides this method + to call +[QuickSpec spec]. This builds the example group stacks and + registers them with Quick.World, a global register of examples. + + Then, XCTest queries QuickSpec for a list of test methods. Normally, XCTest + automatically finds all methods whose selectors begin with the string "test". + However, QuickSpec overrides this default behavior by implementing the + +[XCTestCase testInvocations] method. This method iterates over each example + registered in Quick.World, defines a new method for that example, and + returns an invocation to call that method to XCTest. Those invocations are + the tests that are run by XCTest. Their selector names are displayed in + the Xcode test navigation bar. + */ +@interface QuickSpec : XCTestCase + +/** + Override this method in your spec to define a set of example groups + and examples. + + override class func spec() { + describe("winter") { + it("is coming") { + // ... + } + } + } + + See DSL.swift for more information on what syntax is available. + */ +- (void)spec; + +@end diff --git a/Pods/Quick/Sources/Quick/QuickSpec.m b/Pods/Quick/Sources/Quick/QuickSpec.m new file mode 100644 index 0000000..57a9661 --- /dev/null +++ b/Pods/Quick/Sources/Quick/QuickSpec.m @@ -0,0 +1,170 @@ +#import "QuickSpec.h" +#import "QuickConfiguration.h" +#import "NSString+QCKSelectorName.h" +#import "World.h" +#import + +static QuickSpec *currentSpec = nil; + +const void * const QCKExampleKey = &QCKExampleKey; + +@interface QuickSpec () +@property (nonatomic, strong) Example *example; +@end + +@implementation QuickSpec + +#pragma mark - XCTestCase Overrides + +/** + The runtime sends initialize to each class in a program just before the class, or any class + that inherits from it, is sent its first message from within the program. QuickSpec hooks into + this event to compile the example groups for this spec subclass. + + If an exception occurs when compiling the examples, report it to the user. Chances are they + included an expectation outside of a "it", "describe", or "context" block. + */ ++ (void)initialize { + [QuickConfiguration initialize]; + + World *world = [World sharedWorld]; + world.currentExampleGroup = [world rootExampleGroupForSpecClass:[self class]]; + QuickSpec *spec = [self new]; + + @try { + [spec spec]; + } + @catch (NSException *exception) { + [NSException raise:NSInternalInconsistencyException + format:@"An exception occurred when building Quick's example groups.\n" + @"Some possible reasons this might happen include:\n\n" + @"- An 'expect(...).to' expectation was evaluated outside of " + @"an 'it', 'context', or 'describe' block\n" + @"- 'sharedExamples' was called twice with the same name\n" + @"- 'itBehavesLike' was called with a name that is not registered as a shared example\n\n" + @"Here's the original exception: '%@', reason: '%@', userInfo: '%@'", + exception.name, exception.reason, exception.userInfo]; + } + [self testInvocations]; + world.currentExampleGroup = nil; +} + +/** + Invocations for each test method in the test case. QuickSpec overrides this method to define a + new method for each example defined in +[QuickSpec spec]. + + @return An array of invocations that execute the newly defined example methods. + */ ++ (NSArray *)testInvocations { + NSArray *examples = [[World sharedWorld] examplesForSpecClass:[self class]]; + NSMutableArray *invocations = [NSMutableArray arrayWithCapacity:[examples count]]; + + NSMutableSet *selectorNames = [NSMutableSet set]; + + for (Example *example in examples) { + SEL selector = [self addInstanceMethodForExample:example classSelectorNames:selectorNames]; + NSInvocation *invocation = [self invocationForInstanceMethodWithSelector:selector + example:example]; + [invocations addObject:invocation]; + } + + return invocations; +} + +/** + XCTest sets the invocation for the current test case instance using this setter. + QuickSpec hooks into this event to give the test case a reference to the current example. + It will need this reference to correctly report its name to XCTest. + */ +- (void)setInvocation:(NSInvocation *)invocation { + self.example = objc_getAssociatedObject(invocation, QCKExampleKey); + [super setInvocation:invocation]; +} + +#pragma mark - Public Interface + +- (void)spec { } + +#pragma mark - Internal Methods + +/** + QuickSpec uses this method to dynamically define a new instance method for the + given example. The instance method runs the example, catching any exceptions. + The exceptions are then reported as test failures. + + In order to report the correct file and line number, examples must raise exceptions + containing following keys in their userInfo: + + - "SenTestFilenameKey": A String representing the file name + - "SenTestLineNumberKey": An Int representing the line number + + These keys used to be used by SenTestingKit, and are still used by some testing tools + in the wild. See: https://github.com/Quick/Quick/pull/41 + + @return The selector of the newly defined instance method. + */ ++ (SEL)addInstanceMethodForExample:(Example *)example classSelectorNames:(NSMutableSet *)selectorNames { + IMP implementation = imp_implementationWithBlock(^(QuickSpec *self){ + currentSpec = self; + [example run]; + }); + NSCharacterSet *characterSet = [NSCharacterSet alphanumericCharacterSet]; + NSMutableString *sanitizedFileName = [NSMutableString string]; + for (NSUInteger i = 0; i < example.callsite.file.length; i++) { + unichar ch = [example.callsite.file characterAtIndex:i]; + if ([characterSet characterIsMember:ch]) { + [sanitizedFileName appendFormat:@"%c", ch]; + } + } + + const char *types = [[NSString stringWithFormat:@"%s%s%s", @encode(id), @encode(id), @encode(SEL)] UTF8String]; + + NSString *originalName = example.name.qck_selectorName; + NSString *selectorName = originalName; + NSUInteger i = 2; + + while ([selectorNames containsObject:selectorName]) { + selectorName = [NSString stringWithFormat:@"%@_%tu", originalName, i++]; + } + + [selectorNames addObject:selectorName]; + + SEL selector = NSSelectorFromString(selectorName); + class_addMethod(self, selector, implementation, types); + + return selector; +} + ++ (NSInvocation *)invocationForInstanceMethodWithSelector:(SEL)selector + example:(Example *)example { + NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; + invocation.selector = selector; + objc_setAssociatedObject(invocation, + QCKExampleKey, + example, + OBJC_ASSOCIATION_RETAIN_NONATOMIC); + return invocation; +} + +/** + This method is used to record failures, whether they represent example + expectations that were not met, or exceptions raised during test setup + and teardown. By default, the failure will be reported as an + XCTest failure, and the example will be highlighted in Xcode. + */ +- (void)recordFailureWithDescription:(NSString *)description + inFile:(NSString *)filePath + atLine:(NSUInteger)lineNumber + expected:(BOOL)expected { + if (self.example.isSharedExample) { + filePath = self.example.callsite.file; + lineNumber = self.example.callsite.line; + } + [currentSpec.testRun recordFailureWithDescription:description + inFile:filePath + atLine:lineNumber + expected:expected]; +} + +@end diff --git a/Pods/Quick/Sources/Quick/QuickTestSuite.swift b/Pods/Quick/Sources/Quick/QuickTestSuite.swift new file mode 100644 index 0000000..0cb5187 --- /dev/null +++ b/Pods/Quick/Sources/Quick/QuickTestSuite.swift @@ -0,0 +1,52 @@ +#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) + +import XCTest + +/** + This protocol defines the role of an object that builds test suites. + */ +internal protocol QuickTestSuiteBuilder { + + /** + Construct a `QuickTestSuite` instance with the appropriate test cases added as tests. + + Subsequent calls to this method should return equivalent test suites. + */ + func buildTestSuite() -> QuickTestSuite + +} + +/** + A base class for a class cluster of Quick test suites, that should correctly + build dynamic test suites for XCTest to execute. + */ +public class QuickTestSuite: XCTestSuite { + + private static var builtTestSuites: Set = Set() + + /** + Construct a test suite for a specific, selected subset of test cases (rather + than the default, which as all test cases). + + If this method is called multiple times for the same test case class, e.g.. + + FooSpec/testFoo + FooSpec/testBar + + It is expected that the first call should return a valid test suite, and + all subsequent calls should return `nil`. + */ + public static func selectedTestSuite(forTestCaseWithName name: String) -> QuickTestSuite? { + guard let builder = QuickSelectedTestSuiteBuilder(forTestCaseWithName: name) else { return nil } + + if builtTestSuites.contains(builder.testSuiteClassName) { + return nil + } else { + builtTestSuites.insert(builder.testSuiteClassName) + return builder.buildTestSuite() + } + } + +} + +#endif diff --git a/Pods/Quick/Sources/Quick/String+FileName.swift b/Pods/Quick/Sources/Quick/String+FileName.swift new file mode 100644 index 0000000..87cea7a --- /dev/null +++ b/Pods/Quick/Sources/Quick/String+FileName.swift @@ -0,0 +1,12 @@ +import Foundation + +extension String { + + /** + If the receiver represents a path, returns its file name with a file extension. + */ + var fileName: String? { + return NSURL(string: self)?.URLByDeletingPathExtension?.lastPathComponent + } + +} diff --git a/Pods/Quick/Sources/Quick/World.h b/Pods/Quick/Sources/Quick/World.h new file mode 100644 index 0000000..147425a --- /dev/null +++ b/Pods/Quick/Sources/Quick/World.h @@ -0,0 +1,17 @@ +#import + +@class ExampleGroup; +@class ExampleMetadata; + +SWIFT_CLASS("_TtC5Quick5World") +@interface World + +@property (nonatomic) ExampleGroup * __nullable currentExampleGroup; +@property (nonatomic) ExampleMetadata * __nullable currentExampleMetadata; +@property (nonatomic) BOOL isRunningAdditionalSuites; ++ (World * __nonnull)sharedWorld; +- (void)configure:(void (^ __nonnull)(Configuration * __nonnull))closure; +- (void)finalizeConfiguration; +- (ExampleGroup * __nonnull)rootExampleGroupForSpecClass:(Class __nonnull)cls; +- (NSArray * __nonnull)examplesForSpecClass:(Class __nonnull)specClass; +@end diff --git a/Pods/Quick/Sources/Quick/World.swift b/Pods/Quick/Sources/Quick/World.swift new file mode 100644 index 0000000..9d62b16 --- /dev/null +++ b/Pods/Quick/Sources/Quick/World.swift @@ -0,0 +1,221 @@ +import Foundation + +/** + A closure that, when evaluated, returns a dictionary of key-value + pairs that can be accessed from within a group of shared examples. +*/ +public typealias SharedExampleContext = () -> (NSDictionary) + +/** + A closure that is used to define a group of shared examples. This + closure may contain any number of example and example groups. +*/ +public typealias SharedExampleClosure = (SharedExampleContext) -> () + +/** + A collection of state Quick builds up in order to work its magic. + World is primarily responsible for maintaining a mapping of QuickSpec + classes to root example groups for those classes. + + It also maintains a mapping of shared example names to shared + example closures. + + You may configure how Quick behaves by calling the -[World configure:] + method from within an overridden +[QuickConfiguration configure:] method. +*/ +final internal class World: NSObject { + /** + The example group that is currently being run. + The DSL requires that this group is correctly set in order to build a + correct hierarchy of example groups and their examples. + */ + internal var currentExampleGroup: ExampleGroup! + + /** + The example metadata of the test that is currently being run. + This is useful for using the Quick test metadata (like its name) at + runtime. + */ + + internal var currentExampleMetadata: ExampleMetadata? + + /** + A flag that indicates whether additional test suites are being run + within this test suite. This is only true within the context of Quick + functional tests. + */ + internal var isRunningAdditionalSuites = false + + private var specs: Dictionary = [:] + private var sharedExamples: [String: SharedExampleClosure] = [:] + private let configuration = Configuration() + private var isConfigurationFinalized = false + + internal var exampleHooks: ExampleHooks {return configuration.exampleHooks } + internal var suiteHooks: SuiteHooks { return configuration.suiteHooks } + + // MARK: Singleton Constructor + + private override init() {} + static let sharedWorld = World() + + // MARK: Public Interface + + /** + Exposes the World's Configuration object within the scope of the closure + so that it may be configured. This method must not be called outside of + an overridden +[QuickConfiguration configure:] method. + + - parameter closure: A closure that takes a Configuration object that can + be mutated to change Quick's behavior. + */ + internal func configure(closure: QuickConfigurer) { + assert(!isConfigurationFinalized, + "Quick cannot be configured outside of a +[QuickConfiguration configure:] method. You should not call -[World configure:] directly. Instead, subclass QuickConfiguration and override the +[QuickConfiguration configure:] method.") + closure(configuration: configuration) + } + + /** + Finalizes the World's configuration. + Any subsequent calls to World.configure() will raise. + */ + internal func finalizeConfiguration() { + isConfigurationFinalized = true + } + + /** + Returns an internally constructed root example group for the given + QuickSpec class. + + A root example group with the description "root example group" is lazily + initialized for each QuickSpec class. This root example group wraps the + top level of a -[QuickSpec spec] method--it's thanks to this group that + users can define beforeEach and it closures at the top level, like so: + + override func spec() { + // These belong to the root example group + beforeEach {} + it("is at the top level") {} + } + + - parameter cls: The QuickSpec class for which to retrieve the root example group. + - returns: The root example group for the class. + */ + internal func rootExampleGroupForSpecClass(cls: AnyClass) -> ExampleGroup { + #if _runtime(_ObjC) + let name = NSStringFromClass(cls) + #else + let name = String(cls) + #endif + + if let group = specs[name] { + return group + } else { + let group = ExampleGroup( + description: "root example group", + flags: [:], + isInternalRootExampleGroup: true + ) + specs[name] = group + return group + } + } + + /** + Returns all examples that should be run for a given spec class. + There are two filtering passes that occur when determining which examples should be run. + That is, these examples are the ones that are included by inclusion filters, and are + not excluded by exclusion filters. + + - parameter specClass: The QuickSpec subclass for which examples are to be returned. + - returns: A list of examples to be run as test invocations. + */ + internal func examples(specClass: AnyClass) -> [Example] { + // 1. Grab all included examples. + let included = includedExamples + // 2. Grab the intersection of (a) examples for this spec, and (b) included examples. + let spec = rootExampleGroupForSpecClass(specClass).examples.filter { included.contains($0) } + // 3. Remove all excluded examples. + return spec.filter { example in + !self.configuration.exclusionFilters.reduce(false) { $0 || $1(example: example) } + } + } + +#if _runtime(_ObjC) + @objc(examplesForSpecClass:) + private func objc_examples(specClass: AnyClass) -> [Example] { + return examples(specClass) + } +#endif + + // MARK: Internal + + internal func registerSharedExample(name: String, closure: SharedExampleClosure) { + raiseIfSharedExampleAlreadyRegistered(name) + sharedExamples[name] = closure + } + + internal func sharedExample(name: String) -> SharedExampleClosure { + raiseIfSharedExampleNotRegistered(name) + return sharedExamples[name]! + } + + internal var exampleCount: Int { + return allExamples.count + } + + internal var beforesCurrentlyExecuting: Bool { + let suiteBeforesExecuting = suiteHooks.phase == .BeforesExecuting + let exampleBeforesExecuting = exampleHooks.phase == .BeforesExecuting + var groupBeforesExecuting = false + if let runningExampleGroup = currentExampleMetadata?.example.group { + groupBeforesExecuting = runningExampleGroup.phase == .BeforesExecuting + } + + return suiteBeforesExecuting || exampleBeforesExecuting || groupBeforesExecuting + } + + internal var aftersCurrentlyExecuting: Bool { + let suiteAftersExecuting = suiteHooks.phase == .AftersExecuting + let exampleAftersExecuting = exampleHooks.phase == .AftersExecuting + var groupAftersExecuting = false + if let runningExampleGroup = currentExampleMetadata?.example.group { + groupAftersExecuting = runningExampleGroup.phase == .AftersExecuting + } + + return suiteAftersExecuting || exampleAftersExecuting || groupAftersExecuting + } + + private var allExamples: [Example] { + var all: [Example] = [] + for (_, group) in specs { + group.walkDownExamples { all.append($0) } + } + return all + } + + private var includedExamples: [Example] { + let all = allExamples + let included = all.filter { example in + return self.configuration.inclusionFilters.reduce(false) { $0 || $1(example: example) } + } + + if included.isEmpty && configuration.runAllWhenEverythingFiltered { + return all + } else { + return included + } + } + + private func raiseIfSharedExampleAlreadyRegistered(name: String) { + if sharedExamples[name] != nil { + raiseError("A shared example named '\(name)' has already been registered.") + } + } + + private func raiseIfSharedExampleNotRegistered(name: String) { + if sharedExamples[name] == nil { + raiseError("No shared example named '\(name)' has been registered. Registered shared examples: '\(Array(sharedExamples.keys))'") + } + } +} diff --git a/Pods/Quick/Sources/Quick/XCTestSuite+QuickTestSuiteBuilder.m b/Pods/Quick/Sources/Quick/XCTestSuite+QuickTestSuiteBuilder.m new file mode 100644 index 0000000..e49939e --- /dev/null +++ b/Pods/Quick/Sources/Quick/XCTestSuite+QuickTestSuiteBuilder.m @@ -0,0 +1,40 @@ +#import +#import +#import + +@interface XCTestSuite (QuickTestSuiteBuilder) +@end + +@implementation XCTestSuite (QuickTestSuiteBuilder) + +/** + In order to ensure we can correctly build dynamic test suites, we need to + replace some of the default test suite constructors. + */ ++ (void)load { + Method testCaseWithName = class_getClassMethod(self, @selector(testSuiteForTestCaseWithName:)); + Method hooked_testCaseWithName = class_getClassMethod(self, @selector(qck_hooked_testSuiteForTestCaseWithName:)); + method_exchangeImplementations(testCaseWithName, hooked_testCaseWithName); +} + +/** + The `+testSuiteForTestCaseWithName:` method is called when a specific test case + class is run from the Xcode test navigator. If the built test suite is `nil`, + Xcode will not run any tests for that test case. + + Given if the following test case class is run from the Xcode test navigator: + + FooSpec + testFoo + testBar + + XCTest will invoke this once per test case, with test case names following this format: + + FooSpec/testFoo + FooSpec/testBar + */ ++ (nullable instancetype)qck_hooked_testSuiteForTestCaseWithName:(nonnull NSString *)name { + return [QuickTestSuite selectedTestSuiteForTestCaseWithName:name]; +} + +@end diff --git a/Pods/Target Support Files/Alamofire/Alamofire-dummy.m b/Pods/Target Support Files/Alamofire/Alamofire-dummy.m new file mode 100644 index 0000000..a6c4594 --- /dev/null +++ b/Pods/Target Support Files/Alamofire/Alamofire-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Alamofire : NSObject +@end +@implementation PodsDummy_Alamofire +@end diff --git a/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch b/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch new file mode 100644 index 0000000..b9c163b --- /dev/null +++ b/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch @@ -0,0 +1,4 @@ +#ifdef __OBJC__ +#import +#endif + diff --git a/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h b/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h new file mode 100644 index 0000000..17f78f7 --- /dev/null +++ b/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h @@ -0,0 +1,6 @@ +#import + + +FOUNDATION_EXPORT double AlamofireVersionNumber; +FOUNDATION_EXPORT const unsigned char AlamofireVersionString[]; + diff --git a/Pods/Target Support Files/Alamofire/Alamofire.modulemap b/Pods/Target Support Files/Alamofire/Alamofire.modulemap new file mode 100644 index 0000000..d1f125f --- /dev/null +++ b/Pods/Target Support Files/Alamofire/Alamofire.modulemap @@ -0,0 +1,6 @@ +framework module Alamofire { + umbrella header "Alamofire-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Alamofire/Alamofire.xcconfig b/Pods/Target Support Files/Alamofire/Alamofire.xcconfig new file mode 100644 index 0000000..085c786 --- /dev/null +++ b/Pods/Target Support Files/Alamofire/Alamofire.xcconfig @@ -0,0 +1,10 @@ +CODE_SIGN_IDENTITY = +CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Alamofire +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES diff --git a/Pods/Target Support Files/Alamofire/Info.plist b/Pods/Target Support Files/Alamofire/Info.plist new file mode 100644 index 0000000..42c9fae --- /dev/null +++ b/Pods/Target Support Files/Alamofire/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 3.2.1 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Drip/Drip-dummy.m b/Pods/Target Support Files/Drip/Drip-dummy.m new file mode 100644 index 0000000..b374700 --- /dev/null +++ b/Pods/Target Support Files/Drip/Drip-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Drip : NSObject +@end +@implementation PodsDummy_Drip +@end diff --git a/Pods/Target Support Files/Drip/Drip-prefix.pch b/Pods/Target Support Files/Drip/Drip-prefix.pch new file mode 100644 index 0000000..b9c163b --- /dev/null +++ b/Pods/Target Support Files/Drip/Drip-prefix.pch @@ -0,0 +1,4 @@ +#ifdef __OBJC__ +#import +#endif + diff --git a/Pods/Target Support Files/Drip/Drip-umbrella.h b/Pods/Target Support Files/Drip/Drip-umbrella.h new file mode 100644 index 0000000..365af16 --- /dev/null +++ b/Pods/Target Support Files/Drip/Drip-umbrella.h @@ -0,0 +1,6 @@ +#import + + +FOUNDATION_EXPORT double DripVersionNumber; +FOUNDATION_EXPORT const unsigned char DripVersionString[]; + diff --git a/Pods/Target Support Files/Drip/Drip.modulemap b/Pods/Target Support Files/Drip/Drip.modulemap new file mode 100644 index 0000000..01c0720 --- /dev/null +++ b/Pods/Target Support Files/Drip/Drip.modulemap @@ -0,0 +1,6 @@ +framework module Drip { + umbrella header "Drip-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Drip/Drip.xcconfig b/Pods/Target Support Files/Drip/Drip.xcconfig new file mode 100644 index 0000000..7d8d57e --- /dev/null +++ b/Pods/Target Support Files/Drip/Drip.xcconfig @@ -0,0 +1,10 @@ +CODE_SIGN_IDENTITY = +CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Drip +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES diff --git a/Pods/Target Support Files/Drip/Info.plist b/Pods/Target Support Files/Drip/Info.plist new file mode 100644 index 0000000..161a9d3 --- /dev/null +++ b/Pods/Target Support Files/Drip/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 0.1.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Nimble/Info.plist b/Pods/Target Support Files/Nimble/Info.plist new file mode 100644 index 0000000..b672cd7 --- /dev/null +++ b/Pods/Target Support Files/Nimble/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 4.0.1 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Nimble/Nimble-dummy.m b/Pods/Target Support Files/Nimble/Nimble-dummy.m new file mode 100644 index 0000000..e8177ab --- /dev/null +++ b/Pods/Target Support Files/Nimble/Nimble-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Nimble : NSObject +@end +@implementation PodsDummy_Nimble +@end diff --git a/Pods/Target Support Files/Nimble/Nimble-prefix.pch b/Pods/Target Support Files/Nimble/Nimble-prefix.pch new file mode 100644 index 0000000..b9c163b --- /dev/null +++ b/Pods/Target Support Files/Nimble/Nimble-prefix.pch @@ -0,0 +1,4 @@ +#ifdef __OBJC__ +#import +#endif + diff --git a/Pods/Target Support Files/Nimble/Nimble-umbrella.h b/Pods/Target Support Files/Nimble/Nimble-umbrella.h new file mode 100644 index 0000000..5e99d5d --- /dev/null +++ b/Pods/Target Support Files/Nimble/Nimble-umbrella.h @@ -0,0 +1,10 @@ +#import + +#import "DSL.h" +#import "NMBExceptionCapture.h" +#import "NMBStringify.h" +#import "Nimble.h" + +FOUNDATION_EXPORT double NimbleVersionNumber; +FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; + diff --git a/Pods/Target Support Files/Nimble/Nimble.modulemap b/Pods/Target Support Files/Nimble/Nimble.modulemap new file mode 100644 index 0000000..6f77009 --- /dev/null +++ b/Pods/Target Support Files/Nimble/Nimble.modulemap @@ -0,0 +1,6 @@ +framework module Nimble { + umbrella header "Nimble-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Nimble/Nimble.xcconfig b/Pods/Target Support Files/Nimble/Nimble.xcconfig new file mode 100644 index 0000000..b26844c --- /dev/null +++ b/Pods/Target Support Files/Nimble/Nimble.xcconfig @@ -0,0 +1,13 @@ +CODE_SIGN_IDENTITY = +CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Nimble +ENABLE_BITCODE = NO +FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" +OTHER_LDFLAGS = -weak-lswiftXCTest -weak_framework "XCTest" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES diff --git a/Pods/Target Support Files/Pods-Harbor-HarborTests/Info.plist b/Pods/Target Support Files/Pods-Harbor-HarborTests/Info.plist new file mode 100644 index 0000000..2243fe6 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor-HarborTests/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-acknowledgements.markdown b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-acknowledgements.markdown new file mode 100644 index 0000000..c6e8ba6 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-acknowledgements.markdown @@ -0,0 +1,447 @@ +# Acknowledgements +This application makes use of the following third party libraries: + +## Alamofire + +Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +## Drip + +Copyright (c) 2016 Devmynd + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +## Nimble + +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2014 Quick Team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +## Quick + +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2014, Quick Team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +Generated by CocoaPods - https://cocoapods.org diff --git a/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-acknowledgements.plist b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-acknowledgements.plist new file mode 100644 index 0000000..dc377da --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-acknowledgements.plist @@ -0,0 +1,489 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + Title + Alamofire + Type + PSGroupSpecifier + + + FooterText + Copyright (c) 2016 Devmynd + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Title + Drip + Type + PSGroupSpecifier + + + FooterText + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2014 Quick Team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Title + Nimble + Type + PSGroupSpecifier + + + FooterText + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2014, Quick Team + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Title + Quick + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - https://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-dummy.m b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-dummy.m new file mode 100644 index 0000000..37bd751 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_Harbor_HarborTests : NSObject +@end +@implementation PodsDummy_Pods_Harbor_HarborTests +@end diff --git a/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-frameworks.sh b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-frameworks.sh new file mode 100755 index 0000000..3724a11 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-frameworks.sh @@ -0,0 +1,103 @@ +#!/bin/sh +set -e + +echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" +mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + +SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" + +install_framework() +{ + if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then + local source="${BUILT_PRODUCTS_DIR}/$1" + elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then + local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" + elif [ -r "$1" ]; then + local source="$1" + fi + + local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + + if [ -L "${source}" ]; then + echo "Symlinked..." + source="$(readlink "${source}")" + fi + + # use filter instead of exclude so missing patterns dont' throw errors + echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" + rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" + + local basename + basename="$(basename -s .framework "$1")" + binary="${destination}/${basename}.framework/${basename}" + if ! [ -r "$binary" ]; then + binary="${destination}/${basename}" + fi + + # Strip invalid architectures so "fat" simulator / device frameworks work on device + if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then + strip_invalid_archs "$binary" + fi + + # Resign the code if required by the build settings to avoid unstable apps + code_sign_if_enabled "${destination}/$(basename "$1")" + + # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. + if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then + local swift_runtime_libs + swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) + for lib in $swift_runtime_libs; do + echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" + rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" + code_sign_if_enabled "${destination}/${lib}" + done + fi +} + +# Signs a framework with the provided identity +code_sign_if_enabled() { + if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then + # Use the current code_sign_identitiy + echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" + echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\"" + /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1" + fi +} + +# Strip invalid architectures +strip_invalid_archs() { + binary="$1" + # Get architectures for current file + archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" + stripped="" + for arch in $archs; do + if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then + # Strip non-valid architectures in-place + lipo -remove "$arch" -output "$binary" "$binary" || exit 1 + stripped="$stripped $arch" + fi + done + if [[ "$stripped" ]]; then + echo "Stripped $binary of architectures:$stripped" + fi +} + + +if [[ "$CONFIGURATION" == "Debug" ]]; then + install_framework "$BUILT_PRODUCTS_DIR/Alamofire/Alamofire.framework" + install_framework "$BUILT_PRODUCTS_DIR/Drip/Drip.framework" + install_framework "$BUILT_PRODUCTS_DIR/Nimble/Nimble.framework" + install_framework "$BUILT_PRODUCTS_DIR/Quick/Quick.framework" +fi +if [[ "$CONFIGURATION" == "Test" ]]; then + install_framework "$BUILT_PRODUCTS_DIR/Alamofire/Alamofire.framework" + install_framework "$BUILT_PRODUCTS_DIR/Drip/Drip.framework" + install_framework "$BUILT_PRODUCTS_DIR/Nimble/Nimble.framework" + install_framework "$BUILT_PRODUCTS_DIR/Quick/Quick.framework" +fi +if [[ "$CONFIGURATION" == "Release" ]]; then + install_framework "$BUILT_PRODUCTS_DIR/Alamofire/Alamofire.framework" + install_framework "$BUILT_PRODUCTS_DIR/Drip/Drip.framework" + install_framework "$BUILT_PRODUCTS_DIR/Nimble/Nimble.framework" + install_framework "$BUILT_PRODUCTS_DIR/Quick/Quick.framework" +fi diff --git a/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-resources.sh b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-resources.sh new file mode 100755 index 0000000..e768f92 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-resources.sh @@ -0,0 +1,102 @@ +#!/bin/sh +set -e + +mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +XCASSET_FILES=() + +case "${TARGETED_DEVICE_FAMILY}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; +esac + +realpath() { + DIRECTORY="$(cd "${1%/*}" && pwd)" + FILENAME="${1##*/}" + echo "$DIRECTORY/$FILENAME" +} + +install_resource() +{ + if [[ "$1" = /* ]] ; then + RESOURCE_PATH="$1" + else + RESOURCE_PATH="${PODS_ROOT}/$1" + fi + if [[ ! -e "$RESOURCE_PATH" ]] ; then + cat << EOM +error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. +EOM + exit 1 + fi + case $RESOURCE_PATH in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" + ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" + ;; + *.framework) + echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" + xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" + xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" + ;; + *.xcmappingmodel) + echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" + xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" + ;; + *.xcassets) + ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH") + XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") + ;; + *) + echo "$RESOURCE_PATH" + echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then + mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] +then + # Find all other xcassets (this unfortunately includes those of path pods and other targets). + OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) + while read line; do + if [[ $line != "`realpath $PODS_ROOT`*" ]]; then + XCASSET_FILES+=("$line") + fi + done <<<"$OTHER_XCASSETS" + + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi diff --git a/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-umbrella.h b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-umbrella.h new file mode 100644 index 0000000..bb0dc95 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests-umbrella.h @@ -0,0 +1,6 @@ +#import + + +FOUNDATION_EXPORT double Pods_Harbor_HarborTestsVersionNumber; +FOUNDATION_EXPORT const unsigned char Pods_Harbor_HarborTestsVersionString[]; + diff --git a/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.debug.xcconfig b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.debug.xcconfig new file mode 100644 index 0000000..63e43f6 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.debug.xcconfig @@ -0,0 +1,11 @@ +CODE_SIGN_IDENTITY = +EMBEDDED_CONTENT_CONTAINS_SWIFT = YES +FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Alamofire" "$PODS_CONFIGURATION_BUILD_DIR/Drip" "$PODS_CONFIGURATION_BUILD_DIR/Nimble" "$PODS_CONFIGURATION_BUILD_DIR/Quick" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Drip/Drip.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Nimble/Nimble.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Quick/Quick.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "Drip" -framework "Nimble" -framework "Quick" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT}/Pods diff --git a/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.modulemap b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.modulemap new file mode 100644 index 0000000..b095804 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.modulemap @@ -0,0 +1,6 @@ +framework module Pods_Harbor_HarborTests { + umbrella header "Pods-Harbor-HarborTests-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.release.xcconfig b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.release.xcconfig new file mode 100644 index 0000000..63e43f6 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.release.xcconfig @@ -0,0 +1,11 @@ +CODE_SIGN_IDENTITY = +EMBEDDED_CONTENT_CONTAINS_SWIFT = YES +FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Alamofire" "$PODS_CONFIGURATION_BUILD_DIR/Drip" "$PODS_CONFIGURATION_BUILD_DIR/Nimble" "$PODS_CONFIGURATION_BUILD_DIR/Quick" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Drip/Drip.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Nimble/Nimble.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Quick/Quick.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "Drip" -framework "Nimble" -framework "Quick" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT}/Pods diff --git a/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.test.xcconfig b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.test.xcconfig new file mode 100644 index 0000000..63e43f6 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor-HarborTests/Pods-Harbor-HarborTests.test.xcconfig @@ -0,0 +1,11 @@ +CODE_SIGN_IDENTITY = +EMBEDDED_CONTENT_CONTAINS_SWIFT = YES +FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Alamofire" "$PODS_CONFIGURATION_BUILD_DIR/Drip" "$PODS_CONFIGURATION_BUILD_DIR/Nimble" "$PODS_CONFIGURATION_BUILD_DIR/Quick" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Drip/Drip.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Nimble/Nimble.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Quick/Quick.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "Drip" -framework "Nimble" -framework "Quick" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT}/Pods diff --git a/Pods/Target Support Files/Pods-Harbor/Info.plist b/Pods/Target Support Files/Pods-Harbor/Info.plist new file mode 100644 index 0000000..2243fe6 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-acknowledgements.markdown b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-acknowledgements.markdown new file mode 100644 index 0000000..41ead54 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-acknowledgements.markdown @@ -0,0 +1,37 @@ +# Acknowledgements +This application makes use of the following third party libraries: + +## Alamofire + +Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +## Drip + +Copyright (c) 2016 Devmynd + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Generated by CocoaPods - https://cocoapods.org diff --git a/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-acknowledgements.plist b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-acknowledgements.plist new file mode 100644 index 0000000..c8805ba --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-acknowledgements.plist @@ -0,0 +1,71 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + Copyright (c) 2014–2016 Alamofire Software Foundation (http://alamofire.org/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + Title + Alamofire + Type + PSGroupSpecifier + + + FooterText + Copyright (c) 2016 Devmynd + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Title + Drip + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - https://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-dummy.m b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-dummy.m new file mode 100644 index 0000000..5dd9c25 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_Harbor : NSObject +@end +@implementation PodsDummy_Pods_Harbor +@end diff --git a/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-frameworks.sh b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-frameworks.sh new file mode 100755 index 0000000..fcb2266 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-frameworks.sh @@ -0,0 +1,97 @@ +#!/bin/sh +set -e + +echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" +mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + +SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" + +install_framework() +{ + if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then + local source="${BUILT_PRODUCTS_DIR}/$1" + elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then + local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" + elif [ -r "$1" ]; then + local source="$1" + fi + + local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + + if [ -L "${source}" ]; then + echo "Symlinked..." + source="$(readlink "${source}")" + fi + + # use filter instead of exclude so missing patterns dont' throw errors + echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" + rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" + + local basename + basename="$(basename -s .framework "$1")" + binary="${destination}/${basename}.framework/${basename}" + if ! [ -r "$binary" ]; then + binary="${destination}/${basename}" + fi + + # Strip invalid architectures so "fat" simulator / device frameworks work on device + if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then + strip_invalid_archs "$binary" + fi + + # Resign the code if required by the build settings to avoid unstable apps + code_sign_if_enabled "${destination}/$(basename "$1")" + + # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. + if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then + local swift_runtime_libs + swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) + for lib in $swift_runtime_libs; do + echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" + rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" + code_sign_if_enabled "${destination}/${lib}" + done + fi +} + +# Signs a framework with the provided identity +code_sign_if_enabled() { + if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then + # Use the current code_sign_identitiy + echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" + echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\"" + /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1" + fi +} + +# Strip invalid architectures +strip_invalid_archs() { + binary="$1" + # Get architectures for current file + archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" + stripped="" + for arch in $archs; do + if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then + # Strip non-valid architectures in-place + lipo -remove "$arch" -output "$binary" "$binary" || exit 1 + stripped="$stripped $arch" + fi + done + if [[ "$stripped" ]]; then + echo "Stripped $binary of architectures:$stripped" + fi +} + + +if [[ "$CONFIGURATION" == "Debug" ]]; then + install_framework "$BUILT_PRODUCTS_DIR/Alamofire/Alamofire.framework" + install_framework "$BUILT_PRODUCTS_DIR/Drip/Drip.framework" +fi +if [[ "$CONFIGURATION" == "Test" ]]; then + install_framework "$BUILT_PRODUCTS_DIR/Alamofire/Alamofire.framework" + install_framework "$BUILT_PRODUCTS_DIR/Drip/Drip.framework" +fi +if [[ "$CONFIGURATION" == "Release" ]]; then + install_framework "$BUILT_PRODUCTS_DIR/Alamofire/Alamofire.framework" + install_framework "$BUILT_PRODUCTS_DIR/Drip/Drip.framework" +fi diff --git a/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-resources.sh b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-resources.sh new file mode 100755 index 0000000..e768f92 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-resources.sh @@ -0,0 +1,102 @@ +#!/bin/sh +set -e + +mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +XCASSET_FILES=() + +case "${TARGETED_DEVICE_FAMILY}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; +esac + +realpath() { + DIRECTORY="$(cd "${1%/*}" && pwd)" + FILENAME="${1##*/}" + echo "$DIRECTORY/$FILENAME" +} + +install_resource() +{ + if [[ "$1" = /* ]] ; then + RESOURCE_PATH="$1" + else + RESOURCE_PATH="${PODS_ROOT}/$1" + fi + if [[ ! -e "$RESOURCE_PATH" ]] ; then + cat << EOM +error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. +EOM + exit 1 + fi + case $RESOURCE_PATH in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" + ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" + ;; + *.framework) + echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" + xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" + xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" + ;; + *.xcmappingmodel) + echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" + xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" + ;; + *.xcassets) + ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH") + XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") + ;; + *) + echo "$RESOURCE_PATH" + echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then + mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] +then + # Find all other xcassets (this unfortunately includes those of path pods and other targets). + OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) + while read line; do + if [[ $line != "`realpath $PODS_ROOT`*" ]]; then + XCASSET_FILES+=("$line") + fi + done <<<"$OTHER_XCASSETS" + + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi diff --git a/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-umbrella.h b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-umbrella.h new file mode 100644 index 0000000..b3983e1 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor-umbrella.h @@ -0,0 +1,6 @@ +#import + + +FOUNDATION_EXPORT double Pods_HarborVersionNumber; +FOUNDATION_EXPORT const unsigned char Pods_HarborVersionString[]; + diff --git a/Pods/Target Support Files/Pods-Harbor/Pods-Harbor.debug.xcconfig b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor.debug.xcconfig new file mode 100644 index 0000000..ed3bd28 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor.debug.xcconfig @@ -0,0 +1,11 @@ +CODE_SIGN_IDENTITY = +EMBEDDED_CONTENT_CONTAINS_SWIFT = YES +FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Alamofire" "$PODS_CONFIGURATION_BUILD_DIR/Drip" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Drip/Drip.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "Drip" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT}/Pods diff --git a/Pods/Target Support Files/Pods-Harbor/Pods-Harbor.modulemap b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor.modulemap new file mode 100644 index 0000000..c633afe --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor.modulemap @@ -0,0 +1,6 @@ +framework module Pods_Harbor { + umbrella header "Pods-Harbor-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Pods-Harbor/Pods-Harbor.release.xcconfig b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor.release.xcconfig new file mode 100644 index 0000000..ed3bd28 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor.release.xcconfig @@ -0,0 +1,11 @@ +CODE_SIGN_IDENTITY = +EMBEDDED_CONTENT_CONTAINS_SWIFT = YES +FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Alamofire" "$PODS_CONFIGURATION_BUILD_DIR/Drip" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Drip/Drip.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "Drip" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT}/Pods diff --git a/Pods/Target Support Files/Pods-Harbor/Pods-Harbor.test.xcconfig b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor.test.xcconfig new file mode 100644 index 0000000..ed3bd28 --- /dev/null +++ b/Pods/Target Support Files/Pods-Harbor/Pods-Harbor.test.xcconfig @@ -0,0 +1,11 @@ +CODE_SIGN_IDENTITY = +EMBEDDED_CONTENT_CONTAINS_SWIFT = YES +FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Alamofire" "$PODS_CONFIGURATION_BUILD_DIR/Drip" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Drip/Drip.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "Drip" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT}/Pods diff --git a/Pods/Target Support Files/Quick/Info.plist b/Pods/Target Support Files/Quick/Info.plist new file mode 100644 index 0000000..5d80a39 --- /dev/null +++ b/Pods/Target Support Files/Quick/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 0.9.1 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Quick/Quick-dummy.m b/Pods/Target Support Files/Quick/Quick-dummy.m new file mode 100644 index 0000000..54d7dc0 --- /dev/null +++ b/Pods/Target Support Files/Quick/Quick-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Quick : NSObject +@end +@implementation PodsDummy_Quick +@end diff --git a/Pods/Target Support Files/Quick/Quick-prefix.pch b/Pods/Target Support Files/Quick/Quick-prefix.pch new file mode 100644 index 0000000..b9c163b --- /dev/null +++ b/Pods/Target Support Files/Quick/Quick-prefix.pch @@ -0,0 +1,4 @@ +#ifdef __OBJC__ +#import +#endif + diff --git a/Pods/Target Support Files/Quick/Quick-umbrella.h b/Pods/Target Support Files/Quick/Quick-umbrella.h new file mode 100644 index 0000000..b23d289 --- /dev/null +++ b/Pods/Target Support Files/Quick/Quick-umbrella.h @@ -0,0 +1,10 @@ +#import + +#import "QuickConfiguration.h" +#import "QCKDSL.h" +#import "Quick.h" +#import "QuickSpec.h" + +FOUNDATION_EXPORT double QuickVersionNumber; +FOUNDATION_EXPORT const unsigned char QuickVersionString[]; + diff --git a/Pods/Target Support Files/Quick/Quick.modulemap b/Pods/Target Support Files/Quick/Quick.modulemap new file mode 100644 index 0000000..1d12b21 --- /dev/null +++ b/Pods/Target Support Files/Quick/Quick.modulemap @@ -0,0 +1,6 @@ +framework module Quick { + umbrella header "Quick-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Quick/Quick.xcconfig b/Pods/Target Support Files/Quick/Quick.xcconfig new file mode 100644 index 0000000..25c19b5 --- /dev/null +++ b/Pods/Target Support Files/Quick/Quick.xcconfig @@ -0,0 +1,13 @@ +CODE_SIGN_IDENTITY = +CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Quick +ENABLE_BITCODE = NO +FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" +OTHER_LDFLAGS = -framework "XCTest" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES