yeoman/generator — pull request #251 by stephenplusplus (2013-05-21 21:40:48+00:00)
Title: Added a callback to `installDependencies`

I thought it would be helpful to add a callback after any installed dependencies finish processing. Currently when installing Bower & NPM deps, `this.installDependencies()` launches two concurrent processes. I added an object to track how many commands will execute, and after the last command is finished processing, it calls the callback passed into `this.installDependencies`.

My use case...

(If there is already a way to do this, let me know! :smile:)

I wanted to log out a message on how to use the generator after the dependencies were installed.

```js
var WeblogGenerator = module.exports = function WeblogGenerator(args, options, config) {
yeoman.generators.Base.apply(this, arguments);

this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '../package.json')));

this.on('end', function () {
var howTo
= '\n'
+ '\nSweet!'.yellow + ' You now have a very pretty blog!'
+ '\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-'.red
+ '\n'
+ '\n To create a new post, run:'
+ '\n'
+ '\n yo weblog:post'.cyan
+ '\n'
+ '\n To see your changes as you make them, kick up a server:'
+ '\n'
+ '\n grunt server'.cyan
+ '\n'
+ '\n When you\'re ready to publish your blog, run:'
+ '\n'
+ '\n grunt build'.cyan;

this.installDependencies({
callback: function (res) {
if (!res) {
return;
}

console.log(howTo);
}
});
});
```

I also added in support for simply passing the callback to `installDependencies`:

```js
this.installDependencies(function (res) {
if (!res) {
return;
}

console.log(howTo);
});
```

If I did anything silly, please let me know!