gempilot 0.3.5 → 0.4.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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/skills/using-command-kit/generator-pattern.rb +2 -2
  3. data/.ruby-version +1 -1
  4. data/CLAUDE.md +12 -0
  5. data/Rakefile +3 -2
  6. data/data/templates/gem/Gemfile.erb +1 -0
  7. data/data/templates/gem/Rakefile.erb +5 -2
  8. data/data/templates/gem/bin/setup.erb +1 -0
  9. data/data/templates/gem/dotfiles/github/workflows/ci.yml.erb +2 -0
  10. data/data/templates/gem/dotfiles/gitignore +1 -0
  11. data/lib/gempilot/cli/commands/bump.rb +4 -5
  12. data/lib/gempilot/cli/commands/console.rb +1 -3
  13. data/lib/gempilot/cli/commands/create.rb +32 -165
  14. data/lib/gempilot/cli/commands/destroy.rb +9 -8
  15. data/lib/gempilot/cli/commands/release.rb +5 -9
  16. data/lib/gempilot/cli/gem_builder.rb +2 -31
  17. data/lib/gempilot/cli/gem_scaffold.rb +188 -0
  18. data/lib/gempilot/cli/generator.rb +11 -11
  19. data/lib/gempilot/github_release.rb +8 -10
  20. data/lib/gempilot/origin.rb +6 -10
  21. data/lib/gempilot/rbs_task.rb +87 -0
  22. data/lib/gempilot/shell/command_failed.rb +17 -0
  23. data/lib/gempilot/shell/gateway.rb +45 -0
  24. data/lib/gempilot/shell/invocation.rb +16 -0
  25. data/lib/gempilot/shell/result.rb +14 -0
  26. data/lib/gempilot/shell/status.rb +20 -0
  27. data/lib/gempilot/shell/stub_gateway.rb +65 -0
  28. data/lib/gempilot/shell/unregistered_command.rb +23 -0
  29. data/lib/gempilot/shell.rb +66 -0
  30. data/lib/gempilot/version.rb +1 -1
  31. data/lib/gempilot/version_tag.rb +13 -17
  32. data/lib/gempilot/zeitwerk_task.rb +2 -2
  33. data/lib/gempilot.rb +1 -3
  34. data/rbs_collection.lock.yaml +188 -0
  35. data/rbs_collection.yaml +19 -0
  36. metadata +14 -3
  37. data/lib/gempilot/strict_shell.rb +0 -18
@@ -1,3 +1,3 @@
1
1
  module Gempilot
2
- VERSION = "0.3.5".freeze
2
+ VERSION = "0.4.0".freeze
3
3
  end
@@ -1,10 +1,6 @@
1
- require "open3"
2
-
3
1
  module Gempilot
4
2
  ## Manages git operations for version releases.
5
3
  class VersionTag
6
- include StrictShell
7
-
8
4
  ## Commit-message prefix written for a version bump; the guard below
9
5
  ## matches on it, so the two must stay in sync.
10
6
  BUMP_MESSAGE_PREFIX = "Bump version to ".freeze
@@ -16,42 +12,42 @@ module Gempilot
16
12
  end
17
13
 
18
14
  def create
19
- _, _, status = Open3.capture3("git", "diff", "--staged", "--quiet")
20
- raise "Cannot proceed, staging area must be clean" unless status.success?
15
+ staging_clean = Shell.capture("git", "diff", "--staged", "--quiet").success?
16
+ raise "Cannot proceed, staging area must be clean" unless staging_clean
21
17
 
22
- sh "git", "add", version.path.to_s
23
- sh "git", "commit", "-m", "#{BUMP_MESSAGE_PREFIX}#{version.value}"
18
+ Shell.run("git", "add", version.path.to_s)
19
+ Shell.run("git", "commit", "-m", "#{BUMP_MESSAGE_PREFIX}#{version.value}")
24
20
  end
25
21
 
26
22
  def tag
27
23
  assert_last_commit_is_bump!
28
- sh "git", "tag", version.tag
24
+ Shell.run("git", "tag", version.tag)
29
25
  end
30
26
 
31
27
  def untag
32
28
  assert_last_commit_is_bump!
33
- sh "git", "tag", "--delete", version.tag
29
+ Shell.run("git", "tag", "--delete", version.tag)
34
30
  end
35
31
 
36
32
  def reset
37
33
  assert_last_commit_is_bump!
