mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 17:00:04 +02:00
create add
This commit is contained in:
parent
cdd93a99e0
commit
f1c3ff9e72
1 changed files with 17 additions and 5 deletions
|
@ -6,14 +6,26 @@ prompt = require('prompt');
|
|||
|
||||
prompt.start();
|
||||
|
||||
prompt.get(['command'], function(err, result) {
|
||||
prompt.get(['command', 'whatItDoes'], function(err, result) {
|
||||
var headless = new HeadlessGit();
|
||||
headless.sendCommand(result.command);
|
||||
setTimeout(function() {
|
||||
console.log('expectTreeAsync(');
|
||||
console.log(" \t'" + result.command + "',");
|
||||
console.log(" \t'" + headless.gitEngine.printTree() + "'");
|
||||
console.log(');');
|
||||
var testCase = '\texpectTreeAsync(' +
|
||||
"\t\t'" + result.command + "'," +
|
||||
"\t\t'" + headless.gitEngine.printTree() + "'" +
|
||||
"\t);";
|
||||
|
||||
console.log(testCase);
|
||||
// now add it
|
||||
var testFile = fs.readFileSync('./remote.spec.js', 'utf8');
|
||||
// insert after the last })
|
||||
var toSlice = testFile.lastIndexOf('})');
|
||||
var partOne = testFile.slice(0, toSlice);
|
||||
var partTwo = testFile.slice(toSlice);
|
||||
|
||||
var funcCall = "it('" + result.whatItDoes + "', function() {\n" +
|
||||
testCase + "\n});";
|
||||
fs.writeFileSync('./remote.spec.js', partOne + funcCall + partTwo);
|
||||
}, 100);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue