Introducing gister
A nodejs module for programmatic access to create, edit and retrieve gists from github.
There are quite a few gist libraries available from npm. Most were CLI apps to create new gists, others didn’t exactly meet my needs. So I set out to create gister which provides what I think is a simple API. It follows the observer pattern and uses request to talk to GitHub.
Read the annotated source or check out the code.
Using it is really simple. Here’s how you retrieve a gist with gist_id = 1:
var gist = new Gist({ gist_id: 1 });
gist.on('get', function (data) {
// do something with data
});
gist.get();
Creating a new gist is similar, although you’ll need to provide Gist with your GitHub username and Secret API Token which can be found in your Account Settings
var gist = new Gist({ username: 'goatslacker', token: 'abc123' });
gist.on('created', function (data, gist_id) {
// gist_id is the newly created gist id
// data is what github returns in it's reply
});
gist.create();
Available on npm. Install:
npm install gister
Adding node.js project that uses git-submodules to travis-ci
Recently, I added my projects node-fixmyjs jshint-autofix to Travis-CI which is excellent. Travis is a build system for the open source community, I recommend you take a look at it if you haven’t.
Anyways, both of my projects depended on submodules and the tests were initially failing because I didn’t know how to tell Travis to download the submodules before running the unit tests.
So here’s what you’re supposed to put in your .travis.yml file:
language: node_js
node_js:
- 0.6
before_install:
git submodule init && git submodule --quiet update