Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run git-standup directly to avoid platform issues #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions care.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,15 @@ function doTheCodes() {
var todayCommits = 0;
var weekCommits = 0;

var today = spawn('sh ' + __dirname + '/standup-helper.sh', [config.repos], {shell:true});
todayBox.content = '';
today.stdout.on('data', data => {
collectRepositoryLogs(config.repos, ['-d 1'], (data) => {
todayCommits = getCommits(`${data}`, todayBox);
updateCommitsGraph(todayCommits, weekCommits);
screen.render();
});

var week = spawn('sh ' + __dirname + '/standup-helper.sh', ['-d 7', config.repos], {shell:true});
weekBox.content = '';
week.stdout.on('data', data => {
collectRepositoryLogs(config.repos, ['-d 7'], (data) => {
weekCommits = getCommits(`${data}`, weekBox);
updateCommitsGraph(todayCommits, weekCommits);
screen.render();
Expand Down Expand Up @@ -142,6 +140,23 @@ function makeScrollBox(label) {
return options;
}

function collectRepositoryLogs(search_paths, args, handler) {
var n = search_paths.length;
var output = '';
for (var search_path of search_paths) {
var proc = spawn(__dirname + '/node_modules/git-standup/git-standup', args, {shell: true, cwd: search_path});
proc.stdout.on('data', (data) => {
output += data;
});
proc.once('exit', () => {
--n;
if (n == 0) {
handler(output);
}
});
}
}

var commitRegex = /(.......) (- .*)/g;
function getCommits(data, box) {
var content = colorizeLog(data);
Expand Down
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ config.apiKeys = config.apiKeys === 'true' ? true : false;

// Directories in which to run git-standup on for a list of your recent commits.
config.repos = process.env.TTC_REPOS || '~/Code';
config.repos = config.repos.split(',').join(' ');
config.repos = config.repos.split(',');

// Where to check the weather for. This can be a zip code or a location name
// So both 90210 and "San Francisco, CA" should be ok.
Expand Down
36 changes: 0 additions & 36 deletions standup-helper.sh

This file was deleted.