Home Reference Source
public class | source

Runner

This service is the one that knows how to run a target, so it's in charge of generating the shell commands for it.

Constructor Summary

Public Constructor
public

constructor(pathUtils: PathUtils, projextPlugin: ProjextPlugin, runnerFile: RunnerFile, targets: Targets)

Class constructor.

Member Summary

Public Members
public

A local reference for the pathUtils service.

public

A local reference for the projextPlugin service.

public

A local reference for the runnerFile service.

public

A local reference for the targets service.

Method Summary

Public Methods
public

getCommands(targetName: string, production: boolean, inspect: boolean, runAsPluginCommand: string): string

Get the shell execution commands for running a target.

public

Get the list of commands to run a target without projext present.

public

getCommandsForProjext(targetName: string, production: boolean, inspect: boolean, runAsPluginCommand: string): Array

Get the list of comands to run a target with projext.

public

Get a set of environment variables that will be sent to the executables.

public

Get the commands to run a target production build.

Public Constructors

public constructor(pathUtils: PathUtils, projextPlugin: ProjextPlugin, runnerFile: RunnerFile, targets: Targets) source

Class constructor.

Params:

NameTypeAttributeDescription
pathUtils PathUtils

To create the path for the targets executables.

projextPlugin ProjextPlugin

To check if projext is present or not and to generated the targets build commands.

runnerFile RunnerFile

To read the required information to run targets.

targets Targets

To get the targets information.

Public Members

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 targets: Targets source

A local reference for the targets service.

Public Methods

public getCommands(targetName: string, production: boolean, inspect: boolean, runAsPluginCommand: string): string source

Get the shell execution commands for running a target.

Params:

NameTypeAttributeDescription
targetName string
  • nullable: true

The name of the target to run.

production boolean

In case projext is present, this flag forces the runner to build the target for production and run that build.

inspect boolean

Whether or not to enable the Node inspector.

runAsPluginCommand string

In case production is true, the plugin will first run a build command in order to update the runner file with the latest information and then it will run this command, to inform the plugin that the build is ready and that just needs to execute it.

Return:

string

public getCommandsForProduction(target: Target): Array source

Get the list of commands to run a target without projext present.

Params:

NameTypeAttributeDescription
target Target

The target information.

Return:

Array

public getCommandsForProjext(targetName: string, production: boolean, inspect: boolean, runAsPluginCommand: string): Array source

Get the list of comands to run a target with projext.

Params:

NameTypeAttributeDescription
targetName string
  • nullable: true

The name of the target to run.

production boolean

Forces projext to use the production build.

inspect boolean

Whether or not to enable the Node inspector.

runAsPluginCommand string

In case production is true, the plugin will first run a build command in order to update the runner file with the latest information and then it will run this command, to inform the plugin that the build is ready and that just needs to execute it.

Return:

Array

public getEnvironmentVariables(runnerFileContents: RunnerFileContents): string source

Get a set of environment variables that will be sent to the executables. For now is just the version of the project.

Params:

NameTypeAttributeDescription
runnerFileContents RunnerFileContents

The contents of the runner file.

Return:

string

TODO:

  • Refactor this. The variables should be configurable.

public getPluginCommandsForProduction(targetName: string): string source

Get the commands to run a target production build. This needs to be called after a build is made.

Params:

NameTypeAttributeDescription
targetName string
  • nullable: true

The name of the target to run.

Return:

string