bake-modernize 0.14.1 → 0.14.2

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: d59918cbe614fb303d0eb679b167205430ba98ad6584fb24408466a7d1a4da7a
4
+ data.tar.gz: 8a0fa7d2d03cd7851fabc5a38812f01e61704229a7be2caee72cc75769a7def9
5
5
  SHA512:
6
- metadata.gz: f133f854aaf6d0b309d4ae29efe814563541eb781b8d3882654ff6a80a144213ddcf582b1b1f3727c3e3fb6bc66b7548e17ac3af508b59e7b74db6b8bc1ccdcd
7
- data.tar.gz: 20a7299113e214c81a26aebda737a604218c33353e9258e27ad1ffaf5df2a477a86bd093e4ff6aadcac53bee1c0e2eb6a5dd086c110d5ac2d77df4747d2effd9
6
+ metadata.gz: 61d8594e2e976bd22619bbb34016c96e8fcd1622adba9610105a64c86ff06809405d6b16cd57a46215bb5b1262fbad05f2f6597dd1acaa991edaeb520bd1be57
7
+ data.tar.gz: b8db4b4096a4a409d179062c8652d2f10f6394fa92ca6bed74d82b7693dd1ada770f106f191014269183a0a07ce2ef8b1a63dc8625c7e60d0e163081ed0413e6
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)
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.2"
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.2
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-17 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