Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A source code history analyzer API
Ruby
Tag: 0.1.0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
.yardopts
Changelog.md
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
metior.gemspec

README.md

Metior

Metior is a source code history analyzer API that provides various statistics about a source code repository and its change over time.

Currently Metior provides basic support for Git repositories.

If you're interested in Metior, feel free to join the discussion on Convore in Metior's group.

Examples

One-liner for some basic statistics

Metior.simple_stats :git, '~/open-source/metior'

More fine-grained access to repository statistics

repo = Metior::Git::Repository.new '~/open-source/metior'
repo.commits 'development'         # Get all commits in development
repo.file_stats                    # Basic statistics about the files
                                   # contained in a repository
repo.line_history                  # Quick access to lines added and
                                   # removed in each commit
repo.significant_authors           # Get up to 3 of the most important
                                   # authors
repo.significant_commits, 20       # Get up to 20 of the commits changing
                                   # the most lines
repo.top_authors 'master', 5       # Get the top 5 authors in master

Get statistics about a set of commits

Metior::Commit.activity repo.commits
Metior::Commit.activity repo.authors[author_id].commits

Advanced usage

Specifying commit ranges

Sometimes it's more useful to not analyze the whole history of a repository's branch. For example when analyzing the changes from one branch to another, or from the last released version to the latest code. In that case you will have to specify a commit range. Specifying a commit range works just like in Git:

'master..development'
'master'..'development'
'master..HEAD'
'master'..'HEAD'
'deadbeef..HEAD'

Given that your currently checked out branch is development and master points to commit deadbeef, the above statements are equal. Please also note the different syntaxes: The first, third and fifth example are standards string which will be parsed by Metior. The second and fourth example are Ruby Range objects which can be used by Metior right away.

Requirements

  • Grit — a Ruby API for Git
  • Octokit — a Ruby wrapper for the GitHub API

Documentation

The documentation of the Ruby API can be seen at RubyDoc.info. The API documentation of the current development version is also available there.

Future plans

  • More statistics and analyses
  • Generation of reports in HTML or other formats
  • Support for creating graphs
  • Console and web application to accompany this API
  • More supported VCSs, like Subversion or Mercurial
  • Code analysis to show programming languages, effective lines of code, etc.

Contribute

Metior is a open-source project. Therefore you are free to help improving it. There are several ways of contributing to Metior's development:

  • Build apps using it and spread the word.
  • Report problems and request features using the issue tracker.
  • Write patches yourself to fix bugs and implement new functionality.
  • Create a Metior fork on GitHub and start hacking. Extra points for using Metior pull requests and feature branches.

About the name

The latin word "metior" means "I measure". That's just what Metior does – measuring source code histories.

License

This code is free software; you can redistribute it and/or modify it under the terms of the new BSD License. A copy of this license can be found in the LICENSE file.

Credits

  • Sebastian Staudt – koraktor(at)gmail.com

See Also

Follow Metior on Twitter @metiorstats.

Something went wrong with that request. Please try again.