VersionUtils
A set of utilities to work with the version of the project.
Constructor Summary
| Public Constructor | ||
| public |
constructor(environmentUtils: EnvironmentUtils, appLogger: Logger, pathUtils: PathUtils) Class constructor. |
|
Member Summary
| Public Members | ||
| public |
A local reference for the |
|
| public |
A local reference for the |
|
| public |
The default fallback version in case none can be retrieved. |
|
| public |
A local reference for the |
|
Method Summary
| Public Methods | ||
| public |
Create the revision file with either the version from the environment or, if the project is
on a GIT repository, with the first |
|
| public |
getEnvironmentVersion(environmentVariable: string, withFallback: boolean): string Get the version from an environment variable. |
|
| public |
getVersion(revisionFilename: string, environmentVariable: string): string Look for a version on both the revision file and the environment variable. |
|
| public |
getVersionFromFile(filename: string): string Get the version from the revision file. |
|
Public Constructors
public constructor(environmentUtils: EnvironmentUtils, appLogger: Logger, pathUtils: PathUtils) source
Class constructor.
Params:
| Name | Type | Attribute | Description |
| environmentUtils | EnvironmentUtils | To read the environment variables. |
|
| appLogger | Logger | To inform the user if something goes wrong. |
|
| pathUtils | PathUtils | To build paths for the revision file. |
Public Members
public environmentUtils: EnvironmentUtils source
A local reference for the environmentUtils service.
Public Methods
public createRevisionFile(revisionFilename: string, environmentVariable: string): Promise<string, Error> source
Create the revision file with either the version from the environment or, if the project is
on a GIT repository, with the first 7 letters of the last commit hash.
public getEnvironmentVersion(environmentVariable: string, withFallback: boolean): string source
Get the version from an environment variable.
