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

Update to Stencil 0.14.0 (and Swift 5) #127

Merged
merged 47 commits into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
33cf26b
Update Stencil to master.
fortmarek Aug 2, 2020
d8d5336
Update stencil to 0.14.0
fortmarek Aug 24, 2020
5d8db2c
Fix tests.
fortmarek Aug 29, 2020
1d86d06
Update CircleCI config: switch to using a dedicated orb for bundle in…
AliSoftware Aug 29, 2020
44cda1e
Fix swiftlint issues.
fortmarek Aug 29, 2020
09e7134
Update xcodeproj.
fortmarek Aug 29, 2020
07bceb4
Merge branch 'stable' of https://github.com/fortmarek/StencilSwiftKit…
fortmarek Aug 29, 2020
e3ae168
Temporarily update Xcode version.
fortmarek Aug 29, 2020
03d30cd
Revert "Update xcodeproj."
fortmarek Aug 29, 2020
a4ee566
Update bundle deps.
fortmarek Aug 29, 2020
0e96a0f
Update Stencil Pod.
fortmarek Aug 29, 2020
c715c0d
Update Xcode version.
fortmarek Aug 29, 2020
8ee1b0b
Change Rakefile xcode version.
fortmarek Aug 29, 2020
eba5846
Update linux docker image.
fortmarek Aug 29, 2020
4b5c5a8
Downgrade cocoapods-downloader.
fortmarek Aug 29, 2020
16a5f26
Revert "Downgrade cocoapods-downloader."
fortmarek Aug 29, 2020
bec2ce0
Pin rubocop version.
fortmarek Aug 29, 2020
bb90b63
Downgrade psych version.
fortmarek Aug 29, 2020
d4d6d12
Downgrade docker swift version.
fortmarek Aug 29, 2020
b8fcc0a
Upgrade swiftlint version.
fortmarek Aug 29, 2020
f248a63
Fix swiftlint issues.
fortmarek Aug 29, 2020
bc470fc
Revert "Fix swiftlint issues."
fortmarek Aug 29, 2020
2bc49fb
Remove implicit return from opt in rules.
fortmarek Aug 29, 2020
b4a3e12
Add missing files.
fortmarek Aug 29, 2020
3c5e910
Update bundle deps.
fortmarek Aug 29, 2020
5b4ed54
Update linux docker image.
fortmarek Aug 29, 2020
a6872d6
Use custom docker image.
fortmarek Aug 30, 2020
4a0a86e
Temporarily use custom bundle install.
fortmarek Aug 30, 2020
4931824
Update ruby version.
fortmarek Aug 30, 2020
40c8a66
Update swift version.
fortmarek Aug 30, 2020
ed0f435
Update workspace with new pods version.
fortmarek Aug 30, 2020
329390f
Minor cocoapods changes.
fortmarek Aug 30, 2020
6a7a0a0
Add mising pod files.
fortmarek Aug 30, 2020
4cd545e
Add job for swift 4.2.
fortmarek Aug 30, 2020
fd3e40a
Add jobs with swift versions to check-deploy.
fortmarek Aug 30, 2020
76d3e43
Remove dots and digits from job names.
fortmarek Aug 30, 2020
c50951a
Use 5.2 image.
fortmarek Aug 30, 2020
985e418
Remove redundant bundle install.
fortmarek Aug 30, 2020
90778d9
xcode 12
djbe Oct 8, 2020
3dff275
swift 5 package file
djbe Oct 8, 2020
1428321
No idea what these info.plist were doing here
djbe Oct 8, 2020
ccec91d
Update dependencies
djbe Oct 8, 2020
c8ef1fd
Fix code lint issues
djbe Oct 8, 2020
861ea89
Update copyright notice
djbe Oct 8, 2020
c1f1f4f
Use our own docker image
djbe Oct 8, 2020
963b437
Use docker account
djbe Oct 8, 2020
99ac008
Add changelog entry
djbe Oct 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 14 additions & 34 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
orbs:
bundle-install: toshimaru/[email protected]

defaults:
- &macos-config
parallelism: 1
Expand All @@ -20,23 +23,6 @@ defaults:
run:
name: Create directories for artifacts and reports
command: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
- &restore-gems
restore_cache:
keys:
- &cache-key v1-gems-{{ checksum "Gemfile.lock" }}
- v1-gems-
- &install-gems
run:
name: Bundle install
command: bundle check || bundle install
environment:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
- &store-gems
save_cache:
key: *cache-key
paths:
- vendor/bundle
- &fetch-xcode-logs
run:
name: Getting Xcode activity logs
Expand All @@ -46,16 +32,15 @@ defaults:
path: /tmp/circleci-artifacts


