Skip to content

Commit 28e229f

Browse files
committedMay 21, 2012
Init commit
0 parents  commit 28e229f

File tree

8 files changed

+177
-0
lines changed

8 files changed

+177
-0
lines changed
 

‎.gitignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*.gem
2+
*.rbc
3+
.bundle
4+
.config
5+
.yardoc
6+
Gemfile.lock
7+
InstalledFiles
8+
_yardoc
9+
coverage
10+
doc/
11+
lib/bundler/man
12+
pkg
13+
rdoc
14+
spec/reports
15+
test/tmp
16+
test/version_tmp
17+
tmp

‎Gemfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source 'https://rubygems.org'
2+
3+
# Specify your gem's dependencies in git_blame.gemspec
4+
gemspec

‎LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2012 Linus Oleander
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

‎README.md

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# GitBlame
2+
3+
Who did what in your project?
4+
GitBlame generates som much needed statistics from your current git repository.
5+
6+
## Output
7+
8+
Example out from the [water project](https://github.com/water/mainline).
9+
10+
```
11+
Total number of files: 2,053
12+
Total number of lines: 63,132
13+
Total number of commits: 4,330
14+
+------------------------+--------+---------+-------+----------------+
15+
| name | loc | commits | files | percent |
16+
+------------------------+--------+---------+-------+----------------+
17+
| Johan Sørensen | 22,272 | 1,814 | 414 | 35.3/41.9/20.2 |
18+
| Marius Mathiesen | 10,387 | 502 | 229 | 16.5/11.6/11.2 |
19+
| Jesper Josefsson | 9,689 | 519 | 191 | 15.3/12.0/9.3 |
20+
| Ole Martin Kristiansen | 6,632 | 24 | 60 | 10.5/0.6/2.9 |
21+
| Linus Oleander | 5,769 | 705 | 277 | 9.1/16.3/13.5 |
22+
| Fabio Akita | 2,122 | 24 | 60 | 3.4/0.6/2.9 |
23+
| August Lilleaas | 1,572 | 123 | 63 | 2.5/2.8/3.1 |
24+
| David A. Cuadrado | 731 | 111 | 35 | 1.2/2.6/1.7 |
25+
| Jonas Ängeslevä | 705 | 148 | 51 | 1.1/3.4/2.5 |
26+
| Diego Algorta | 650 | 6 | 5 | 1.0/0.1/0.2 |
27+
| Arash Rouhani | 629 | 95 | 31 | 1.0/2.2/1.5 |
28+
| Sofia Larsson | 595 | 70 | 77 | 0.9/1.6/3.8 |
29+
| Tor Arne Vestbø | 527 | 51 | 97 | 0.8/1.2/4.7 |
30+
| spontus | 339 | 18 | 42 | 0.5/0.4/2.0 |
31+
| Pontus | 225 | 49 | 34 | 0.4/1.1/1.7 |
32+
+------------------------+--------+---------+-------+----------------+
33+
```
34+
35+
## Usage
36+
37+
### Console
38+
39+
Start by navigating to a git repository.
40+
41+
#### Plain
42+
43+
`git accuse`
44+
45+
#### Order by a specific field
46+
47+
Order by the amounts of current lines of code `loc`, the amounts of `commits` or author
48+
49+
- `git accuse --order=loc`
50+
- `git accuse --order=commits`
51+
- `git accuse --order=author`
52+
53+
Default is `loc`.
54+
55+
### Class
56+
57+
Want to work with the data before printing it?
58+
59+
`repository = GitBlame.new`
60+
61+
#### Order by
62+
63+
The constructor takes a hash with arguments, one being the `order` key.
64+
65+
`GitBlame.new({order: "loc"})`
66+
67+
#### Print table to console
68+
69+
`repository.pretty_print`
70+
71+
### Statistics
72+
73+
#### GitBlame
74+
75+
- Total number of lines
76+
- `repository.loc`
77+
- Total number of commits
78+
- `repository.commits`
79+
- Total number of files
80+
- `repository.files`
81+
- All authors
82+
- `repository.authors`
83+
84+
#### Author
85+
86+
`author = repository.authors`
87+
88+
- Number of lines
89+
- `author.loc`
90+
- Number of commits
91+
- `author.commits`
92+
- Number of files changed
93+
- `author.files`
94+
- Percent of total (loc/commits/files)
95+
- `author.percent`
96+
97+
## Contributing
98+
99+
1. Fork it
100+
2. Create your feature branch (`git checkout -b my-new-feature`)
101+
3. Commit your changes (`git commit -am 'Added some feature'`)
102+
4. Push to the branch (`git push origin my-new-feature`)
103+
5. Create new Pull Request

‎Rakefile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env rake
2+
require "bundler/gem_tasks"

‎git_blame.gemspec

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -*- encoding: utf-8 -*-
2+
require File.expand_path('../lib/git_blame/version', __FILE__)
3+
4+
Gem::Specification.new do |gem|
5+
gem.authors = ["Linus Oleander"]
6+
gem.email = ["linus@oleander.nu"]
7+
gem.description = %q{TODO: Write a gem description}
8+
gem.summary = %q{TODO: Write a gem summary}
9+
gem.homepage = ""
10+
11+
gem.files = `git ls-files`.split($\)
12+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14+
gem.name = "git_blame"
15+
gem.require_paths = ["lib"]
16+
gem.version = GitBlame::VERSION
17+
end

‎lib/git_blame.rb

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
require "git_blame/version"
2+
require "progressbar"
3+
require "mimer_plus"
4+
require "hirb"
5+
require "action_view"
6+
7+
module GitBlame
8+
# Your code goes here...
9+
end

‎lib/git_blame/version.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module GitBlame
2+
VERSION = "0.0.1"
3+
end

0 commit comments

Comments
 (0)
Please sign in to comment.