Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vapor 2 #12

Merged
merged 89 commits into from May 24, 2017
Merged

Vapor 2 #12

Changes from 88 commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
5c1b242
Use Vapor 2 packages and comment out old imports
0xTim Apr 17, 2017
dfdab5b
Convert most of the Model stuff over to Vapor 2
0xTim Apr 17, 2017
9c0a1d9
Fix most of the makeNode errors
0xTim Apr 20, 2017
4200143
Update Swift badge on README
0xTim Apr 24, 2017
4f9d6c7
Fix the Provider
0xTim Apr 24, 2017
ebd0631
Update getting the user from the request
0xTim Apr 24, 2017
675be08
Sort out Authentication
0xTim Apr 24, 2017
6c7d9a0
Convert most of the Relationships stuff
0xTim Apr 24, 2017
af48967
Fix sibling relation between BlogTag and BlogPost
0xTim Apr 24, 2017
c8c536f
Model fixes
0xTim Apr 25, 2017
9538394
Use BCrypt for passwords and some model fixes
0xTim Apr 25, 2017
8ea741a
Bring back validation
0xTim May 1, 2017
decd083
Some tidy ups and fixing the modifications
0xTim May 1, 2017
d40c29a
Use in-built pagination
0xTim May 1, 2017
5bc6017
Get most of the tests compiling
0xTim May 1, 2017
5593045
Try and get the tests working
0xTim May 1, 2017
d176868
Fix post count tag test
0xTim May 1, 2017
598957d
Fix BlogAdminController tests
0xTim May 1, 2017
d965cb6
Migrations don't appear to work. Use correct column ID for the relation
0xTim May 3, 2017
5ba91c4
Prepare the pivot correctly
0xTim May 3, 2017
0a411b7
Update framework to latest Vapor changes
0xTim May 3, 2017
39d2863
Fix more tests for parent-child relations
0xTim May 3, 2017
ceef36e
Force author to be passed in when creating a post as we now need to s…
0xTim May 3, 2017
8c83dca
Fix test where username wasn't unique
0xTim May 3, 2017
ac66f27
Prepare the database for tests in one place
0xTim May 3, 2017
e12990b
Make the migrations SQLite compatible and use them in tests
0xTim May 3, 2017
ee1e906
Fix context check in BlogPost
0xTim May 3, 2017
ba70bb4
Blog Controller tests now all working again
0xTim May 3, 2017
a86321d
Bring back the commented out tests
0xTim May 3, 2017
6ef73df
All tests that don't rely on a paginator are now working
0xTim May 3, 2017
3d43b8f
Updates for latest Vapor 2 beta
0xTim May 3, 2017
71455aa
Tests are now passing for Vapor 2!
0xTim May 3, 2017
1e6cfc5
Modernising makeNode and tidy ups
0xTim May 3, 2017
9393c2b
Update CI script for Vapor 2
0xTim May 3, 2017
2b62412
Make authentication work
0xTim May 4, 2017
9065e22
Add some type safety around setting the password (it is now Bytes typ…
0xTim May 4, 2017
ca5ff19
Fix test from Vapor 2 update
0xTim May 4, 2017
7c78d9a
Fix logging in to the blog
0xTim May 4, 2017
ddc8700
Admin user must reset their password on first login again
0xTim May 4, 2017
4a9f603
Fix log out
0xTim May 4, 2017
7bec662
Unauthenticate already calls unpersist
0xTim May 4, 2017
ea12d9e
Fix last edited date not being saved correctly
0xTim May 4, 2017
95ef064
Make Travis emails a bit less spammy
0xTim May 4, 2017
99088ce
Finally inlined the logic to differentiate between none, one and mult…
0xTim May 4, 2017
223d614
Redirect to post once created
0xTim May 4, 2017
1240cd1
We don't need code coverage for the tests...
0xTim May 4, 2017
0676f87
BCryptHasher automatically conforms to PasswordVerifier now
0xTim May 8, 2017
348f6f4
Start bringing the paginator tag back
0xTim May 9, 2017
a2970ce
Get paginator work building again
0xTim May 9, 2017
8730ef0
First signs of a working paginator
0xTim May 9, 2017
7a612fb
Fix pagination when only one page
0xTim May 10, 2017
fdf6122
First stab at paginator. Uses crude method for creating the links as …
0xTim May 10, 2017
4ff9978
Start moving to new Routing way
0xTim May 11, 2017
e927cd0
Update for new Routing
0xTim May 12, 2017
46ec618
Remove casting and give the compiler a hand
0xTim May 12, 2017
9c5abc1
Make posts per page for paginator use the configuration passed again
0xTim May 12, 2017
a5f4d80
Having a bit of a tidy up
0xTim May 12, 2017
4fc5cb7
No longer need a Console implementation for tests
0xTim May 12, 2017
82a5c9a
Rename persist middleware in case of conflicts
0xTim May 12, 2017
d9bdd08
Update README about adding the middleware
0xTim May 12, 2017
4b5adbb
Use next() instead of get() to pull out parameters
0xTim May 12, 2017
f2d71bb
Merge branch 'vapor2' of personalid:brokenhandsio/SteamPress into vapor2
0xTim May 12, 2017
62d951d
Add information about SessionsMiddleware to README
0xTim May 12, 2017
db89df5
Controllers shouldn't know about the Droplet's config. Adding a disqu…
0xTim May 12, 2017
fef6778
Revert the database as part of teardown for each test
0xTim May 12, 2017
506a08a
Move preparations into a separate file
0xTim May 14, 2017
48bc094
Tidy up the models
0xTim May 14, 2017
422eb10
Make column names less 'stringly typed'
0xTim May 14, 2017
1536039
Use a single BCryptHasher rather than creating a load of them in diff…
0xTim May 14, 2017
a96f723
Allow Bootstrap 3 or 4 for the paginator Tag
0xTim May 14, 2017
610eab2
Note change in parameter of URI
0xTim May 16, 2017
903694f
Better error for Parameterizable models
0xTim May 16, 2017
b1218bd
Tidy up old parameters
0xTim May 16, 2017
31ba66e
Use custom Sessions stuff in prepration for SessionsMiddleware change…
0xTim May 16, 2017
532c0a2
Update README with details about custom middleware
0xTim May 16, 2017
b1cef8d
Fix preparation order on MySQL
0xTim May 17, 2017
a4965ca
Add test for logging in
0xTim May 17, 2017
f6e1027
Add tests for checking for login on admin pages
0xTim May 17, 2017
782c969
Updates to latest Vapor code
0xTim May 17, 2017
8878664
Entity types can already conform to Parameterizable without any work
0xTim May 18, 2017
892715a
Update for latest Vapor changes and remember me should now work
0xTim May 18, 2017
789481a
Merge pull request #1 from brokenhandsio/vapor2
pruthvikar May 18, 2017
bb8f0db
using a struct with static let strings for cleaner field name access
pruthvikar May 17, 2017
2ab8f3e
Merge pull request #13 from pruthvikar/PropertiesStruct
0xTim May 18, 2017
d2a4650
Update README for Vapor 2
0xTim May 19, 2017
ef62970
Use latest releases and merged Forks
0xTim May 19, 2017
6599093
Fix login bug and work around the Redirect issue for now
0xTim May 19, 2017
0955712
Update tests for new redirect behaviour
0xTim May 22, 2017
a24710d
Fix typo in comment
0xTim May 24, 2017
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+1,570 −1,206
Diff settings

Always

Just for now

Copy path View file
@@ -0,0 +1,4 @@
coverage:
range: "0...100"
ignore:
- "Tests/"
Copy path View file
@@ -1,10 +1,31 @@
os:
- linux
- osx
- linux
- osx
language: generic
sudo: required
dist: trusty

osx_image: xcode8.3
before_install:
- if [ $TRAVIS_OS_NAME == "osx" ]; then
brew tap vapor/tap;
brew update;
brew install vapor;
else
eval "$(curl -sL https://apt.vapor.sh)";
sudo apt-get install vapor;
sudo chmod -R a+rx /usr/;
fi

script:
- eval "$(curl -sL https://swift.vapor.sh/ci-3.1)"
- eval "$(curl -sL https://swift.vapor.sh/codecov)"
- swift build
- swift build -c release
- swift test

after_success:
- eval "$(curl -sL https://swift.vapor.sh/codecov)"

notifications:
email:
on_success: change
on_failure: change
Copy path View file
@@ -3,9 +3,12 @@ import PackageDescription
let package = Package(
name: "SteamPress",
dependencies: [
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 1),
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 2),
.Package(url: "https://github.com/scinfu/SwiftSoup.git", majorVersion: 1),
.Package(url: "https://github.com/brokenhandsio/LeafMarkdown.git", majorVersion: 0),
.Package(url: "https://github.com/nodes-vapor/paginator", majorVersion: 0)
.Package(url: "https://github.com/vapor-community/markdown-provider.git", majorVersion: 1),
.Package(url: "https://github.com/vapor/leaf-provider.git", majorVersion: 1),
.Package(url: "https://github.com/vapor/fluent-provider.git", majorVersion: 1),
.Package(url: "https://github.com/vapor/auth-provider.git", majorVersion: 1),
.Package(url: "https://github.com/vapor/validation.git", majorVersion: 0),
]
)
Copy path View file
@@ -1,6 +1,6 @@
# SteamPress

