bake-modernize 0.29.0 → 0.31.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 -0
- 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: 81bf9409585e5870cf25f0c79771e23c9cf30e0ab15f7521f6cf8aac990d2df3
|
4
|
+
data.tar.gz: ac8a8397d88e76bcd9e76f7220bbfb88092e21702291f1c8a30c84ad4340ae0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90bde03bfe765581c7b7d1073c559486b9652bd7cd57222de042e647ace23cab24955fe60b2683251f9ea5b0a36e4a056e2285415e22dc345655cf0c3aedcd57
|
7
|
+
data.tar.gz: 691f768f63cd7e9bbcea80668abfcd6491decfdd23d79b63a599b685200f4863bea8a6fe98ae014e147d7e8dca5ed03d467baa37e528cbda13a2393c01f25ba8
|
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)
|
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.31.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-09-
|
41
|
+
date: 2024-09-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
|