How do you setup a rails project to work with a remote ruby install?
My dev machine is running Windows, IntelliJ Idea 13 (EAP), and VirtualBox. I run a virtual linux server with ruby (setup to match the production server I'll deploy to). I have configured IntelliJ to use the ruby SDK on the (virtually) remote server, but I am having problems creating new rails projects because it is trying to pass windows local paths to the remote ruby install.
On my windows, I try to create the project in D:\Projects\MyRubyProject
On the VM, that dir maps to /projects/MyRubyProject
In the new project dialog, I would like to set the content root to /projects/MyRubyProject, but if I do it says it doesnt exists and ask to create it, when it creates it, it is created in the IntelliJ install dir. I tried giving it the same type of ssh:// path that the remote SDK accepts, but it just silentl fails.
Any suggestions or is this something that is just not supported?
请先登录再写评论。
Hi,
creating project with remote sdk is not supported (you have to do it manually).
The fact that you can choose it in Idea+Plugin is our bug :(
pelase file it in our tracker http://youtrack.jetbrains.com/issues/RUBY
Thanks in advance, Oleg.
ok, so given that, here are the steps I tried. Please let me know where I am getting it wrong.
Not sure what to do next. If I run the rails generator dialg (ctrl+alt+g) it says generator not found. How do I run rails new? If I hit the run button, it tries to run from my local, not the remote, and fails: "Rails server launcher D:/Projects/test/script/server wasnt found in project"
I also downloaded and installed RubyMine 6 and did the same steps (adjusting as needed for the slightly diff menus/UI). It had the same results except running gave this message: "Rails server launcher D:/Projects/rmtest/bin/rails wasnt found in project"
I figured out how to get this working, except for running tests.
At this point I can run different generators, startup rails, etc. The one problem I am now having is getting testing fully working.
There are a couple different probs. First, whenever the project is opened, the rake working dir is set to $MODULE_DIR$ and running rake gives "Error running test: depot: Working directory doesn't exist". Setting the working dir to the project dir (for me: D:|Projects\depot) fixes it until the next time I open the project. Annoying, but I can work around it. Any way to make this setting permanent (or to have $MODULE_DIR$ evaluated when used in that context)?
Once that is changed, I can run the tests. Console output is:
/usr/local/bin/ruby -C'/projects/depot' -e '$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)' /projects/depot/bin/rake test
Testing started at 4:06 PM ...
Run options: --seed 735
# Running tests:
.........
Finished tests in 0.622883s, 14.4489 tests/s, 24.0816 assertions/s.
9 tests, 15 assertions, 0 failures, 0 errors, 0 skips
Process finished with exit code 0
That looks fine, but the Event Log has: "Empty test suite" and the GUI test result tree only has one branch: "Unable to attach test reporter to test framework or test framework quit unexpectedly". The only .rb files in my test dir (except test_helper.rb) end with _test.rb and all contain at least one test case. So I'm not sure with test suite is empty? I tried adding the following to my Gemfile, but it didnt change the result.
gem "minitest"
gem "minitest-reporters", '>= 0.5.0'
I'm running ruby 2.0.0, rails 4.0.0, minitest 4.7.5, and minitest-reporters 0.14.22 (as shown in the Modules section of the Project Structure dlg).
Any suggestions would be appreciated. Thanks for your help!
Hi Joshua,
the steps you've made looks fine expect I'd expect that #4 is not required.
As for the problems you have both looks like a bug for me so I'd suggest to file a tickets for them in our tracker (http://youtrack.jetbrains.com/issues/RUBY)
It would be very helpful if you'd provide a test project which reproduces the problems.
Thanks in advance, Oleg.
P.S. Do not forget to specify which particular build of Idea and Ruby plugin you are using.
I created these issues:
http://youtrack.jetbrains.com/issue/RUBY-14293 - Test results tree not getting populated
http://youtrack.jetbrains.com/issue/RUBY-14294 - Rake work dir not playing well with $MODULE_DIR$
Thank you, I will take care of these problems.
Oleg.
I'm not sure which #4 you meant, but if you meant: "Go into each run/debug config and setup ip address, port, working dir, path mappings, and ruby sdk (some items may not need all of these)" I retested and found that working dir and path mappings are not required (as you expected), but I did need to change ip/port--these are in the rails config and were set to 127.0.0.1 and 3000; this would work if I had proxy pass setup, but I currently dont, so I set them to 192.168.1.254 and 80--and ruby sdk--this one depends on whether you fix the bug of not allowing remote sdk selection during project creation. If no sdk is selected during project creation then this is set to [No SDK selected] and needs to be set in each run config. If the remote sdk is selected during project creation, then it is set to use the project's sdk. I havent tested selecting no sdk during project creation and then setting the sdk in the project structure, if that auto updates all run configs.
Anyway, thanks again for all the help on this.