gemfather-cli 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/exe/gemfather +1 -2
- data/lib/gemfather/cli/settings_builder.rb +71 -0
- data/lib/gemfather/cli/version.rb +1 -3
- data/lib/gemfather/cli.rb +67 -37
- data/lib/gemfather_cli.rb +3 -1
- data/templates/.release-please-manifest.json +3 -0
- data/templates/CHANGELOG.md +1 -0
- data/templates/CODE_OF_CONDUCT.md.erb +36 -0
- data/templates/Makefile.erb +25 -0
- data/templates/ci/github/ci.yml +19 -0
- data/templates/ci/github/release.yml +37 -0
- data/templates/licences/mit.txt.erb +21 -0
- data/templates/release-please-config.json.erb +16 -0
- metadata +87 -10
- data/lib/gemfather/cli/settings_reader.rb +0 -51
- data/templates/Makefile +0 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 94f5dd47f0cc1438a3e1ebe62983f95906df2e4b0d5356d76dccd139b9e52170
|
|
4
|
+
data.tar.gz: 97bdda962067221aac47791a0f1df2227774b04d16bdfb47f9bbb3895dbfb65d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fac2cf27bf3f7c13931f016594481b8f3b18aa9014134f38cc6b5c2203d6e99ed11bec037857038855d33118cdb4751f8bf0cc3407ed4d7f4707aa9cd9053d4f
|
|
7
|
+
data.tar.gz: ae44d8e5806cb759b3c8b32c6febda710a079e1b95bd173c2d63c2cabf2ad3e29e0399b972bdd42fba6e4dd7a1edc812c09a34a325d42a7614b64d1e3601bb0a
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.3.0](https://github.com/k0va1/gemfather-cli/compare/v0.2.1...v0.3.0) (2025-11-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* use zeitwerk for code loading
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* use zeitwerk for code loading ([aad63b2](https://github.com/k0va1/gemfather-cli/commit/aad63b2cd3c2779590b18a317f908b43bd057341))
|
|
13
|
+
|
|
14
|
+
## [0.2.1](https://github.com/k0va1/gemfather-cli/compare/v0.2.0...v0.2.1) (2025-11-08)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* new settings, release please and templates ([a3cd69e](https://github.com/k0va1/gemfather-cli/commit/a3cd69e92eac50d87a9890424b15a720d1e7b1a2))
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 k0va1
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Gemfather CLI
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
`gemfather-cli` allows you to create new gems easily providing predifined templates
|
|
6
|
+
|
|
7
|
+
[](https://asciinema.org/a/598640)
|
|
8
|
+
|
|
9
|
+
It includes:
|
|
10
|
+
* Makefile
|
|
11
|
+
* Linter config
|
|
12
|
+
* Test config
|
|
13
|
+
|
|
14
|
+
## Supported Ruby versions
|
|
15
|
+
|
|
16
|
+
This gem supports Ruby version >= 2.6.0
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
`gem install gemfather-cli`
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
Just call `gemfather` in the terminal
|
|
25
|
+
|
|
26
|
+
## Development
|
|
27
|
+
|
|
28
|
+
* run `make install` to install gem dependencies
|
|
29
|
+
* run `make start` to install gem dependencies
|
|
30
|
+
* run `make test` to run tests
|
|
31
|
+
* run `make lint-fix` to run autocorrect
|
|
32
|
+
* run `make install_gem` to intall gem locally
|
|
33
|
+
* run `make reinstall_gem` to reintall gem locally
|
|
34
|
+
|
|
35
|
+
## Contributing
|
|
36
|
+
|
|
37
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/k0va1/gemfather-cli.
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/exe/gemfather
CHANGED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
require "tty-prompt"
|
|
2
|
+
|
|
3
|
+
module Gemfather
|
|
4
|
+
module Cli
|
|
5
|
+
class SettingsBuilder
|
|
6
|
+
DEFAULT_GEM_NAME = "awesome-new-gem"
|
|
7
|
+
DEFAULT_USER_EMAIL = "your-mail@example.com"
|
|
8
|
+
DEFAULT_USERNAME = `whoami`.chomp
|
|
9
|
+
|
|
10
|
+
attr_accessor :settings
|
|
11
|
+
|
|
12
|
+
def initialize
|
|
13
|
+
@settings = {}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def call
|
|
17
|
+
prompt = TTY::Prompt.new(interrupt: :exit)
|
|
18
|
+
|
|
19
|
+
user_email = `git config user.email`.chomp
|
|
20
|
+
settings[:email] = user_email.empty? ? DEFAULT_USER_EMAIL : user_email
|
|
21
|
+
|
|
22
|
+
username = `git config user.name`.chomp
|
|
23
|
+
settings[:username] = username.empty? ? DEFAULT_USERNAME : username
|
|
24
|
+
|
|
25
|
+
settings[:name] = prompt.ask("Gem name:", default: DEFAULT_GEM_NAME)
|
|
26
|
+
settings[:summary] = prompt.ask("Summary", default: DEFAULT_GEM_NAME)
|
|
27
|
+
settings[:description] = prompt.ask("Description", default: DEFAULT_GEM_NAME)
|
|
28
|
+
settings[:homepage] = prompt.ask("Home page(URL)", default: DEFAULT_GEM_NAME, value: "https://github.com/")
|
|
29
|
+
|
|
30
|
+
settings[:licence] = prompt.select("Select Licence") do |menu|
|
|
31
|
+
menu.choice "MIT", "mit"
|
|
32
|
+
menu.choice "N/A", "n/a"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
settings[:linter] = prompt.select("Select linter") do |menu|
|
|
36
|
+
menu.choice "Standard", "standard"
|
|
37
|
+
menu.choice "Rubocop", "rubocop"
|
|
38
|
+
menu.choice "N/A", "n/a"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
settings[:test] = prompt.select("Select test tool") do |menu|
|
|
42
|
+
menu.choice "RSpec", "rspec"
|
|
43
|
+
menu.choice "Minitest", "minitest"
|
|
44
|
+
menu.choice "N/A", "n/a"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
settings[:ci] = prompt.select("Select CI") do |menu|
|
|
48
|
+
menu.choice "GitHub", "github"
|
|
49
|
+
menu.choice "Gitlab", "gitlab"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
settings[:use_release_please] = prompt.yes?("Do you want to use release-please for releases?")
|
|
53
|
+
|
|
54
|
+
settings[:makefile?] = prompt.yes?("Do you need Makefile?")
|
|
55
|
+
settings[:coc?] = prompt.yes?("Do you need Code Of Conduct?")
|
|
56
|
+
settings[:changelog?] = prompt.yes?("Do you need CHANGELOG file?")
|
|
57
|
+
|
|
58
|
+
settings[:debugger] = prompt.select("Select debugger tool:") do |menu|
|
|
59
|
+
menu.choice "IRB", "irb"
|
|
60
|
+
menu.choice "Pry", "pry"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
settings
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def get_binding
|
|
67
|
+
binding
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
data/lib/gemfather/cli.rb
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "cli/settings_reader"
|
|
4
1
|
require "fileutils"
|
|
2
|
+
require "erb"
|
|
5
3
|
|
|
6
4
|
module Gemfather
|
|
7
5
|
module Cli
|
|
8
6
|
class Error < StandardError; end
|
|
9
7
|
|
|
10
|
-
# Entrypoint of the gem
|
|
11
8
|
class Runner
|
|
12
|
-
attr_accessor :settings
|
|
9
|
+
attr_accessor :settings_builder, :settings
|
|
13
10
|
|
|
14
|
-
def initialize(
|
|
15
|
-
@
|
|
11
|
+
def initialize(settings_builder: ::Gemfather::Cli::SettingsBuilder.new)
|
|
12
|
+
@settings_builder = settings_builder
|
|
13
|
+
@settings = @settings_builder.call
|
|
16
14
|
end
|
|
17
15
|
|
|
18
16
|
def call
|
|
19
|
-
populate_settings
|
|
20
17
|
init_gem
|
|
21
18
|
update_gem_info
|
|
22
19
|
copy_templates
|
|
@@ -24,29 +21,23 @@ module Gemfather
|
|
|
24
21
|
|
|
25
22
|
private
|
|
26
23
|
|
|
27
|
-
def populate_settings
|
|
28
|
-
@settings = @settings_reader.call
|
|
29
|
-
end
|
|
30
|
-
|
|
31
24
|
def build_bundle_options
|
|
32
25
|
linter_options = build_linter_options
|
|
33
26
|
test_options = build_test_options
|
|
34
|
-
coc_options = build_coc_options
|
|
35
27
|
ci_options = build_ci_options
|
|
36
28
|
|
|
37
29
|
[
|
|
38
30
|
linter_options,
|
|
39
31
|
test_options,
|
|
40
|
-
coc_options,
|
|
41
32
|
ci_options
|
|
42
33
|
].join(" ")
|
|
43
34
|
end
|
|
44
35
|
|
|
45
36
|
def build_linter_options
|
|
46
37
|
case settings[:linter]
|
|
47
|
-
when "
|
|
38
|
+
when "rubocop"
|
|
48
39
|
"--linter=rubocop"
|
|
49
|
-
when "
|
|
40
|
+
when "standard"
|
|
50
41
|
"--linter=standard"
|
|
51
42
|
else
|
|
52
43
|
""
|
|
@@ -55,25 +46,17 @@ module Gemfather
|
|
|
55
46
|
|
|
56
47
|
def build_test_options
|
|
57
48
|
case settings[:test]
|
|
58
|
-
when "
|
|
49
|
+
when "minitest"
|
|
59
50
|
"--test=minitest"
|
|
60
|
-
when "
|
|
51
|
+
when "rspec"
|
|
61
52
|
"--test=rspec"
|
|
62
|
-
when "TestUnit"
|
|
63
|
-
"--test=test-unit"
|
|
64
53
|
else
|
|
65
54
|
""
|
|
66
55
|
end
|
|
67
56
|
end
|
|
68
57
|
|
|
69
|
-
def build_coc_options
|
|
70
|
-
settings[:coc?] ? "--coc" : "--no-coc"
|
|
71
|
-
end
|
|
72
|
-
|
|
73
58
|
def build_ci_options
|
|
74
|
-
|
|
75
|
-
ci_name = cis[settings[:ci]]
|
|
76
|
-
ci_name ? "--ci=#{ci_name}" : ""
|
|
59
|
+
settings[:ci] ? "--ci=#{settings[:ci]}" : ""
|
|
77
60
|
end
|
|
78
61
|
|
|
79
62
|
def init_gem
|
|
@@ -85,14 +68,11 @@ module Gemfather
|
|
|
85
68
|
gemspec_path = File.join(Dir.pwd, settings[:name], "#{settings[:name]}.gemspec")
|
|
86
69
|
updated_gemspec_lines = update_gemspec_lines(gemspec_path)
|
|
87
70
|
|
|
88
|
-
File.
|
|
89
|
-
f.write(updated_gemspec_lines.join)
|
|
90
|
-
f.close
|
|
91
|
-
end
|
|
71
|
+
File.write(gemspec_path, updated_gemspec_lines.join)
|
|
92
72
|
end
|
|
93
73
|
|
|
94
|
-
def update_gemspec_lines(gemspec_path)
|
|
95
|
-
IO.readlines(gemspec_path).map do |line|
|
|
74
|
+
def update_gemspec_lines(gemspec_path)
|
|
75
|
+
IO.readlines(gemspec_path).map do |line|
|
|
96
76
|
case line
|
|
97
77
|
when /spec\.summary =.*/
|
|
98
78
|
line.gsub(/=\s".*"/, "= \"#{settings[:summary]}\"")
|
|
@@ -100,10 +80,16 @@ module Gemfather
|
|
|
100
80
|
line.gsub(/=\s".*"/, "= \"#{settings[:description]}\"")
|
|
101
81
|
when /spec\.homepage =.*/
|
|
102
82
|
line.gsub(/=\s".*"/, "= \"#{settings[:homepage]}\"")
|
|
83
|
+
when /spec\.metadata\["homepage_uri"\] =.*/
|
|
84
|
+
line.gsub(/=\s".*"/, "= spec.homepage")
|
|
103
85
|
when /spec\.metadata\["source_code_uri"\] =.*/
|
|
104
|
-
line.gsub(/=\s".*"/, "=
|
|
86
|
+
line.gsub(/=\s".*"/, "= spec.homepage")
|
|
105
87
|
when /spec\.metadata\["changelog_uri"\] =.*/
|
|
106
|
-
|
|
88
|
+
if settings[:changelog?]
|
|
89
|
+
line.gsub(/=\s".*"/, "= \"#{settings[:homepage]}/blob/master/CHANGELOG.md\"")
|
|
90
|
+
end
|
|
91
|
+
when /spec\.metadata\["allowed_push_host"\] =.*/
|
|
92
|
+
next
|
|
107
93
|
else
|
|
108
94
|
line
|
|
109
95
|
end
|
|
@@ -113,19 +99,63 @@ module Gemfather
|
|
|
113
99
|
def copy_templates
|
|
114
100
|
copy_makefile
|
|
115
101
|
copy_changelog
|
|
102
|
+
copy_coc
|
|
103
|
+
copy_release_please
|
|
104
|
+
copy_ci_files
|
|
116
105
|
end
|
|
117
106
|
|
|
118
107
|
def copy_makefile
|
|
119
|
-
|
|
108
|
+
return unless settings[:makefile?]
|
|
109
|
+
|
|
110
|
+
rendered_string = render_erb("Makefile.erb", settings_builder.get_binding)
|
|
111
|
+
File.write(File.join(new_gem_root, "Makefile"), rendered_string)
|
|
120
112
|
end
|
|
121
113
|
|
|
122
114
|
def copy_changelog
|
|
123
|
-
|
|
115
|
+
return unless settings[:changelog?]
|
|
116
|
+
|
|
117
|
+
FileUtils.cp(File.join(templates_root, "CHANGELOG.md"), new_gem_root)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def copy_coc
|
|
121
|
+
return unless settings[:coc?]
|
|
122
|
+
|
|
123
|
+
rendered_string = render_erb("CODE_OF_CONDUCT.md.erb", settings_builder.get_binding)
|
|
124
|
+
File.write(File.join(new_gem_root, "CODE_OF_CONDUCT.md"), rendered_string)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def copy_release_please
|
|
128
|
+
return unless settings[:use_release_please]
|
|
129
|
+
|
|
130
|
+
rendered_string = render_erb("release-please-config.json.erb", settings_builder.get_binding)
|
|
131
|
+
File.write(File.join(new_gem_root, "release-please-config.json"), rendered_string)
|
|
132
|
+
FileUtils.cp(File.join(templates_root, ".release-please-manifest.json"), new_gem_root)
|
|
133
|
+
|
|
134
|
+
if settings[:ci] == "github"
|
|
135
|
+
FileUtils.cp(File.join(templates_root, "ci/github/release.yml"), File.join(new_gem_root, ".github/workflows/release.yml"))
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def copy_ci_files
|
|
140
|
+
if settings[:ci] == "github"
|
|
141
|
+
FileUtils.rm_rf(File.join(new_gem_root, ".github/workflows/main.yml"))
|
|
142
|
+
FileUtils.cp(File.join(templates_root, "ci/github/ci.yml"), File.join(new_gem_root, ".github/workflows/ci.yml"))
|
|
143
|
+
end
|
|
124
144
|
end
|
|
125
145
|
|
|
126
146
|
def new_gem_root
|
|
127
147
|
@new_gem_root ||= File.join(Dir.pwd, settings[:name])
|
|
128
148
|
end
|
|
149
|
+
|
|
150
|
+
def templates_root
|
|
151
|
+
@templates_root ||= File.join(File.dirname(__dir__), "../templates")
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def render_erb(file, binding)
|
|
155
|
+
template_path = File.join(templates_root, file)
|
|
156
|
+
template = ERB.new(File.read(template_path))
|
|
157
|
+
template.result(binding)
|
|
158
|
+
end
|
|
129
159
|
end
|
|
130
160
|
end
|
|
131
161
|
end
|
data/lib/gemfather_cli.rb
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Changelog
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
We, the maintainers and contributors, pledge to make participation in this project a harassment-free experience for everyone. We are committed to creating a welcoming and inclusive community regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
5
|
+
|
|
6
|
+
## Our Standards
|
|
7
|
+
### Examples of behavior that contributes to a positive environment:
|
|
8
|
+
- Using welcoming and inclusive language
|
|
9
|
+
- Being respectful of differing viewpoints and experiences
|
|
10
|
+
- Accepting constructive criticism gracefully
|
|
11
|
+
- Focusing on what is best for the community
|
|
12
|
+
- Showing empathy toward other community members
|
|
13
|
+
|
|
14
|
+
### Examples of unacceptable behavior:
|
|
15
|
+
- Harassment or discriminatory jokes and language
|
|
16
|
+
- Personal or political attacks
|
|
17
|
+
- Publishing others’ private information without permission
|
|
18
|
+
- Unwanted sexual attention or advances
|
|
19
|
+
- Any conduct that would be considered inappropriate in a professional setting
|
|
20
|
+
|
|
21
|
+
## Our Responsibilities
|
|
22
|
+
Project maintainers are responsible for clarifying standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable conduct.
|
|
23
|
+
|
|
24
|
+
Maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, issues, and other contributions that do not align with this Code of Conduct.
|
|
25
|
+
|
|
26
|
+
## Scope
|
|
27
|
+
This Code of Conduct applies within all project spaces and in public spaces when an individual is representing the project or its community.
|
|
28
|
+
|
|
29
|
+
## Enforcement
|
|
30
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainers at **<%= settings[:email] %>**.
|
|
31
|
+
All complaints will be reviewed and investigated, and will result in a response that is deemed necessary and appropriate to the circumstances.
|
|
32
|
+
|
|
33
|
+
Maintainers are obligated to respect the privacy and safety of reporters.
|
|
34
|
+
|
|
35
|
+
## Attribution
|
|
36
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.PHONY: test lint-fix console install
|
|
2
|
+
|
|
3
|
+
install:
|
|
4
|
+
bundle install
|
|
5
|
+
|
|
6
|
+
console:
|
|
7
|
+
bin/console
|
|
8
|
+
<% if settings[:test] == "rspec" %>
|
|
9
|
+
|
|
10
|
+
test:
|
|
11
|
+
bundle exec rspec
|
|
12
|
+
<% elsif settings[:test] == "minitest" %>
|
|
13
|
+
|
|
14
|
+
test:
|
|
15
|
+
bundle exec rake test
|
|
16
|
+
<% end %>
|
|
17
|
+
<% if settings[:linter] == "rubocop" %>
|
|
18
|
+
|
|
19
|
+
lint-fix:
|
|
20
|
+
bundle exec rubocop -A
|
|
21
|
+
<% elsif settings[:linter] == "standard" %>
|
|
22
|
+
|
|
23
|
+
lint-fix:
|
|
24
|
+
bundle exec standardrb --fix
|
|
25
|
+
<% end %>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on: [push]
|
|
3
|
+
jobs:
|
|
4
|
+
tests:
|
|
5
|
+
runs-on: ubuntu-latest
|
|
6
|
+
strategy:
|
|
7
|
+
matrix:
|
|
8
|
+
ruby-version: ['3.2', '3.3', '3.4']
|
|
9
|
+
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
|
|
13
|
+
- name: Setup Ruby
|
|
14
|
+
uses: ruby/setup-ruby@v1
|
|
15
|
+
with:
|
|
16
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
17
|
+
|
|
18
|
+
- name: Run tests & linters
|
|
19
|
+
run: bundle install && bundle exec rake
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
id-token: write
|
|
11
|
+
pull-requests: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
release:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Release Please
|
|
19
|
+
uses: googleapis/release-please-action@v4
|
|
20
|
+
id: release
|
|
21
|
+
with:
|
|
22
|
+
token: ${{ secrets.GH_TOKEN }}
|
|
23
|
+
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
26
|
+
with:
|
|
27
|
+
fetch-tags: true
|
|
28
|
+
|
|
29
|
+
- name: Set up Ruby
|
|
30
|
+
uses: ruby/setup-ruby@v1
|
|
31
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
32
|
+
with:
|
|
33
|
+
bundler-cache: true
|
|
34
|
+
ruby-version: 3.4
|
|
35
|
+
|
|
36
|
+
- uses: rubygems/release-gem@v1
|
|
37
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) <%= Time.now.year %> <%= settings[:username] %>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"packages": {
|
|
3
|
+
".": {
|
|
4
|
+
"package-name": "<%= settings[:name] %>",
|
|
5
|
+
"include-component-in-tag": false,
|
|
6
|
+
"changelog-path": "CHANGELOG.md",
|
|
7
|
+
"release-type": "ruby",
|
|
8
|
+
"bump-minor-pre-major": true,
|
|
9
|
+
"bump-patch-for-minor-pre-major": true,
|
|
10
|
+
"draft": false,
|
|
11
|
+
"prerelease": false,
|
|
12
|
+
"version-file": "lib/<%= settings[:name] %>/version.rb"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
|
|
16
|
+
}
|
metadata
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gemfather-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- k0va1
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: zeitwerk
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '2.7'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '2.7'
|
|
13
26
|
- !ruby/object:Gem::Dependency
|
|
14
27
|
name: tty-prompt
|
|
15
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -24,6 +37,62 @@ dependencies:
|
|
|
24
37
|
- - "~>"
|
|
25
38
|
- !ruby/object:Gem::Version
|
|
26
39
|
version: '0.23'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: bundler
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '2.0'
|
|
47
|
+
type: :development
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '2.0'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: rake
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '13.0'
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '13.0'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: rspec
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '3.0'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '3.0'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: standard
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - '='
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: 1.51.0
|
|
89
|
+
type: :development
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - '='
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: 1.51.0
|
|
27
96
|
description: Ask some questions & create a new gem template
|
|
28
97
|
email:
|
|
29
98
|
- al3xander.koval@gmail.com
|
|
@@ -32,20 +101,29 @@ executables:
|
|
|
32
101
|
extensions: []
|
|
33
102
|
extra_rdoc_files: []
|
|
34
103
|
files:
|
|
104
|
+
- CHANGELOG.md
|
|
105
|
+
- LICENSE.txt
|
|
106
|
+
- README.md
|
|
35
107
|
- exe/gemfather
|
|
36
108
|
- lib/gemfather/cli.rb
|
|
37
|
-
- lib/gemfather/cli/
|
|
109
|
+
- lib/gemfather/cli/settings_builder.rb
|
|
38
110
|
- lib/gemfather/cli/version.rb
|
|
39
111
|
- lib/gemfather_cli.rb
|
|
40
|
-
- templates
|
|
112
|
+
- templates/.release-please-manifest.json
|
|
113
|
+
- templates/CHANGELOG.md
|
|
114
|
+
- templates/CODE_OF_CONDUCT.md.erb
|
|
115
|
+
- templates/Makefile.erb
|
|
116
|
+
- templates/ci/github/ci.yml
|
|
117
|
+
- templates/ci/github/release.yml
|
|
118
|
+
- templates/licences/mit.txt.erb
|
|
119
|
+
- templates/release-please-config.json.erb
|
|
41
120
|
homepage: https://gitlab.com/k0va1/gemfather-cli
|
|
42
121
|
licenses:
|
|
43
122
|
- MIT
|
|
44
123
|
metadata:
|
|
45
124
|
homepage_uri: https://gitlab.com/k0va1/gemfather-cli
|
|
46
125
|
source_code_uri: https://gitlab.com/k0va1/gemfather-cli
|
|
47
|
-
changelog_uri: https://gitlab.com/k0va1/gemfather-cli
|
|
48
|
-
post_install_message:
|
|
126
|
+
changelog_uri: https://gitlab.com/k0va1/gemfather-cli/blob/master/CHANGELOG.md
|
|
49
127
|
rdoc_options: []
|
|
50
128
|
require_paths:
|
|
51
129
|
- lib
|
|
@@ -53,15 +131,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
53
131
|
requirements:
|
|
54
132
|
- - ">="
|
|
55
133
|
- !ruby/object:Gem::Version
|
|
56
|
-
version: 2.
|
|
134
|
+
version: 3.2.0
|
|
57
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
136
|
requirements:
|
|
59
137
|
- - ">="
|
|
60
138
|
- !ruby/object:Gem::Version
|
|
61
139
|
version: '0'
|
|
62
140
|
requirements: []
|
|
63
|
-
rubygems_version: 3.
|
|
64
|
-
signing_key:
|
|
141
|
+
rubygems_version: 3.6.9
|
|
65
142
|
specification_version: 4
|
|
66
143
|
summary: Gem for creating other gems
|
|
67
144
|
test_files: []
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "tty-prompt"
|
|
4
|
-
|
|
5
|
-
module Gemfather
|
|
6
|
-
module Cli
|
|
7
|
-
# Class responsible to collect user input and build settings hash
|
|
8
|
-
class SettingsReader
|
|
9
|
-
def call # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
|
10
|
-
settings = {}
|
|
11
|
-
prompt = TTY::Prompt.new(interrupt: :exit)
|
|
12
|
-
|
|
13
|
-
settings[:name] = prompt.ask("Gem name:", default: "awesome-new-gem")
|
|
14
|
-
settings[:summary] = prompt.ask("Summary", default: "awesome-new-gem")
|
|
15
|
-
settings[:description] = prompt.ask("Description", default: "awesome-new-gem")
|
|
16
|
-
settings[:homepage] = prompt.ask("Home page(URL)", default: "awesome-new-gem")
|
|
17
|
-
|
|
18
|
-
settings[:linter] = prompt.select("Select linter") do |menu|
|
|
19
|
-
menu.choice "Rubocop"
|
|
20
|
-
menu.choice "Standard"
|
|
21
|
-
menu.choice "N/A"
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
settings[:test] = prompt.select("Select test tool:") do |menu|
|
|
25
|
-
menu.choice "RSpec"
|
|
26
|
-
menu.choice "Minitest"
|
|
27
|
-
menu.choice "TestUnit"
|
|
28
|
-
menu.choice "N/A"
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
settings[:ci] = prompt.select("Select CI tool:") do |menu|
|
|
32
|
-
menu.choice "GitHub"
|
|
33
|
-
menu.choice "Gitlab"
|
|
34
|
-
menu.choice "Travis"
|
|
35
|
-
menu.choice "Circle"
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
settings[:makefile?] = prompt.yes?("Do you need Makefile?")
|
|
39
|
-
settings[:coc?] = prompt.yes?("Do you need Code Of Conduct?")
|
|
40
|
-
settings[:changelog?] = prompt.yes?("Do you need CHANGELOG?")
|
|
41
|
-
|
|
42
|
-
settings[:debugger] = prompt.select("Select debugger tool:") do |menu|
|
|
43
|
-
menu.choice "IRB"
|
|
44
|
-
menu.choice "Pry"
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
settings
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|