git_commit_size_scraper 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +1 -1
- data/lib/git_commit_size_scraper/version.rb +1 -1
- metadata +16 -16
- data/lib/git_commit_size_scraper.foo +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cff546b0a40b83559b17d79d60e3ac90f802de3
|
4
|
+
data.tar.gz: f397ae9e254f692c829199b25d594b68e34abd0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f49a6a52c9cdf1c8d0fa83bca32fb5acc70fb329b97b88493d308ab7eda91f3bba0484528d9db3cb4cb28ea4b568de604d52533188579ac5e70dc9ec789e6e34
|
7
|
+
data.tar.gz: 379bf01be4643e73046145f96890d2988162f2831742d01b591fc2011467f912b4ef126d51317a26d6e37552cdebd512cbee94c8bf8888ad7ebc098177df0ce4
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
git_commit_size_scraper (1.0.
|
4
|
+
git_commit_size_scraper (1.0.1)
|
5
5
|
statistical_array (~> 1.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
rake (10.1
|
10
|
+
rake (10.3.1)
|
11
11
|
statistical_array (1.0.0)
|
12
12
|
|
13
13
|
PLATFORMS
|
data/README.md
CHANGED
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_commit_size_scraper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd A. Jacobs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: statistical_array
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: Walk Git history to calculate commit size in bytes.
|
@@ -60,10 +60,10 @@ executables:
|
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
-
- .gitignore
|
64
|
-
- .ruby-gemset
|
65
|
-
- .ruby-version
|
66
|
-
- .travis.yml
|
63
|
+
- ".gitignore"
|
64
|
+
- ".ruby-gemset"
|
65
|
+
- ".ruby-version"
|
66
|
+
- ".travis.yml"
|
67
67
|
- AUTHORS
|
68
68
|
- COPYING
|
69
69
|
- Gemfile
|
@@ -73,7 +73,6 @@ files:
|
|
73
73
|
- Rakefile
|
74
74
|
- bin/git_commit_size_scraper
|
75
75
|
- git_commit_size_scraper.gemspec
|
76
|
-
- lib/git_commit_size_scraper.foo
|
77
76
|
- lib/git_commit_size_scraper.rb
|
78
77
|
- lib/git_commit_size_scraper/scraper.rb
|
79
78
|
- lib/git_commit_size_scraper/version.rb
|
@@ -87,18 +86,19 @@ require_paths:
|
|
87
86
|
- lib
|
88
87
|
required_ruby_version: !ruby/object:Gem::Requirement
|
89
88
|
requirements:
|
90
|
-
- -
|
89
|
+
- - ">="
|
91
90
|
- !ruby/object:Gem::Version
|
92
91
|
version: '0'
|
93
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
93
|
requirements:
|
95
|
-
- -
|
94
|
+
- - ">="
|
96
95
|
- !ruby/object:Gem::Version
|
97
96
|
version: '0'
|
98
97
|
requirements: []
|
99
98
|
rubyforge_project:
|
100
|
-
rubygems_version: 2.
|
99
|
+
rubygems_version: 2.2.2
|
101
100
|
signing_key:
|
102
101
|
specification_version: 4
|
103
102
|
summary: ''
|
104
103
|
test_files: []
|
104
|
+
has_rdoc:
|
@@ -1,60 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
class GitCommitSize
|
4
|
-
attr_reader :list
|
5
|
-
|
6
|
-
def initialize args=nil
|
7
|
-
@commits = `git rev-list --all #{args}`.split
|
8
|
-
@list = {}
|
9
|
-
end
|
10
|
-
|
11
|
-
def blobs_in_commit treeish
|
12
|
-
`git diff-tree -r -c -M -C --no-commit-id #{treeish}`.
|
13
|
-
split("\n").
|
14
|
-
map { |blob| blob.split[3] }
|
15
|
-
end
|
16
|
-
|
17
|
-
def size_in_bytes obj
|
18
|
-
return 0 if obj =~ /\A0+\z/
|
19
|
-
`git cat-file -s #{obj}`.to_i
|
20
|
-
end
|
21
|
-
|
22
|
-
def bytes_in_commit treeish
|
23
|
-
blobs = blobs_in_commit treeish
|
24
|
-
total = blobs.map { |blob| size_in_bytes blob }.reduce(:+)
|
25
|
-
end
|
26
|
-
|
27
|
-
def walk
|
28
|
-
@commits.map { |c| @list[c] = bytes_in_commit c }
|
29
|
-
end
|
30
|
-
|
31
|
-
def sorted
|
32
|
-
@list.reject { |k, v| v.nil? }.sort_by { |k,v| v }
|
33
|
-
end
|
34
|
-
|
35
|
-
def avg
|
36
|
-
(@list.values.compact.reduce(:+).to_f / @commits.count).round
|
37
|
-
end
|
38
|
-
|
39
|
-
def median
|
40
|
-
list = @list.values.map(&:to_i).sort
|
41
|
-
n = list.count
|
42
|
-
case @list.count.odd?
|
43
|
-
when true
|
44
|
-
@list[(n+1)/2]
|
45
|
-
when false
|
46
|
-
( list[n/2-1] + list[n/2] ) / 2.0
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
if __FILE__ == $0
|
52
|
-
git = GitCommitSize.new
|
53
|
-
count = git.commits.count
|
54
|
-
puts "Walking #{count} commits."
|
55
|
-
git.walk
|
56
|
-
result = git.sorted
|
57
|
-
numsep = /(?<=\d)(?=(?:\d{3})+(\.\d+)?\z)/
|
58
|
-
pp result
|
59
|
-
puts "Average: %s bytes" % git.avg.to_s.gsub(numsep, ?,)
|
60
|
-
end
|