bake-modernize 0.17.4 → 0.17.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65d6b9a42133ae86ab48a97a908f5539b0223f1bf7fec948f5f3cd20d178e043
4
- data.tar.gz: 7390a861caca26af8389d00da3409722eb08632f4a2e7f0db4c6938ba12e2c42
3
+ metadata.gz: 90130235dfa991ea6c2a2e44747bd1af6a6af02ede3ca0d26fe883f5d270076d
4
+ data.tar.gz: '084c5bbc66e242bb232585034ccfef70e46cf53b563311d4d16abdcd775b3a53'
5
5
  SHA512:
6
- metadata.gz: 44a727be6bc7dd4e3a4edd7b6d4b022139314fecd9b8305cdc2e573f5eee726cedb81873cb25362900038c851a6e8bf483f218ae043479069110a61cd5cd81fc
7
- data.tar.gz: 7dc3a78ad44ce97113ca1e63558e059c14c168a9b6ef6563f899b5ad14695a661aabd57f6457df5f404b37002d2b8a22f38cb0a8b0f41d0635498061f92ad83c
6
+ metadata.gz: e1a186343dfcb4cc628e8c83253c03449e34e9d76912285224bdc8d2ad322612d35a1768b1c0115adf1c480727507435cc59148c4a3a477a3117a58e1ae982ce
7
+ data.tar.gz: 8aa617e6cad8690923eabdd00dab64af5e2f292d663b92981e1e7fbc0d78baf7aa0c970840cfef63b1a6d128ee16608f55f3396b7313c8435c117fa899aca2b4
checksums.yaml.gz.sig CHANGED
Binary file
@@ -33,7 +33,7 @@ def update(path: default_gemspec_path, output: $stdout)
33
33
  spec.metadata["funding_uri"] ||= detect_funding_uri(spec)
34
34
  spec.metadata["documentation_uri"] ||= detect_documentation_uri(spec)
35
35
 
36
- spec.authors = sorted_authors(spec)
36
+ spec.authors = sorted_authors(Dir.pwd)
37
37
 
38
38
  spec.metadata.delete_if{|_, value| value.nil?}
39
39
 
@@ -220,23 +220,11 @@ def detect_documentation_uri(spec)
220
220
  end
221
221
  end
222
222
 
223
- def sorted_authors(spec)
224
- input, output = IO.pipe
223
+ def sorted_authors(root)
224
+ authorship = Bake::Modernize::License::Authorship.new
225
+ authorship.extract(root)
225
226
 
226
- pid = Process.spawn("git", "log", "--format=%aN", out: output)
227
- output.close
228
-
229
- authors = Hash.new{|h,k| h[k] = 0}
230
-
231
- input.each_line do |author|
232
- author = author.chomp!
233
- authors[author] += 1
234
- end
235
-
236
- Process.wait(pid)
237
- input.close
238
-
239
- return authors.sort_by{|k,v| [-v, k]}.map(&:first)
227
+ return authorship.sorted_authors
240
228
  end
241
229
 
242
230
  IGNORE_GEMS = %w[
@@ -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)
@@ -165,6 +172,18 @@ module Bake
165
172
  return self
166
173
  end
167
174
 
175
+ def sorted_authors
176
+ authors = Hash.new{|h,k| h[k] = 0}
177
+
178
+ @commits.each do |key, modifications|
179
+ modifications.map(&:full_name).uniq.each do |full_name|
180
+ authors[full_name] += 1
181
+ end
182
+ end
183
+
184
+ return authors.sort_by{|k,v| [-v, k]}.map(&:first)
185
+ end
186
+
168
187
  def copyrights
169
188
  copyrights_for_modifications(@paths.values.flatten)
170
189
  end
@@ -218,7 +237,7 @@ module Bake
218
237
  end
219
238
  end
220
239
 
221
- @paths[new_path] << Modification.new(author, commit.time, new_path)
240
+ add(new_path, author, commit.time, commit.oid)
222
241
  end
223
242
  end
224
243
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Bake
7
7
  module Modernize
8
- VERSION = "0.17.4"
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.4
4
+ version: 0.17.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file