bake-modernize 0.17.5 → 0.17.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6bf8c1f1f973846d16af55aa30a9b62960b2db001d80e7a19506161a9992203
4
- data.tar.gz: 047c44563a79018b3163b9dabf1498d23b9f538c3f18a403177b580fb3156157
3
+ metadata.gz: 90130235dfa991ea6c2a2e44747bd1af6a6af02ede3ca0d26fe883f5d270076d
4
+ data.tar.gz: '084c5bbc66e242bb232585034ccfef70e46cf53b563311d4d16abdcd775b3a53'
5
5
  SHA512:
6
- metadata.gz: fbea3be9c9830f12f1590704cfddd527bdc7a7876b0cd00b9b6e008c6c17e9a6282dfe2c975ced005292925b57c08e433f374a9de3ba7b49bf9de91d713cef15
7
- data.tar.gz: 18b73153b2156878413a7dd34b232e12cb4477b2cedf070c4d11bf2ed10a758d7036bfe9c39f436956e24329a2e1a01d48bf3cf4523cf4370ef44806d9c1b8aa
6
+ metadata.gz: e1a186343dfcb4cc628e8c83253c03449e34e9d76912285224bdc8d2ad322612d35a1768b1c0115adf1c480727507435cc59148c4a3a477a3117a58e1ae982ce
7
+ data.tar.gz: 8aa617e6cad8690923eabdd00dab64af5e2f292d663b92981e1e7fbc0d78baf7aa0c970840cfef63b1a6d128ee16608f55f3396b7313c8435c117fa899aca2b4
checksums.yaml.gz.sig CHANGED
Binary file
@@ -122,10 +122,14 @@ module Bake
122
122
  end
123
123
 
124
124
  class Authorship
125
- Modification = Struct.new(:author, :time, :path) do
125
+ Modification = Struct.new(:author, :time, :path, :id) do
126
126
  def full_name
127
127
  author[:name]
128
128
  end
129
+
130
+ def key
131
+ self.id || "#{self.author[:email]}:#{self.time.iso8601}"
132
+ end
129
133
  end
130
134
 
131
135
  Copyright = Struct.new(:dates, :author) do
@@ -140,14 +144,17 @@ module Bake
140
144
  end
141
145
 
142
146
  def initialize
143
- @paths = {}
147
+ @paths = Hash.new{|h,k| h[k] = []}
148
+ @commits = Hash.new{|h,k| h[k] = []}
144
149
  end
145
150
 
146
151
  attr :paths
147
152
 
148
- def add(path, author, time)
149
- @paths[path] ||= []
150
- @paths[path] << Modification.new(author, time, path)
153
+ def add(path, author, time, id = nil)
154
+ modification = Modification.new(author, time, path, id)
155
+
156
+ @commits[modification.key] << modification
157
+ @paths[path] << modification
151
158
  end
152
159
 
153
160
  def extract(root = Dir.pwd)
@@ -168,9 +175,9 @@ module Bake
168
175
  def sorted_authors
169
176
  authors = Hash.new{|h,k| h[k] = 0}
170
177
 
171
- @paths.each do |path, modifications|
172
- modifications.each do |modification|
173
- authors[modification.full_name] += 1
178
+ @commits.each do |key, modifications|
179
+ modifications.map(&:full_name).uniq.each do |full_name|
180
+ authors[full_name] += 1
174
181
  end
175
182
  end
176
183
 
@@ -230,7 +237,7 @@ module Bake
230
237
  end
231
238
  end
232
239
 
233
- @paths[new_path] << Modification.new(author, commit.time, new_path)
240
+ add(new_path, author, commit.time, commit.oid)
234
241
  end
235
242
  end
236
243
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Bake
7
7
  module Modernize
8
- VERSION = "0.17.5"
8
+ VERSION = "0.17.6"
9
9
  end
10
10
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bake-modernize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.5
4
+ version: 0.17.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file