Skip to content

Commit

Permalink
Merge pull request #67 from radify/fix-generator
Browse files Browse the repository at this point in the history
Fixes broken code in Generator.js
  • Loading branch information
gavD committed Dec 10, 2015
2 parents b10ccf7 + f820775 commit 0cf9ac7
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions lib/Generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
var fs = require('fs');
var Q = require('q');
var mkdirp = require('mkdirp');
// create promise versions of read and write files
var read = Q.denodeify(fs.readFile);
var write = Q.denodeify(fs.writeFile);

module.exports = {
generate: function(answers) {

// create promise versions of read and write files, chmod, and mkdirp
var read = Q.denodeify(fs.readFile);
var write = Q.denodeify(fs.writeFile);
// create promise versions of chmod and mkdirp
var chmod = Q.denodeify(fs.chmod);
var mkdir = Q.denodeify(mkdirp);

Expand All @@ -36,19 +37,19 @@
fs.chmod('ansible/inventory/ec2.py', '0755');
})
.catch(handler);

/**
* Render a template by injecting answers into it
*
* @param {String} template
* @returns {String} rendered template
*/
function render(template) {
return mustache.render(template, answers);
}
}
};

/**
* Render a template by injecting answers into it
*
* @param {String} template
* @returns {String} rendered template
*/
function render(template) {
return mustache.render(template, answers);
}

/**
* Partial application - creates a function which allows reading and returns a promise
*
Expand Down

0 comments on commit 0cf9ac7

Please sign in to comment.