Merge pull request #3 from RockfordWei/master

Fully upgrading to Swift 4.1.1
This commit is contained in:
Kyle Jessup 2018-05-31 14:28:56 -04:00 committed by GitHub
commit a3bce7e83f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 11 deletions

3
.gitignore vendored
View File

@ -67,3 +67,6 @@ fastlane/test_output
Packages/ Packages/
*.xcodeproj/ *.xcodeproj/
.DS_Store .DS_Store
*.resolved
*.pins

View File

@ -1,3 +1,4 @@
// swift-tools-version:4.0
// //
// Package.swift // Package.swift
// PerfectMustache // PerfectMustache
@ -9,7 +10,7 @@
// //
// This source file is part of the Perfect.org open source project // This source file is part of the Perfect.org open source project
// //
// Copyright (c) 2015 - 2016 PerfectlySoft Inc. and the Perfect project authors // Copyright (c) 2015 - 2018 PerfectlySoft Inc. and the Perfect project authors
// Licensed under Apache License v2.0 // Licensed under Apache License v2.0
// //
// See http://perfect.org/licensing.html for license information // See http://perfect.org/licensing.html for license information
@ -18,10 +19,16 @@
// //
import PackageDescription import PackageDescription
let package = Package(name: "PerfectMustache",
let package = Package( products: [.library(name: "PerfectMustache",targets: ["PerfectMustache"]),],
dependencies: [
.package(url: "https://github.com/PerfectlySoft/Perfect-HTTP.git", from: "3.0.0"),
],
targets: [
.target(
name: "PerfectMustache", name: "PerfectMustache",
targets: [], dependencies: ["PerfectHTTP"]),
dependencies: [.Package(url: "https://github.com/PerfectlySoft/Perfect-HTTP.git", majorVersion: 3)], .testTarget(
exclude: [] name: "PerfectMustacheTests",
) dependencies: ["PerfectMustache"]),
])

View File

@ -23,7 +23,7 @@
<p align="center"> <p align="center">
<a href="https://developer.apple.com/swift/" target="_blank"> <a href="https://developer.apple.com/swift/" target="_blank">
<img src="https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat" alt="Swift 4.0"> <img src="https://img.shields.io/badge/Swift-4.1-orange.svg?style=flat" alt="Swift 4.1">
</a> </a>
<a href="https://developer.apple.com/swift/" target="_blank"> <a href="https://developer.apple.com/swift/" target="_blank">
<img src="https://img.shields.io/badge/Platforms-OS%20X%20%7C%20Linux%20-lightgray.svg?style=flat" alt="Platforms OS X | Linux"> <img src="https://img.shields.io/badge/Platforms-OS%20X%20%7C%20Linux%20-lightgray.svg?style=flat" alt="Platforms OS X | Linux">
@ -48,7 +48,7 @@ This package is designed to work along with [Perfect](https://github.com/Perfect
To start, add this project as a dependency in your Package.swift file. To start, add this project as a dependency in your Package.swift file.
```swift ```swift
.Package(url: "https://github.com/PerfectlySoft/Perfect-Mustache.git", majorVersion: 3) .package(url: "https://github.com/PerfectlySoft/Perfect-Mustache.git", from: "3.0.0")
``` ```
Basic usage: Basic usage:

View File

@ -610,7 +610,11 @@ public class MustacheTemplate : MustacheGroupTag {
override func populateClone(_ tag: MustacheTag) { override func populateClone(_ tag: MustacheTag) {
super.populateClone(tag) super.populateClone(tag)
if let template = tag as? MustacheTemplate { if let template = tag as? MustacheTemplate {
#if swift(>=4.1)
template.pragmas = self.pragmas.compactMap { $0.clone() as? MustachePragmaTag }
#else
template.pragmas = self.pragmas.flatMap { $0.clone() as? MustachePragmaTag } template.pragmas = self.pragmas.flatMap { $0.clone() as? MustachePragmaTag }
#endif
self.templateName = template.templateName self.templateName = template.templateName
} }
} }