|
|
@@ -0,0 +1,40 @@
|
|
|
+const path = require('path');
|
|
|
+const execAsync = require('./execAsync');
|
|
|
+const appRoot = path.normalize(__dirname + '/..');
|
|
|
+const isTesting = process.env.NODE_ENV === 'testing';
|
|
|
+const examplesDir = ! isTesting ? appRoot + '/exemples' :
|
|
|
+ appRoot + '/test/integration/test-examples';
|
|
|
+
|
|
|
+// Promisified exec of git mv src dst
|
|
|
+function gitStatusAsync(src, dst) {
|
|
|
+ var cmd = 'git status ' + examplesDir;
|
|
|
+ return execAsync(cmd)
|
|
|
+ // .then(({ stdout, stderr }) => {
|
|
|
+ // // console.log(`stdout: ${stdout}`);
|
|
|
+ // // console.log(`stderr: ${stderr}`);
|
|
|
+ // })
|
|
|
+ .catch(error => {
|
|
|
+ console.error(`exec error: ${error}`);
|
|
|
+ throw error;
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function getUntrackedReposAndExamples() {
|
|
|
+ gitStatusAsync()
|
|
|
+ .then(({ stdout }) => {
|
|
|
+ let idx = stdout.indexOf('Untracked files:');
|
|
|
+ const output = stdout.substr(idx);
|
|
|
+ let lines = output.split('\n');
|
|
|
+
|
|
|
+ lines.splice(0, 3);
|
|
|
+ idx = 0;
|
|
|
+ while(lines[idx]) idx++;
|
|
|
+ lines.splice(idx, lines.length - idx);
|
|
|
+ lines.forEach((line, i) => {
|
|
|
+ lines[i] = line.trim();
|
|
|
+ });
|
|
|
+ console.log(lines);
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+getUntrackedReposAndExamples()
|