Utils class
Common utility functions shared by all tasks and commands
Constructors
- Utils()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- isInDocker → bool
-
Indicates whether or not this process is running in our docker image
no setter
-
relativePathRoots
→ Map<
KnownPaths, String> -
A map of expected KnownPaths relative to a workspace.
final
Static Methods
-
chmod(
String perms, String filePath, [String? workingDir]) → bool -
Runs a
chmodcommand against thefilePathin theworkingDirusing the providedperms -
deleteIfExists(
String entityPath) → bool -
Deletes a FileSystemEntity by
entityPath, only if it exists. IfentityPathis a directory, it is deleted recursively. Returnstrueif theentityPathdoesn't exist or was deleted, otherwisefalse. -
dockerImageExists(
String name) → bool -
Indicates whether or not a docker image exists by
name -
findFiles(
{String? subPath, String? rootDir, RegExp? matcher}) → Stream< File> -
An async Stream of File instances found responsive to the
matcherwithin therootDir/subPathlocation on the file system. THerootDirwill default to Directory.current if not provided -
getCPUArch(
) → CpuArch - Checks the OS-reported CPU architecture and returns the appropriate internal CpuArch value.
-
getFinalDir(
String dirPath) → String -
Returns the result of
path.normalize, as an absolute path from Directory.current. -
getGitHash(
[String? dirPath]) → String? -
Gets the git hash from
dirPath, if it's a repo, otherwisenull. -
getIaCValue(
String targetDir, String key) → String? -
Gets the value of
keyfrom theiac.jsonfile in thetargetDir. -
getPubSpecValue(
String targetDir, String key) → String? -
Gets the value of
keyfrom thepubspec.yamlfile in thetargetDir. -
getTempPath(
[String prefix = 'endaft']) → String - Creates a temporary Directory under the system temporary directory and returns the absolute path to it.
-
handleProcessResult(
ProcessResult result, Logger logger, [String indent = '', ProcessFinalizer? finalizer, String message = '']) → bool - Handles the child process results and outputs
-
installCommand(
String command) → bool -
Checks if
commandis executable on this system. -
isCommand(
String command) → bool -
Checks if
commandis executable on this system. -
pathFromRoot(
KnownPaths type, [String? rootDir, bool create = true]) → String -
Gets a path from within the
rootDirfor the specifiedtype, this will optionallycreatethe directory if it doesn't already exist. -
readFile<
T> ({required File file, required FileParser< T> parser}) → T -
Attempts to read a File from the specified
filePath, and parse it with the specifiedparser. Common FileParser implementations are available from FileParsers. If the file doesn't exist, throws a FileSystemException -
readFilePath<
T> ({required String filePath, required FileParser< T> parser}) → T -
Attempts to read a File from the specified
filePath, and parse it with the specifiedparser. Common FileParser implementations are available from FileParsers. If the file doesn't exist, throws a FileSystemException -
readSchemaFile(
String filePath, [FileCreator? creator]) → JsonSchema -
Reads the file at
filePathas aJsonSchema -
toolPath(
String command) → String? -
Get the full path to
commandon this system, or null if thecommandis not available.