From de6c3780a70e32f637e4209120ba7991ef9d8e9d Mon Sep 17 00:00:00 2001 From: Morten Bjerg Gregersen Date: Mon, 25 May 2020 20:36:38 +0200 Subject: [PATCH] Add HTML docs to Pages (#62) * Update docs.yml * Update docs.yml * Update docs.yml * Update docs.yml * Update docs.yml * Update docs.yml * Update Store.swift * Fix doc comment parsing * Make enum internal * Create .jazzy.yaml * Move abstracts * Update Effect+Run.swift * Update docs.yml --- .github/workflows/docs.yml | 34 ++++++++------ .jazzy.yaml | 45 +++++++++++++++++++ .../Abstracts/SwiftUI.md | 0 .../Abstracts/Test Support.md | 2 +- Sources/Fluxor/Action.swift | 2 +- Sources/Fluxor/Effects.swift | 2 +- Sources/Fluxor/Interceptor.swift | 2 +- .../Interceptors/PrintInterceptor.swift | 2 +- .../Operators/ActionPublisher+OfType.swift | 2 +- .../ActionPublisher+WasCreatedBy.swift | 2 +- .../ActionPublisher+WithIdentifier.swift | 2 +- Sources/Fluxor/Reducer.swift | 2 +- Sources/Fluxor/Selector.swift | 2 +- Sources/Fluxor/Store.swift | 12 ++--- Sources/FluxorSwiftUI/ObservableValue.swift | 2 +- Sources/FluxorSwiftUI/ValueBinding.swift | 2 +- Sources/FluxorTestSupport/Effect+Run.swift | 18 ++++---- Sources/FluxorTestSupport/MockStore.swift | 2 +- .../FluxorTestSupport/TestInterceptor.swift | 2 +- .../ObservableValueTests.swift | 2 +- .../ValueBindingTests.swift | 2 +- Tests/FluxorTests/ActionTests.swift | 2 +- Tests/FluxorTests/EffectsTests.swift | 2 +- .../Interceptors/PrintInterceptorTests.swift | 2 +- .../Interceptors/TestInterceptorTests.swift | 2 +- Tests/FluxorTests/MockStoreTests.swift | 2 +- .../ActionPublisher+OfTypeTests.swift | 2 +- .../ActionPublisher+WasCreatedByTests.swift | 2 +- Tests/FluxorTests/SelectorTests.swift | 2 +- Tests/FluxorTests/StoreTests.swift | 2 +- 30 files changed, 105 insertions(+), 54 deletions(-) create mode 100644 .jazzy.yaml rename FluxorSwiftUI.md => Documentation/Abstracts/SwiftUI.md (100%) rename FluxorTestSupport.md => Documentation/Abstracts/Test Support.md (99%) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 1b887cd..8a4ba2a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -6,28 +6,34 @@ on: - master jobs: + pages: + name: Documentation for Pages + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - name: Generate Documentation for Pages + uses: sersoft-gmbh/swifty-docs-action@v1 + - name: Upload to GitHub Pages + uses: crazy-max/ghaction-github-pages@v1.4.1 + with: + build_dir: "docs" + env: + GITHUB_PAT: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} wiki: - name: Documentation + name: Documentation for Wiki runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Install swift-doc - run: | - git clone https://github.com/SwiftDocOrg/swift-doc - cd swift-doc - sudo make install - cd .. - name: Generate Documentation for Wiki - run: swift-doc generate Sources/Fluxor* --module-name Fluxor --output Documentation-Wiki + uses: SwiftDocOrg/swift-doc@master + with: + inputs: "Sources" + format: "commonmark" + module-name: Fluxor + output: "Documentation-Wiki" - name: Upload to Wiki uses: SwiftDocOrg/github-wiki-publish-action@v1 with: path: "Documentation-Wiki" env: GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} -# - name: Generate Documentation for Pages -# run: swift-doc generate Sources/Fluxor* --module-name Fluxor --output Documentation-Pages --format html -# - name: Upload to GitHub Pages -# uses: crazy-max/ghaction-github-pages@v1.4.1 -# with: -# build_dir: "Documentation-Pages" diff --git a/.jazzy.yaml b/.jazzy.yaml new file mode 100644 index 0000000..4bb60ee --- /dev/null +++ b/.jazzy.yaml @@ -0,0 +1,45 @@ +module: Fluxor +author: Morten Bjerg Gregersen +github_url: https://github.com/FluxorOrg/Fluxor +copyright: '© 2020 under [open source license](https://github.com/FluxorOrg/Fluxor/blob/master/LICENSE).' +swift_version: 5.2 + +documentation: "Documentation/Guides/*.md" +abstract: "Documentation/Abstracts/*.md" + +custom_categories: + - name: Store + children: + - Store + - name: Actions + children: + - Action + - ActionTemplate + - AnonymousAction + - name: Reducers + children: + - Reducer + - ReduceOn + - name: Selectors + children: + - SelectorProtocol + - Selector + - name: Effects + children: + - Effects + - Effect + - name: Extensions + children: + - Publisher + - name: Debugging + children: + - Interceptor + - PrintInterceptor + - name: SwiftUI + children: + - ObservableValue + - ValueBinding + - name: Test Support + children: + - MockStore + - TestInterceptor diff --git a/FluxorSwiftUI.md b/Documentation/Abstracts/SwiftUI.md similarity index 100% rename from FluxorSwiftUI.md rename to Documentation/Abstracts/SwiftUI.md diff --git a/FluxorTestSupport.md b/Documentation/Abstracts/Test Support.md similarity index 99% rename from FluxorTestSupport.md rename to Documentation/Abstracts/Test Support.md index e6d0b39..9215ea2 100644 --- a/FluxorTestSupport.md +++ b/Documentation/Abstracts/Test Support.md @@ -96,4 +96,4 @@ class SettingsEffectsTests: XCTestCase { XCTAssertEqual(result[0], Actions.hideColorPicker()) } } -``` \ No newline at end of file +``` diff --git a/Sources/Fluxor/Action.swift b/Sources/Fluxor/Action.swift index ac3e77b..ab544a2 100644 --- a/Sources/Fluxor/Action.swift +++ b/Sources/Fluxor/Action.swift @@ -1,4 +1,4 @@ -/** +/* * Fluxor * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Sources/Fluxor/Effects.swift b/Sources/Fluxor/Effects.swift index 4390275..ee5a957 100644 --- a/Sources/Fluxor/Effects.swift +++ b/Sources/Fluxor/Effects.swift @@ -1,4 +1,4 @@ -/** +/* * Fluxor * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Sources/Fluxor/Interceptor.swift b/Sources/Fluxor/Interceptor.swift index 1cc35c6..3de3a0b 100644 --- a/Sources/Fluxor/Interceptor.swift +++ b/Sources/Fluxor/Interceptor.swift @@ -1,4 +1,4 @@ -/** +/* * Fluxor * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Sources/Fluxor/Interceptors/PrintInterceptor.swift b/Sources/Fluxor/Interceptors/PrintInterceptor.swift index e5a7515..ec8c165 100644 --- a/Sources/Fluxor/Interceptors/PrintInterceptor.swift +++ b/Sources/Fluxor/Interceptors/PrintInterceptor.swift @@ -1,4 +1,4 @@ -/** +/* * Fluxor * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Sources/Fluxor/Operators/ActionPublisher+OfType.swift b/Sources/Fluxor/Operators/ActionPublisher+OfType.swift index 90f6b73..f1980ff 100644 --- a/Sources/Fluxor/Operators/ActionPublisher+OfType.swift +++ b/Sources/Fluxor/Operators/ActionPublisher+OfType.swift @@ -1,4 +1,4 @@ -/** +/* * Fluxor * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Sources/Fluxor/Operators/ActionPublisher+WasCreatedBy.swift b/Sources/Fluxor/Operators/ActionPublisher+WasCreatedBy.swift index c94a7bb..392cd41 100644 --- a/Sources/Fluxor/Operators/ActionPublisher+WasCreatedBy.swift +++ b/Sources/Fluxor/Operators/ActionPublisher+WasCreatedBy.swift @@ -1,4 +1,4 @@ -/** +/* * Fluxor * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Sources/Fluxor/Operators/ActionPublisher+WithIdentifier.swift b/Sources/Fluxor/Operators/ActionPublisher+WithIdentifier.swift index 8f4ac3b..bd4e70b 100644 --- a/Sources/Fluxor/Operators/ActionPublisher+WithIdentifier.swift +++ b/Sources/Fluxor/Operators/ActionPublisher+WithIdentifier.swift @@ -1,4 +1,4 @@ -/** +/* * Fluxor * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Sources/Fluxor/Reducer.swift b/Sources/Fluxor/Reducer.swift index aa49eac..22c3380 100644 --- a/Sources/Fluxor/Reducer.swift +++ b/Sources/Fluxor/Reducer.swift @@ -1,4 +1,4 @@ -/** +/* * Fluxor * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Sources/Fluxor/Selector.swift b/Sources/Fluxor/Selector.swift index 854743c..339ff02 100644 --- a/Sources/Fluxor/Selector.swift +++ b/Sources/Fluxor/Selector.swift @@ -1,4 +1,4 @@ -/** +/* * Fluxor * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Sources/Fluxor/Store.swift b/Sources/Fluxor/Store.swift index c8fdc15..0331484 100644 --- a/Sources/Fluxor/Store.swift +++ b/Sources/Fluxor/Store.swift @@ -1,4 +1,4 @@ -/** +/* * Fluxor * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details @@ -13,15 +13,15 @@ import struct Foundation.UUID A `Store` is configured by registering all the desired `Reducer`s and `Effects`s. - # Usage + ## Usage To update the `State` callers dispatch `Action`s on the `Store`. - # Interceptors - It is possible to intercept all `Action`s and `State` changes by registering an `Interceptor`. - - # Selecting + ## Selecting To select a value in the `State` the callers can either use a `Selector` or a key path. It is possible to get a `Publisher` for the value or just to select the current value. + + ## Interceptors + It is possible to intercept all `Action`s and `State` changes by registering an `Interceptor`. */ open class Store { internal private(set) var state: CurrentValueSubject diff --git a/Sources/FluxorSwiftUI/ObservableValue.swift b/Sources/FluxorSwiftUI/ObservableValue.swift index f01b6db..ef9f4a2 100644 --- a/Sources/FluxorSwiftUI/ObservableValue.swift +++ b/Sources/FluxorSwiftUI/ObservableValue.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorSwiftUI * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Sources/FluxorSwiftUI/ValueBinding.swift b/Sources/FluxorSwiftUI/ValueBinding.swift index e4bdbd4..d06283c 100644 --- a/Sources/FluxorSwiftUI/ValueBinding.swift +++ b/Sources/FluxorSwiftUI/ValueBinding.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorSwiftUI * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Sources/FluxorTestSupport/Effect+Run.swift b/Sources/FluxorTestSupport/Effect+Run.swift index fae9a59..bf4048e 100644 --- a/Sources/FluxorTestSupport/Effect+Run.swift +++ b/Sources/FluxorTestSupport/Effect+Run.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorTestSupport * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details @@ -10,14 +10,8 @@ import Fluxor import XCTest public extension Effect { - /// `Error`s which can be thrown when running `Effect`s - enum RunError: Error { - /// The `Effect` can't be run this way - case wrongType - } - /** - Run the `Effect` with the specified `Action` and return the published `Action`s. + __TestSupport:__ Run the `Effect` with the specified `Action` and return the published `Action`s. The `expectedCount` defines how many `Action`s the `Publisher` should publish before they are returned. @@ -43,7 +37,7 @@ public extension Effect { } /** - Run the `Effect` with the specified `Action`. + __TestSupport:__ Run the `Effect` with the specified `Action`. - Parameter action: The `Action` to send to the `Effect` */ @@ -54,6 +48,12 @@ public extension Effect { effectCreator(actions.eraseToAnyPublisher()).store(in: &cancellables) actions.send(action) } + + /// `Error`s which can be thrown when running `Effect`s + internal enum RunError: Error { + /// The `Effect` can't be run this way + case wrongType + } } /** diff --git a/Sources/FluxorTestSupport/MockStore.swift b/Sources/FluxorTestSupport/MockStore.swift index 70227c7..1ea6766 100644 --- a/Sources/FluxorTestSupport/MockStore.swift +++ b/Sources/FluxorTestSupport/MockStore.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorTestSupport * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Sources/FluxorTestSupport/TestInterceptor.swift b/Sources/FluxorTestSupport/TestInterceptor.swift index 893928e..be1f9cc 100644 --- a/Sources/FluxorTestSupport/TestInterceptor.swift +++ b/Sources/FluxorTestSupport/TestInterceptor.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorTestSupport * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Tests/FluxorSwiftUITests/ObservableValueTests.swift b/Tests/FluxorSwiftUITests/ObservableValueTests.swift index 15df5b1..910dd69 100644 --- a/Tests/FluxorSwiftUITests/ObservableValueTests.swift +++ b/Tests/FluxorSwiftUITests/ObservableValueTests.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorSwiftUITests * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Tests/FluxorSwiftUITests/ValueBindingTests.swift b/Tests/FluxorSwiftUITests/ValueBindingTests.swift index 6364e44..a30dd39 100644 --- a/Tests/FluxorSwiftUITests/ValueBindingTests.swift +++ b/Tests/FluxorSwiftUITests/ValueBindingTests.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorSwiftUITests * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Tests/FluxorTests/ActionTests.swift b/Tests/FluxorTests/ActionTests.swift index b6f4f3a..63c9640 100644 --- a/Tests/FluxorTests/ActionTests.swift +++ b/Tests/FluxorTests/ActionTests.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorTests * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Tests/FluxorTests/EffectsTests.swift b/Tests/FluxorTests/EffectsTests.swift index b123353..5c41c7c 100644 --- a/Tests/FluxorTests/EffectsTests.swift +++ b/Tests/FluxorTests/EffectsTests.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorTests * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Tests/FluxorTests/Interceptors/PrintInterceptorTests.swift b/Tests/FluxorTests/Interceptors/PrintInterceptorTests.swift index 847b560..c563464 100644 --- a/Tests/FluxorTests/Interceptors/PrintInterceptorTests.swift +++ b/Tests/FluxorTests/Interceptors/PrintInterceptorTests.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorTests * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Tests/FluxorTests/Interceptors/TestInterceptorTests.swift b/Tests/FluxorTests/Interceptors/TestInterceptorTests.swift index df100ce..b5d438c 100644 --- a/Tests/FluxorTests/Interceptors/TestInterceptorTests.swift +++ b/Tests/FluxorTests/Interceptors/TestInterceptorTests.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorTests * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Tests/FluxorTests/MockStoreTests.swift b/Tests/FluxorTests/MockStoreTests.swift index 280c13b..87de8fc 100644 --- a/Tests/FluxorTests/MockStoreTests.swift +++ b/Tests/FluxorTests/MockStoreTests.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorTests * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Tests/FluxorTests/Operators/ActionPublisher+OfTypeTests.swift b/Tests/FluxorTests/Operators/ActionPublisher+OfTypeTests.swift index 1b8d036..64df3d8 100644 --- a/Tests/FluxorTests/Operators/ActionPublisher+OfTypeTests.swift +++ b/Tests/FluxorTests/Operators/ActionPublisher+OfTypeTests.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorTests * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Tests/FluxorTests/Operators/ActionPublisher+WasCreatedByTests.swift b/Tests/FluxorTests/Operators/ActionPublisher+WasCreatedByTests.swift index c7eda5c..f8dde73 100644 --- a/Tests/FluxorTests/Operators/ActionPublisher+WasCreatedByTests.swift +++ b/Tests/FluxorTests/Operators/ActionPublisher+WasCreatedByTests.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorTests * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Tests/FluxorTests/SelectorTests.swift b/Tests/FluxorTests/SelectorTests.swift index 2750f19..209eae0 100644 --- a/Tests/FluxorTests/SelectorTests.swift +++ b/Tests/FluxorTests/SelectorTests.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorTests * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details diff --git a/Tests/FluxorTests/StoreTests.swift b/Tests/FluxorTests/StoreTests.swift index 6f96519..e80e963 100644 --- a/Tests/FluxorTests/StoreTests.swift +++ b/Tests/FluxorTests/StoreTests.swift @@ -1,4 +1,4 @@ -/** +/* * FluxorTests * Copyright (c) Morten Bjerg Gregersen 2020 * MIT license, see LICENSE file for details