38
- sh "git", "reset", "--quiet", "--mixed", "HEAD~1"
39
- sh "git", "restore", version.path.to_s
34
+ Shell.run("git", "reset", "--quiet", "--mixed", "HEAD~1")
35
+ Shell.run("git", "restore", version.path.to_s)
40
36
  end
41
37
 
42
38
  def revert
43
39
  assert_last_commit_is_bump!
44
- sh "git", "revert", "HEAD", "--no-edit"
40
+ Shell.run("git", "revert", "HEAD", "--no-edit")
45
41
  end
46
42
 
47
43
  private
48
44
 
49
45
  def assert_last_commit_is_bump!
50
- message, status = Open3.capture2("git", "log", "-1", "--pretty=%B")
51
- raise "Failed to read last commit message" unless status.success?
46
+ result = Shell.capture("git", "log", "-1", "--pretty=%B")
47
+ raise "Failed to read last commit message" unless result.success?
52
48
 
53
- message.strip!
54
- raise "Last commit does not appear to be a version bump." unless message.start_with?(BUMP_MESSAGE_PREFIX)
49
+ bump = result.output.strip.start_with?(BUMP_MESSAGE_PREFIX)
50
+ raise "Last commit does not appear to be a version bump." unless bump
55
51
  end
56
52
  end
57
53
  end
@@ -29,12 +29,12 @@ module Gempilot
29
29
 
30
30
  def define_validate_task
31
31
  desc "Verify all files follow Zeitwerk naming conventions"
32
- task(:validate) { ruby "-Ilib", "-e", validate_script }
32
+ task(:validate) { Shell.run(RbConfig.ruby, "-Ilib", "-e", validate_script) }
33
33
  end
34
34
 
35
35
  def define_all_task
36
36
  desc "List every constant Zeitwerk manages and the file it expects"
37
- task(:all) { ruby "-Ilib", "-e", all_script }
37
+ task(:all) { Shell.run(RbConfig.ruby, "-Ilib", "-e", all_script) }
38
38
  end
39
39
 
40
40
  def loader
data/lib/gempilot.rb CHANGED
@@ -1,12 +1,10 @@
1
1
  require "zeitwerk"
2
2
 
3
- autoload :Open3, "open3"
4
-
5
3
  # CLI toolkit for creating and managing Ruby gems.
6
4
  module Gempilot
7
5
  ROOT = Pathname(__dir__).parent.expand_path.freeze
8
6
  LOADER = Zeitwerk::Loader.for_gem.tap do |l|
9
- l.inflector.inflect("cli" => "CLI")
7
+ l.inflector.inflect("cli" => "CLI", "rbs_task" => "RBSTask")
10
8
  l.push_dir ROOT.join("lib/core_ext")
11
9
  l.collapse ROOT.join("lib/core_ext/*/refinements")
12
10
  l.setup
