using spring does not work from subdirectories

Open
#644 11 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
rails, ruby

Research direction

Reproduce spring rspec lib/acts_as_list_spec.rb from the spec directory and inspect config/spring.rb alongside the Spring client and server handling of the working directory. Done means Spring locates the parent project's config/application.rb and runs the command with the expected project working directory.

Written by the indexing model from the issue text.

Description

bug

having a rails project with a spec directory:

spring rspec lib/acts_as_list_spec.rb
>> Spring was unable to find your config/application.rb file. Your project root was detected at /Users/cody/src/canvas-lms/spec, so Spring looked for /Users/cody/src/canvas-lms/spec/config/application.rb but it doesn't exist. You can configure the root of your application by setting Spring.application_root in config/spring.rb.

But non-springified works fine, properly searching the parent dir for the Gemfile, and then booting the app.

I've explored this quite a bit by monkey patching, and even if you can get the Spring client to boot via enough tricks, the server will still try to launch from the wrong directory and throw the same error. If you're sneaky and boot the server from the actual project root, and then run spring rspec from the spec directory, it will not have the some working directory, and just be confusing. It seems like the server needs to be directory aware - having the client pass its working directory through, and the server changing to that before running the command.

Dominant language
Ruby
Stars
2.8k
Forks
342
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rails/spring

All issues in rails/spring

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.