git_statistics 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,68 +1,60 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_statistics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
5
- prerelease:
4
+ version: 0.7.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Kevin Jalbert
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-01 00:00:00.000000000 Z
11
+ date: 2013-10-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: json
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
- name: grit
28
+ name: rugged
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
- name: github-linguist
42
+ name: language_sniffer
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,49 +69,15 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rake
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
92
- - !ruby/object:Gem::Version
93
- version: '0'
94
- - !ruby/object:Gem::Dependency
95
- name: simplecov
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
- - !ruby/object:Gem::Dependency
111
- name: tailor
112
- requirement: !ruby/object:Gem::Requirement
113
- none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
80
+ - - '>='
124
81
  - !ruby/object:Gem::Version
125
82
  version: '0'
126
83
  description: git_statistics is a gem that provides detailed git statistics
@@ -132,64 +89,54 @@ executables:
132
89
  extensions: []
133
90
  extra_rdoc_files: []
134
91
  files:
135
- - lib/git_statistics/blob.rb
136
- - lib/git_statistics/branches.rb
137
92
  - lib/git_statistics/collector.rb
138
- - lib/git_statistics/commit_line_extractor.rb
93
+ - lib/git_statistics/commit_summary.rb
139
94
  - lib/git_statistics/commits.rb
95
+ - lib/git_statistics/diff_summary.rb
140
96
  - lib/git_statistics/formatters/console.rb
141
97
  - lib/git_statistics/initialize.rb
142
98
  - lib/git_statistics/log.rb
143
99
  - lib/git_statistics/pipe.rb
144
- - lib/git_statistics/regex_matcher.rb
145
100
  - lib/git_statistics/utilities.rb
146
101
  - lib/git_statistics/version.rb
147
102
  - lib/git_statistics.rb
148
- - spec/branches_spec.rb
149
103
  - spec/collector_spec.rb
150
- - spec/commit_line_extractor_spec.rb
104
+ - spec/commit_summary_spec.rb
151
105
  - spec/commits_spec.rb
152
106
  - spec/formatters/console_spec.rb
153
107
  - spec/log_spec.rb
154
108
  - spec/pipe_spec.rb
155
- - spec/regex_matcher_spec.rb
156
109
  - spec/utilities_spec.rb
157
110
  - bin/git_statistics
158
111
  - bin/git-statistics
159
112
  homepage: https://github.com/kevinjalbert/git_statistics
160
113
  licenses: []
114
+ metadata: {}
161
115
  post_install_message:
162
116
  rdoc_options: []
163
117
  require_paths:
164
118
  - lib
165
119
  required_ruby_version: !ruby/object:Gem::Requirement
166
- none: false
167
120
  requirements:
168
- - - ! '>='
121
+ - - '>='
169
122
  - !ruby/object:Gem::Version
170
- version: 1.9.1
123
+ version: 1.9.3
171
124
  required_rubygems_version: !ruby/object:Gem::Requirement
172
- none: false
173
125
  requirements:
174
- - - ! '>='
126
+ - - '>='
175
127
  - !ruby/object:Gem::Version
176
128
  version: '0'
177
- segments:
178
- - 0
179
- hash: 2745027118134232724
180
129
  requirements: []
181
130
  rubyforge_project:
182
- rubygems_version: 1.8.24
131
+ rubygems_version: 2.1.5
183
132
  signing_key:
184
- specification_version: 3
133
+ specification_version: 4
185
134
  summary: Gem that provides the ability to gather detailed git statistics
186
135
  test_files:
187
- - spec/branches_spec.rb
188
136
  - spec/collector_spec.rb
189
- - spec/commit_line_extractor_spec.rb
137
+ - spec/commit_summary_spec.rb
190
138
  - spec/commits_spec.rb
191
139
  - spec/formatters/console_spec.rb
192
140
  - spec/log_spec.rb
193
141
  - spec/pipe_spec.rb
194
- - spec/regex_matcher_spec.rb
195
142
  - spec/utilities_spec.rb
