bake-modernize 0.19.4 → 0.21.0
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/contributors.rb +53 -0
- data/bake/modernize/gemspec.rb +1 -1
- data/lib/bake/modernize/license.rb +32 -4
- data/lib/bake/modernize/version.rb +1 -1
- data/template/actions/.github/workflows/test-external.yaml +0 -1
- data/template/actions/.github/workflows/test.yaml +0 -1
- data.tar.gz.sig +0 -0
- metadata +5 -4
- 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: 97619ecf26d612765128d5d230c2ef3eaf1206672924340fc4d39b954fb9b57a
|
4
|
+
data.tar.gz: 6902a97b42d283fdd766bf9ed1da7fcc9d48b5a5aa99ccadb4b258ac4c3bcc97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d40bb9823d62852a886c663d501b3834eadce9b81535a090d5b5641e59d9a8dab76896f38256bcd1afefdb20287428b616a402c4a3cc07da0e4dc333c3d3e38
|
7
|
+
data.tar.gz: 6a8e1e291023423f566ec76147f93aab94a63587f1596e2e44a6758458f092eb14663c11384f98deeaf5532d3a608d9248be782a1a8f5e519e996d9ed62bcbe8
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2024, by Samuel Williams.
|
5
|
+
|
6
|
+
def initialize(context)
|
7
|
+
super
|
8
|
+
|
9
|
+
require 'bake/modernize/license'
|
10
|
+
end
|
11
|
+
|
12
|
+
# Extract changes from a repository and generate a list of contributors.
|
13
|
+
# @parameter root [String] The root directory of the repository.
|
14
|
+
# @parameter paths [Array(String)] The paths to extract changes from.
|
15
|
+
def extract(root:, paths:)
|
16
|
+
authorship = Bake::Modernize::License::Authorship.new
|
17
|
+
|
18
|
+
authorship.extract(root)
|
19
|
+
|
20
|
+
modifications = []
|
21
|
+
|
22
|
+
paths.each do |path|
|
23
|
+
authorship.paths[path].each do |modification|
|
24
|
+
modification = modification.to_h
|
25
|
+
|
26
|
+
if modification[:path] != path
|
27
|
+
modification[:original_path] = modification[:path]
|
28
|
+
modification[:path] = path
|
29
|
+
end
|
30
|
+
|
31
|
+
modifications << modification
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
modifications.sort_by!{|modification| modification[:time]}
|
36
|
+
|
37
|
+
return modifications
|
38
|
+
end
|
39
|
+
|
40
|
+
# Map the changes to a new path.
|
41
|
+
# @parameter input [Array(Hash)] The list of changes.
|
42
|
+
# @parameter original_path [String] The original path of the changes.
|
43
|
+
# @parameter path [String] The path that now contains the content of the original changes.
|
44
|
+
def map(original_path, path, input:)
|
45
|
+
input.each do |modification|
|
46
|
+
if modification[:path] == original_path
|
47
|
+
modification[:original_path] = modification[:path]
|
48
|
+
modification[:path] = path
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
return input
|
53
|
+
end
|
data/bake/modernize/gemspec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2022-
|
4
|
+
# Copyright, 2022-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
require 'rugged'
|
7
7
|
require 'yaml'
|
@@ -89,7 +89,8 @@ module Bake
|
|
89
89
|
line.match(PATTERN)
|
90
90
|
end
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
|
+
# Extract contributors from a YAML file which can be generated from another repository.
|
93
94
|
class Contributors
|
94
95
|
# 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.
|
95
96
|
DEFAULT_PATH = '.'
|
@@ -110,15 +111,32 @@ module Bake
|
|
110
111
|
|
111
112
|
def each(&block)
|
112
113
|
@contributions.each do |contribution|
|
113
|
-
|
114
|
+
author = contribution[:author]
|
115
|
+
time = contribution[:time]
|
116
|
+
|
117
|
+
paths_for(contribution) do |path|
|
118
|
+
yield path, author, time
|
119
|
+
end
|
114
120
|
end
|
115
121
|
end
|
116
122
|
|
117
123
|
def extract(path)
|
118
124
|
@contributions.concat(
|
119
|
-
YAML.load_file(path, aliases: true, symbolize_names: true, permitted_classes: [Date, Time])
|
125
|
+
YAML.load_file(path, aliases: true, symbolize_names: true, permitted_classes: [Symbol, Date, Time])
|
120
126
|
)
|
121
127
|
end
|
128
|
+
|
129
|
+
def paths_for(contribution)
|
130
|
+
if path = contribution[:path]
|
131
|
+
yield path
|
132
|
+
# elsif paths = contribution[:paths]
|
133
|
+
# paths.each do |path|
|
134
|
+
# yield path
|
135
|
+
# end
|
136
|
+
else
|
137
|
+
yield DEFAULT_PATH
|
138
|
+
end
|
139
|
+
end
|
122
140
|
end
|
123
141
|
|
124
142
|
class Authorship
|
@@ -130,6 +148,15 @@ module Bake
|
|
130
148
|
def key
|
131
149
|
self.id || "#{self.author[:email]}:#{self.time.iso8601}"
|
132
150
|
end
|
151
|
+
|
152
|
+
def to_h
|
153
|
+
{
|
154
|
+
id: id,
|
155
|
+
time: time,
|
156
|
+
path: path,
|
157
|
+
author: author,
|
158
|
+
}
|
159
|
+
end
|
133
160
|
end
|
134
161
|
|
135
162
|
Copyright = Struct.new(:dates, :author) do
|
@@ -149,6 +176,7 @@ module Bake
|
|
149
176
|
end
|
150
177
|
|
151
178
|
attr :paths
|
179
|
+
attr :commits
|
152
180
|
|
153
181
|
def add(path, author, time, id = nil)
|
154
182
|
modification = Modification.new(author, time, path, id)
|
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.
|
4
|
+
version: 0.21.0
|
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: 2024-01
|
41
|
+
date: 2024-04-01 00:00:00.000000000 Z
|
42
42
|
dependencies:
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: async-http
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- bake/modernize.rb
|
120
120
|
- bake/modernize/actions.rb
|
121
121
|
- bake/modernize/contributing.rb
|
122
|
+
- bake/modernize/contributors.rb
|
122
123
|
- bake/modernize/editorconfig.rb
|
123
124
|
- bake/modernize/frozen_string_literal.rb
|
124
125
|
- bake/modernize/gemfile.rb
|
@@ -152,14 +153,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
153
|
requirements:
|
153
154
|
- - ">="
|
154
155
|
- !ruby/object:Gem::Version
|
155
|
-
version: '3.
|
156
|
+
version: '3.1'
|
156
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
158
|
requirements:
|
158
159
|
- - ">="
|
159
160
|
- !ruby/object:Gem::Version
|
160
161
|
version: '0'
|
161
162
|
requirements: []
|
162
|
-
rubygems_version: 3.5.
|
163
|
+
rubygems_version: 3.5.3
|
163
164
|
signing_key:
|
164
165
|
specification_version: 4
|
165
166
|
summary: Automatically modernize parts of your project/gem.
|
metadata.gz.sig
CHANGED
Binary file
|