bake-modernize 0.15.1 → 0.16.0

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: 715e7310bed56e56203b7b689bae99fcfaea4d1466d314cc2ce91b6902550596
4
- data.tar.gz: 20bd920437aaf896ff8dbc71c7ddcd9cd29a3d4a32ebc099234cd366df6e8e91
3
+ metadata.gz: 310142a997767785291aadb64e0cb29310a0776a7e1d6a5081ab5c674ea711fe
4
+ data.tar.gz: 944e2d7c534f5303c92f6b3564ed0777c4857d2eeb0c46877dff3bd4c8568cb2
5
5
  SHA512:
6
- metadata.gz: fe0673005c97cfe3dabe1e11db1e6412194544b7eb0f3a68849381c505003d007f2ededbb470bdcb93801efc6fee608e0aa94722b01c1129e2726383c7e244dc
7
- data.tar.gz: 43edd77b36cbdd4438447dce0b065c89127b531e7e227444ddf717a063c6d4d2c6859963215860dce04a8f5a79db80a96d15877d1c915fbf64f457d563e6e9f2
6
+ metadata.gz: a5366bbe5432f8c8e0c45a18a0b80457e2a48a9fdd1568336e10cd4c51c2c08c26233612ce7698fc085b93db3e48a7d79bb73586723952824dffd6c46c92d71a
7
+ data.tar.gz: 643d36c17ab69f94246bbcc6e5fcf986067acdfe0418cac26010bbba019659b71d318e2fa51a9393b48b195a89b835d3e99acaf1ab58872957c7ca300d23b77d
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2023, by Samuel Williams.
5
+
6
+ require 'bake/modernize'
7
+ require 'markly'
8
+
9
+ def contributing
10
+ update(root: Dir.pwd)
11
+ update_contributing(File.join(Dir.pwd, 'readme.md'))
12
+ end
13
+
14
+ def update(root:)
15
+ template_root = Bake::Modernize.template_path_for('contributing')
16
+ Bake::Modernize.copy_template(template_root, root)
17
+ end
18
+
19
+ private
20
+
21
+ DEFAULT_CONTRIBUTING = <<~EOF
22
+ We welcome contributions to this project.
23
+
24
+ 1. Fork it.
25
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
26
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
27
+ 4. Push to the branch (`git push origin my-new-feature`).
28
+ 5. Create new Pull Request.
29
+ EOF
30
+
31
+ def update_contributing(readme_path)
32
+ root = Markly.parse(File.read(readme_path))
33
+
34
+ replacement = Markly.parse(DEFAULT_CONTRIBUTING)
35
+
36
+ node = root.first_child
37
+
38
+ while node
39
+ if node.type == :header && node.to_plaintext =~ /Contributing/
40
+ break
41
+ end
42
+
43
+ node = node.next
44
+ return unless node
45
+ end
46
+
47
+ contributing_header = node
48
+ node = node.next
49
+
50
+ while node
51
+ next_node = node.next
52
+ node.delete
53
+
54
+ node = next_node
55
+
56
+ if next_node.nil? || node.type == :header
57
+ break
58
+ end
59
+ end
60
+
61
+ node = contributing_header
62
+ replacement.each do |child|
63
+ node.insert_after(child)
64
+ node = child
65
+ end
66
+
67
+ File.write(readme_path, root.to_markdown(width: 0))
68
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2022, by Samuel Williams.
4
+ # Copyright, 2020-2023, by Samuel Williams.
5
5
 
6
6
  require 'bake/modernize'
7
7
 
@@ -10,12 +10,6 @@ def editorconfig
10
10
  end
11
11
 
12
12
  def update(root:)
13
- editorconfig_path = File.expand_path(".editorconfig", root)
14
-
15
- if File.exist?(editorconfig_path)
16
- FileUtils.rm_rf(editorconfig_path)
17
- end
18
-
19
13
  template_root = Bake::Modernize.template_path_for('editorconfig')
20
14
  Bake::Modernize.copy_template(template_root, root)
21
15
  end
@@ -16,12 +16,33 @@ def update(root:)
16
16
  system("git", "push", "-u", "origin", "main")
17
17
  end
18
18
 
