Add custom template for testing stencil filters

This commit is contained in:
Vendula Švastalová 2020-11-03 20:00:07 +01:00
parent d45a8ed757
commit b75ba22c60
3 changed files with 29 additions and 0 deletions

View File

@ -18,4 +18,11 @@ Feature: Scaffold a project using Tuist
"""
// Generated file with platform: ios and name: TemplateProject
"""
Then tuist scaffolds a custom_using_filters template to TemplateProject named TemplateProject
Then content of a file named TemplateProject/custom.swift in a directory TemplateProject should be equal to // this is test TemplateProject content
Then content of a file named TemplateProject/generated.swift in a directory TemplateProject should be equal to:
"""
// Generated file with platform: iOS and snake case name: template_project
"""

View File

@ -0,0 +1,21 @@
import ProjectDescription
let nameAttributeThree: Template.Attribute = .required("name")
let platformAttributeThree: Template.Attribute = .optional("platform", default: "IOS")
let testContentsThree = """
// this is test \(nameAttributeThree) content
"""
let templateThree = Template(
description: "Custom template",
attributes: [
nameAttributeThree,
platformAttributeThree
],
files: [
.string(path: "\(nameAttributeThree)/custom.swift", contents: testContentsThree),
.file(path: "\(nameAttributeThree)/generated.swift", templatePath: "filters.stencil"),
]
)

View File

@ -0,0 +1 @@
// Generated file with platform: {{ platform|lowerFirstLetter }} and snake case name: {{ name|camelToSnakeCase }}