@@ -0,0 +1,188 @@
1
+ ---
2
+ path: ".gem_rbs_collection"
3
+ gems:
4
+ - name: ast
5
+ version: '2.4'
6
+ source:
7
+ type: git
8
+ name: ruby/gem_rbs_collection
9
+ revision: a2080c5762e4d22bf00ca0591eb4c8ec5d1fdd55
10
+ remote: https://github.com/ruby/gem_rbs_collection.git
11
+ repo_dir: gems
12
+ - name: benchmark
13
+ version: '0'
14
+ source:
15
+ type: stdlib
16
+ - name: diff-lcs
17
+ version: '1.5'
18
+ source:
19
+ type: git
20
+ name: ruby/gem_rbs_collection
21
+ revision: a2080c5762e4d22bf00ca0591eb4c8ec5d1fdd55
22
+ remote: https://github.com/ruby/gem_rbs_collection.git
23
+ repo_dir: gems
24
+ - name: erb
25
+ version: '0'
26
+ source:
27
+ type: stdlib
28
+ - name: fileutils
29
+ version: '0'
30
+ source:
31
+ type: stdlib
32
+ - name: io-console
33
+ version: '0'
34
+ source:
35
+ type: stdlib
36
+ - name: json
37
+ version: '0'
38
+ source:
39
+ type: stdlib
40
+ - name: language_server-protocol
41
+ version: 3.17.0.6
42
+ source:
43
+ type: rubygems
44
+ - name: lint_roller
45
+ version: '1.1'
46
+ source:
47
+ type: git
48
+ name: ruby/gem_rbs_collection
49
+ revision: a2080c5762e4d22bf00ca0591eb4c8ec5d1fdd55
50
+ remote: https://github.com/ruby/gem_rbs_collection.git
51
+ repo_dir: gems
52
+ - name: logger
53
+ version: '1.7'
54
+ source:
55
+ type: git
56
+ name: ruby/gem_rbs_collection
57
+ revision: a2080c5762e4d22bf00ca0591eb4c8ec5d1fdd55
58
+ remote: https://github.com/ruby/gem_rbs_collection.git
59
+ repo_dir: gems
60
+ - name: minitest
61
+ version: '5.25'
62
+ source:
63
+ type: git
64
+ name: ruby/gem_rbs_collection
65
+ revision: a2080c5762e4d22bf00ca0591eb4c8ec5d1fdd55
66
+ remote: https://github.com/ruby/gem_rbs_collection.git
67
+ repo_dir: gems
68
+ - name: monitor
69
+ version: '0'
70
+ source:
71
+ type: stdlib
72
+ - name: observer
73
+ version: '0.1'
74
+ source:
75
+ type: git
76
+ name: ruby/gem_rbs_collection
77
+ revision: a2080c5762e4d22bf00ca0591eb4c8ec5d1fdd55
78
+ remote: https://github.com/ruby/gem_rbs_collection.git
79
+ repo_dir: gems
80
+ - name: optparse
81
+ version: '0'
82
+ source:
83
+ type: stdlib
84
+ - name: parallel
85
+ version: '1.20'
86
+ source:
87
+ type: git
88
+ name: ruby/gem_rbs_collection
89
+ revision: a2080c5762e4d22bf00ca0591eb4c8ec5d1fdd55
90
+ remote: https://github.com/ruby/gem_rbs_collection.git
91
+ repo_dir: gems
92
+ - name: parser
93
+ version: '3.2'
94
+ source:
95
+ type: git
96
+ name: ruby/gem_rbs_collection
97
+ revision: a2080c5762e4d22bf00ca0591eb4c8ec5d1fdd55
98
+ remote: https://github.com/ruby/gem_rbs_collection.git
99
+ repo_dir: gems
100
+ - name: pathname
101
+ version: '0'
102
+ source:
103
+ type: stdlib
104
+ - name: pp
105
+ version: '0'
106
+ source:
107
+ type: stdlib
108
+ - name: prettyprint
109
+ version: '0'
110
+ source:
111
+ type: stdlib
112
+ - name: prism
113
+ version: 1.9.0
114
+ source:
115
+ type: rubygems
116
+ - name: racc
117
+ version: '1.8'
118
+ source:
119
+ type: git
120
+ name: ruby/gem_rbs_collection
121
+ revision: a2080c5762e4d22bf00ca0591eb4c8ec5d1fdd55
122
+ remote: https://github.com/ruby/gem_rbs_collection.git
123
+ repo_dir: gems
124
+ - name: rainbow
125
+ version: '3.0'
126
+ source:
127
+ type: git
128
+ name: ruby/gem_rbs_collection
129
+ revision: a2080c5762e4d22bf00ca0591eb4c8ec5d1fdd55
130
+ remote: https://github.com/ruby/gem_rbs_collection.git
131
+ repo_dir: gems
132
+ - name: rake
133
+ version: '13.0'
134
+ source:
135
+ type: git
136
+ name: ruby/gem_rbs_collection
137
+ revision: a2080c5762e4d22bf00ca0591eb4c8ec5d1fdd55
138
+ remote: https://github.com/ruby/gem_rbs_collection.git
139
+ repo_dir: gems
140
+ - name: rbs
141
+ version: 4.2.0
142
+ source:
143
+ type: rubygems
144
+ - name: rdoc
145
+ version: '0'
146
+ source:
147
+ type: stdlib
148
+ - name: regexp_parser
149
+ version: '2.8'
150
+ source:
151
+ type: git
152
+ name: ruby/gem_rbs_collection
153
+ revision: a2080c5762e4d22bf00ca0591eb4c8ec5d1fdd55
154
+ remote: https://github.com/ruby/gem_rbs_collection.git
155
+ repo_dir: gems
156
+ - name: repl_type_completor
157
+ version: 0.1.16
158
+ source:
159
+ type: rubygems
160
+ - name: rubocop
161
+ version: '1.57'
162
+ source:
163
+ type: git
164
+ name: ruby/gem_rbs_collection
165
+ revision: a2080c5762e4d22bf00ca0591eb4c8ec5d1fdd55
166
+ remote: https://github.com/ruby/gem_rbs_collection.git
167
+ repo_dir: gems
168
+ - name: rubocop-ast
169
+ version: '1.46'
170
+ source:
171
+ type: git
172
+ name: ruby/gem_rbs_collection
173
+ revision: a2080c5762e4d22bf00ca0591eb4c8ec5d1fdd55
174
+ remote: https://github.com/ruby/gem_rbs_collection.git
175
+ repo_dir: gems
176
+ - name: tsort
177
+ version: '0'
178
+ source:
179
+ type: stdlib
180
+ - name: zeitwerk
181
+ version: '2.8'
182
+ source:
183
+ type: git
184
+ name: ruby/gem_rbs_collection
185
+ revision: a2080c5762e4d22bf00ca0591eb4c8ec5d1fdd55
186
+ remote: https://github.com/ruby/gem_rbs_collection.git
187
+ repo_dir: gems
188
+ gemfile_lock_path: Gemfile.lock
@@ -0,0 +1,19 @@
1
+ # Download sources
2
+ sources:
3
+ - type: git
4
+ name: ruby/gem_rbs_collection
5
+ remote: https://github.com/ruby/gem_rbs_collection.git
6
+ revision: main
7
+ repo_dir: gems
8
+
9
+ # You can specify local directories as sources also.
10
+ # - type: local
11
+ # path: path/to/your/local/repository
12
+
13
+ # A directory to install the downloaded RBSs
14
+ path: .gem_rbs_collection
15
+
16
+ # gems:
17
+ # # If you want to avoid installing rbs files for gems, you can specify them here.
18
+ # - name: GEM_NAME
19
+ # ignore: true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gempilot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Gillis
@@ -131,19 +131,30 @@ files:
131
131
  - lib/gempilot/cli/commands/release.rb