version: 2
version: 2.1
jobs:
lint:
<<: *macos-config
steps:
- *prepare-storage
- checkout
- *restore-gems
- *install-gems
- *store-gems
- bundle-install/bundle-install:
cache_key_prefix: v1-macos
- run:
name: Lint source code
command: bundle exec rake lint:code
Expand All @@ -69,9 +54,8 @@ jobs:
steps:
- *prepare-storage
- checkout
- *restore-gems
- *install-gems
- *store-gems
- bundle-install/bundle-install:
cache_key_prefix: v1-macos
- run:
name: Run all tests
command: bundle exec rake xcode:test
Expand All @@ -85,9 +69,8 @@ jobs:
steps:
- *prepare-storage
- checkout
- *restore-gems
- *install-gems
- *store-gems
- bundle-install/bundle-install:
cache_key_prefix: v1-linux
- run:
name: Run all tests
command: bundle exec rake spm:test
Expand All @@ -98,9 +81,8 @@ jobs:
steps:
- *prepare-storage
- checkout
- *restore-gems
- *install-gems
- *store-gems
- bundle-install/bundle-install:
cache_key_prefix: v1-macos
- run:
name: Run all tests
command: bundle exec rake spm:test
Expand All @@ -111,9 +93,8 @@ jobs:
steps:
- *prepare-storage
- checkout
- *restore-gems
- *install-gems
- *store-gems
- bundle-install/bundle-install:
cache_key_prefix: v1-macos
- run:
name: Download podspec repo
command: curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
Expand All @@ -124,7 +105,6 @@ jobs:


