git_statistics 0.7.0 → 0.8.0
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 +4 -4
- data/bin/git-statistics +1 -1
- data/bin/git_statistics +1 -1
- data/lib/git_statistics.rb +33 -35
- data/lib/git_statistics/collector.rb +13 -16
- data/lib/git_statistics/commit_summary.rb +13 -16
- data/lib/git_statistics/commits.rb +34 -36
- data/lib/git_statistics/diff_summary.rb +13 -17
- data/lib/git_statistics/formatters/console.rb +22 -18
- data/lib/git_statistics/log.rb +3 -5
- data/lib/git_statistics/pipe.rb +1 -1
- data/lib/git_statistics/utilities.rb +7 -9
- data/lib/git_statistics/version.rb +1 -1
- data/spec/collector_spec.rb +107 -104
- data/spec/commit_summary_spec.rb +110 -84
- data/spec/commits_spec.rb +251 -218
- data/spec/formatters/console_spec.rb +141 -127
- data/spec/log_spec.rb +19 -21
- data/spec/pipe_spec.rb +30 -25
- data/spec/utilities_spec.rb +42 -40
- metadata +37 -37
data/spec/utilities_spec.rb
CHANGED
@@ -2,63 +2,66 @@ require 'spec_helper'
|
|
2
2
|
include GitStatistics
|
3
3
|
|
4
4
|
describe Utilities do
|
5
|
-
|
6
|
-
describe "#max_length_in_list" do
|
5
|
+
describe '#max_length_in_list' do
|
7
6
|
let(:max) { nil }
|
8
7
|
let(:list) { [] }
|
9
|
-
subject(:results) {Utilities.max_length_in_list(list, max)}
|
8
|
+
subject(:results) { Utilities.max_length_in_list(list, max) }
|
10
9
|
|
11
|
-
context
|
12
|
-
it {
|
10
|
+
context 'with empty list' do
|
11
|
+
it { expect(subject).to eq(0) }
|
13
12
|
end
|
14
13
|
|
15
|
-
context
|
14
|
+
context 'with nil list' do
|
16
15
|
let(:list) { nil }
|
17
|
-
it {
|
16
|
+
it { expect(subject).to eq(0) }
|
18
17
|
end
|
19
18
|
|
20
|
-
context
|
19
|
+
context 'with empty list and zero max' do
|
21
20
|
let(:list) { [] }
|
22
21
|
let(:max) { 0 }
|
23
|
-
it {
|
22
|
+
it { expect(subject).to eq(0) }
|
24
23
|
end
|
25
24
|
|
26
|
-
context
|
25
|
+
context 'with preset minimum length' do
|
27
26
|
let(:max) { 10 }
|
28
|
-
it {
|
27
|
+
it { expect(subject).to eq(10) }
|
29
28
|
end
|
30
29
|
|
31
|
-
context
|
32
|
-
let(:list) {
|
33
|
-
it {
|
30
|
+
context 'with valid list' do
|
31
|
+
let(:list) { %w(abc a ab) }
|
32
|
+
it { expect(subject).to eq(3) }
|
34
33
|
end
|
35
34
|
|
36
|
-
context
|
37
|
-
let(:list) { {
|
38
|
-
it {
|
35
|
+
context 'with valid hash' do
|
36
|
+
let(:list) { { 'a' => 'word_a', 'ab' => 'word_b', 'abc' => 'word_c' } }
|
37
|
+
it { expect(subject).to eq(3) }
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
42
|
-
describe
|
41
|
+
describe '#get_modified_time' do
|
43
42
|
let(:file) { 'file' }
|
43
|
+
|
44
44
|
after { Utilities.get_modified_time(file) }
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
|
46
|
+
context 'on a Mac' do
|
47
|
+
before { allow(Utilities).to receive(:os) { :mac } }
|
48
|
+
it { expect(Utilities).to receive(:time_at).with(%(stat -f %m file)) { 10 } }
|
48
49
|
end
|
49
|
-
|
50
|
-
|
51
|
-
|
50
|
+
|
51
|
+
context 'on a Linux' do
|
52
|
+
before { allow(Utilities).to receive(:os) { :linux } }
|
53
|
+
it { expect(Utilities).to receive(:time_at).with(%(stat -c %Y file)) { 10 } }
|
52
54
|
end
|
53
|
-
|
54
|
-
|
55
|
-
|
55
|
+
|
56
|
+
context 'on a Unix' do
|
57
|
+
before { allow(Utilities).to receive(:os) { :unix } }
|
58
|
+
it { expect(Utilities).to receive(:time_at).with(%(stat -c %Y file)) { 10 } }
|
56
59
|
end
|
57
60
|
end
|
58
61
|
|
59
|
-
describe
|
62
|
+
describe '#number_of_matching_files' do
|
60
63
|
let(:pattern) { (/\d+\.json/) }
|
61
|
-
subject {Utilities.number_of_matching_files(Dir.pwd, pattern)}
|
64
|
+
subject { Utilities.number_of_matching_files(Dir.pwd, pattern) }
|
62
65
|
|
63
66
|
around do |example|
|
64
67
|
Dir.mktmpdir do |dir|
|
@@ -68,27 +71,26 @@ describe Utilities do
|
|
68
71
|
end
|
69
72
|
end
|
70
73
|
|
71
|
-
context
|
72
|
-
it {
|
74
|
+
context 'with missing directory' do
|
75
|
+
it { expect(subject).to eq(0) }
|
73
76
|
end
|
74
77
|
|
75
|
-
context
|
78
|
+
context 'with valid files' do
|
76
79
|
before do
|
77
|
-
FileUtils.touch([
|
80
|
+
FileUtils.touch(['0.json', '1.json', '2.json'])
|
78
81
|
end
|
79
|
-
it {
|
82
|
+
it { expect(subject).to eq(3) }
|
80
83
|
end
|
81
84
|
|
82
|
-
context
|
85
|
+
context 'with invalid files' do
|
83
86
|
before do
|
84
|
-
FileUtils.touch([
|
87
|
+
FileUtils.touch(['0.json', 'incorrect.json', '1.json'])
|
85
88
|
end
|
86
|
-
it {
|
89
|
+
it { expect(subject).to eq(2) }
|
87
90
|
end
|
88
91
|
|
89
|
-
context
|
90
|
-
it {
|
92
|
+
context 'with no files' do
|
93
|
+
it { expect(subject).to eq(0) }
|
91
94
|
end
|
92
95
|
end
|
93
|
-
|
94
96
|
end
|
metadata
CHANGED
@@ -1,85 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_statistics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Jalbert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
type: :
|
19
|
+
version: 1.6.0
|
20
|
+
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.6.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :
|
33
|
+
version: '10.0'
|
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
|
-
version: '0'
|
40
|
+
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: json
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.8.3
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 1.8.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rugged
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
type: :
|
61
|
+
version: 0.23.3
|
62
|
+
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 0.23.3
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: language_sniffer
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
76
|
-
type: :
|
75
|
+
version: 1.0.2
|
76
|
+
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 1.0.2
|
83
83
|
description: git_statistics is a gem that provides detailed git statistics
|
84
84
|
email:
|
85
85
|
- kevin.j.jalbert@gmail.com
|
@@ -89,6 +89,9 @@ executables:
|
|
89
89
|
extensions: []
|
90
90
|
extra_rdoc_files: []
|
91
91
|
files:
|
92
|
+
- bin/git-statistics
|
93
|
+
- bin/git_statistics
|
94
|
+
- lib/git_statistics.rb
|
92
95
|
- lib/git_statistics/collector.rb
|
93
96
|
- lib/git_statistics/commit_summary.rb
|
94
97
|
- lib/git_statistics/commits.rb
|
@@ -99,7 +102,6 @@ files:
|
|
99
102
|
- lib/git_statistics/pipe.rb
|
100
103
|
- lib/git_statistics/utilities.rb
|
101
104
|
- lib/git_statistics/version.rb
|
102
|
-
- lib/git_statistics.rb
|
103
105
|
- spec/collector_spec.rb
|
104
106
|
- spec/commit_summary_spec.rb
|
105
107
|
- spec/commits_spec.rb
|
@@ -107,8 +109,6 @@ files:
|
|
107
109
|
- spec/log_spec.rb
|
108
110
|
- spec/pipe_spec.rb
|
109
111
|
- spec/utilities_spec.rb
|
110
|
-
- bin/git_statistics
|
111
|
-
- bin/git-statistics
|
112
112
|
homepage: https://github.com/kevinjalbert/git_statistics
|
113
113
|
licenses: []
|
114
114
|
metadata: {}
|
@@ -118,17 +118,17 @@ require_paths:
|
|
118
118
|
- lib
|
119
119
|
required_ruby_version: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- -
|
121
|
+
- - ">="
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: 1.9.3
|
124
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
125
|
requirements:
|
126
|
-
- -
|
126
|
+
- - ">="
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.
|
131
|
+
rubygems_version: 2.4.8
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: Gem that provides the ability to gather detailed git statistics
|