132
132
  - lib/gempilot/cli/gem_builder.rb
133
133
  - lib/gempilot/cli/gem_context.rb
134
+ - lib/gempilot/cli/gem_scaffold.rb
134
135
  - lib/gempilot/cli/generator.rb
135
136
  - lib/gempilot/gem_constant.rb
136
137
  - lib/gempilot/github_release.rb
137
138
  - lib/gempilot/origin.rb
138
139
  - lib/gempilot/project.rb
139
140
  - lib/gempilot/project/version.rb
141
+ - lib/gempilot/rbs_task.rb
140
142
  - lib/gempilot/release_tasks.rb
141
143
  - lib/gempilot/segmented_version.rb
142
- - lib/gempilot/strict_shell.rb
144
+ - lib/gempilot/shell.rb
145
+ - lib/gempilot/shell/command_failed.rb
146
+ - lib/gempilot/shell/gateway.rb
147
+ - lib/gempilot/shell/invocation.rb
148
+ - lib/gempilot/shell/result.rb
149
+ - lib/gempilot/shell/status.rb
150
+ - lib/gempilot/shell/stub_gateway.rb
151
+ - lib/gempilot/shell/unregistered_command.rb
143
152
  - lib/gempilot/version.rb
144
153
  - lib/gempilot/version_tag.rb
145
154
  - lib/gempilot/version_task.rb
146
155
  - lib/gempilot/zeitwerk_task.rb
156
+ - rbs_collection.lock.yaml
157
+ - rbs_collection.yaml
147
158
  - vendor/vendored.gemv
148
159
  homepage: https://github.com/gillisd/gempilot
149
160
  licenses:
@@ -165,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
176
  - !ruby/object:Gem::Version
166
177
  version: '0'
167
178
  requirements: []
168
- rubygems_version: 4.0.20
179
+ rubygems_version: 4.0.24
169
180
  specification_version: 4
170
181
  summary: A toolkit for creating, managing, and releasing your own rubygems
171
182
  test_files: []
@@ -1,18 +0,0 @@
1
- require "rake"
2
-
3
- module Gempilot
4
- ## Wraps Rake's sh to raise on non-zero exit status.
5
- module StrictShell
6
- include Rake::FileUtilsExt
7
-
8
- private
9
-
10
- def sh(*args, **kwargs)
11
- super do |ok, res|
12
- raise "Command #{args.join(" ").inspect} failed (exit #{res.exitstatus})" unless ok
13
-
14
- [ok, res]
15
- end
16
- end
17
- end
18
- end