Skip to content

Commit 1118ddb

Browse files
calvellidotruizlop
andauthored
Initial website structure (#19)
* Update gitignore * Initial template site * Set travis jobs * Fix compilation issues in docs * Fix rendering issue * Fix Travis commands * Add correct path to main documentation page * Remove nef images Co-authored-by: Tomás Ruiz-López <truizlop@gmail.com>
1 parent 420d7ff commit 1118ddb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2260
-11
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,15 @@ Podfile.lock
3737

3838
## nef
3939
**/*/nef
40+
41+
## Jekyll
42+
_site
43+
.sass-cache
44+
.jekyll-metadata
45+
46+
## Ruby environment normalization:
47+
.bundle/
48+
vendor/
49+
/lib/bundler/man/
50+
docs/docs/*
51+
/docs/_data/sidebar.yml

.travis.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ addons:
66
homebrew:
77
taps:
88
- adoptopenjdk/openjdk
9+
- bow-swift/nef
10+
packages:
11+
- nef
912
casks:
1013
- adoptopenjdk/openjdk/adoptopenjdk8
1114

@@ -14,6 +17,9 @@ env:
1417
- PROJECT="BowOpenAPI.xcodeproj"
1518
- JOB="XCODE"
1619
- DEST="platform=macOS,arch=x86_64"
20+
- SCHEME="Markup"
21+
- SDK="macosx"
22+
- ACTION="test"
1723

1824
jobs:
1925
include:
@@ -31,3 +37,22 @@ jobs:
3137
script:
3238
- set -o pipefail
3339
- xcodebuild test -project "$PROJECT" -scheme "Tests" -destination "$DEST" | xcpretty -c
40+
- stage: verify documentation
41+
before_install:
42+
- gem update --system
43+
- gem install cocoapods
44+
script:
45+
- nef compile Documentation.app
46+
- stage: deploy microsite
47+
if: branch = master AND type != pull_request
48+
script:
49+
- nef jekyll --project Documentation.app --output docs --main-page Documentation.app/Jekyll/Home.md
50+
deploy:
51+
provider: pages
52+
skip-cleanup: true
53+
github-token: $GITHUB_TOKEN
54+
keep-history: true
55+
local-dir: docs
56+
target-branch: gh-pages
57+
on:
58+
all_branches: true

Documentation.app/Contents/MacOS/Consuming generated code.playground/Pages/Customizing the configuration.xcplaygroundpage/Contents.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import Bow
99
import BowEffects
1010
import Foundation
1111

12-
public enum DecodingError: Error {}
12+
enum DecodingError: Error {}
1313

14-
public protocol ResponseDecoder {
14+
protocol ResponseDecoder {
1515
func safeDecode<T: Decodable>(_ type: T.Type, from: Data) -> IO<DecodingError, T>
1616
}
1717

@@ -40,14 +40,22 @@ enum API {
4040
self.session = session
4141
self.decoder = decoder
4242
}
43+
44+
static func ==(lhs: Config, rhs: Config) -> Bool {
45+
lhs.basePath == rhs.basePath && lhs.headers == rhs.headers
46+
}
47+
}
48+
49+
enum ContentType {
50+
case json
4351
}
4452
}
4553

4654
extension API.Config {
4755
func appending(headers: [String: String]) -> API.Config { self }
4856
func appending(contentType: API.ContentType) -> API.Config { self }
4957
func appendingHeader(value: String, forKey key: String) -> API.Config { self }
50-
func appendingHeader(token: String) -> API.Config { self }
58+
func appendingHeader(token: String) -> API.Config { self }
5159
}
5260
// nef:end
5361
/*:

Documentation.app/Contents/MacOS/Consuming generated code.playground/Pages/Running a network request.xcplaygroundpage/Contents.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ protocol CustomerAPI {
3838
// nef:begin:hidden
3939
struct CustomerAPIClient: CustomerAPI {
4040
func getCustomers() -> EnvIO<API.Config, API.HTTPError, Customers> {
41-
EnvIO { _ in
41+
EnvIO { _ in
4242
IO.invoke {
43-
[ Customer(id: 1, name: "Tomás") ]
43+
[ Customer(identifier: 1, name: "Tomás") ]
4444
}
4545
}
4646
}
4747
}
4848

4949
extension API {
50-
var customer: CustomerAPI {
50+
static var customer: CustomerAPI {
5151
CustomerAPIClient()
5252
}
5353
}
@@ -76,9 +76,14 @@ let either: Either<API.HTTPError, Customers> =
7676

7777
// Asynchronous run
7878
customersRequest.provide(config).unsafeRunAsync { either in
79-
either.fold({ httpError in /* ... */ },
80-
{ customers in /* ... */ })
79+
either.fold({ httpError in
80+
// ...
81+
},
82+
{ customers in
83+
// ...
84+
})
8185
}
8286

87+
8388
// Changing queue
84-
let customers: Customers? = try? customersRequest.provide(config).unsafeRunSync(on: .background)
89+
try? customersRequest.provide(config).unsafeRunSync(on: .global(qos: .background))

