Permalink
Browse files

adding git-issues

  • Loading branch information...
mlazarov committed Jan 17, 2012
1 parent f49051e commit 97a265599759e09d231262e1503c27bf2b4a1a9f
Showing with 52 additions and 0 deletions.
  1. +52 −0 bin/git-issues
View
@@ -0,0 +1,52 @@
+#!/usr/bin/env node
+
+/**
+ * Dependencies.
+ */
+//var params = require('../lib/params');
+//var argv = require('optimist').options(params).argv;
+
+var fs = require('fs');
+var path = require('path');
+
+var Dispatcher = require('../lib/dispatcher');
+var argv = {_:[], '$0': 'node ./git-issues', reporter: 'basic'};
+var dispatcher = new Dispatcher(argv);
+var error = console.error;
+var file = null;
+
+var location = process.cwd();
+var found = null;
+
+while (!found) {
+ file = location + '/.git/config';
+ if (path.existsSync( file )) {
+ found = file;
+ } else if (location !== '/') {
+ location = path.dirname(location);
+ } else {
+ throw new Error('.git/config can not be located');
+ }
+}
+var data = fs.readFileSync(file,'utf-8');
+
+
+var r = data.match(/url = git:\/\/github.com\/([^\/]+)\/([^\.]+).git/);
+
+argv._[0] = r[1];
+argv._[1] = r[2];
+
+
+
+/**
+ * Handles exceptions.
+ */
+process.on('uncaughtException', function(err) {
+ error(err.message);
+ process.exit(1);
+})
+
+/**
+ * Dispatches the request.
+ */
+dispatcher.run();

0 comments on commit 97a2655

Please sign in to comment.