Skip to content

Commit

Permalink
workflows are now immutable
Browse files Browse the repository at this point in the history
  • Loading branch information
deecewan committed Jun 24, 2018
1 parent 63614be commit 34d991a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,26 @@ export default class Config {
place: string = path.resolve(Config.CONFIG_LOCATION);
workflows: Array<Workflow> = [];

clone() {
const item = new this.constructor();
item.place = this.place;
item.workflows = this.workflows;

return item;
}

workflow(workflow: Workflow) {
this.workflows.push(workflow);
const item = this.clone();
item.workflows.push(workflow);

return this;
return item;
}

location(directory: string = __dirname) {
this.place = path.resolve(directory, this.constructor.CONFIG_LOCATION);
const item = this.clone();
item.place = path.resolve(directory, item.constructor.CONFIG_LOCATION);

return this;
return item;
}

compose() {
Expand Down

0 comments on commit 34d991a

Please sign in to comment.