Plugins: context

context plugin

Context is one of the main concept in piscosour, the contexts define where and when pisco can be executed.

This plugin provides:

  1. check() hook
  2. ctxIs() addon
  3. ctxWhoami() addon

1. Hook: check()

Check one shot is executed in the root of any repository type.

If the working directory where pisco is executed detects one or more contexts, then will show the following message:

Context checked: Execution contexts: [ documentation, recipe, develop ]

If not, then:

This is not the root of a [ documentation, recipe, develop ]

There is two special corner case:

2. Addon: ctxIs()

Use this.ctxIs to test if pisco is executed over a specific context and returns a boolean.

Param Type Optional Description
name String No name of the context to test

Example:

run: function() {
  let isComponent = this.ctxIs("component");
}

Then, isComponent is true if your recipe was executed in the root of a component.

3. Addon: ctxWhoami()

Returns the list of contexts where recipe is executed.

It has no parameters.

Example:

run: function() {
  let repos = this.ctxWhoami();
}

THen repos is an Array of context strings that match the place where the recipe is executed.