From 3d11cdce44711d5f0af56d058689706a2e4ed579 Mon Sep 17 00:00:00 2001 From: Bart van Andel Date: Fri, 2 Dec 2016 12:06:17 +0100 Subject: [PATCH] Setup npm package --- .gitignore | 2 ++ README.md | 3 +++ gitinspector.js | 29 ++++++++++++++++++++++++ package.json | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+) create mode 100644 gitinspector.js create mode 100644 package.json diff --git a/.gitignore b/.gitignore index eeca378..b6f142c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,7 @@ build debian deb_dist dist +node_modules *.egg-info *.pyc +*.tgz diff --git a/README.md b/README.md index 9f93b05..65e1946 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Below are some example outputs for a number of famous open source projects. All ### The Team * Adam Waldenberg, Lead maintainer and Swedish translation * Agustín Cañas, Spanish translation + * Bart van Andel, npm package maintainer * Bill Wang, Chinese translation * Christian Kastner, Debian package maintainer * Jiwon Kim, Korean translation @@ -49,5 +50,7 @@ Below are some example outputs for a number of famous open source projects. All ### Packages The Debian packages offered with releases of gitinspector are unofficial and very simple packages generated with [stdeb](https://github.com/astraw/stdeb). Christian Kastner is maintaining the official Debian packages. You can check the current status on the [Debian Package Tracker](https://tracker.debian.org/pkg/gitinspector). Consequently, there are official packages for many Debian based distributions installable via *apt-get*. +An [npm](https://npmjs.com) package is provided for convenience as well. To install it globally, execute `npm i -g gitinspector`. + ### License gitinspector is licensed under the *GNU GPL v3*. The gitinspector logo is partly based on the git logo; based on the work of Jason Long. The logo is licensed under the *Creative Commons Attribution 3.0 Unported License*. diff --git a/gitinspector.js b/gitinspector.js new file mode 100644 index 0000000..b27ac00 --- /dev/null +++ b/gitinspector.js @@ -0,0 +1,29 @@ +var PythonShell = require('python-shell'); + +var options = { + // The main python script is in the same directory as this file + scriptPath: __dirname, + + // Get command line arguments, skipping the default node args: + // arg0 == node executable, arg1 == this file + args: process.argv.slice(2) +}; + + +// Set encoding used by stdin etc manually. Without this, gitinspector may fail to run. +process.env.PYTHONIOENCODING = 'utf8'; + +// Start inspector +var inspector = new PythonShell('gitinspector.py', options); + +// Handle stdout +inspector.on('message', function(message) { + console.log(message); +}); + +// Let the inspector run, catching any error at the end +inspector.end(function (err) { + if (err) { + throw err; + } +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..dbd7efc --- /dev/null +++ b/package.json @@ -0,0 +1,59 @@ +{ + "name": "gitinspector", + "version": "0.5.0-dev", + "description": "Gitinspector is a statistical analysis tool for git repositories. The default analysis shows general statistics per author, which can be complemented with a timeline analysis that shows the workload and activity of each author. Under normal operation, it filters the results to only show statistics about a number of given extensions and by default only includes source files in the statistical analysis.", + "main": "gitinspector.py", + "directories": { + "doc": "docs", + "test": "tests" + }, + "scripts": { + "clean": "rimraf **/*.pyc", + "prepublish": "npm run clean", + "release": "with-package git commit -am pkg.version && with-package git tag pkg.version && git push && npm publish && git push --tags", + "release:beta": "npm run release && npm run tag:beta", + "tag:beta": "with-package npm dist-tag add pkg.name@pkg.version beta", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "bin": { + "gitinspector": "gitinspector.py" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ejwa/gitinspector.git" + }, + "keywords": [ + "git", + "statistics", + "stats" + ], + "author": { + "name": "Adam Waldenberg", + "email": "adam.waldenberg@ejwa.se", + "url": "https://github.com/adam-waldenberg" + }, + "contributors": [ + "Agustín Cañas", + "Bart van Andel ", + "Bill Wang", + "Christian Kastner", + "Jiwon Kim", + "Kamila Chyla", + "Luca Motta", + "Philipp Nowak", + "Sergei Lomakov", + "Yannick Moy" + ], + "license": "GPL-3.0", + "bugs": { + "url": "https://github.com/ejwa/gitinspector/issues" + }, + "homepage": "https://github.com/ejwa/gitinspector#readme", + "devDependencies": { + "rimraf": "^2.5.4", + "with-package": "^0.2.0" + }, + "dependencies": { + "python-shell": "^0.4.0" + } +}