fix gemspec directive support (closes #2)#4
Open
nz wants to merge 2 commits into
Open
Conversation
nz
force-pushed
the
nz/gemspec-directive-fix
branch
from
July 14, 2026 17:14
ff7fd42 to
475b36f
Compare
nz
force-pushed
the
nz/pipeline-refactor-and-docs
branch
from
July 14, 2026 17:26
a5f4e7b to
13ebc91
Compare
nz
force-pushed
the
nz/gemspec-directive-fix
branch
from
July 14, 2026 17:26
475b36f to
e3cda70
Compare
robsears
approved these changes
Jul 14, 2026
Gemfiles from the default `bundle gem` layout use the `gemspec` directive, which makes Bundler glob for `*.gemspec` in the working directory at Gemfile eval time. The group-detection IFD previously copied only Gemfile and Gemfile.lock into its sandbox, so Bundler aborted with `Bundler::InvalidOption: There are no gemspecs at ...` before any gems could be resolved. This effectively broke gemfileEnv for every gem-under-development. Adds `gemspec` and `extraFiles` params to gemfileEnv, mirroring bundlerEnv's `extraConfigPaths`. `extraFiles` is an attrset keyed by destination path so files land where the gemspec's require_relative calls expect them. Detects the `gemspec` directive in Nix and throws an actionable error (with a copy-pasteable snippet) when it appears without a matching `gemspec` param, so users don't have to decipher a Bundler backtrace. Bumps nixpkgs 24.11 -> 26.05 to pick up bundler >= 2.6, which is what writes CHECKSUMS via `bundle lock --add-checksums`; the fixture lockfile would otherwise need hand-written sha256s. Ruby moves 3.3 -> 3.4 as a side effect; existing checks pass unchanged. Fixture at test/integration/gemspec-directive/ exercises the full path: a minimal `bundle gem`-style layout with foo.gemspec + lib/foo/version.rb and rake as a runtime dep. `integration-gemspec-directive` wires it into `nix flake check`.
nz
force-pushed
the
nz/gemspec-directive-fix
branch
from
July 14, 2026 17:47
e3cda70 to
10f5209
Compare
The canonical `bundle gem` gemspec computes spec.files via IO.popen(%w[git ls-files -z]). The group-inference sandbox had only ruby and bundler on PATH, so that popen raised Errno::ENOENT and gemspec evaluation aborted — defeating the gemspec-directive support this branch adds. Add git to the sandbox buildInputs so the standard gemspec evaluates and degrades to an empty file list in the non-git sandbox.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2 — the group-detection IFD sandbox previously copied only
GemfileandGemfile.lock, so any Gemfile using thegemspecdirective (i.e. every gem generated bybundle gem) aborted withBundler::InvalidOption: There are no gemspecs at …before any gems could resolve.gemspecandextraFilesparams ongemfileEnv(mirrorsbundlerEnv'sextraConfigPaths).extraFilesis an attrset keyed by destination path sorequire_relativetargets land where the gemspec expects them.gemspecdirective raises an actionable error with a copy-pasteable fix, thrown before Bundler is ever invoked. Bypassed when the caller suppliesgemGroups(which already skips the IFD).test/integration/gemspec-directive/fixture: minimalbundle gem-shaped layout withfoo.gemspec,lib/foo/version.rb, andrakeas a runtime dep. Wired intoflake.checksasintegration-gemspec-directive.Common Errorsentry for the new error message.Scope note
Bumps
nixpkgs24.11 to 26.05 to pick up bundler 2.6, whosebundle lock --add-checksumsis required to author the fixture lockfile without hand-writing sha256s. Ruby moves from 3.3 to 3.4 as a side effect; existing checks pass unchanged. I guess if anyone has bugs on older nixpkgs/rubies open an issue and we can target that in a test matrix.Base
Stacked on top of #3 (
nz/pipeline-refactor-and-docs) since it depends on the newerparse-gemfile-and-lockfile.nixand thegemGroupsescape hatch referenced in the error message.Test plan
nix flake checkpasses on aarch64-darwin (addsintegration-gemspec-directiveon top of the existing checks)nixfmt --checkcleangemspec, gemfileEnv throws the new actionable error (verified against the fixture)gemspec+extraFiles, the environment builds andrakeloads under Ruby (validate.rb)gemGroupsescape hatch still bypasses the IFD (no gemspec required)