workflows:
version: 2
lint-buildandtest-checkdeploy:
jobs:
- lint
Expand Down
12 changes: 6 additions & 6 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@
"repositoryURL": "https://github.com/kylef/PathKit.git",
"state": {
"branch": null,
"revision": "e2f5be30e4c8f531c9c1e8765aa7b71c0a45d7a0",
"version": "0.9.2"
"revision": "73f8e9dca9b7a3078cb79128217dc8f2e585a511",
"version": "1.0.0"
}
},
{
"package": "Spectre",
"repositoryURL": "https://github.com/kylef/Spectre.git",
"state": {
"branch": null,
"revision": "f14ff47f45642aa5703900980b014c2e9394b6e5",
"version": "0.9.0"
"revision": "f717bbce0e19f0129fc001b2b6bed43b70fd8b87",
"version": "0.9.1"
}
},
{
"package": "Stencil",
"repositoryURL": "https://github.com/stencilproject/Stencil.git",
"state": {
"branch": null,
"revision": "0e9a78d6584e3812cd9c09494d5c7b483e8f533c",
"version": "0.13.1"
"revision": "94197b3adbbf926348ad8765476a158aa4e54f8a",
"version": "0.14.0"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import PackageDescription
let package = Package(
name: "StencilSwiftKit",
products: [
.library(name: "StencilSwiftKit", targets: ["StencilSwiftKit"])
.library(name: "StencilSwiftKit", targets: ["StencilSwiftKit"])
],
dependencies: [
.package(url: "https://github.com/stencilproject/Stencil.git", .upToNextMinor(from: "0.13.0"))
.package(url: "https://github.com/stencilproject/Stencil.git", .upToNextMajor(from: "0.14.0"))
fortmarek marked this conversation as resolved.
Show resolved Hide resolved
],
targets: [
.target(
Expand Down
4 changes: 2 additions & 2 deletions [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import PackageDescription
let package = Package(
name: "StencilSwiftKit",
products: [
.library(name: "StencilSwiftKit", targets: ["StencilSwiftKit"])
.library(name: "StencilSwiftKit", targets: ["StencilSwiftKit"])
],
dependencies: [
.package(url: "https://github.com/stencilproject/Stencil.git", .upToNextMinor(from: "0.13.0"))
.package(url: "https://github.com/stencilproject/Stencil.git", .upToNextMajor(from: "0.14.0"))
],
targets: [
.target(
Expand Down
4 changes: 2 additions & 2 deletions Sources/StencilSwiftKit/CallMacroNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MacroNode: NodeType {
let token: Token?

class func parse(_ parser: TokenParser, token: Token) throws -> NodeType {
let components = token.components()
let components = token.components
guard components.count >= 2 else {
throw TemplateSyntaxError("'macro' tag takes at least one argument, the name of the variable to set.")
}
Expand Down Expand Up @@ -76,7 +76,7 @@ class CallNode: NodeType {
let token: Token?

class func parse(_ parser: TokenParser, token: Token) throws -> NodeType {
let components = token.components()
let components = token.components
guard components.count >= 2 else {
throw TemplateSyntaxError("'call' tag takes at least one argument, the name of the block to call.")
}
Expand Down
1 change: 1 addition & 0 deletions Sources/StencilSwiftKit/Filters+Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ extension Filters.Strings {
/// e.g. "PeoplePicker" gives "peoplePicker" but "URLChooser" gives "urlChooser"
static func lowerFirstWord(_ value: Any?) throws -> Any? {
let string = try Filters.parseString(from: value)
guard !string.isEmpty else { return "" }
let characterSet = CharacterSet.uppercaseLetters
let scalars = string.unicodeScalars
let start = scalars.startIndex
Expand Down
2 changes: 1 addition & 1 deletion Sources/StencilSwiftKit/MapNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MapNode: NodeType {
let token: Token?

class func parse(parser: TokenParser, token: Token) throws -> NodeType {
let components = token.components()
let components = token.components

func hasToken(_ token: String, at index: Int) -> Bool {
return components.indices ~= index + 1 && components[index] == token
Expand Down
2 changes: 1 addition & 1 deletion Sources/StencilSwiftKit/SetNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SetNode: NodeType {
let token: Token?

class func parse(_ parser: TokenParser, token: Token) throws -> NodeType {
let components = token.components()
let components = token.components
guard components.count <= 3 else {
throw TemplateSyntaxError(
"""
Expand Down
8 changes: 4 additions & 4 deletions Tests/StencilSwiftKitTests/MacroNodeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class MacroNodeTests: XCTestCase {

func testContextModification() throws {
let node = MacroNode(variableName: "myFunc", parameters: [], nodes: [TextNode(text: "hello")])
let context = Context(dictionary: [:])
let context = Context(dictionary: ["": ""])
_ = try node.render(context)

guard let block = context["myFunc"] as? CallableBlock else {
Expand All @@ -104,7 +104,7 @@ class MacroNodeTests: XCTestCase {

func testContextModificationWithParameters() throws {
let node = MacroNode(variableName: "myFunc", parameters: ["a", "b", "c"], nodes: [TextNode(text: "hello")])
let context = Context(dictionary: [:])
let context = Context(dictionary: ["":""])
_ = try node.render(context)

guard let block = context["myFunc"] as? CallableBlock else {
Expand All @@ -130,8 +130,8 @@ class MacroNodeTests: XCTestCase {
func testCallableBlockWithFilterExpressionParameter() throws {
let block = CallableBlock(parameters: ["greeting"], nodes: [])

let parser = TokenParser(tokens: [], environment: stencilSwiftEnvironment())
let arguments = try [FilterExpression(token: "greet|uppercase", parser: parser)]
let environment = stencilSwiftEnvironment()
let arguments = try [FilterExpression(token: "greet|uppercase", environment: environment)]
let context = Context(dictionary: ["greet": "hello"])

let result = try block.context(context, arguments: arguments, variable: Variable("myFunc"))
Expand Down
6 changes: 3 additions & 3 deletions Tests/StencilSwiftKitTests/SetNodeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class SetNodeTests: XCTestCase {

func testContextModification() throws {
// start empty
let context = Context(dictionary: [:])
let context = Context(dictionary: ["": ""])
XCTAssertNil(context["a"])
XCTAssertNil(context["b"])
XCTAssertNil(context["c"])
Expand Down Expand Up @@ -272,8 +272,8 @@ class SetNodeTests: XCTestCase {
func testSetWithFilterExpressionParameter() throws {
let context = Context(dictionary: ["greet": "hello"])

let parser = TokenParser(tokens: [], environment: stencilSwiftEnvironment())
let argument = try FilterExpression(token: "greet|uppercase", parser: parser)
let environment = stencilSwiftEnvironment()
let argument = try FilterExpression(token: "greet|uppercase", environment: environment)
let node = SetNode(variableName: "a", content: .reference(resolvable: argument))

_ = try node.render(context)
Expand Down