UNPKG

@atomist/rug

Version:

TypeScript model for Atomist Rugs, see http://docs.atomist.com/

101 lines (88 loc) 2.87 kB
/* * Copyright 2015-2017 Atomist Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { TreeNode, GraphNode, FormatInfo, PathExpressionEngine } from "@atomist/rug/tree/PathExpression"; import { ProjectContext } from "@atomist/rug/operations/ProjectEditor"; import { File } from "./File"; import { Project } from "./Project"; export { ProjectView }; /** * ProjectView */ interface ProjectView { /** * Return a new Project View based on the original backing object (normally the .atomist/ directory) * * @returns {Project} */ backingArchiveProject(): Project; /** * Provides access additional context, such as the PathExpressionEngine * * @property {ProjectContext} context */ readonly context: ProjectContext; /** * The number of files directly in this directory * * @param path {string} The path to use * @returns {number} */ countFilesInDirectory(path: string): number; /** * Does a file with the given path exist and have the expected content? * * @param path {string} The path to use * @param content {string} The content to check * @returns {boolean} */ fileContains(path: string, content: string): boolean; /** * The total number of files in this project * * @property {number} fileCount */ readonly fileCount: number; /** * Does a file with the given path exist and have the expected content? * * @param path {string} The path to use * @param content {string} The content to check against the given file * @returns {boolean} */ fileHasContent(path: string, content: string): boolean; /** * Files in this archive * * @property {File[]} files */ readonly files: File[]; /** * Return the name of the project. If it's in GitHub, it will be the repo name. If it's on the local filesystem it will be the directory name * * @property {string} name */ readonly name: string; /** * Return the path expression to this point in the given file * * @param arg0 {string} * @param arg1 {string} * @param arg2 {number} * @param arg3 {number} * @returns {string} */ pathTo(arg0: string, arg1: string, arg2: number, arg3: number): string; }