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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/modernize/gemspec.rb +5 -17
- data/lib/bake/modernize/license.rb +25 -6
- data/lib/bake/modernize/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90130235dfa991ea6c2a2e44747bd1af6a6af02ede3ca0d26fe883f5d270076d
|
4
|
+
data.tar.gz: '084c5bbc66e242bb232585034ccfef70e46cf53b563311d4d16abdcd775b3a53'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1a186343dfcb4cc628e8c83253c03449e34e9d76912285224bdc8d2ad322612d35a1768b1c0115adf1c480727507435cc59148c4a3a477a3117a58e1ae982ce
|
7
|
+
data.tar.gz: 8aa617e6cad8690923eabdd00dab64af5e2f292d663b92981e1e7fbc0d78baf7aa0c970840cfef63b1a6d128ee16608f55f3396b7313c8435c117fa899aca2b4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bake/modernize/gemspec.rb
CHANGED
@@ -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(
|
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(
|
224
|
-
|
223
|
+
def sorted_authors(root)
|
224
|
+
authorship = Bake::Modernize::License::Authorship.new
|
225
|
+
authorship.extract(root)
|
225
226
|
|
226
|
-
|
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
|
-
|
150
|
-
|
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
|
-
|
240
|
+
add(new_path, author, commit.time, commit.oid)
|
222
241
|
end
|
223
242
|
end
|
224
243
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|