Open pedz opened 11 years ago
Taking a cue from ruby-compilation
, wouldn't it be easier to leave cucumber-compilation-executable
as a string, so that you could set it to bundle exec cucumber
, and then have cucumber-compilation-run
split it as follows?
(defun cucumber-compilation-run (cmd)
"Run a cucumber process, dumping output to a compilation buffer."
(interactive)
(let* ((name (file-name-nondirectory (car (split-string cmd))))
(profile-name (cucumber-compilation-profile-name))
(cmdlist (append (split-string-and-unquote cucumber-compilation-executable)
(list "-p" profile-name
(expand-file-name cmd)))))
(pop-to-buffer (cucumber-compilation-do name cmdlist))))
In general, I don't think it's advisable to change the default command to use bundle
, but I agree that that case should be handled better.
I didn't know how to change it really. The "split string" fails if you need an argument with a space (yea... so what? you might ask). Sometimes a package has the command string and then a list of arguments that can be added. I Googled looking for an emacs idiom for this but didn't find anything.
As far as bundle, rake, etc... I can't claim any expertise here. My situation is that for some reason, running cucumber on the command line fails because selenium-webdriver is not on my system but running it via bundler works. The rubygems require tries to load all the dependencies of a gem so when capybara is loaded, it sees the dependency on selenium-webdriver, tries to load it, and fails. I assume bundle puts in its own method for require (like rubygems does) but does not load the dependencies.
As far as what is preferred or recommended, I don't know for sure. I would assume the test wants to be as close to production as possible and in production, bundle is used to actually kick off the application (at least in the version of rails I'm running 3.2.8). Sprinkle liberally with disclaimers... I don't really know for sure about any of this.
I posted a question on the mailing list and didn't get a reply so I tried hacking it myself.
I hope this helps...
Maybe go the more user-friendly way and do what rspec-mode
does? It has variable rspec-use-bundler-when-possible
, and when it's t
and one of the parent directories contains Gemfile
, it prepends the command with "bundle exec".
I don't use cucumber though, so feel free to disregard.
I posted a question on "cukes" (the google group for Cucumber). The short answer is, set up your environment properly and then just use "cucumber" (not via rake and not via bundle exec). I'm in the process of setting up my environment so that will work.
Thanks for the update. Maybe comment again when you've got it working. Sounds like we can close this issue if you succeed!
This prompted the addition of flatten to the processing of the command and its arguments