├── .gitignore ├── .npmignore ├── README.md ├── index.html ├── index.js ├── package.json └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | screenshot.png 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Visualize the commits to a repo. 3 | 4 | ## Installation 5 | 6 | npm install show-commits -g 7 | 8 | ## To run 9 | 10 | cd into a git directory. 11 | 12 | cd /Users/victorpowell/Documents/projects/show-commits 13 | 14 | run show-commits 15 | 16 | show-commits 17 | 18 | This will open a Chrome window in "app" mode (no toolbars and what not.) 19 | 20 | When you're done, just quit the App or kill the process with `ctrl-c` (SIGINT) from the command line. 21 | 22 |  -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 79 | 80 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node 2 | 'use strict'; 3 | var child = require('child_process'); 4 | var mkdirp = require('mkdirp'); 5 | var path = require('path'); 6 | var express = require('express'); 7 | var spawnCommand = require('spawn-command'); 8 | var app = express(); 9 | var port = 1454; 10 | 11 | var GOOGLE_CHROME_PATH = null; 12 | 13 | if (process.platform == "darwin") { 14 | GOOGLE_CHROME_PATH = '/Applications/Google\ Chrome.app\ 15 | /Contents/MacOS/Google\ Chrome'; 16 | GOOGLE_CHROME_PATH = GOOGLE_CHROME_PATH.replace(/\ /g, '\\ '); 17 | } else if (process.platform == "linux") { 18 | GOOGLE_CHROME_PATH = '/usr/bin/google-chrome'; 19 | } else { 20 | console.log("Unsupported OS. show-commits only runs on OSX and Linux"); 21 | process.exit(1); 22 | } 23 | 24 | app.use(express.static(__dirname)); 25 | 26 | var tmpPath = process.env.TMPDIR 27 | if (!tmpPath) { 28 | console.log("Unable to detect TMPDIR. Please set your own TMPDIR e.g.\n") 29 | console.log(" TMPDIR=/tmp show-commits\n") 30 | process.exit(1); 31 | } 32 | 33 | var tmpDir = path.join(process.env.TMPDIR, 'show-commits'); 34 | 35 | mkdirp.sync(tmpDir); 36 | 37 | var cmd = 'git log --format=format:"%cn,%ct" --no-merges'; 38 | var output = child.exec(cmd, { 39 | cwd: process.cwd() 40 | }, function(err, stdout, stderr) { 41 | if (err) throw err; 42 | var commits = 'author,timestamp\n' + stdout; 43 | // console.log('commits', commits); 44 | app.get('/commits.csv', function (req, res) { 45 | res.send(commits); 46 | console.log('sending commits'); 47 | }); 48 | var server = app.listen(port, function () { 49 | var host = 'localhost'; 50 | var port = server.address().port; 51 | var cmd = GOOGLE_CHROME_PATH + ' \ 52 | --user-data-dir=' + tmpDir + ' \ 53 | --force-app-mode \ 54 | --kiosk \ 55 | --app=http://' + host + ':' + port + '/'; 56 | console.log(cmd); 57 | var child = spawnCommand(cmd); 58 | child.stdout.on('data', function (data) { 59 | console.log(data.toString()); 60 | }); 61 | child.stderr.on('data', function (data) { 62 | console.log(data.toString()); 63 | }); 64 | child.on('exit', function() { 65 | process.exit(); 66 | }); 67 | }); 68 | }); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "show-commits", 3 | "version": "0.2.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git://github.com/vicapow/show-commits.git" 12 | }, 13 | "preferGlobal": "true", 14 | "bin": { 15 | "show-commits": "index.js" 16 | }, 17 | "author": "Victor Powell", 18 | "license": "ISC", 19 | "dependencies": { 20 | "d3": "^3.5.6", 21 | "express": "^4.13.1", 22 | "mkdirp": "^0.5.1", 23 | "spawn-command": "0.0.2-1" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vicapow/show-commits/8c70de45d44e49872261ad370aacae86b361670c/screenshot.png --------------------------------------------------------------------------------