The most used IDE for Ruby on Rails developers is probably JetBrains RubyMine. Apart from the well-designed GUI it adds some nice debugging features. It`s also possible to work with an remote interpreter/debugger on a server. Which is useful, for example in my case, when using Windows but developing on for Linux platforms (which is most likely for RoR). In this post I`m going to explain how to config RubyMine for using a remote server. In my case I use Ubuntu Server running in a VM hosted by virtual box.
Install a SFTP-Server:
I recommend vsftpd cause it`s a save easy to configure ftp-Server. Install it via:
sudo apt-get install vsftpd
For configuring the server we need to edit the configuration file, which should be found here: “/etc/vsftpd.conf”. Open the configuration file:
Sudo vi /etc/vsftpd.conf
Uncomment the following lines:
- Allowing local users to login
- Enable writing permissions
NOTE: This configuration is just for my development environment. For a production system you probably want to add more security by using non local ftp-accounts and stuff. For more information take a look at https://wiki.ubuntuusers.de/vsftpd/
Add a Remote Server configuration to RubyMine
First thing in RubyMine we have to do is adding a remote server configuration. To do that create a local project (we need to do that with an open project in other case we can`t do the mapping of the folders). Go to “Settings” -> “Build, Execution, Deployment”. Select the green plus and choose SFTP. Type in the name for the connection and apply. Enter the details for the connection afterwards, which is IP, root path, user and password. Test the connection and apply the changes.
RubyMine will clone all changes made locally to the server. We need to specify the local as well as the server path. That`s happening with Folder-Mappings. Go to the tap “Mappings” within the remote server configuration. Specify a local path (the folder your project is in) and a remote folder.
Add a remote interpreter
Now that we have set up the remote server connection it`s time to add the ruby SDK. In the settings menu go to “Languages & Frameworks” and select “Ruby SDK and Gems”. Click on the green plus and choose “new remote”.
The Path of the ruby interpreter. You can find the ruby interpreter in two paths on linux:
For discovering gems it`s important to use the second ruby interpreter. Add the path to ruby and click ok. RubyMine is searching for gems now, this can take a while. After finishing you should see a list of gems. Click ok to leave the settings.
In the Main-Menu-Bar select “Run”-> “Edit Configuration” and choose “Rails”-“Development:project” in the sidebar. In the Configuration-Tap add your server IP and port. Make sure the right SDK is selected (the remote).
If you already started to develop on the server you can download the project. If you start from the scratch you can start coding now. For running your code on the rails server upload your code to the server and start the server like you`re use to (“Run”->”run”) . To upload your changes I recommend to use the Sync-feature it will show the changes you made (folders won`t get deleted).