Adapt project for Astzweig
This commit is contained in:
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@@ -1 +1 @@
|
|||||||
* @adam-fowler @Joannis
|
* @astzweig/coders
|
||||||
|
|||||||
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@@ -1 +0,0 @@
|
|||||||
github: adam-fowler
|
|
||||||
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
Package for rendering Mustache templates. Mustache is a "logic-less" templating language commonly used in web and mobile platforms. You can find out more about Mustache [here](http://mustache.github.io/mustache.5.html).
|
Package for rendering Mustache templates. Mustache is a "logic-less" templating language commonly used in web and mobile platforms. You can find out more about Mustache [here](http://mustache.github.io/mustache.5.html).
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> This repository is a fork of [hummingbird-project/swift-mustache](https://github.com/hummingbird-project/swift-mustache). It may contain modifications required by our other open source tools.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Load your templates from the filesystem
|
Load your templates from the filesystem
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/// Protocol for content types
|
/// Protocol for content types
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2024 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
/// Context while rendering mustache tokens
|
/// Context while rendering mustache tokens
|
||||||
struct MustacheContext {
|
struct MustacheContext {
|
||||||
let stack: [Any]
|
let stack: [Any]
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/// Allow object to override standard hummingbird type rendering which uses
|
/// Allow object to override standard hummingbird type rendering which uses
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2024 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// Below is a list of unavailable symbols with the "HB" prefix. These are available
|
// Below is a list of unavailable symbols with the "HB" prefix. These are available
|
||||||
// temporarily to ease transition from the old symbols that included the "HB"
|
// temporarily to ease transition from the old symbols that included the "HB"
|
||||||
// prefix to the new ones.
|
// prefix to the new ones.
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
/// Lambda function. Can add this to object being rendered to filter contents of objects.
|
/// Lambda function. Can add this to object being rendered to filter contents of objects.
|
||||||
///
|
///
|
||||||
/// See http://mustache.github.io/mustache.5.html for more details on
|
/// See http://mustache.github.io/mustache.5.html for more details on
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2024 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
extension MustacheLibrary {
|
extension MustacheLibrary {
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2024 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
/// Class holding a collection of mustache templates.
|
/// Class holding a collection of mustache templates.
|
||||||
///
|
///
|
||||||
/// Each template can reference the others via a partial using the name the template is registered under
|
/// Each template can reference the others via a partial using the name the template is registered under
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
extension Mirror {
|
extension Mirror {
|
||||||
/// Return value from Mirror given name
|
/// Return value from Mirror given name
|
||||||
func getValue(forKey key: String) -> Any? {
|
func getValue(forKey key: String) -> Any? {
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#if compiler(<6.0)
|
#if compiler(<6.0)
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
/// Protocol for object that has a custom method for accessing their children, instead
|
/// Protocol for object that has a custom method for accessing their children, instead
|
||||||
/// of using Mirror
|
/// of using Mirror
|
||||||
public protocol MustacheParent {
|
public protocol MustacheParent {
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/// Reader object for parsing String buffers
|
/// Reader object for parsing String buffers
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
/// Protocol for objects that can be rendered as a sequence in Mustache
|
/// Protocol for objects that can be rendered as a sequence in Mustache
|
||||||
public protocol MustacheSequence: Sequence {}
|
public protocol MustacheSequence: Sequence {}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
/// Context that current object inside a sequence is being rendered in. Only relevant when rendering a sequence
|
/// Context that current object inside a sequence is being rendered in. Only relevant when rendering a sequence
|
||||||
struct MustacheSequenceContext: MustacheTransformable {
|
struct MustacheSequenceContext: MustacheTransformable {
|
||||||
var first: Bool
|
var first: Bool
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
extension String {
|
extension String {
|
||||||
private static let htmlEscapedCharacters: [Character: String] = [
|
private static let htmlEscapedCharacters: [Character: String] = [
|
||||||
"<": "<",
|
"<": "<",
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2024 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
extension MustacheTemplate {
|
extension MustacheTemplate {
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
extension MustacheTemplate {
|
extension MustacheTemplate {
|
||||||
/// Error return by `MustacheTemplate.parse`. Includes information about where error occurred
|
/// Error return by `MustacheTemplate.parse`. Includes information about where error occurred
|
||||||
public struct ParserError: Swift.Error {
|
public struct ParserError: Swift.Error {
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2024 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
extension MustacheTemplate {
|
extension MustacheTemplate {
|
||||||
|
|||||||
@@ -1,18 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2024 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
/// Class holding Mustache template
|
|
||||||
public struct MustacheTemplate: Sendable, CustomStringConvertible {
|
public struct MustacheTemplate: Sendable, CustomStringConvertible {
|
||||||
/// Initialize template
|
/// Initialize template
|
||||||
/// - Parameter string: Template text
|
/// - Parameter string: Template text
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
/// Objects that can have a transforms run on them. Mustache transforms are specific to this implementation
|
/// Objects that can have a transforms run on them. Mustache transforms are specific to this implementation
|
||||||
/// of Mustache. They allow you to process objects before they are rendered.
|
/// of Mustache. They allow you to process objects before they are rendered.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
import Mustache
|
import Mustache
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2024 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
@testable import Mustache
|
@testable import Mustache
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
@testable import Mustache
|
@testable import Mustache
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import Mustache
|
import Mustache
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
@testable import Mustache
|
@testable import Mustache
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
import Mustache
|
import Mustache
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,3 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) 2021-2021 the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
import Mustache
|
import Mustache
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
##
|
|
||||||
## This source file is part of the Hummingbird server framework project
|
|
||||||
##
|
|
||||||
## Copyright (c) 2021-2024 the Hummingbird authors
|
|
||||||
## Licensed under Apache License v2.0
|
|
||||||
##
|
|
||||||
## See LICENSE.txt for license information
|
|
||||||
## See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
##
|
|
||||||
## SPDX-License-Identifier: Apache-2.0
|
|
||||||
##
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
##
|
|
||||||
## This source file is part of the SwiftNIO open source project
|
|
||||||
##
|
|
||||||
## Copyright (c) 2017-2019 Apple Inc. and the SwiftNIO project authors
|
|
||||||
## Licensed under Apache License v2.0
|
|
||||||
##
|
|
||||||
## See LICENSE.txt for license information
|
|
||||||
## See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
||||||
##
|
|
||||||
## SPDX-License-Identifier: Apache-2.0
|
|
||||||
##
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
|
|
||||||
SWIFT_FORMAT_VERSION=0.53.10
|
SWIFT_FORMAT_VERSION=0.53.10
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
@@ -49,78 +22,3 @@ if [[ "$FIRST_OUT" != "$SECOND_OUT" ]]; then
|
|||||||
else
|
else
|
||||||
printf "\033[0;32mokay.\033[0m\n"
|
printf "\033[0;32mokay.\033[0m\n"
|
||||||
fi
|
fi
|
||||||
printf "=> Checking license headers... "
|
|
||||||
tmp=$(mktemp /tmp/.soto-core-sanity_XXXXXX)
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
for language in swift-or-c; do
|
|
||||||
declare -a matching_files
|
|
||||||
declare -a exceptions
|
|
||||||
expections=( )
|
|
||||||
matching_files=( -name '*' )
|
|
||||||
case "$language" in
|
|
||||||
swift-or-c)
|
|
||||||
exceptions=( -path '*/Benchmarks/.build/*' -o -name Package.swift)
|
|
||||||
matching_files=( -name '*.swift' -o -name '*.c' -o -name '*.h' )
|
|
||||||
cat > "$tmp" <<"EOF"
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// This source file is part of the Hummingbird server framework project
|
|
||||||
//
|
|
||||||
// Copyright (c) YEARS the Hummingbird authors
|
|
||||||
// Licensed under Apache License v2.0
|
|
||||||
//
|
|
||||||
// See LICENSE.txt for license information
|
|
||||||
// See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
EOF
|
|
||||||
;;
|
|
||||||
bash)
|
|
||||||
matching_files=( -name '*.sh' )
|
|
||||||
cat > "$tmp" <<"EOF"
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
##
|
|
||||||
## This source file is part of the Hummingbird server framework project
|
|
||||||
##
|
|
||||||
## Copyright (c) YEARS the Hummingbird authors
|
|
||||||
## Licensed under Apache License v2.0
|
|
||||||
##
|
|
||||||
## See LICENSE.txt for license information
|
|
||||||
## See hummingbird/CONTRIBUTORS.txt for the list of Hummingbird authors
|
|
||||||
##
|
|
||||||
## SPDX-License-Identifier: Apache-2.0
|
|
||||||
##
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
EOF
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo >&2 "ERROR: unknown language '$language'"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
lines_to_compare=$(cat "$tmp" | wc -l | tr -d " ")
|
|
||||||
# need to read one more line as we remove the '#!' line
|
|
||||||
lines_to_read=$(expr "$lines_to_compare" + 1)
|
|
||||||
expected_sha=$(cat "$tmp" | shasum)
|
|
||||||
|
|
||||||
(
|
|
||||||
cd "$here/.."
|
|
||||||
find . \
|
|
||||||
\( \! -path './.build/*' -a \
|
|
||||||
\( "${matching_files[@]}" \) -a \
|
|
||||||
\( \! \( "${exceptions[@]}" \) \) \) | while read line; do
|
|
||||||
if [[ "$(cat "$line" | head -n $lines_to_read | replace_acceptable_years | head -n $lines_to_compare | shasum)" != "$expected_sha" ]]; then
|
|
||||||
printf "\033[0;31mmissing headers in file '$line'!\033[0m\n"
|
|
||||||
diff -u <(cat "$line" | head -n $lines_to_read | replace_acceptable_years | head -n $lines_to_compare) "$tmp"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
printf "\033[0;32mokay.\033[0m\n"
|
|
||||||
)
|
|
||||||
done
|
|
||||||
|
|
||||||
rm "$tmp"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user