Documentation.app/Contents/MacOS/Consuming generated code.playground/Pages/Testing your network calls.xcplaygroundpage/Contents.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ enum API {
2121
}
2222
}
2323

24-
enum HTTPError {}
24+
enum HTTPError: Error {}
2525
}
2626

2727
struct Customer: Codable, Equatable {
@@ -42,7 +42,7 @@ struct CustomerAPIClient: CustomerAPI {
4242
}
4343

4444
extension API {
45-
var customer: CustomerAPI {
45+
static var customer: CustomerAPI {
4646
CustomerAPIClient()
4747
}
4848
}

docs/CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
openapi.bow-swift.io

docs/Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source "https://rubygems.org"
2+
3+
gem "jekyll", ">= 3.7.4"

docs/Gemfile.lock

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
addressable (2.6.0)
5+
public_suffix (>= 2.0.2, < 4.0)
6+
colorator (1.1.0)
7+
concurrent-ruby (1.1.5)
8+
em-websocket (0.5.1)
9+
eventmachine (>= 0.12.9)
10+
http_parser.rb (~> 0.6.0)
11+
eventmachine (1.2.7)
12+
ffi (1.10.0)
13+
forwardable-extended (2.6.0)
14+
http_parser.rb (0.6.0)
15+
i18n (0.9.5)
16+
concurrent-ruby (~> 1.0)
17+
jekyll (3.8.5)
18+
addressable (~> 2.4)
19+
colorator (~> 1.0)
20+
em-websocket (~> 0.5)
21+
i18n (~> 0.7)
22+
jekyll-sass-converter (~> 1.0)
23+
jekyll-watch (~> 2.0)
24+
kramdown (~> 1.14)
25+
liquid (~> 4.0)
26+
mercenary (~> 0.3.3)
27+
pathutil (~> 0.9)
28+
rouge (>= 1.7, < 4)
29+
safe_yaml (~> 1.0)
30+
jekyll-sass-converter (1.5.2)
31+
sass (~> 3.4)
32+
jekyll-watch (2.2.1)
33+
listen (~> 3.0)
34+
kramdown (1.17.0)
35+
liquid (4.0.3)
36+
listen (3.1.5)
37+
rb-fsevent (~> 0.9, >= 0.9.4)
38+
rb-inotify (~> 0.9, >= 0.9.7)
39+
ruby_dep (~> 1.2)
40+
mercenary (0.3.6)
41+
pathutil (0.16.2)
42+
forwardable-extended (~> 2.6)
43+
public_suffix (3.0.3)
44+
rb-fsevent (0.10.3)
45+
rb-inotify (0.10.0)
46+
ffi (~> 1.0)
47+
rouge (3.3.0)
48+
ruby_dep (1.5.0)
49+
safe_yaml (1.0.5)
50+
sass (3.7.4)
51+
sass-listen (~> 4.0.0)
52+
sass-listen (4.0.0)
53+
rb-fsevent (~> 0.9, >= 0.9.4)
54+
rb-inotify (~> 0.9, >= 0.9.7)
55+
56+
PLATFORMS
57+
ruby
58+
59+
DEPENDENCIES
60+
jekyll (>= 3.7.4)
61+
62+
BUNDLED WITH
63+
2.1.1

docs/_config.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
title: Bow-OpenAPI
2+
#-------------------------
3+
name: Bow-OpenAPI
4+
#-------------------------
5+
description: A command-line tool to generate a Swift network client from an OpenAPI / Swagger specification file. Please, refer to the project website for extensive and detailed documentation about the project.
6+
#-------------------------
7+
author: 47 Degrees
8+
keywords: functional-programming, monads, monad-transformers, functional-data-structure, swift, bow, xcode, xcode-playgrounds, playgrounds, fp-types, adt, free-monads, tagless-final, mtl, for-comprehension, category-theory
9+
#-------------------------
10+
url: https://openapi.bow-swift.io
11+
#-------------------------
12+
markdown: kramdown
13+
sass:
14+
sass_dir: _sass
15+
style: compressed
16+
#-------------------------
17+
permalink: pretty
18+
#-------------------------
19+
exclude: ['config.ru', 'Gemfile', 'Gemfile.lock', 'vendor', 'Procfile', 'Rakefile']
20+
#-------------------------

docs/_data/features.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
content:
2+
- title: Verification
3+
description: Eases the creation of Xcode Playgrounds with support for third party libraries.
4+
icon: img/main-image-primary.svg
5+
6+
- title: Compile
7+
description: Compiles Xcode Playgrounds with support for third party libraries from the command line.
8+
icon: img/main-image-secondary.svg
9+
10+
- title: Generation
11+
description: Generates Markdown project from Xcode Playground.
12+
icon: img/main-image-tertiary.svg
13+
14+
- title: Integration
15+
description: Integrates Xcode Playgrounds with Carbon to export code snippets and Jekyll to create a microsite.
16+
icon: img/main-image-quaternary.svg

0 commit comments

Comments
 (0)