This repository has been archived by the owner on Aug 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0ca2fd5
Showing
15 changed files
with
468 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# 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 | ||
*.xccheckout | ||
*.xcscmblueprint | ||
|
||
## Obj-C/Swift specific | ||
*.hmap | ||
*.ipa | ||
*.dSYM.zip | ||
*.dSYM | ||
|
||
## 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/ | ||
# Package.pins | ||
.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://docs.fastlane.tools/best-practices/source-control/#source-control | ||
|
||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots | ||
fastlane/test_output | ||
|
||
.DS_Store | ||
Packages/* | ||
*.xcodeproj/* | ||
Package.resolved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
os: | ||
- linux | ||
env: | ||
language: generic | ||
sudo: required | ||
dist: trusty | ||
osx_image: xcode9.4.1 | ||
install: | ||
- if [ $TRAVIS_OS_NAME = linux ]; then | ||
eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)"; | ||
fi | ||
matrix: | ||
include: | ||
- script: | ||
- make test-swift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] | ||
|
||
[homepage]: http://contributor-covenant.org | ||
[version]: http://contributor-covenant.org/version/1/4/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM norionomura/swift:41 | ||
|
||
WORKDIR /package | ||
|
||
COPY . ./ | ||
|
||
RUN swift package resolve | ||
RUN swift package clean | ||
CMD swift test --parallel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Point-Free, Inc. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
SUDO = sudo --prompt=$(SUDO_PROMPT) | ||
SUDO_PROMPT = " 🔒 Please enter your password: " | ||
SDK_PATH = $(shell xcrun --show-sdk-path 2>/dev/null) | ||
FRAMEWORKS_PATH = $(SDK_PATH)/System/Library/Frameworks | ||
|
||
bootstrap: xcodeproj install-mm-xcodeproj | ||
|
||
xcodeproj: | ||
swift package generate-xcodeproj | ||
xed . | ||
|
||
test-linux: | ||
docker build --tag html . \ | ||
&& docker run --rm html | ||
|
||
test-macos: xcodeproj | ||
brew install libressl | ||
set -o pipefail && \ | ||
xcodebuild test \ | ||
-scheme HtmlVaporSupport-Package \ | ||
-destination platform="macOS" \ | ||
| xcpretty | ||
|
||
linux-main: | ||
swift test --generate-linuxmain | ||
|
||
test-swift: linux-main | ||
swift test | ||
|
||
test-all: test-linux test-mac | ||
|
||
install-mm-xcodeproj: xcodeproj | ||
@ls HtmlVaporSupport.xcodeproj/GeneratedModuleMap | xargs -n1 -I '{}' $(SUDO) mkdir -p "$(FRAMEWORKS_PATH)/{}.framework" | ||
@ls HtmlVaporSupport.xcodeproj/GeneratedModuleMap | xargs -n1 -I '{}' $(SUDO) cp "./HtmlVaporSupport.xcodeproj/GeneratedModuleMap/{}/module.modulemap" "$(FRAMEWORKS_PATH)/{}.framework/module.map" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
{ | ||
"object": { | ||
"pins": [ | ||
{ | ||
"package": "Socket", | ||
"repositoryURL": "https://github.com/IBM-Swift/BlueSocket.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "ce36f72f2c36b88f847de50c8c0ed8021ff80097", | ||
"version": "1.0.16" | ||
} | ||
}, | ||
{ | ||
"package": "SSLService", | ||
"repositoryURL": "https://github.com/IBM-Swift/BlueSSLService.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "a8e24ec6db452ed202502ebae885b39f43e34d98", | ||
"version": "1.0.16" | ||
} | ||
}, | ||
{ | ||
"package": "CCurl", | ||
"repositoryURL": "https://github.com/IBM-Swift/CCurl.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "2a431e3a5fb8d004aa7d4d1bebb5d511f568c43e", | ||
"version": "1.0.0" | ||
} | ||
}, | ||
{ | ||
"package": "Kitura", | ||
"repositoryURL": "https://github.com/IBM-Swift/Kitura.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "38ca4d1c8385ea11ccbc7a0c841aff49accbcf17", | ||
"version": "2.5.1" | ||
} | ||
}, | ||
{ | ||
"package": "Kitura-net", | ||
"repositoryURL": "https://github.com/IBM-Swift/Kitura-net.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "4023a2ea525e0c46d9ea793770d83f75df8a1707", | ||
"version": "2.1.1" | ||
} | ||
}, | ||
{ | ||
"package": "Kitura-TemplateEngine", | ||
"repositoryURL": "https://github.com/IBM-Swift/Kitura-TemplateEngine.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "b030d2d176719acc6a902c40db1b87dc6a83e2fc", | ||
"version": "2.0.0" | ||
} | ||
}, | ||
{ | ||
"package": "KituraContracts", | ||
"repositoryURL": "https://github.com/IBM-Swift/KituraContracts.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "8e41f3fc81b662722020754f74a8fd8c7bdbbf3b", | ||
"version": "1.1.0" | ||
} | ||
}, | ||
{ | ||
"package": "LoggerAPI", | ||
"repositoryURL": "https://github.com/IBM-Swift/LoggerAPI.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "5041f2673aa75d6e973d9b6bd3956bc5068387c8", | ||
"version": "1.7.3" | ||
} | ||
}, | ||
{ | ||
"package": "Html", | ||
"repositoryURL": "https://github.com/pointfreeco/swift-html.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "bb2fac72ec6f0adbe5a74b534d6d265f073b24bf", | ||
"version": "0.1.1" | ||
} | ||
}, | ||
{ | ||
"package": "SnapshotTesting", | ||
"repositoryURL": "https://github.com/pointfreeco/swift-snapshot-testing.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "69b48c8487ef8207170aee02485c40f9cafc79c8", | ||
"version": "0.0.1" | ||
} | ||
}, | ||
{ | ||
"package": "TypeDecoder", | ||
"repositoryURL": "https://github.com/IBM-Swift/TypeDecoder.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "aaf636e64089baf6a710ff5e7dd5f4c8798ff940", | ||
"version": "1.1.0" | ||
} | ||
} | ||
] | ||
}, | ||
"version": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// swift-tools-version:4.0 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "HtmlKituraSupport", | ||
products: [ | ||
.library( | ||
name: "HtmlKituraSupport", | ||
targets: ["HtmlKituraSupport"]), | ||
.executable( | ||
name: "HtmlKituraSupportExample", | ||
targets: ["HtmlKituraSupportExample"]), | ||
], | ||
dependencies: [ | ||
.package(url: "https://github.com/pointfreeco/swift-html.git", from: "0.1.1"), | ||
.package(url: "https://github.com/IBM-Swift/Kitura.git", .upToNextMinor(from: "2.5.0")), | ||
], | ||
targets: [ | ||
.target( | ||
name: "HtmlKituraSupport", | ||
dependencies: ["Html", "Kitura"]), | ||
.testTarget( | ||
name: "HtmlKituraSupportTests", | ||
dependencies: ["HtmlKituraSupport"]), | ||
.target( | ||
name: "HtmlKituraSupportExample", | ||
dependencies: ["HtmlKituraSupport"]), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# swift-html-kitura | ||
|
||
[](https://swift.org/download/) | ||
[](https://travis-ci.org/pointfreeco/swift-html-kitura) | ||
[](https://twitter.com/pointfreeco) | ||
|
||
[Kitura](https://www.kitura.io) plugin for type-safe, transformable HTML views using [swift-html](https://github.com/pointfreeco/swift-html). | ||
|
||
## Motivation | ||
|
||
The most popular choice for rendering HTML in a Kitura web app is to use the Stencil templating language, but it exposes your application to **runtime errors** and **invalid HTML**. Our plugin prevents these runtime issues at compile-time by embedding HTML directly into Swift’s powerful type system. It uses the [swift-html](https://github.com/pointfreeco/swift-html) DSL for constructing HTML documents using plain Swift data structures. | ||
|
||
## Example | ||
|
||
To use the plugin all you have to do is return a `Node` value from your router callback: | ||
|
||
``` swift | ||
import HtmlKituraSupport | ||
import Kitura | ||
|
||
let router = Router() | ||
|
||
router.get("/") { request, response, next in | ||
response.send( | ||
h1(["Hello, type-safe HTML on Kitura!"]) | ||
) | ||
next() | ||
} | ||
|
||
Kitura.addHTTPServer(onPort: 8080, with: router) | ||
Kitura.run() | ||
``` | ||
|
||
## Installation | ||
|
||
If you want to use swift-html-kitura in a project that uses [SwiftPM](https://swift.org/package-manager/), it's as simple as adding a `dependencies` clause to your `Package.swift`: | ||
|
||
``` swift | ||
dependencies: [ | ||
.package(url: "https://github.com/pointfreeco/swift-html-kitura.git", from: "0.1.0") | ||
] | ||
``` | ||
|
||
### Xcode Sub-project | ||
|
||
Submodule, clone, or download swift-html-kitura, and drag `HtmlKituraSupport.xcodeproj` into your project. | ||
|
||
## License | ||
|
||
All modules are released under the MIT license. See [LICENSE](LICENSE) for details. |
Oops, something went wrong.