Working with Hub

Hub is a cli for github.

I mostly use it for creating pull-requests or to navigate to the github page for the current repository.

It can be used for more, including calling github api’s

Here is an example of fetching a file from a repo (which would work based upon the credentials attached to hub).

hub api -X GET /repos/chriseyre2000/sample-readme/contents/README.md -H "Accept: application/vnd.github.VERSION.raw"

This fetches the content of the file.

Intend to use this to analyse the package.json of a range of projects.

These will be passed into https://github.com/chriseyre2000/package_compare so that I can load a neo4j database. This will allow me to analyse the package dependencies.

Microservices can result in a lot of packages ….

This is a script that can be used to load a node package.json from github into a local neo4j database:

#/bin/bash
owner=$1
project=$2

hub api -X GET /repos/$owner/$project/contents/package.json -H "Accept: application/vnd.github.VERSION.raw" > $project.json
package_compare $project.json localhost neo4j magicbeans

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s