bake-modernize 0.14.1 → 0.14.3

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: a7c628b23ad3f6c917cecca7b5f0b81cd18047eeb4b60e64146394638a5cb141
4
- data.tar.gz: 01a578fd9f4a36e9881b1954317dcca8ab78bbf6234701a8818b0aa0eb88fa4b
3
+ metadata.gz: e47d126f23b96ed593098da55ac6b7d66d8da92e92e7c2e68525a8ac9d492702
4
+ data.tar.gz: 7f3c41662a9fd909a721d6e68286ab8968cb5f11717010a5d6adb230fdb51b71
5
5
  SHA512:
6
- metadata.gz: f133f854aaf6d0b309d4ae29efe814563541eb781b8d3882654ff6a80a144213ddcf582b1b1f3727c3e3fb6bc66b7548e17ac3af508b59e7b74db6b8bc1ccdcd
7
- data.tar.gz: 20a7299113e214c81a26aebda737a604218c33353e9258e27ad1ffaf5df2a477a86bd093e4ff6aadcac53bee1c0e2eb6a5dd086c110d5ac2d77df4747d2effd9
6
+ metadata.gz: 4fb1cd52d9464fe4c6b746003b170204fba329c24bf485ab8da6bb40add0415821fd753d2a9a2397667d302b50f3632b7f3ff693aada11e5e6e3031f6be416e9
7
+ data.tar.gz: a485d8c283beb8a6414abd52e1823635950f743a6f9dfdf4471fc6cf4756d8ce796ebcf138b59270f8e16f8795e6798731cc3095cb78b02dfae8d7e4a11e0990
checksums.yaml.gz.sig CHANGED
Binary file
@@ -4,6 +4,7 @@
4
4
  # Copyright, 2022, by Samuel Williams.
5
5
 
6
6
  require 'rugged'
7
+ require 'yaml'
7
8
 
8
9
  module Bake
9
10
  module Modernize
@@ -42,6 +43,35 @@ module Bake
42
43
  end
43
44
  end
44
45
 
46
+ class Contributors
47
+ # The default path is the root of the repository and for authors who have contributed to the entire repository or unspecified paths in the past.
48
+ DEFAULT_PATH = '.'
49
+
50
+ def self.for(root)
51
+ full_path = File.join(root, '.contributors.yaml')
52
+
53
+ if File.exist?(full_path)
54
+ contributors = self.new
55
+ contributors.extract(full_path)
56
+ return contributors
57
+ end
58
+ end
59
+
60
+ def initialize
61
+ @contributions = []
62
+ end
63
+
64
+ def each(&block)
65
+ @contributions.each do |contribution|
66
+ yield (contribution[:path] || DEFAULT_PATH), contribution[:author], contribution[:time]
67
+ end
68
+ end
69
+
70
+ def extract(path)
71
+ YAML.load_file(path, aliases: true, symbolize_names: true, permitted_classes: [Date, Time])
72
+ end
73
+ end
74
+
45
75
  class Authorship
46
76
  Modification = Struct.new(:author, :time, :path) do
47
77
  def full_name
@@ -66,9 +96,20 @@ module Bake
66
96
 
67
97
  attr :paths
68
98
 
99
+ def add(author, time, path)
100
+ @paths[path] ||= []
101
+ @paths[path] << Modification.new(author, time, path)
102
+ end
103
+
69
104
  def extract(root = Dir.pwd)
70
105
  mailmap = Mailmap.for(root)
71
106
 
107
+ if contributors = Contributors.for(root)
108
+ contributors.each do |author, time, path|
109
+ add(author, time, path)
110
+ end
111
+ end
112
+
72
113
  walk(Rugged::Repository.discover(root), mailmap: mailmap)
73
114
 
74
115
  return self
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Bake
7
7
  module Modernize
8
- VERSION = "0.14.1"
8
+ VERSION = "0.14.3"
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.14.1
4
+ version: 0.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -38,7 +38,7 @@ cert_chain:
38
38
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
39
39
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
40
40
  -----END CERTIFICATE-----
41
- date: 2023-01-07 00:00:00.000000000 Z
41
+ date: 2023-01-18 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: async-http
metadata.gz.sig CHANGED
Binary file