[![Language](https://img.shields.io/badge/Swift-3-brightgreen.svg)](http://swift.org)
[![Language](https://img.shields.io/badge/Swift-3.1-brightgreen.svg)](http://swift.org)
[![Build Status](https://travis-ci.org/brokenhandsio/SteamPress.svg?branch=master)](https://travis-ci.org/brokenhandsio/SteamPress)
[![codecov](https://codecov.io/gh/brokenhandsio/SteamPress/branch/master/graph/badge.svg)](https://codecov.io/gh/brokenhandsio/SteamPress)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/brokenhandsio/SteamPress/master/LICENSE)
@@ -28,9 +28,27 @@ There is an example of how it can work in a site (and what it requires in terms

# How to Use

## Integration

In order for SteamPress to work properly, it requires various Middleware to do things like authentication. You must add these to your `droplet.json` so they are loaded up and SteamPress can work properly. In your `droplet.json` add `steampress-sessions` and `blog-persist` like so (and in this order):

```json
{
...
"middleware": [
...,
"steampress-sessions"
"blog-persist"
],
...
}
```

`steampress-sessions` will used the `Droplet`'s configured `SessionsProtocol` implementation and you can configure it in your `Configuration` (for example to use Redis instead of in-memory).

## Setup

It's just a single line! Well almost... First add it to your `Package.swift` dependencies:
SteamPress is easy to integrate with your application. First add SteamPress to your `Package.swift` dependencies:

```swift
dependencies: [
@@ -48,7 +66,7 @@ import SteamPress
Finally, add the provider!

```swift
try drop.addProvider(SteamPress.Provider.self)
try config.addProvider(SteamPress.Provider.self)
```

This will look for a config file called `steampress.json` that looks like:
@@ -68,14 +86,14 @@ You can also initialise the Provider manually, by creating it as so:

```swift
let steampress = SteamPress.Provider(postsPerPage: 5)
drop.addProvider(steampress)
config.addProvider(steampress)
```

This will initialise it as the root path of your site. If you wish to have it in a subdirectory, initialise it with:

```swift
let steampress = SteamPress.Provider(postsPerPage: 5, blogPath: "blog")
drop.addProvider(steampress)
config.addProvider(steampress)
```

### Bootstrap Versions
@@ -100,7 +118,7 @@ let steampress = SteamPress.Provider(postsPerPage: 5, blogPath: "blog", useBoots

### Disabling Routes

You can disable the routes for authors pages and tags pages (both individual and all) by adding the option in your configuration file. To disable all of the authors pages, in your `steampress.json` add:
You can disable the routes for authors pages and tags pages (both individual and all) by adding the option in your configuration file. To disable all of the authors pages, in your `steampress.json` add:

```json
{
@@ -193,7 +211,7 @@ This is the page for viewing a single entire blog post. The parameters set are:
* `disqus_name` - the name of your Disqus site if configured
* `post_uri` - The URI of the post
* `post_uri_encoded` - A URL-query encoded for of the URI for passing to Share buttons
* `site_uri`: The URI of the root site - this is useful for creating links to author pages for `article:author` Open Graph support
* `site_uri`: The URI of the root site - this is useful for creating links to author pages for `article:author` Open Graph support (has a trailing slash)
* `post_description` - The HTML of the short snippet of the post on a single line with all HTML tags stripped out for the `description` tags
* `post_image` - The first image in the blog post if one is there. Useful for OpenGraph and Twitter Cards
* `post_image_alt` - The alt text of the first image if it exists. Useful for Twitter Cards
@@ -367,10 +385,6 @@ SteamPress also contains an API for accessing certain things that may be useful.

* `/<blog-path>/api/tags/` - returns all the tags that have been saved in JSON

# Known issues

* When the admin user is created when first accessing the login screen, sometimes two are created so you need to use the first password displayed. You can then delete the second Admin user in the Admin pane.

# Roadmap

I anticipate SteamPress staying on a version 0 for some time, whilst some of the biggest features are implemented. Semantic versioning makes life a little difficult for this as any new endpoints will require a breaking change for you to add Leaf templates! However, I will aim to stabilise this as quickly as possible, and any breaking changes will be announced in the [releases](https://github.com/brokenhandsio/SteamPress/releases) page.
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.