2015-03-29 14:42:42 +02:00
|
|
|
# GitStats [![Build Status](https://secure.travis-ci.org/tomgi/git_stats.svg)](https://secure.travis-ci.org/tomgi/git_stats) [![Build Status](https://codeclimate.com/badge.png)](https://codeclimate.com/github/tomgi/git_stats)
|
2012-10-08 17:11:11 +02:00
|
|
|
|
2012-10-23 21:15:23 +02:00
|
|
|
GitStats is a git repository statistics generator.
|
2012-10-23 21:54:36 +02:00
|
|
|
It browses the repository and outputs html page with statistics.
|
2012-10-08 17:11:11 +02:00
|
|
|
|
2012-10-23 21:15:23 +02:00
|
|
|
## Examples
|
2012-10-23 21:40:40 +02:00
|
|
|
* [devise](http://tomgi.github.com/git_stats/examples/devise/index.html)
|
|
|
|
* [devise_invitable](http://tomgi.github.com/git_stats/examples/devise_invitable/index.html)
|
2012-10-25 16:52:37 +02:00
|
|
|
* [john](http://tomgi.github.com/git_stats/examples/john/index.html)
|
2012-10-23 21:40:40 +02:00
|
|
|
* [jquery](http://tomgi.github.com/git_stats/examples/jquery/index.html)
|
2012-10-23 23:17:01 +02:00
|
|
|
* [merit](http://tomgi.github.com/git_stats/examples/merit/index.html)
|
2012-10-23 21:40:40 +02:00
|
|
|
* [paperclip](http://tomgi.github.com/git_stats/examples/paperclip/index.html)
|
|
|
|
* [rails](http://tomgi.github.com/git_stats/examples/rails/index.html)
|
2012-10-08 17:11:11 +02:00
|
|
|
|
2012-10-23 21:15:23 +02:00
|
|
|
## Installation
|
2012-10-08 17:11:11 +02:00
|
|
|
|
2016-06-29 11:11:24 +02:00
|
|
|
### Existing ruby/gem environment
|
|
|
|
|
2012-10-23 21:15:23 +02:00
|
|
|
$ gem install git_stats
|
2018-08-13 21:31:11 +02:00
|
|
|
|
|
|
|
### debian stretch (9.*)
|
2012-10-08 17:11:11 +02:00
|
|
|
|
2018-08-13 21:31:11 +02:00
|
|
|
# apt-get install ruby ruby-nokogiri ruby-nokogiri-diff ruby-nokogumbo
|
|
|
|
# gem install git_stats
|
|
|
|
|
2016-06-29 11:11:24 +02:00
|
|
|
### Ubuntu
|
|
|
|
|
2019-01-12 06:06:13 +01:00
|
|
|
$ sudo apt-get install ruby ruby-dev
|
2016-06-29 11:11:24 +02:00
|
|
|
$ sudo gem install git_stats
|
|
|
|
|
2012-10-23 21:15:23 +02:00
|
|
|
## Usage
|
2012-10-08 17:11:11 +02:00
|
|
|
|
2012-10-23 21:42:14 +02:00
|
|
|
### Generator
|
2012-10-08 17:11:11 +02:00
|
|
|
|
2013-08-15 22:17:36 +02:00
|
|
|
#### Print help
|
|
|
|
|
2013-04-06 14:52:01 +02:00
|
|
|
$ git_stats
|
2013-08-15 22:17:36 +02:00
|
|
|
Commands:
|
|
|
|
git_stats generate # Generates the statistics of a repository
|
|
|
|
git_stats help [COMMAND] # Describe available commands or one specific command
|
|
|
|
|
|
|
|
#### Print help of the generate command
|
|
|
|
|
|
|
|
$ git_stats help generate
|
|
|
|
Usage:
|
|
|
|
git_stats generate
|
|
|
|
|
|
|
|
Options:
|
2014-06-25 20:12:39 +02:00
|
|
|
p, [--path=PATH] # Path to repository from which statistics should be generated.
|
|
|
|
# Default: .
|
|
|
|
o, [--out-path=OUT_PATH] # Output path where statistics should be written.
|
|
|
|
# Default: ./git_stats
|
|
|
|
l, [--language=LANGUAGE] # Language of written statistics.
|
|
|
|
# Default: en
|
|
|
|
f, [--first-commit-sha=FIRST_COMMIT_SHA] # Commit from where statistics should start.
|
|
|
|
t, [--last-commit-sha=LAST_COMMIT_SHA] # Commit where statistics should stop.
|
|
|
|
# Default: HEAD
|
|
|
|
s, [--silent], [--no-silent] # Silent mode. Don't output anything.
|
|
|
|
d, [--tree=TREE] # Tree where statistics should be generated.
|
|
|
|
# Default: .
|
|
|
|
c, [--comment-string=COMMENT_STRING] # The string which is used for comments.
|
|
|
|
# Default: //
|
|
|
|
|
|
|
|
Generates the statistics of a repository
|
2014-06-22 14:23:34 +02:00
|
|
|
|
|
|
|
|
2013-08-15 22:17:36 +02:00
|
|
|
|
|
|
|
#### Start generator with default settings
|
|
|
|
|
|
|
|
$ git_stats generate
|
|
|
|
git rev-list --pretty=format:'%h|%at|%ai|%aE' HEAD | grep -v commit
|
|
|
|
git shortlog -se HEAD
|
|
|
|
...
|
|
|
|
|
|
|
|
#### Start generator with some parameters in long and short form.
|
|
|
|
|
|
|
|
$ git_stats generate -o stats --langugage de
|
|
|
|
git rev-list --pretty=format:'%h|%at|%ai|%aE' HEAD | grep -v commit
|
|
|
|
git shortlog -se HEAD
|
|
|
|
...
|
2012-10-08 17:11:11 +02:00
|
|
|
|
2012-10-23 21:42:14 +02:00
|
|
|
### API usage example
|
2012-10-08 17:11:11 +02:00
|
|
|
|
2013-04-03 13:35:12 +02:00
|
|
|
> repo = GitStats::GitData::Repo.new(path: '.', first_commit_sha: 'abcd1234', last_commit_sha: 'HEAD')
|
2012-10-23 21:15:23 +02:00
|
|
|
> repo.authors
|
|
|
|
=> [...]
|
|
|
|
> repo.commits
|
|
|
|
=> [...]
|
|
|
|
> commit.files
|
|
|
|
=> [...]
|
2012-10-08 17:11:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
## Contributing
|
|
|
|
|
|
|
|
1. Fork it
|
|
|
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
2012-10-23 21:15:23 +02:00
|
|
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
|
|
|
4. Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
|
|
|
5. Push to the branch (`git push origin my-new-feature`)
|
2012-10-25 16:52:37 +02:00
|
|
|
6. Create new Pull Request
|