Comments (23)
It is because there is a function which searches for "Dockerfile" to determine the projects root directory. If there is none, the use of docker is disabled. This was intended to enable docker-compose
from the root directory of the project, if some files deeper in the directory tree are beeing edited when rspec mode is run. Even the projects root directory is needed to get the relative filename of specs to run. As a quick workaround you can create an empty Dockerfile in your apps root directory.
To resolve the issue, there could be a distinction if docker
or docker-compose
is given as rspec-docker-command
. Also it would be reasonable to look for "docker-compose.yml" instead of "Dockerfile" and/or to allow a variable filename to find projects root.
from rspec-mode.
I think most of those are used for scripting purposes, don't they? Like, the CI script copies docker-compose.gitlab.yml
to docker-compose.yml
before running the build.
In any case, I can simply add a custom var with the file name to look for.
from rspec-mode.
some people might be still using Docker without docker-compose
Then they have to customize docker-command
anyway.
from rspec-mode.
Is there a Dockerfile in the project root?
from rspec-mode.
@dgutov yes, but they end with different extensions, eg.: Dockerfile.aws
from rspec-mode.
How do you choose which one to use?
from rspec-mode.
Locally its used via docker-compose
from rspec-mode.
What is?
from rspec-mode.
You can read about docker-compose
here
from rspec-mode.
@micdahl seems a reasonable workaround. Extending the topic, which function looks for the Dockerfile
in the project root? Maybe extending how it searches for the file could solve the issue of having multiple Dockerfiles
with extensions.
from rspec-mode.
After revisiting, I found the responsible code here. I think the second part of the and
statement could just be removed, so that rspec-docker-p
only relies on rspec-use-docker-when-possible
:
(defun rspec-docker-p ()
rspec-use-docker-when-possible)
That should do the trick, but I am unsure about the correct use of lisp, as I haven't had a look on it for years.
from rspec-mode.
@fibrasek You can certainly use advice on rspec-docker-p
to make it behave however you like.
@micdahl Not sure simply removing the existence check is the correct approach. After all, all other similar variables work that way. At the very least, the option would have to be renamed.
from rspec-mode.
@dgutov thanks for the tip, Ill look up on how to properly use advice, since my lisp skills are pretty basic 😄
from rspec-mode.
I believe that it is worth mentioning in README that rspec-mode expects to find Dockerfile in the root directory. For new users it is very confusing because having Dockerfile in non-root directory is pretty common practice(for example https://github.com/evilmartians/terraforming-rails/tree/master/examples/dockerdev ).
Other than that rspec-mode
is awesome
from rspec-mode.
@nfedyashev How can we support this use case? Can we just look for docker-compose.yml
as well?
from rspec-mode.
Can we just look for docker-compose.yml as well?
yes or checking for the presence of files named like docker-compose* - it covers cases like
docker-compose.yml
docker-compose.consul.yml
docker-compose.dev.yml
docker-compose.prod.yml
docker-compose.override.yml
docker-compose.sec.yml
docker-compose.storage.yml
docker-compose.sync.yml
docker-compose.development.yml
Examples were taken from https://github.com/search?q=docker-compose&type=Code
from rspec-mode.
Although I never used custom docker-compose yaml confg files(like docker-compose.custom.yml) I suspect some may use it for expressiveness/explicitness in their complex projects.
CI script most likely doesn't need to copy/rename docker-compose config files because it can explicitly specify which config to pick up using docker-compose -f docker-compose.custom.yml
In any case, I can simply add a custom var with the file name to look for.
👍
and the default value would be "docker-compose.yml"? This should solve the issue for most generic projects and make it really easy to understand what to do in the case of custom Compose files because it is explicit and clear in form of variable name.
from rspec-mode.
and the default value would be "docker-compose.yml"?
Why not "Dockerfile"? :)
In your experience, do people use Docker without docker-compose these days?
from rspec-mode.
from rspec-mode.
I'm, uh, trying to minimize the number of disk accesses in the default config (mostly important when one uses Tramp, but still). The var could be a list, but the default would have one element.
Speaking of, one of the recent PRs sneaked in a change in the default of rspec-docker-command
. @pedz, did you have to customize that?
from rspec-mode.
from rspec-mode.
Given that this is Docker + RoR + Development (since this is using Rspec) … I’d go with docker compose
Excellent, docker-compose it is!
Turns out you can use Brave instead of Chrome
Or, um, Firefox?
from rspec-mode.
and the default value would be "docker-compose.yml"?
Why not "Dockerfile"? :)
oh, sorry, I might have misunderstood your point.
I thought that's going to be combined check(presence of Dockerfile OR docker-compose.yml).
In your experience, do people use Docker without docker-compose these days?
I guess some people might be still using Docker without docker-compose.
from rspec-mode.
Related Issues (20)
- Copy last test command to clipboard HOT 3
- How to customize rspec erorr stack colours matching with my preferred theme. HOT 7
- rspec-mode does not work when I follow the instruction on README HOT 3
- Wrong Ruby version used during test invocation with Rbenv + ZSH + Spacemacs HOT 9
- Handle the FactoryGirl -> FactoryBot rename HOT 1
- Multiple rspec processes at the same time HOT 1
- Error for rspec-compile-target-directory HOT 3
- Running `rspec-verify-matching` uses wrong full path to matched files HOT 7
- Opt out of multiple compilation buffer support HOT 2
- Using rake spec doesn't exclude files HOT 3
- Docker based invocation should not assume presence of bash HOT 4
- Request: Ability to configure primary spec directory
- How disable rspec -b backtrace options HOT 2
- Low level configurable spec runner command HOT 3
- Trouble using rspec-mode with docker HOT 6
- Pry history is broken HOT 1
- Support for request specs in rspec-toggle-spec-and-target? HOT 5
- rspec not using test env if RAILS_ENV is set in the environment. HOT 4
- Newly started spring server gets stopped by SIGHUP at end of run HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rspec-mode.