Skip to content

Commit

Permalink
Sets the plugin scope to plugin's variables. (#2)
Browse files Browse the repository at this point in the history
* Sets the plugin scope to plugin's variables.

* The test was corrected.
  • Loading branch information
victor-shelepen authored and knownasilya committed Apr 26, 2017
1 parent 434fa28 commit f02bff0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions test/worker_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ describe('template worker test example', function () {
};
process.env.strider_server_name = 'http://example.com';
config = {
environment: 'test message',
prepare: 'test message'
template: {
environment: 'test message',
prepare: 'test message'
}
};
//_.each(schema, function(v,k) { config[k] = v.default });
//config.token = 'token';
Expand Down
10 changes: 5 additions & 5 deletions worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ module.exports = {
// or a fn(context, done(err, didrun))

//string style
environment: `echo "${config.environment}"`,
environment: `echo "${config.template.environment}"`,
//object style
prepare: {
command: 'echo',
args: [`"${config.prepare}"`]
args: [`"${config.template.prepare}"`]
},
//function style (calling done is a MUST)
test: function (context, done) {
//this will show up in the terminal log as 'info'
debug(config.test);
debug(config.template.test);

//demonstration of how to perform async tasks, finishing with a call to done()
checkSomething(context, function (shouldDoThings) {
Expand All @@ -66,8 +66,8 @@ module.exports = {
});
});
},
deploy: `echo "${config.deploy}"`,
cleanup: `echo "${config.cleanup}"`
deploy: `echo "${config.template.deploy}"`,
cleanup: `echo "${config.template.cleanup}"`
});
},
// this is only used if there is _no_ plugin configuration for a
Expand Down

0 comments on commit f02bff0

Please sign in to comment.