gempilot 0.4.0 → 0.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53a52246a6719fec251c1ac15f2db5270ff7419984ff93db68b0fd3c259c0ea7
4
- data.tar.gz: 0d5f4d32f3c373c20eb4d846b9be8ce1b5f006cfea4700c8383228d7edd95de0
3
+ metadata.gz: 320de6965ef0089a0e50d5a51e272a2a5ef21a3c5f48e6fc9a6aac5a2e380925
4
+ data.tar.gz: 7bac12867b04d35d6ec2ca2d27bd239254ef6213b9d13384691532685aa2886e
5
5
  SHA512:
6
- metadata.gz: f6585d264a17e3eb49bb37d085486b8671dbfaed3207370ca2a207edf570c893291b805600eef13f3f37eafe05474ab00e5d977bfa0a5e9e277b1b498c52692d
7
- data.tar.gz: 377229960329acd2601a65c8acab370e2d390b2f33752f1614044cc66e7e64eb8ccfb97af5745aa0d2bc879ef348fca8b82e21b2f0c62a9a9a3e4965f52eda99
6
+ metadata.gz: 544b3fb273103b5cbcb14c3f6e68e6a207b93ebedc2cb5387ca3b85e7c45c9ce8947f61563e6078c93e16e98774806e95d48410cee1c7f479f0195ffb1a64bd3
7
+ data.tar.gz: 1da8891d7d49cf3f4d7099cdf8a0a4e695527d5ac8ca1448d6fc5e3363e46293b836659c7532386bd4225fe82b2b912969483ffbaa732b5763dfeb380b198c12
data/CLAUDE.md CHANGED
@@ -23,7 +23,7 @@ A CLI tool for creating and managing Ruby gems, built on CommandKit.
23
23
  - `GemScaffold` (`lib/gempilot/cli/gem_scaffold.rb`) renders a new gem's files and runs no commands; `Commands::Create` subclasses it to run `bin/setup` and commit
24
24
  - GemContext module (`lib/gempilot/cli/gem_context.rb`) shared by new, destroy, release, console
25
25
  - `GemConstant` value object (`lib/gempilot/gem_constant.rb`) owns constant→namespace/path resolution for `new`/`destroy`; constants are rooted at the gem module by construction
26
- - `Gempilot::RBSTask` (`lib/gempilot/rbs_task.rb`, a `Rake::TaskLib`) wraps `rbs collection`: `rbs:setup`, `rbs:clobber`, `rbs:validate`, `rbs:collection:init/install/update` (requires `rbs` in the consuming gem's bundle)
26
+ - `Gempilot::RBSTask` (`lib/gempilot/rbs_task.rb`, a `Rake::TaskLib`) wraps `rbs collection`: `rbs:setup`, `rbs:clobber`, `rbs:validate`, `rbs:default_gems` (adds the bundle's default gems to `rbs_collection.yaml` via `Gempilot::Rubygems::Env`), `rbs:collection:init/install/update` (requires `rbs` in the consuming gem's bundle)
27
27
  - `SegmentedVersion` value object (`lib/gempilot/segmented_version.rb`) owns version parsing and bump arithmetic; every bump moves to the smallest version of the requested shape greater than the current version (RubyGems ordering)
28
28
  - CommandKit::Commands::AutoLoad maps filenames in `commands/` to command names
29
29
 
@@ -48,5 +48,5 @@ A CLI tool for creating and managing Ruby gems, built on CommandKit.
48
48
  - GitHub Actions CI workflow (`.github/workflows/ci.yml`)
49
49
  - `git ls-files`-based gemspec with glob fallback for non-git repos
50
50
  - Version lifecycle rake tasks installed via `Gempilot::VersionTask.new` (a `Rake::TaskLib`): `version:current/bump/commit/tag/untag/reset/revert` and composite `version:release`/`version:unrelease`
51
- - RBS collection rake tasks via `Gempilot::RBSTask.new`; `bin/setup` runs `rake setup`, which chains `rbs:setup` → `rbs:collection:install` → `rbs:collection:init`. `gempilot create` runs the new gem's `bin/setup`, so the collection (and `rbs_collection.lock.yaml`) exist before the initial commit
51
+ - RBS collection rake tasks via `Gempilot::RBSTask.new`; `bin/setup` runs `rake setup`, which chains `rbs:setup` → `rbs:default_gems` → `rbs:collection:init`, then `rbs:collection:install`. `gempilot create` runs the new gem's `bin/setup`, so the collection (and `rbs_collection.lock.yaml`) exist before the initial commit
52
52
  - Publishing rake tasks (mixed into `VersionTask` via `Gempilot::ReleaseTasks`): `release` (all remotes), `release:rubygems`, `release:github`, `release:list:github`, `unrelease`, `unrelease:github`. These override and reuse bundler's `bundler/gem_tasks` release chain; `release:source_control_push` is replaced with `Gempilot::Origin` to push commit+tag idempotently
@@ -11,6 +11,7 @@ gem "minitest-reporters"
11
11
  <% end -%>
12
12
  gem "rake"
13
13
  gem "rbs"
14
+ gem "repl_type_completor"
14
15
  <% if @test_framework == :rspec -%>
15
16
  gem "rspec", "~> 3.0"
16
17
  <% end -%>
@@ -1,5 +1,6 @@
1
1
  require "rake/clean"
2
2
  require "rake/tasklib"
3
+ require "yaml"
3
4
  require_relative "../gempilot"
4
5
 
5
6
  module Gempilot
@@ -31,6 +32,7 @@ module Gempilot
31
32
  define_setup_task
32
33
  define_clobber_task
33
34
  define_validate_task
35
+ define_default_gems_task
34
36
  namespace(:collection) { define_collection_tasks }
35
37
  end
36
38
  define_top_level_hooks
@@ -44,7 +46,21 @@ module Gempilot
44
46
 
45
47
  def define_setup_task
46
48
  desc "Install the rbs collection rbs_collection.lock.yaml pins"
47
- task setup: ["rbs:collection:install"]
49
+ task setup: ["rbs:default_gems", "rbs:collection:install"]
50
+ end
51
+
52
+ def define_default_gems_task
53
+ yaml = collection_yaml
54
+ desc "List the default gems the bundle uses in rbs_collection.yaml"
55
+ task(default_gems: ["rbs:collection:init"]) { add_collection_gems(yaml, Rubygems::Env.new.default_gems.map(&:name)) }
56
+ end
57
+
58
+ def add_collection_gems(yaml, names)
59
+ collection = YAML.load_file(yaml) || {}
60
+ listed = collection.fetch("gems", nil) || []
61
+ missing = names - listed.map { it["name"] }
62
+ collection["gems"] = listed + missing.map { { "name" => it } }
63
+ File.write(yaml, YAML.dump(collection))
48
64
  end
49
65
 
50
66
  def define_clobber_task
@@ -0,0 +1,37 @@
1
+ module Gempilot
2
+ module Rubygems
3
+ # Finds the default gems (the gems that ship with Ruby) that the current bundle locks.
4
+ #
5
+ # Gempilot::Rubygems::Env.new.default_gems.map(&:name)
6
+ # # => ["erb", "pp", "prettyprint", "prism", "tsort"]
7
+ class Env
8
+ def default_gems_dir
9
+ Pathname(Gem.default_specifications_dir)
10
+ end
11
+
12
+ def default_gems
13
+ index = all_default_gems.to_h { [it.name, it] }
14
+ Bundler
15
+ .locked_gems
16
+ .specs
17
+ .select { index.key? it.name }
18
+ end
19
+
20
+ def all_default_gems
21
+ @all_default_gems ||= begin
22
+ default_gems_dir
23
+ .children
24
+ .map(&:to_s)
25
+ .map { load_spec it }
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def load_spec(body)
32
+ # noinspection RubyMismatchedReturnType
33
+ Gem::Specification.load body
34
+ end
35
+ end
36
+ end
37
+ end
@@ -1,3 +1,3 @@
1
1
  module Gempilot
2
- VERSION = "0.4.0".freeze
2
+ VERSION = "0.4.1".freeze
3
3
  end
@@ -154,7 +154,7 @@ gems:
154
154
  remote: https://github.com/ruby/gem_rbs_collection.git
155
155
  repo_dir: gems
156
156
  - name: repl_type_completor
157
- version: 0.1.16
157
+ version: 0.1.17
158
158
  source:
159
159
  type: rubygems
160
160
  - name: rubocop
data/rbs_collection.yaml CHANGED
@@ -1,19 +1,16 @@
1
- # Download sources
1
+ ---
2
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
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
+ path: ".gem_rbs_collection"
9
+ gems:
10
+ - name: erb
11
+ - name: pp
12
+ - name: prettyprint
13
+ - name: prism
14
+ - name: tsort
15
+ - name: io-console
16
+ - name: json
@@ -0,0 +1,15 @@
1
+ module Gempilot
2
+ module Rubygems
3
+ class Env
4
+ def default_gems_dir: () -> Pathname
5
+
6
+ def default_gems: () -> Array[Gem::Specification]
7
+
8
+ def all_default_gems: () -> Array[Gem::Specification]
9
+
10
+ private
11
+
12
+ def load_spec: (string body) -> Gem::Specification
13
+ end
14
+ end
15
+ end
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.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Gillis
@@ -140,6 +140,7 @@ files:
140
140
  - lib/gempilot/project/version.rb
141
141
  - lib/gempilot/rbs_task.rb
142
142
  - lib/gempilot/release_tasks.rb
143
+ - lib/gempilot/rubygems/env.rb
143
144
  - lib/gempilot/segmented_version.rb
144
145
  - lib/gempilot/shell.rb
145
146
  - lib/gempilot/shell/command_failed.rb
@@ -155,7 +156,7 @@ files:
155
156
  - lib/gempilot/zeitwerk_task.rb
156
157
  - rbs_collection.lock.yaml
157
158
  - rbs_collection.yaml
158
- - vendor/vendored.gemv
159
+ - sig/gempilot/rubygems/env.rbs
159
160
  homepage: https://github.com/gillisd/gempilot
160
161
  licenses:
161
162
  - MIT
data/vendor/vendored.gemv DELETED
Binary file