bake-modernize 0.28.0 → 0.30.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/actions.rb +6 -6
- data/bake/modernize/contributing.rb +3 -3
- data/bake/modernize/contributors.rb +1 -1
- data/bake/modernize/editorconfig.rb +3 -3
- data/bake/modernize/gemfile.rb +2 -2
- data/bake/modernize/gemspec.rb +10 -10
- data/bake/modernize/git.rb +4 -4
- data/bake/modernize/license.rb +3 -3
- data/bake/modernize/readme.rb +3 -3
- data/bake/modernize/rubocop.rb +3 -3
- data/bake/modernize/signing.rb +2 -2
- data/bake/modernize.rb +10 -10
- data/lib/bake/modernize/license.rb +7 -7
- data/lib/bake/modernize/version.rb +1 -1
- data/lib/bake/modernize.rb +5 -5
- data/template/actions/.github/workflows/test-coverage.yaml +2 -2
- data/template/rubocop/.rubocop.yml +4 -0
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: '069754fbdd6efc12b1f6f5b6111e6ed9f1091abd16811f5a0c7f2684e863c906'
|
4
|
+
data.tar.gz: 2d2dc88f71e811a3489745b3efb3d3c7e2b4868e7899d4156cd5853006fd9cbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd3ec9677fff6c61ca56fafb2c5fa4fdffb1f6269fa50431864a4939050e0e8441bea209097d0003b82e7144f690c25e1413d12b45e5765b041f0232fd69e369
|
7
|
+
data.tar.gz: 47311d3e9a166128a4fb2c8ddb188667218dae4ca9842ffa37b5770cd3e011286ecaafd8b117d8498932fe81dc62295efb3ba613368f65971e02365e85e0ca18
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bake/modernize/actions.rb
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2020-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
6
|
+
require "bake/modernize"
|
7
|
+
require "rugged"
|
8
|
+
require "markly"
|
9
|
+
require "build/files/system"
|
10
10
|
|
11
11
|
def actions
|
12
12
|
update(root: Dir.pwd)
|
@@ -21,7 +21,7 @@ def update(root:)
|
|
21
21
|
|
22
22
|
update_filenames(root)
|
23
23
|
|
24
|
-
template_root = Bake::Modernize.template_path_for(
|
24
|
+
template_root = Bake::Modernize.template_path_for("actions")
|
25
25
|
Bake::Modernize.copy_template(template_root, root)
|
26
26
|
|
27
27
|
readme_path = ["README.md", "readme.md"].find{|path| File.exist?(File.expand_path(path, root))}
|
@@ -62,7 +62,7 @@ end
|
|
62
62
|
|
63
63
|
def repository_url(root)
|
64
64
|
repository = Rugged::Repository.discover(root)
|
65
|
-
git_url = repository.remotes[
|
65
|
+
git_url = repository.remotes["origin"].url
|
66
66
|
|
67
67
|
if match = git_url.match(/@(?<url>.*?):(?<path>.*?)(\.git)?\z/)
|
68
68
|
return "https://#{match[:url]}/#{match[:path]}"
|
@@ -3,15 +3,15 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2023-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
6
|
+
require "bake/modernize"
|
7
|
+
require "markly"
|
8
8
|
|
9
9
|
def contributing
|
10
10
|
if conduct_path = Dir["conduct.md"]
|
11
11
|
FileUtils.rm_f(conduct_path)
|
12
12
|
end
|
13
13
|
|
14
|
-
update_contributing(File.join(Dir.pwd,
|
14
|
+
update_contributing(File.join(Dir.pwd, "readme.md"))
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2020-
|
4
|
+
# Copyright, 2020-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
6
|
+
require "bake/modernize"
|
7
7
|
|
8
8
|
def editorconfig
|
9
9
|
update(root: Dir.pwd)
|
10
10
|
end
|
11
11
|
|
12
12
|
def update(root:)
|
13
|
-
template_root = Bake::Modernize.template_path_for(
|
13
|
+
template_root = Bake::Modernize.template_path_for("editorconfig")
|
14
14
|
Bake::Modernize.copy_template(template_root, root)
|
15
15
|
end
|
data/bake/modernize/gemfile.rb
CHANGED
data/bake/modernize/gemspec.rb
CHANGED
@@ -51,12 +51,12 @@ def update(path: default_gemspec_path, output: $stdout)
|
|
51
51
|
output.puts "\tspec.authors = #{spec.authors.inspect}"
|
52
52
|
output.puts "\tspec.license = #{spec.license.inspect}"
|
53
53
|
|
54
|
-
certificate_path = File.expand_path(
|
54
|
+
certificate_path = File.expand_path("release.cert", root)
|
55
55
|
|
56
56
|
if File.exist?(certificate_path)
|
57
57
|
output.puts "\t"
|
58
|
-
output.puts "\tspec.cert_chain = [
|
59
|
-
output.puts "\tspec.signing_key = File.expand_path(
|
58
|
+
output.puts "\tspec.cert_chain = [\"release.cert\"]"
|
59
|
+
output.puts "\tspec.signing_key = File.expand_path(\"~/.gem/release.pem\")"
|
60
60
|
end
|
61
61
|
|
62
62
|
if spec.homepage and !spec.homepage.empty?
|
@@ -76,8 +76,8 @@ def update(path: default_gemspec_path, output: $stdout)
|
|
76
76
|
output.puts "\t"
|
77
77
|
output.puts "\tspec.files = #{directory_glob_for(spec)}"
|
78
78
|
|
79
|
-
if spec.require_paths != [
|
80
|
-
output.puts "\tspec.require_paths = [
|
79
|
+
if spec.require_paths != ["lib"]
|
80
|
+
output.puts "\tspec.require_paths = [\"lib\"]"
|
81
81
|
end
|
82
82
|
|
83
83
|
if executables = spec.executables and executables.any?
|
@@ -132,15 +132,15 @@ def directory_glob_for(spec, paths = spec.files)
|
|
132
132
|
directories[directory] = true
|
133
133
|
end
|
134
134
|
|
135
|
-
if basename.start_with?(
|
135
|
+
if basename.start_with?(".")
|
136
136
|
dotfiles = true
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
140
|
if dotfiles
|
141
|
-
return "Dir.glob([
|
141
|
+
return "Dir.glob([\"{#{directories.keys.join(',')}}/**/*\", \"*.md\"], File::FNM_DOTMATCH, base: __dir__)"
|
142
142
|
else
|
143
|
-
return "Dir[
|
143
|
+
return "Dir[\"{#{directories.keys.join(',')}}/**/*\", \"*.md\", base: __dir__]"
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
@@ -174,8 +174,8 @@ def version_path(root)
|
|
174
174
|
Dir["lib/**/version.rb", base: root].first
|
175
175
|
end
|
176
176
|
|
177
|
-
require
|
178
|
-
require
|
177
|
+
require "async"
|
178
|
+
require "async/http/internet"
|
179
179
|
|
180
180
|
def valid_uri?(uri)
|
181
181
|
Sync do
|
data/bake/modernize/git.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2021-
|
4
|
+
# Copyright, 2021-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
6
|
+
require "bake/modernize"
|
7
7
|
|
8
8
|
def git
|
9
9
|
update(root: Dir.pwd)
|
@@ -18,7 +18,7 @@ def update(root:)
|
|
18
18
|
|
19
19
|
current_gitignore_custom_lines = self.current_gitignore_custom_lines(root)
|
20
20
|
|
21
|
-
template_root = Bake::Modernize.template_path_for(
|
21
|
+
template_root = Bake::Modernize.template_path_for("git")
|
22
22
|
Bake::Modernize.copy_template(template_root, root)
|
23
23
|
|
24
24
|
if current_gitignore_custom_lines
|
@@ -44,7 +44,7 @@ def current_gitignore_custom_lines(root)
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def current_branch
|
47
|
-
require
|
47
|
+
require "open3"
|
48
48
|
|
49
49
|
output, status = Open3.capture2("git", "branch", "--show-current")
|
50
50
|
|
data/bake/modernize/license.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
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
|
-
require
|
7
|
-
require
|
6
|
+
require "bake/modernize"
|
7
|
+
require "markly"
|
8
8
|
|
9
9
|
LICENSE = <<~LICENSE
|
10
10
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
data/bake/modernize/readme.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2022, by Samuel Williams.
|
4
|
+
# Copyright, 2022-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
6
|
+
require "bake/modernize"
|
7
|
+
require "build/files/system"
|
8
8
|
|
9
9
|
def readme
|
10
10
|
update(root: Dir.pwd)
|
data/bake/modernize/rubocop.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
6
|
+
require "bake/modernize"
|
7
|
+
require "build/files/system"
|
8
8
|
|
9
9
|
def rubocop
|
10
10
|
update(root: Dir.pwd)
|
@@ -13,7 +13,7 @@ end
|
|
13
13
|
def update(root:)
|
14
14
|
system("bundle", "add", "rubocop", "--group", "test", chdir: root)
|
15
15
|
|
16
|
-
template_root = Bake::Modernize.template_path_for(
|
16
|
+
template_root = Bake::Modernize.template_path_for("rubocop")
|
17
17
|
Bake::Modernize.copy_template(template_root, root)
|
18
18
|
|
19
19
|
system("bundle", "update", chdir: root)
|
data/bake/modernize/signing.rb
CHANGED
data/bake/modernize.rb
CHANGED
@@ -5,15 +5,15 @@
|
|
5
5
|
|
6
6
|
def modernize
|
7
7
|
call(
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
8
|
+
"modernize:git",
|
9
|
+
"modernize:readme",
|
10
|
+
"modernize:actions",
|
11
|
+
"modernize:editorconfig",
|
12
|
+
"modernize:gemfile",
|
13
|
+
"modernize:rubocop",
|
14
|
+
"modernize:signing",
|
15
|
+
"modernize:gemspec",
|
16
|
+
"modernize:license",
|
17
|
+
"modernize:contributing",
|
18
18
|
)
|
19
19
|
end
|
@@ -3,8 +3,8 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2022-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
6
|
+
require "rugged"
|
7
|
+
require "yaml"
|
8
8
|
|
9
9
|
module Bake
|
10
10
|
module Modernize
|
@@ -34,7 +34,7 @@ module Bake
|
|
34
34
|
|
35
35
|
# Extract the revisions from the given path.
|
36
36
|
def extract(path)
|
37
|
-
File.open(path,
|
37
|
+
File.open(path, "r") do |file|
|
38
38
|
file.each_line do |line|
|
39
39
|
# Skip empty lines and comments
|
40
40
|
next if line =~ /^\s*(#|$)/
|
@@ -54,7 +54,7 @@ module Bake
|
|
54
54
|
class Mailmap
|
55
55
|
# Load the mailmap from a directory.
|
56
56
|
def self.for(root)
|
57
|
-
full_path = File.join(root,
|
57
|
+
full_path = File.join(root, ".mailmap")
|
58
58
|
|
59
59
|
if File.exist?(full_path)
|
60
60
|
mailmap = self.new
|
@@ -73,7 +73,7 @@ module Bake
|
|
73
73
|
|
74
74
|
# Extract the mailmap from the given path.
|
75
75
|
def extract(path)
|
76
|
-
File.open(path,
|
76
|
+
File.open(path, "r") do |file|
|
77
77
|
file.each_line do |line|
|
78
78
|
# Skip comments
|
79
79
|
next if line =~ /^#/
|
@@ -107,11 +107,11 @@ module Bake
|
|
107
107
|
# Extract contributors from a YAML file which can be generated from another repository.
|
108
108
|
class Contributors
|
109
109
|
# 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.
|
110
|
-
DEFAULT_PATH =
|
110
|
+
DEFAULT_PATH = "."
|
111
111
|
|
112
112
|
# Load contributors from a directory.
|
113
113
|
def self.for(root)
|
114
|
-
full_path = File.join(root,
|
114
|
+
full_path = File.join(root, ".contributors.yaml")
|
115
115
|
|
116
116
|
if File.exist?(full_path)
|
117
117
|
contributors = self.new
|
data/lib/bake/modernize.rb
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2020-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require
|
9
|
-
require
|
6
|
+
require_relative "modernize/license"
|
7
|
+
require_relative "modernize/version"
|
8
|
+
require "build/files/glob"
|
9
|
+
require "fileutils"
|
10
10
|
|
11
11
|
# @namespace
|
12
12
|
module Bake
|
@@ -35,7 +35,7 @@ module Bake
|
|
35
35
|
# @parameter source_path [String] The source path.
|
36
36
|
# @parameter destination_path [String] The destination path.
|
37
37
|
def self.copy_template(source_path, destination_path)
|
38
|
-
glob = Build::Files::Glob.new(source_path,
|
38
|
+
glob = Build::Files::Glob.new(source_path, "**/*")
|
39
39
|
|
40
40
|
glob.each do |path|
|
41
41
|
full_path = File.join(destination_path, path.relative_path)
|
@@ -34,7 +34,7 @@ jobs:
|
|
34
34
|
timeout-minutes: 5
|
35
35
|
run: bundle exec bake test
|
36
36
|
|
37
|
-
- uses: actions/upload-artifact@
|
37
|
+
- uses: actions/upload-artifact@v4
|
38
38
|
with:
|
39
39
|
name: coverage-${{matrix.os}}-${{matrix.ruby}}
|
40
40
|
path: .covered.db
|
@@ -50,7 +50,7 @@ jobs:
|
|
50
50
|
ruby-version: "3.3"
|
51
51
|
bundler-cache: true
|
52
52
|
|
53
|
-
- uses: actions/download-artifact@
|
53
|
+
- uses: actions/download-artifact@v4
|
54
54
|
|
55
55
|
- name: Validate coverage
|
56
56
|
timeout-minutes: 5
|
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.30.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-
|
41
|
+
date: 2024-09-07 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
|