Skip to content

Commit

Permalink
Merge pull request #24 from brokenhandsio/swift4
Browse files Browse the repository at this point in the history
Swift 4
  • Loading branch information
0xTim committed Sep 27, 2017
2 parents 0a346a2 + 2d7767b commit d203bf6
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ language: generic
sudo: required
dist: trusty

osx_image: xcode8.3
osx_image: xcode9
before_install:
- if [ $TRAVIS_OS_NAME == "osx" ]; then
brew tap vapor/tap;
Expand Down
24 changes: 24 additions & 0 deletions Package@swift-4.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// swift-tools-version:4.0

import PackageDescription

let package = Package(
name: "SteamPress",
products: [
.library(name: "SteamPress", targets: ["SteamPress"]),
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", from: "2.2.0"),
.package(url: "https://github.com/scinfu/SwiftSoup.git", from: "1.5.1"),
.package(url: "https://github.com/vapor-community/markdown-provider.git", from: "1.0.0"),
.package(url: "https://github.com/vapor/leaf-provider.git", from: "1.1.0"),
.package(url: "https://github.com/vapor/fluent-provider.git", from: "1.1.0"),
.package(url: "https://github.com/vapor/auth-provider.git", from: "1.2.0"),
.package(url: "https://github.com/vapor/validation.git", from: "1.0.1"),
],
targets: [
.target(name: "SteamPress", dependencies: ["Vapor", "SwiftSoup", "MarkdownProvider", "LeafProvider",
"FluentProvider", "AuthProvider", "Validation"]),
.testTarget(name: "SteamPressTests", dependencies: ["SteamPress"]),
]
)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<br>
<br>
<a href="https://swift.org">
<img src="http://img.shields.io/badge/Swift-3.1-brightgreen.svg" alt="Language">
<img src="http://img.shields.io/badge/Swift-4-brightgreen.svg" alt="Language">
</a>
<a href="https://travis-ci.org/brokenhandsio/SteamPress">
<img src="https://travis-ci.org/brokenhandsio/SteamPress.svg?branch=master" alt="Build Status">
Expand Down Expand Up @@ -67,7 +67,7 @@ SteamPress is easy to integrate with your application. First add SteamPress to y
```swift
dependencies: [
...,
.Package(url: "https://github.com/brokenhandsio/SteamPress", majorVersion: 0)
.package(url: "https://github.com/brokenhandsio/SteamPress", from: "0.15.0")
]
```

Expand Down
4 changes: 4 additions & 0 deletions Sources/SteamPress/Views/LeafViewFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ struct LeafViewFactory: ViewFactory {
guard let editSubstringIndex = uri.descriptionWithoutPort.range(of: "admin/posts")?.lowerBound else {
throw Abort.serverError
}
#if swift(>=4)
postPathPrefix = uri.descriptionWithoutPort[..<editSubstringIndex] + "posts/"
#else
postPathPrefix = uri.descriptionWithoutPort.substring(to: editSubstringIndex) + "posts/"
#endif
} else {
postPathPrefix = uri.descriptionWithoutPort.replacingOccurrences(of: "admin/createPost", with: "posts")
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/SteamPressTests/BlogAdminControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class BlogAdminControllerTests: XCTestCase {
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
let thisClass = type(of: self)
let linuxCount = thisClass.allTests.count
let darwinCount = Int(thisClass.defaultTestSuite().testCaseCount)
let darwinCount = Int(thisClass.defaultTestSuite.testCaseCount)
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from allTests")
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/SteamPressTests/BlogControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class BlogControllerTests: XCTestCase {
let thisClass = type(of: self)
let linuxCount = thisClass.allTests.count
let darwinCount = Int(thisClass
.defaultTestSuite().testCaseCount)
.defaultTestSuite.testCaseCount)
XCTAssertEqual(linuxCount, darwinCount,
"\(darwinCount - linuxCount) tests are missing from allTests")
#endif
Expand Down
2 changes: 1 addition & 1 deletion Tests/SteamPressTests/BlogPostTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class BlogPostTests: XCTestCase {
let thisClass = type(of: self)
let linuxCount = thisClass.allTests.count
let darwinCount = Int(thisClass
.defaultTestSuite().testCaseCount)
.defaultTestSuite.testCaseCount)
XCTAssertEqual(linuxCount, darwinCount,
"\(darwinCount - linuxCount) tests are missing from allTests")
#endif
Expand Down
2 changes: 1 addition & 1 deletion Tests/SteamPressTests/BlogTagTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BlogTagTests: XCTestCase {
let thisClass = type(of: self)
let linuxCount = thisClass.allTests.count
let darwinCount = Int(thisClass
.defaultTestSuite().testCaseCount)
.defaultTestSuite.testCaseCount)
XCTAssertEqual(linuxCount, darwinCount,
"\(darwinCount - linuxCount) tests are missing from allTests")
#endif
Expand Down
2 changes: 1 addition & 1 deletion Tests/SteamPressTests/Feed Tests/AtomFeedTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AtomFeedTests: XCTestCase {
let thisClass = type(of: self)
let linuxCount = thisClass.allTests.count
let darwinCount = Int(thisClass
.defaultTestSuite().testCaseCount)
.defaultTestSuite.testCaseCount)
XCTAssertEqual(linuxCount, darwinCount,
"\(darwinCount - linuxCount) tests are missing from allTests")
#endif
Expand Down
2 changes: 1 addition & 1 deletion Tests/SteamPressTests/Feed Tests/RSSFeedTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class RSSFeedTests: XCTestCase {
let thisClass = type(of: self)
let linuxCount = thisClass.allTests.count
let darwinCount = Int(thisClass
.defaultTestSuite().testCaseCount)
.defaultTestSuite.testCaseCount)
XCTAssertEqual(linuxCount, darwinCount,
"\(darwinCount - linuxCount) tests are missing from allTests")
#endif
Expand Down
2 changes: 1 addition & 1 deletion Tests/SteamPressTests/LeafViewFactoryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class LeafViewFactoryTests: XCTestCase {
let thisClass = type(of: self)
let linuxCount = thisClass.allTests.count
let darwinCount = Int(thisClass
.defaultTestSuite().testCaseCount)
.defaultTestSuite.testCaseCount)
XCTAssertEqual(linuxCount, darwinCount,
"\(darwinCount - linuxCount) tests are missing from allTests")
#endif
Expand Down

0 comments on commit d203bf6

Please sign in to comment.