Skip to content

feat(makefile): docker_network/docker_volumes + rspec-rails detection (#46, #48)#49

Merged
matthew-on-git merged 1 commit into
mainfrom
fix/rails-rspec-detection-and-docker-networking
May 29, 2026
Merged

feat(makefile): docker_network/docker_volumes + rspec-rails detection (#46, #48)#49
matthew-on-git merged 1 commit into
mainfrom
fix/rails-rspec-detection-and-docker-networking

Conversation

@matthew-on-git
Copy link
Copy Markdown
Contributor

Summary

Bundles two downstream Rails-sync fixes surfaced from tipsyhive into one PR.

  • make test fails locally for Rails projects with a sibling Postgres container #48 (Added): two optional .devrail.yml keys for customizing the toolchain container's docker run:
    • docker_network — a single user-defined network name, rendered as --network <name>, so the container can reach a sibling service container (e.g. a Postgres at hostname myapp-pg during make test).
    • docker_volumes — a list of host:container (or volume:container) mount specs, each rendered as -v <spec>.
    • Both are injected into DOCKER_RUN, mirror the existing env:DEVRAIL_ENV_FLAGS pattern, and are no-ops when absent.
  • Ruby: RUBY_EXEC_FOR,rspec macro fails to detect rspec-rails-based projects #46 (Fixed): RUBY_EXEC_FOR now keys rspec detection on rspec-core (the runner gem) instead of a bare rspec lock entry. Rails apps declare only rspec-rails, so the old pattern skipped bundle exec and ran the container's bundled rspec — activating Ruby 3.4's default cgi 0.4.2 before bundler/setup could switch to the lock-pinned cgi 0.5.1 (Gem::LoadError). The fix preserves the "only bundle exec when the project pins the tool" behaviour for non-Rails projects.

Design notes (#48 open questions, resolved)

  • Single docker_network, not a listdocker run only honors one --network at launch; additional networks require a separate docker network connect. A single value matches Docker's actual behaviour.
  • docker_volumes included alongside docker_network (list of -v specs; docker run does honor multiple -v).
  • Configured in .devrail.yml, mirroring env: — declarative and in-band, rather than a new Makefile.local include hook.

Test plan

Closes #46
Closes #48

🤖 Generated with Claude Code

Bundles two downstream Rails-sync fixes surfaced from tipsyhive.

#48 (Added): new optional .devrail.yml keys `docker_network` (single
network name -> --network) and `docker_volumes` (list -> repeated -v),
injected into DOCKER_RUN. Lets projects reach a sibling service
container (e.g. Postgres at `myapp-pg`) and mount extra data during
`make test`. Mirrors the existing `env:` -> DEVRAIL_ENV_FLAGS pattern;
no-ops when absent.

#46 (Fixed): RUBY_EXEC_FOR now keys rspec detection on `rspec-core`
(the runner gem) instead of a bare `rspec` lock entry. Rails apps
declare only `rspec-rails`, so the old pattern skipped `bundle exec`
and ran the container's bundled rspec, activating Ruby 3.4's default
cgi 0.4.2 before bundler/setup (Gem::LoadError vs lock-pinned 0.5.1).
Preserves the "only bundle exec when the project pins the tool"
behaviour for non-Rails projects.

Regression coverage added to tests/smoke-rails.sh (sections 5 and 6)
via `make --eval` probes against the mounted Makefile. README and
CHANGELOG updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
matthew-on-git added a commit to devrail-dev/devrail-standards that referenced this pull request May 29, 2026
…rail.yml

Three top-level keys that the reference Makefile already (or now) reads
were previously undocumented in the canonical schema reference:

- env: project-specific environment variables passed into the toolchain
  container via -e KEY=value (DEVRAIL_ENV_FLAGS). Existing feature,
  documented for the first time.
- docker_network: attaches the container to a user-defined Docker network
  via --network <name>, so it can reach sibling service containers (e.g.
  a Postgres at hostname `myapp-pg` during `make test`). New in
  dev-toolchain #48.
- docker_volumes: additional `docker -v` mounts. New in dev-toolchain #48.

The Single-Language Project (Ruby on Rails) example is extended to show
the sibling-Postgres pattern that motivated #48.

Companion to devrail-dev/dev-toolchain#49.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@matthew-on-git matthew-on-git merged commit 60b4254 into main May 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant