本文整理匯總了TypeScript中@atomist/rug/model/Project.Project類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Project類的具體用法?TypeScript Project怎麽用?TypeScript Project使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Project類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: cleanChangeLog
export function cleanChangeLog(project: Project, owner: string): void {
const changeLog: File = project.findFile("CHANGELOG.md");
const middleContentRE = "\\d+\\.\\d+\\.\\d+\\.\\.\\.HEAD\n\n[\\S\\s]*## \\[0\\.1\\.0\\]";
changeLog.regexpReplace(middleContentRE, "0.1.0...HEAD\n\n## [0.1.0]");
changeLog.regexpReplace("\n### Added[\\S\\s]*", "\nAdded\n\n- Everything\n");
changeLog.replace("spring-rugs", project.name);
changeLog.replace("atomist-rugs", owner);
}
示例2: cleanReadMe
export function cleanReadMe(project: Project, description: string, owner: string): void {
const readMe: File = project.findFile("README.md");
readMe.regexpReplace("^# Atomist 'spring-rugs'[\\S\\s]*\n## Spring Boot REST Service\n",
`# ${project.name}
This project contains a [Spring Boot][boot] [REST][rest] service for ${description}.
`);
}
示例3: renameClass
export function renameClass(project: Project, oldClass: string, newClass: string): void {
const eng: PathExpressionEngine = project.context.pathExpressionEngine;
eng.with<JavaType>(project, `//JavaType()`, j => {
if (j.name.indexOf(oldClass) >= 0) {
j.renameByReplace(oldClass, newClass);
}
});
project.replace(oldClass, newClass);
}
示例4: Then
Then("file at ([^\\s]+) should not exist", (p: Project, world: ProjectScenarioWorld, path: string) => {
return !p.fileExists(path);
});
示例5:
toDelete.forEach(f => project.deleteFile(f));