19
+ current_gitignore_custom_lines = self.current_gitignore_custom_lines(root)
20
+
19
21
  template_root = Bake::Modernize.template_path_for('git')
20
22
  Bake::Modernize.copy_template(template_root, root)
23
+
24
+ if current_gitignore_custom_lines
25
+ File.open(File.join(root, ".gitignore"), "a") do |file|
26
+ file.puts
27
+ file.puts(current_gitignore_custom_lines)
28
+ end
29
+ end
21
30
  end
22
31
 
23
32
  private
24
33
 
34
+ def current_gitignore_custom_lines(root)
35
+ gitignore_path = File.join(root, ".gitignore")
36
+
37
+ if File.exist?(gitignore_path)
38
+ lines = File.readlines(gitignore_path)
39
+ if blank_index = lines.index{|line| line =~ /^\s*$/}
40
+ lines.shift(blank_index+1)
41
+ return lines
42
+ end
43
+ end
44
+ end
45
+
25
46
  def current_branch
26
47
  require 'open3'
27
48
 
@@ -4,6 +4,7 @@
4
4
  # Copyright, 2022-2023, by Samuel Williams.
5
5
 
6
6
  require 'bake/modernize'
7
+ require 'markly'
7
8
 
8
9
  LICENSE = <<~LICENSE
9
10
  Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -49,6 +50,8 @@ def update(root:)
49
50
  file.write(buffer.string)
50
51
  end
51
52
 
53
+ remove_license(File.join(root, "readme.md"))
54
+
52
55
  authorship.paths.each do |path, modifications|
53
56
  next unless File.exist?(path)
54
57
 
@@ -108,3 +111,32 @@ def update_source_file_authors(authorship, path, modifications)
108
111
  file.puts(output)
109
112
  end
110
113
  end
114
+
115
+ def remove_license(readme_path)
116
+ root = Markly.parse(File.read(readme_path))
117
+
118
+ node = root.first_child
119
+
120
+ while node
121
+ if node.type == :header && node.to_plaintext =~ /License/
122
+ break
123
+ end
124
+
125
+ node = node.next
126
+ return unless node
127
+ end
128
+
129
+ while node
130
+ next_node = node.next
131
+ node.delete
132
+
133
+ node = next_node
134
+
135
+ if next_node.nil? || node.type == :header
136
+ break
137
+ end
138
+ end
139
+
140
+ File.write(readme_path, root.to_markdown(width: 0))
141
+ end
142
+
data/bake/modernize.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2020-2022, by Samuel Williams.
4
+ # Copyright, 2020-2023, by Samuel Williams.
5
5
 
6
6
  def modernize
7
- call('modernize:git', 'modernize:readme', 'modernize:actions', 'modernize:editorconfig', 'modernize:gemfile', 'modernize:signing', 'modernize:gemspec', 'modernize:license', 'modernize:frozen_string_literal')
7
+ call('modernize:git', 'modernize:readme', 'modernize:actions', 'modernize:editorconfig', 'modernize:gemfile', 'modernize:signing', 'modernize:gemspec', 'modernize:license', 'modernize:frozen_string_literal', 'modernize:contributing')
8
8
  end
