macblame 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +24 -0
- data/Rakefile +2 -0
- data/bin/macblame +6 -0
- data/lib/macblame.rb +61 -0
- data/lib/macblame/version.rb +3 -0
- data/macblame.gemspec +20 -0
- metadata +55 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 40352524be307a397e36b567fb140b6c12506a93
|
4
|
+
data.tar.gz: 746020c7ad3ab963326e366844f936461fd0c9cc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: be0c7f1af17782b07cb86bfd500bdf90255e4518f01c406bf04cf5ec00f5dc26b43c157423134179d6fd83950798ed02509827c94645f8d290f596f468830e31
|
7
|
+
data.tar.gz: f43e96b702633cd2f510eb76e0c130f50561ea6851f8cb35aa5e5207554877b1e1c837c32ae756f92ca85806479b034b1703d617a7b6a559253948d9b5b2113c
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Prasanna Sundar
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Macblame
|
2
|
+
|
3
|
+
A better git blame to use in your Terminal.app This tool is used along with git to get a better version of "git blame ".. It will give you the percentage of contribution by individual users, so that it will be easier for you to blame the right person.. ;) This idea was conceived by Vignesh Jeyavel of Freshdesk and it's a cool idea!
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
install it yourself as:
|
8
|
+
|
9
|
+
$ gem install macblame
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
$ macblame <filename 1> <filename 2> ....
|
14
|
+
|
15
|
+
all the files given as params should be tracked by git.
|
16
|
+
|
17
|
+
|
18
|
+
## Contributing
|
19
|
+
|
20
|
+
1. Fork it ( https://github.com/praserocking/macblame-gem/fork )
|
21
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
22
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
23
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
24
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/macblame
ADDED
data/lib/macblame.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
require "macblame/version"
|
2
|
+
|
3
|
+
module Macblame
|
4
|
+
class Main
|
5
|
+
def run_app
|
6
|
+
if ARGV.length == 0
|
7
|
+
print_general_message
|
8
|
+
else
|
9
|
+
ARGV.each do |name|
|
10
|
+
macblame(name)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def macblame(file_name)
|
17
|
+
contributor = {}
|
18
|
+
output = open("| git blame "+file_name)
|
19
|
+
feed = output.read()
|
20
|
+
lines = feed.split("\n")
|
21
|
+
loc = lines.length
|
22
|
+
lines.each do |line|
|
23
|
+
tokens = line.split("(")
|
24
|
+
name = tokens[1].split(" ")[0]
|
25
|
+
if contributor[name].nil?
|
26
|
+
contributor[name] = 1
|
27
|
+
else
|
28
|
+
contributor[name] += 1
|
29
|
+
end
|
30
|
+
end
|
31
|
+
sorted_hash = contributor.sort.sort do |a,b|
|
32
|
+
b[1] <=> a[1]
|
33
|
+
end
|
34
|
+
print "for file #{file_name}.. \n"
|
35
|
+
sorted_hash.each do |i|
|
36
|
+
if i[0] == "Not"
|
37
|
+
print_info("not yet committed",i[1],loc)
|
38
|
+
else
|
39
|
+
print_info(i[0],i[1],loc)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
puts "* "*25
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
def print_info(name,loc,commits)
|
47
|
+
puts "Contributor: \033[1;32m#{name}\033[0m with \033[1;32m#{((loc.to_f/commits.to_f)*100).round(2)} %\033[0m contribution with \033[1;32m#{loc}\033[0m lines of code"
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
def print_general_message
|
52
|
+
print "macblame - A better alternative to 'git blame'\n\n"
|
53
|
+
puts "Usage:"
|
54
|
+
print "macblame <filename 1> <filename 2> ..... \n\n"
|
55
|
+
puts "Description:"
|
56
|
+
print "macblame shows stats about the files tracked by git. It uses the output of 'git blame' and summarize it in a cleaner and intuitive format."
|
57
|
+
puts "\n\n Credits:"
|
58
|
+
print "Prasanna Sundar - prassi - praserocking@gmail.com"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/macblame.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'macblame/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "macblame"
|
8
|
+
spec.version = Macblame::VERSION
|
9
|
+
spec.authors = ["Prasanna Sundar"]
|
10
|
+
spec.email = ["prasanna.s@freshdesk.com"]
|
11
|
+
spec.summary = %q{macblame - A better alternative to 'git blame'}
|
12
|
+
spec.description = %q{macblame shows stats about the files tracked by git. It uses the output of 'git blame' and summarize it in a cleaner and intuitive format.}
|
13
|
+
spec.homepage = "https://github.com/praserocking/macblame-gem"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = ["macblame"]
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: macblame
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Prasanna Sundar
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-20 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: macblame shows stats about the files tracked by git. It uses the output
|
14
|
+
of 'git blame' and summarize it in a cleaner and intuitive format.
|
15
|
+
email:
|
16
|
+
- prasanna.s@freshdesk.com
|
17
|
+
executables:
|
18
|
+
- macblame
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- ".gitignore"
|
23
|
+
- Gemfile
|
24
|
+
- LICENSE.txt
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- bin/macblame
|
28
|
+
- lib/macblame.rb
|
29
|
+
- lib/macblame/version.rb
|
30
|
+
- macblame.gemspec
|
31
|
+
homepage: https://github.com/praserocking/macblame-gem
|
32
|
+
licenses:
|
33
|
+
- MIT
|
34
|
+
metadata: {}
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubyforge_project:
|
51
|
+
rubygems_version: 2.4.6
|
52
|
+
signing_key:
|
53
|
+
specification_version: 4
|
54
|
+
summary: macblame - A better alternative to 'git blame'
|
55
|
+
test_files: []
|