Rewrite for yeoman-generator 0.17.x

I'd move this write to the “writeIndex“ method.

Less `this` abuse is always best.