socialcast-git-extensions 2.3.5 → 2.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -50,7 +50,19 @@ else
50
50
  end
51
51
 
52
52
  short_description = description.split("\n").first(5).join("\n")
53
- stats = `git diff --stat master...#{branch}`
53
+ changes = `git diff --stat master...#{branch}`.split("\n")
54
+ stats = changes.pop
55
+ if changes.length > 5
56
+ dirs = changes.map do |file_change|
57
+ filename = "#{file_change.split.first}"
58
+ dir = filename.gsub(/\/[^\/]+$/, '')
59
+ dir
60
+ end
61
+ dir_counts = Hash.new(0)
62
+ dirs.each {|dir| dir_counts[dir] += 1 }
63
+ changes = dir_counts.to_a.sort_by {|k,v| v}.reverse.first(5).map {|k,v| "#{k} (#{v} file#{'s' if v > 1})"}
64
+ end
65
+ change_summary = (changes + [stats]).join("\n")
54
66
 
55
67
  repo = `git config -z --get remote.origin.url`.strip
56
68
  # ex: git@github.com:socialcast/socialcast-git-extensions.git
@@ -58,7 +70,7 @@ repo = repo.scan(/:(.+\/.+)\./).first.first
58
70
  url = create_pull_request username, password, branch, repo, description
59
71
 
60
72
  if url
61
- review_message = ["@SocialcastDevelopers #reviewrequest for #{branch} #scgitx", short_description, stats].join("\n\n")
73
+ review_message = ["@SocialcastDevelopers #reviewrequest for #{branch} #scgitx", short_description, change_summary].join("\n\n")
62
74
  share review_message, {:url => url, :message_type => 'review_request'}
63
75
  else
64
76
  HighLine.say "Skipping socialcast announcement"
@@ -1,5 +1,5 @@
1
1
  module Socialcast
2
2
  module Gitx
3
- VERSION = "2.3.5"
3
+ VERSION = "2.3.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socialcast-git-extensions
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 3
9
- - 5
10
- version: 2.3.5
9
+ - 6
10
+ version: 2.3.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Sonnek