data/conduct.md ADDED
@@ -0,0 +1,133 @@
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, caste, color, religion, or sexual
11
+ identity and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
15
+
16
+ ## Our Standards
17
+
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
20
+
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the overall
27
+ community
28
+
29
+ Examples of unacceptable behavior include:
30
+
31
+ * The use of sexualized language or imagery, and sexual attention or advances of
32
+ any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email address,
36
+ without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official e-mail address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement at
64
+ [INSERT CONTACT METHOD].
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series of
87
+ actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or permanent
94
+ ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within the
114
+ community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.1, available at
120
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
+
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127
+ [https://www.contributor-covenant.org/translations][translations].
128
+
129
+ [homepage]: https://www.contributor-covenant.org
130
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131
+ [Mozilla CoC]: https://github.com/mozilla/diversity
132
+ [FAQ]: https://www.contributor-covenant.org/faq
133
+ [translations]: https://www.contributor-covenant.org/translations
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Bake
7
7
  module Modernize
8
- VERSION = "0.15.1"
8
+ VERSION = "0.16.0"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -16,8 +16,10 @@ It will modernize your project.
16
16
 
17
17
  ## Contributing
18
18
 
19
- 1. Fork it
20
- 2. Create your feature branch (`git checkout -b my-new-feature`)
21
- 3. Commit your changes (`git commit -am 'Add some feature'`)
22
- 4. Push to the branch (`git push origin my-new-feature`)
23
- 5. Create new Pull Request
19
+ We welcome contributions to this project.
20
+
21
+ 1. Fork it.
22
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
23
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
24
+ 4. Push to the branch (`git push origin my-new-feature`).
25
+ 5. Create new Pull Request.
@@ -0,0 +1,133 @@
1
+
2
+ # Contributor Covenant Code of Conduct
3
+
4
+ ## Our Pledge
5
+
6
+ We as members, contributors, and leaders pledge to make participation in our
7
+ community a harassment-free experience for everyone, regardless of age, body
8
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
9
+ identity and expression, level of experience, education, socio-economic status,
10
+ nationality, personal appearance, race, caste, color, religion, or sexual
11
+ identity and orientation.
12
+
13
+ We pledge to act and interact in ways that contribute to an open, welcoming,
14
+ diverse, inclusive, and healthy community.
15
+
16
+ ## Our Standards
17
+
18
+ Examples of behavior that contributes to a positive environment for our
19
+ community include:
20
+
21
+ * Demonstrating empathy and kindness toward other people
22
+ * Being respectful of differing opinions, viewpoints, and experiences
23
+ * Giving and gracefully accepting constructive feedback
24
+ * Accepting responsibility and apologizing to those affected by our mistakes,
25
+ and learning from the experience
26
+ * Focusing on what is best not just for us as individuals, but for the overall
27
+ community
28
+
29
+ Examples of unacceptable behavior include:
30
+
31
+ * The use of sexualized language or imagery, and sexual attention or advances of
32
+ any kind
33
+ * Trolling, insulting or derogatory comments, and personal or political attacks
34
+ * Public or private harassment
35
+ * Publishing others' private information, such as a physical or email address,
36
+ without their explicit permission
37
+ * Other conduct which could reasonably be considered inappropriate in a
38
+ professional setting
39
+
40
+ ## Enforcement Responsibilities
41
+
42
+ Community leaders are responsible for clarifying and enforcing our standards of
43
+ acceptable behavior and will take appropriate and fair corrective action in
44
+ response to any behavior that they deem inappropriate, threatening, offensive,
45
+ or harmful.
46
+
47
+ Community leaders have the right and responsibility to remove, edit, or reject
48
+ comments, commits, code, wiki edits, issues, and other contributions that are
49
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
50
+ decisions when appropriate.
51
+
52
+ ## Scope
53
+
54
+ This Code of Conduct applies within all community spaces, and also applies when
55
+ an individual is officially representing the community in public spaces.
56
+ Examples of representing our community include using an official e-mail address,
57
+ posting via an official social media account, or acting as an appointed
58
+ representative at an online or offline event.
59
+
60
+ ## Enforcement
61
+
62
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
+ reported to the community leaders responsible for enforcement at
64
+ [INSERT CONTACT METHOD].
65
+ All complaints will be reviewed and investigated promptly and fairly.
66
+
67
+ All community leaders are obligated to respect the privacy and security of the
68
+ reporter of any incident.
69
+
70
+ ## Enforcement Guidelines
71
+
72
+ Community leaders will follow these Community Impact Guidelines in determining
73
+ the consequences for any action they deem in violation of this Code of Conduct:
74
+
75
+ ### 1. Correction
76
+
77
+ **Community Impact**: Use of inappropriate language or other behavior deemed
78
+ unprofessional or unwelcome in the community.
79
+
80
+ **Consequence**: A private, written warning from community leaders, providing
81
+ clarity around the nature of the violation and an explanation of why the
82
+ behavior was inappropriate. A public apology may be requested.
83
+
84
+ ### 2. Warning
85
+
86
+ **Community Impact**: A violation through a single incident or series of
87
+ actions.
88
+
89
+ **Consequence**: A warning with consequences for continued behavior. No
90
+ interaction with the people involved, including unsolicited interaction with
91
+ those enforcing the Code of Conduct, for a specified period of time. This
92
+ includes avoiding interactions in community spaces as well as external channels
93
+ like social media. Violating these terms may lead to a temporary or permanent
94
+ ban.
95
+
96
+ ### 3. Temporary Ban
97
+
98
+ **Community Impact**: A serious violation of community standards, including
99
+ sustained inappropriate behavior.
100
+
101
+ **Consequence**: A temporary ban from any sort of interaction or public
102
+ communication with the community for a specified period of time. No public or
103
+ private interaction with the people involved, including unsolicited interaction
104
+ with those enforcing the Code of Conduct, is allowed during this period.
105
+ Violating these terms may lead to a permanent ban.
106
+
107
+ ### 4. Permanent Ban
108
+
109
+ **Community Impact**: Demonstrating a pattern of violation of community
110
+ standards, including sustained inappropriate behavior, harassment of an
111
+ individual, or aggression toward or disparagement of classes of individuals.
112
+
113
+ **Consequence**: A permanent ban from any sort of public interaction within the
114
+ community.
115
+
116
+ ## Attribution
117
+
118
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
+ version 2.1, available at
120
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121
+
122
+ Community Impact Guidelines were inspired by
123
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
+
125
+ For answers to common questions about this code of conduct, see the FAQ at
126
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127
+ [https://www.contributor-covenant.org/translations][translations].
128
+
129
+ [homepage]: https://www.contributor-covenant.org
130
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131
+ [Mozilla CoC]: https://github.com/mozilla/diversity
132
+ [FAQ]: https://www.contributor-covenant.org/faq
133
+ [translations]: https://www.contributor-covenant.org/translations
data.tar.gz.sig CHANGED
@@ -1 +1,3 @@
1
- r�IYF�G>�p�u�| �F5�D�vu�dgL��`J���;S��/r�Ѵu���T���S�Q�6(S�9�>�?"RB <��C�{ �>03K(�������`�¶)���=!�^x >#&" �<6A% �]6��Ei��*.���Kju��Ԛ%T�J�f'�7�6�q �
1
+ Suy6`D�U����S��FE)����?5��A'����|�V������
2
+ �
3
+ �����N%^�x�I͑����y*l��N4̧,)4OF�23�չ5�"�.��(�k��p5�rI�"M�)$L<(f�"��~ �˼�?i!�h ˲%�Z b�k�/�M)���4�Н����!��� :��p�\����Q�����:(�j���
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.15.1
4
+ version: 0.16.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: 2023-02-13 00:00:00.000000000 Z
41
+ date: 2023-06-15 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: async-http
@@ -132,6 +132,7 @@ extra_rdoc_files: []
132
132
  files:
133
133
  - bake/modernize.rb
134
134
  - bake/modernize/actions.rb
135
+ - bake/modernize/contributing.rb
135
136
  - bake/modernize/editorconfig.rb
136
137
  - bake/modernize/frozen_string_literal.rb
137
138
  - bake/modernize/gemfile.rb
@@ -140,6 +141,7 @@ files:
140
141
  - bake/modernize/license.rb
141
142
  - bake/modernize/readme.rb
142
143
  - bake/modernize/signing.rb
144
+ - conduct.md
143
145
  - lib/bake/modernize.rb
144
146
  - lib/bake/modernize/license.rb
145
147
  - lib/bake/modernize/version.rb
@@ -149,9 +151,10 @@ files:
149
151
  - template/actions/.github/workflows/documentation.yaml
150
152
  - template/actions/.github/workflows/test-external.yaml
151
153
  - template/actions/.github/workflows/test.yaml
154
+ - template/contributing/conduct.md
152
155
  - template/editorconfig/.editorconfig
153
156
  - template/git/.gitignore
154
- - template/readme/README.md
157
+ - template/readme/readme.md
155
158
  homepage: https://github.com/ioquatix/bake-modernize
156
159
  licenses:
157
160
  - MIT
@@ -172,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
175
  - !ruby/object:Gem::Version
173
176
  version: '0'
174
177
  requirements: []
175
- rubygems_version: 3.4.6
178
+ rubygems_version: 3.4.7
176
179
  signing_key:
177
180
  specification_version: 4
178
181
  summary: Automatically modernize parts of your project/gem.
metadata.gz.sig CHANGED
Binary file
File without changes