Home Reference Source
public class | source

Targets

This service is in charge of providing and validating the targets stored on the runner file.

Constructor Summary

Public Constructor
public

constructor(packageInfo: Object, pathUtils: PathUtils, projextPlugin: ProjextPlugin, runnerFile: RunnerFile)

Class constructor.

Member Summary

Public Members
public

The information of the project's package.json.

public

A local reference for the pathUtils service.

public

A local reference for the projextPlugin service.

public

A local reference for the runnerFile service.

Method Summary

Public Methods
public

Returns the target with the name of project (specified on the package.json) and if there's no target with that name, then the first one, using a list of the targets name on alphabetical order.

public

Get a target information by its name.

public

Validate a target information.

Private Methods
private

Add the execution path (exec) to a Target.

Public Constructors

public constructor(packageInfo: Object, pathUtils: PathUtils, projextPlugin: ProjextPlugin, runnerFile: RunnerFile) source

Class constructor.

Params:

NameTypeAttributeDescription
packageInfo Object

The project's package.json, necessary to get the project's name and use it as the name of the default target.

pathUtils PathUtils

To create the targets exeuction paths.

projextPlugin ProjextPlugin

To check if projext is present or not.

runnerFile RunnerFile

To get the targets information.

Public Members

public packageInfo: Object source

The information of the project's package.json.

public pathUtils: PathUtils source

A local reference for the pathUtils service.

public projextPlugin: ProjextPlugin source

A local reference for the projextPlugin service.

public runnerFile: RunnerFile source

A local reference for the runnerFile service.

Public Methods

public getDefaultTarget(): Target source

Returns the target with the name of project (specified on the package.json) and if there's no target with that name, then the first one, using a list of the targets name on alphabetical order.

Return:

Target

Throw:

Error

If the project has no targets

public getTarget(name: string): Target source

Get a target information by its name.

Params:

NameTypeAttributeDescription
name string

The target name.

Return:

Target

Throw:

Error

If the target information is not on the runner file.

public validate(name: string): boolean source

Validate a target information.

Params:

NameTypeAttributeDescription
name string
  • nullable: true

The target name.

Return:

boolean

Throw:

Error

If the runner file doesn't exist.

Error

If the target executable doesn't exist.

Private Methods

private _normalizeTarget(target: Target): Target source

Add the execution path (exec) to a Target.

Params:

NameTypeAttributeDescription
target Target

The target for which the execution path will be generated for.

Return:

Target