@@ -1,5 +0,0 @@
1
- module Grit
2
- class Blob
3
- include Linguist::BlobHelper
4
- end
5
- end
@@ -1,35 +0,0 @@
1
- module GitStatistics
2
- class Branches
3
-
4
- CURRENT_BRANCH = /\A\*\s/
5
- NO_BRANCH = /no branch/i
6
-
7
- def self.all
8
- list.collect { |branch| branch.sub(CURRENT_BRANCH, "") }
9
- end
10
-
11
- def self.current
12
- return '(none)' if detached?
13
- list.detect { |branch| branch =~ CURRENT_BRANCH }.sub(CURRENT_BRANCH, "")
14
- end
15
-
16
- def self.detached?
17
- stripped.grep(NO_BRANCH).any?
18
- end
19
-
20
- private
21
-
22
- def self.list
23
- stripped.reject { |b| b =~ NO_BRANCH }
24
- end
25
-
26
- def self.stripped
27
- pipe.map(&:strip)
28
- end
29
-
30
- def self.pipe
31
- Pipe.new("git --no-pager branch --no-color")
32
- end
33
-
34
- end
35
- end
@@ -1,50 +0,0 @@
1
- module GitStatistics
2
- class CommitLineExtractor
3
-
4
- AdditionsOrDeletions = RegexMatcher.new(/^([-|\d]+)\s+([-|\d]+)\s+(.+)/i, 3)
5
- RenamedOrCopied = RegexMatcher.new(/^(rename|copy)\s+(.+)\s+=>\s+(.+)\s+\((\d+)/i, 4)
6
- CreatedOrDeleted = RegexMatcher.new(/^(create|delete) mode \d+ ([^\\\n]*)/i, 2)
7
- ModifiedOrRenamed = RegexMatcher.new(/^([-|\d]+)\s+([-|\d]+)\s+(.+)\s+=>\s+(.+)/i, 4)
8
-
9
- attr_reader :line
10
-
11
- def initialize(line)
12
- @line = line
13
- end
14
-
15
- def changed
16
- modified_or_renamed = ModifiedOrRenamed.if_matches(line) do |changes|
17
- split_file = Utilities.split_old_new_file(changes[2], changes[3])
18
- {:additions => changes[0].to_i,
19
- :deletions => changes[1].to_i,
20
- :file => split_file[:new_file],
21
- :old_file => split_file[:old_file]}
22
- end
23
- return modified_or_renamed unless modified_or_renamed.empty?
24
-
25
- AdditionsOrDeletions.if_matches(line) do |changes|
26
- {:additions => changes[0].to_i,
27
- :deletions => changes[1].to_i,
28
- :file => changes[2]}
29
- end
30
- end
31
-
32
- def created_or_deleted
33
- CreatedOrDeleted.if_matches(line) do |changes|
34
- {:status => changes[0],
35
- :file => changes[1]}
36
- end
37
- end
38
-
39
- def renamed_or_copied
40
- RenamedOrCopied.if_matches(line) do |changes|
41
- split_file = Utilities.split_old_new_file(changes[1], changes[2])
42
- {:status => changes[0],
43
- :old_file => split_file[:old_file],
44
- :new_file => split_file[:new_file],
45
- :similar => changes[3].to_i}
46
- end
47
- end
48
-
49
- end
50
- end
@@ -1,23 +0,0 @@
1
- module GitStatistics
2
- class RegexMatcher
3
-
4
- attr_reader :regex, :expected_change_count
5
- def initialize(regex, expected_change_count)
6
- @regex = regex
7
- @expected_change_count = expected_change_count
8
- end
9
-
10
- def scan(line)
11
- line.scan(regex).first || []
12
- end
13
-
14
- def if_matches(line)
15
- changes = self.scan(line)
16
- if changes && changes.size == expected_change_count
17
- yield changes
18
- else
19
- {}
20
- end
21
- end
22
- end
23
- end
@@ -1,44 +0,0 @@
1
- require 'spec_helper'
2
- include GitStatistics
3
-
4
- describe Branches do
5
- subject { described_class }
6
-
7
- before do
8
- subject.stub(:pipe) { fixture(branches) }
9
- end
10
-
11
- context "with many branches" do
12
- let(:branches) {"git_many_branches.txt"}
13
- its(:all) { should have(2).items }
14
- its(:all) { should include "issue_2" }
15
- its(:all) { should include "master" }
16
- its(:current) { should == "issue_2" }
17
- its(:detached?) { should be_false }
18
- end
19
-
20
- context "with zero branches" do
21
- let(:branches) {"git_zero_branches.txt"}
22
- its(:all) { should have(1).items }
23
- its(:all) { should include "master" }
24
- its(:current) { should == "master" }
25
- its(:detached?) { should be_false }
26
- end
27
-
28
- context "with many branches in detached state" do
29
- let(:branches) {"git_many_branches_detached_state.txt"}
30
- its(:all) { should have(2).items }
31
- its(:all) { should include "issue_2" }
32
- its(:all) { should include "master" }
33
- its(:current) { should == "(none)" }
34
- its(:detached?) { should be_true }
35
- end
36
-
37
- context "with zero branches in detached state" do
38
- let(:branches) {"git_zero_branches_detached_state.txt"}
39
- its(:all) { should have(1).items }
40
- its(:all) { should include "master" }
41
- its(:current) { should == "(none)" }
42
- its(:detached?) { should be_true }
43
- end
44
- end
@@ -1,70 +0,0 @@
1
- require 'spec_helper'
2
- include GitStatistics
3
-
4
- describe CommitLineExtractor do
5
-
6
- let(:extractor) { CommitLineExtractor.new(line) }
7
-
8
- describe "#extract_change_file" do
9
- let(:file) { extractor.changed }
10
-
11
- context "with a simple changed file" do
12
- let(:line) {"37 30 lib/file.rb"}
13
- it {file[:additions].should == 37}
14
- it {file[:deletions].should == 30}
15
- it {file[:file].should == "lib/file.rb"}
16
- end
17
-
18
- context "with a simple rename/copy changed file" do
19
- let(:line) {"11 3 old_file.rb => lib/file.rb"}
20
- it {file[:additions].should == 11}
21
- it {file[:deletions].should == 3}
22
- it {file[:file].should == "lib/file.rb"}
23
- it {file[:old_file].should == "old_file.rb"}
24
- end
25
-
26
- context "with a complex rename/copy changed file" do
27
- let(:line) {"- - lib/{old_dir => new_dir}/file.rb"}
28
- it {file[:additions].should == 0}
29
- it {file[:deletions].should == 0}
30
- it {file[:file].should == "lib/new_dir/file.rb"}
31
- it {file[:old_file].should == "lib/old_dir/file.rb"}
32
- end
33
- end
34
-
35
- describe "#extract_create_delete_file" do
36
- let(:file) { extractor.created_or_deleted }
37
-
38
- context "with a create changed file" do
39
- let(:line) {"create mode 100644 lib/dir/file.rb"}
40
- it {file[:status].should == "create"}
41
- it {file[:file].should == "lib/dir/file.rb"}
42
- end
43
-
44
- context "with a delete changed file" do
45
- let(:line) {"delete mode 100644 lib/file.rb"}
46
- it {file[:status].should == "delete"}
47
- it {file[:file].should == "lib/file.rb"}
48
- end
49
- end
50
-
51
- describe "#extract_rename_copy_file" do
52
- let(:file) { extractor.renamed_or_copied }
53
-
54
- context "with a rename changed file" do
55
- let(:line) {"rename lib/{old_dir => new_dir}/file.rb (100%)"}
56
- it {file[:status].should == "rename"}
57
- it {file[:old_file].should == "lib/old_dir/file.rb"}
58
- it {file[:new_file].should == "lib/new_dir/file.rb"}
59
- it {file[:similar].should == 100}
60
- end
61
-
62
- context "with a copy changed file" do
63
- let(:line) {"copy lib/dir/{old_file.rb => new_file.rb} (75%)"}
64
- it {file[:status].should == "copy"}
65
- it {file[:old_file].should == "lib/dir/old_file.rb"}
66
- it {file[:new_file].should == "lib/dir/new_file.rb"}
67
- it {file[:similar].should == 75}
68
- end
69
- end
70
- end