hubba gem - little github api helper for (auto-)generating statistics reports (summary, stars, timeline, updates)


  I have updated the hubba gem [1] - a little github api helper for
(auto-)generating statistics reports (includes summary, stars,
timeline, updates).

  Get started in 1-2-3 steps. From the readme:

Step 0: Secrets, Secrets, Secrets - Your Authentication Token

Note: Set your GitHub env credentials (personal access token preferred) e.g.

set HUBBA_TOKEN=abcdef0123456789
#   - or -
set HUBBA_USER=you
set HUBBA_PASSWORD=topsecret

Step 1: Get a list of all your repos

Use the GitHub API to get a list of all your repos:

require 'hubba'

h = Hubba.reposet( 'geraldb' )
pp h './repos.yml', 'w' ) { |f| f.write( h.to_yaml ) }

resulting in:

geraldb (11):
- austria
- catalog
- chelitas
- logos
- sandbox
- talks
- web-proxy-win
- webcomponents
- webpub-reader

openfootball (41):
- africa-cup
- austria
- club-world-cup
- clubs
- confed-cup
- copa-america
- copa-libertadores
- copa-sudamericana
- deutschland
# ...

Note: If you have more than one account (e.g. an extra robot account or such)
you can add them along e.g.

h = Hubba.reposet( 'geraldb', 'yorobot' )
pp h

Note: By default all your repos from organizations get auto-included -
use the `orgs: false` option to turn off auto-inclusion.

Note: By default all (personal) repos, that is, repos in your primary (first)
account that are forks get auto-excluded.

Step 2: Update repo statistics (daily / weekly / monthly)

Use `update_stats` to to get the latest commit, star count and more
for all your repos listed in `./repos.yml` via the GitHub API:

Hubba.update_stats( './repos.yml' )

Note: By default the datafiles (one per repo) get stored in the
`./data` directory.

Step 3: Generate some statistics / reports

Hubba has four built-in reports (for now):

- `ReportSummary` - A-Z list of your repos by orgs with stars and size in kb
- `ReportStars` - your repos ranked by stars
- `ReportTimeline` - your repos in reverse chronological order by creation
- `ReportUpdates` - your repos in reverse chronological order by last commit

If you only generate a single report, use:

report = './repos.yml' ) './' )

If you generate more reports, (re)use the in-memory statistics cache / object:

stats = Hubba.stats( './repos.yml' )

report = stats ) './' )

report = stats ) './' )

report = stats ) './' )

report = stats ) './' )

That's it for now. For some real-world examples, see the reports in
the backup repo [2a,2b,2c,2d].

Happy programming with ruby. Cheers. Prost.


  I have updated the hubba (github analytics) gem [1] and added some
more (statics) reports.

  New traffic reports include page views and clones, top/popular referrers,
top/popular pages plus a catalog page with description and topics.
For live (real-world) examples, see,,, [2a,b,c,d].

Happy data crunching with ruby. Cheers. Prost.

PS: Note - the traffic reports require push access for data gathering
(via the github api) for your github (personal) access token.


   In the ongoing series on talking to myself about github analytics -
yet another update.

   In an act of hybris I have split the hubba gem into two - the idea
is to make it easier to (re)use - kind of foolish as the analytics
show I am the only user anyway :-).

   Anyways, the idea is to split the collecting of data via github api
calls (and storage) from the generation of the reports.
Thus, lets welcome the new hubba-reports [1] gem / library.

   What's your most used language?
  To find out I have added a new language usage report. The surprise
in my case of course is that
ruby is in character count (bytes) only #3 behind html and javascript,
see as a "real-world" example [2].


report = './repos.yml' ) './' )

   to generate your own language report.

   Bonus: Using GitHub Actions you can schedule the data gathering
every week or such - I use every 1st and 15th of the month, see the
updates.yml [3a] workflow and the heart of the data collecting
workflow / action the update.rb script [3b]

require "hubba"

Hubba.config.data_dir = "./cache.github"

h = Hubba.reposet( "geraldb" )
pp h

Hubba.update_stats( h )
Hubba.update_traffic( h )

puts "Done."

      Happy data crunching with ruby. Cheers. Prost.