mantra/.gulp/Settings.ts

164 lines
3.3 KiB
TypeScript
Raw Normal View History

2019-10-07 11:48:01 +00:00
import Path = require("upath");
/**
* Provides settings for building the project.
*/
export class Settings
{
/**
* A value indicating whether the project should be built in watched mode.
*/
public Watch = false;
/**
* The target of the project-build.
*/
public Target: string;
/**
* The path to the source-code root.
*/
private sourceRoot = "src";
/**
* The path to the root of the typescript-project.
*/
private typeScriptProjectRoot = "App";
/**
* The path to the root of the typescript-source.
*/
private typeScriptSourceRoot = "src";
/**
* The path to save the javascript-code to.
*/
private libraryPath = "javascript";
2019-10-07 15:50:06 +00:00
/**
* The path to the test-directory.
*/
private testPath = "test";
/**
* The path to the test-website.
*/
private testWebsitePath = "website";
2019-10-07 11:48:01 +00:00
/**
* Initializes a new instance of the `Settings` class.
*
* @param target
* The target of the project-build.
*/
public constructor(target: string)
{
this.Target = target;
}
/**
* A value indicating whether the debug-mode is enabled.
*/
public get Debug()
{
return this.Target === "Debug";
}
/**
* Creates a path relative to the root of the solution.
*
* @param path
* The path to join.
*
* @return
* The joined path.
*/
public RootPath(...path: string[])
{
return Path.join(Path.dirname(__dirname), ...path);
}
/**
* Creates a path relative to the root of the source-code.
*
* @param path
* The path to join.
*
* @returns
* The joined path.
*/
public SourceRoot(...path: string[])
{
return this.RootPath(this.sourceRoot, ...path);
}
/**
* Creates a path relative to the root of the typescript-project.
*
* @param path
* The path to join.
*
* @returns
* The joined path.
*/
public TypeScriptProjectRoot(...path: string[])
{
return this.SourceRoot(this.typeScriptProjectRoot, ...path);
}
/**
* Creates a path relative to the root of the typescript-source.
*
* @param path
* The path to join.
*
* @returns
* The joined path.
*/
public TypeScriptSourceRoot(...path: string[])
{
return this.TypeScriptProjectRoot(this.typeScriptSourceRoot, ...path);
}
/**
* Creates a path relative to the directory to save the javascript-code to.
*
* @param path
* The path to join.
*
* @returns
* The joined path.
*/
public LibraryPath(...path: string[])
{
return this.RootPath(this.libraryPath, ...path);
}
2019-10-07 15:50:06 +00:00
/**
* Creates a path relative to the test-directory.
*
* @param path
* The path to join.
*
* @returns
* The joined path.
*/
public TestPath(...path: string[])
{
return this.RootPath(this.testPath, ...path);
}
/**
* Creates a path relative to the test-website.
*
* @param path
* The path to join.
*
* @returns
* The joined path.
*/
public TestWebsitePath(...path: string[])
{
return this.TestPath(this.testWebsitePath, ...path);
}
2019-10-07 11:48:01 +00:00
}