Welcome to the DjaoDjin Blog!

A place to share experiences in building Software-as-a-Service.

Triggering the VersionEye API

by Sebastien Mirolo on Wed, 30 Jul 2014

Today we are going to mechanically upload DjaoDjin's requirements file to VersionEye through a git post-update hook.

VersionEye is awesome! They keep crawling the web for new versions of you favorite libraries and send you an email if any new version is available. You also get to see the licenses of all the libraries a project depends on a separate tab - pretty useful added feature.

If you have a repository on github (public or private), you only need to create a project on VersionEye and enter the URL to the requirements file. VersionEye will keep in sync with the updates you push.

Here we prefer to host the git repositories on our own servers, even if only to run pylint on a git pre-receive hook. We thus need a way to trigger an upload of changes to VersionEye. Ask and you will be served, VersionEye provides API end points for almost everything available through the web interface. We add the following commands in .git/hooks/post-update

$ curl https://www.versioneye.com/api/v2/projects/project1_id?api_key=api_key -F project_file=@requirements.txt
$ curl https://www.versioneye.com/api/v2/projects/project2_id?api_key=api_key -F project_file=@bower.json

Et Voila!

Note we have two curl commands here because we created two projects on VersionEye, one for the Python prerequisites (web server) and one for the Javascript prerequisites (user interface).