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?

7 comments

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.

0

ok, so given that, here are the steps I tried. Please let me know where I am getting it wrong.

  1. New Project Dialog
    1. Type: Ruby Module
    2. Project name: test
    3. leave all others paths at their defaults
    4. there's no way to de-select the only SDK which is a remote, so I hit the Configure... button and remove it and continue without an SDK specified
    5. Check Ruby on Rails and SQL Support for the desired technologies
  2. Deployment Configuration Dialog
    1. SFTP Host is 192.168.1.254
    2. Connection tests successfully
    3. Web server root URL is http://192.168.1.254
    4. Setup the mapping from the  project dir to the dir it is mounted to in the virtual machine
  3. Project Structure Dialog
    1. Hit the New... project SDK button
    2. Select Ruby SDK and new remote
    3. Hit fille from deploy settings button
    4. Connection tests successfully
    5. Browse to the remote location of ruby (/usr/local/bin/ruby)
    6. Hit OK and wait for it to download gems
    7. Hit OK to save the config and close the dialog


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"

0

I figured out how to get this working, except for running tests.

  1. Before project creation, ssh into the VM and make a new rails app on the cli.
  2. Create a project over that existing rails app (ok to select the remote sdk)
  3. Setup deployment to map the remote project dir
  4. 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)


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!

0

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.

0

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$

0

Thank you, I will take care of these problems.

Oleg.

0

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.

0

Please sign in to leave a comment.