1 | const exec = require('mz/child_process').exec;
|
2 |
|
3 | const commit = exec('git rev-list --all --count').then((stdout) => parseInt(stdout.join('').toString()));
|
4 | const date = exec('git log -1 --format=%at').then((stdout) => parseInt(stdout.join('').toString()));
|
5 | const branch = exec('git rev-parse --abbrev-ref HEAD').then((stdout) => stdout.join('').toString().trim());
|
6 | const repo = exec('git config remote.origin.url').then((stdout) => {
|
7 | const data = stdout.join('').toString().split('/');
|
8 | let repo = data[data.length - 1].trim();
|
9 | const remove = '.git';
|
10 | if (repo.toLowerCase().endsWith(remove)) {
|
11 | repo = repo.substr(0, repo.length - remove.length);
|
12 | }
|
13 | return repo;
|
14 | });
|
15 |
|
16 | const settings = {
|
17 | "branch": branch,
|
18 | "date": date,
|
19 | "commit": commit,
|
20 | "repo": repo
|
21 | };
|
22 |
|
23 |
|
24 | module.exports = settings;
|
25 |
|