socialcast-git-extensions 3.1.32 → 3.1.33
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/lib/socialcast-git-extensions/git.rb +8 -3
- data/lib/socialcast-git-extensions/version.rb +1 -1
- data/socialcast-git-extensions.gemspec +2 -2
- data/spec/git_spec.rb +79 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8ea01b7fd80ae11dd510c1adc02a7b542fff16b
|
4
|
+
data.tar.gz: 4feb1e553b2a19e94c5380f15975128246ab4daa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7038bed4dbfba680c9c92501d46970ffe5dc47fdfcb349e1c8b89d7d4a7b0c7f6221a485970cebfa5595b92bb5893f65e5c279be8821678ec8d4d84a5ab5e024
|
7
|
+
data.tar.gz: 661f2006acac98cc336c3fbe568a18f8c339a024e0e43fd9c5f3c55419810847557814cb24518f9f9e53d7bdde11b0e03da6e1d4083df26853b4f09888c20b8e
|
@@ -142,17 +142,22 @@ module Socialcast
|
|
142
142
|
|
143
143
|
# build a summary of changes
|
144
144
|
def changelog_summary(branch)
|
145
|
-
changes = `git diff --
|
146
|
-
stats =
|
145
|
+
changes = `git diff --numstat origin/#{base_branch}...#{branch}`.split("\n")
|
146
|
+
stats = `git diff --shortstat origin/#{base_branch}...#{branch}`
|
147
147
|
if changes.length > 5
|
148
148
|
dirs = changes.map do |file_change|
|
149
|
-
filename = "#{file_change.split.
|
149
|
+
filename = "#{file_change.split.last}"
|
150
150
|
dir = filename.gsub(/\/[^\/]+$/, '')
|
151
151
|
dir
|
152
152
|
end
|
153
153
|
dir_counts = Hash.new(0)
|
154
154
|
dirs.each {|dir| dir_counts[dir] += 1 }
|
155
155
|
changes = dir_counts.to_a.sort_by {|k,v| v}.reverse.first(5).map {|k,v| "#{k} (#{v} file#{'s' if v > 1})"}
|
156
|
+
else
|
157
|
+
changes = changes.map do |line|
|
158
|
+
added, removed, filename = line.split
|
159
|
+
"#{filename} | #{added}+ #{removed}-"
|
160
|
+
end
|
156
161
|
end
|
157
162
|
(changes + [stats]).join("\n")
|
158
163
|
end
|
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = "socialcast-git-extensions"
|
7
7
|
s.version = Socialcast::Gitx::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ["
|
10
|
-
s.email = ["
|
9
|
+
s.authors = ["Socialcast"]
|
10
|
+
s.email = ["developers@socialcast.com"]
|
11
11
|
s.homepage = "http://github.com/socialcast/socialcast-git-extensions"
|
12
12
|
s.summary = %q{git extension scripts for socialcast workflow}
|
13
13
|
s.description = %q{GIT it done!}
|
data/spec/git_spec.rb
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Socialcast::Gitx::Git do
|
4
|
+
before do
|
5
|
+
stub_const 'TestClass', Class.new { |k| include Socialcast::Gitx::Git }
|
6
|
+
allow_any_instance_of(TestClass).to receive(:'`') do |_instance, _cmd|
|
7
|
+
raise 'Unstubbed backticks detected'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
let(:test_instance) { TestClass.new }
|
11
|
+
subject { test_instance }
|
12
|
+
|
13
|
+
describe '#changelog_summary' do
|
14
|
+
subject { test_instance.send(:changelog_summary, branch) }
|
15
|
+
let(:base_branch) { 'master' }
|
16
|
+
let(:branch) { 'my-branch' }
|
17
|
+
let(:numstat_command) { 'git diff --numstat origin/master...my-branch' }
|
18
|
+
let(:shortstat_command) { 'git diff --shortstat origin/master...my-branch' }
|
19
|
+
before do
|
20
|
+
allow(test_instance).to receive(:base_branch).and_return(base_branch)
|
21
|
+
expect(test_instance).to receive(:'`').with(numstat_command).and_return(numstat_output)
|
22
|
+
expect(test_instance).to receive(:'`').with(shortstat_command).and_return(shortstat_output)
|
23
|
+
end
|
24
|
+
context 'when fewer than 6 files are changed' do
|
25
|
+
let(:shortstat_output) do
|
26
|
+
<<-EOS.strip_heredoc
|
27
|
+
5 files changed, 34 insertions(+), 129 deletions(-)
|
28
|
+
EOS
|
29
|
+
end
|
30
|
+
let(:numstat_output) do
|
31
|
+
<<-EOS.strip_heredoc
|
32
|
+
11 4 engines/shoelaces/app/models/hightop.rb
|
33
|
+
21 4 engines/shoelaces/spec/models/hightop_spec.rb
|
34
|
+
2 2 engines/shoelaces/spec/models/bowling_spec.rb
|
35
|
+
0 58 lib/tasks/images.rake
|
36
|
+
0 61 script/img_dev.rb
|
37
|
+
EOS
|
38
|
+
end
|
39
|
+
it 'shows file level detail and overall stats' do
|
40
|
+
is_expected.to eq <<-EOS.strip_heredoc
|
41
|
+
engines/shoelaces/app/models/hightop.rb | 11+ 4-
|
42
|
+
engines/shoelaces/spec/models/hightop_spec.rb | 21+ 4-
|
43
|
+
engines/shoelaces/spec/models/bowling_spec.rb | 2+ 2-
|
44
|
+
lib/tasks/images.rake | 0+ 58-
|
45
|
+
script/img_dev.rb | 0+ 61-
|
46
|
+
5 files changed, 34 insertions(+), 129 deletions(-)
|
47
|
+
EOS
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'when 6 or more files are changed' do
|
52
|
+
let(:shortstat_output) do
|
53
|
+
<<-EOS.strip_heredoc
|
54
|
+
6 files changed, 35 insertions(+), 129 deletions(-)
|
55
|
+
EOS
|
56
|
+
end
|
57
|
+
let(:numstat_output) do
|
58
|
+
<<-EOS.strip_heredoc
|
59
|
+
11 4 engines/shoelaces/app/models/hightop.rb
|
60
|
+
21 4 engines/shoelaces/spec/models/hightop_spec.rb
|
61
|
+
2 2 engines/shoelaces/spec/models/bowling_spec.rb
|
62
|
+
0 58 lib/tasks/images.rake
|
63
|
+
0 61 script/img_dev.rb
|
64
|
+
1 0 doc/images.md
|
65
|
+
EOS
|
66
|
+
end
|
67
|
+
it 'summarizes the changes by directory' do
|
68
|
+
is_expected.to eq <<-EOS.strip_heredoc
|
69
|
+
engines/shoelaces/spec/models (2 files)
|
70
|
+
lib/tasks (1 file)
|
71
|
+
script (1 file)
|
72
|
+
doc (1 file)
|
73
|
+
engines/shoelaces/app/models (1 file)
|
74
|
+
6 files changed, 35 insertions(+), 129 deletions(-)
|
75
|
+
EOS
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: socialcast-git-extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.33
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Socialcast
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grit
|
@@ -138,7 +138,7 @@ dependencies:
|
|
138
138
|
version: '1.21'
|
139
139
|
description: GIT it done!
|
140
140
|
email:
|
141
|
-
-
|
141
|
+
- developers@socialcast.com
|
142
142
|
executables:
|
143
143
|
- git-backportpr
|
144
144
|
- git-cleanup
|
@@ -188,6 +188,7 @@ files:
|
|
188
188
|
- lib/socialcast-git-extensions/version.rb
|
189
189
|
- socialcast-git-extensions.gemspec
|
190
190
|
- spec/cli_spec.rb
|
191
|
+
- spec/git_spec.rb
|
191
192
|
- spec/spec_helper.rb
|
192
193
|
homepage: http://github.com/socialcast/socialcast-git-extensions
|
193
194
|
licenses: []
|
@@ -214,4 +215,5 @@ specification_version: 4
|
|
214
215
|
summary: git extension scripts for socialcast workflow
|
215
216
|
test_files:
|
216
217
|
- spec/cli_spec.rb
|
218
|
+
- spec/git_spec.rb
|
217
219
|
- spec/spec_helper.rb
|