RubyMine 2016.3 Help

Configuring RubyMine to Work on the VM

Consider the situation when you work on your project on one platform, but want to deploy and run it on a different one. This is where RubyMine helps a lot with its extensive support for remote interpreters.

The task of running a project on a virtual machine falls into several major steps:

  • First, you need to define a virtual box.
  • Second, you need to configure a remote interpreter to run in this virtual box.
  • Finally, you need to launch your script in the remote console.

Before you start

Make sure that outside of RubyMine you have already done the following:

  • Installed Oracle's Virtual Box.
  • Installed Vagrant.
  • Added the following executables to your system path:
    • vagrant.bat from your Vagrant installation. This should be done automatically by the installer.
    • VBoxManage.exe from your Oracle's VirtualBox installation.

In RubyMine, make sure that Vagrant plugin is enabled: on the main toolbar, click /help/img/idea/2016.3/settings.png, and in the Settings/Preferences dialog box, open the page Plugins. Actually, this plugin is enabled by default:

/help/img/idea/2016.3/vagrant_plugin_bundled.png

Now all the preliminary steps are over, and we are ready to start.

Creating a virtual box

In the Settings/Preferences dialog (/help/img/idea/2016.3/settings.png on the main toolbar) click the page Vagrant, and enter the Vagrant executable and Vagrant instance folder.

If the boxes are already defined, they appear in the list, and you can select one.

/help/img/idea/2016.3/vagrant_virtual_box.png

If there is no suitable virtual box, click /help/img/idea/2016.3/new.png to create a new one. Enter the box name and URL for downloading:

/help/img/idea/2016.3/vagrant_vbox_add.png

After clicking OK, RubyMine downloads the VM template. Thus, the virtual box is created and added it to the environment.

Pay attention to the Vagrant menu commands under the Tools menu. These commands correspond to the standard Vagrant actions. Once a Vagrant box is created, you have to initialize it in project root. To do that, on the main menu, point to Tools | Vagrant, and then choose Init in Project Root:

/help/img/idea/2016.3/vagrant_node.png

First, choose folder, if required. Note that you have this choice if there are several projects opened in the same window:

/help/img/idea/2016.3/vagrant_select_folder.png

Choose the Vagrant box you are going to initialize:

/help/img/idea/2016.3/vagrant_select_box.png

Thus a Vagrantfile is created, and you can view and change it as required:

/help/img/idea/2016.3/vagrantfile.png

After initialization, perform the vagrant up command (choose Up on the Tools | Vagrant menu). RubyMine runs the vagrant up command, and shows its output in the console:

/help/img/idea/2016.3/rm_vagrant_up.png

Configuring remote interpreter via virtual box

Now open the Settings/Preferences dialog box again (/help/img/idea/2016.3/settings.png on the main toolbar), and click the page Ruby SDK and Gems Here you can select one of the existing interpreters, but what if none of the them meets your needs? Then click /help/img/idea/2016.3/new.png and choose New remote:

/help/img/idea/2016.3/rm_interpreter_types_remote.png

In the Configure Remote Ruby Interpreter dialog box, you have to specify the server settings. These settings can be taken from the Vagrant configuration file you've already defined. All the server setting fields are filled with the values, taken from the Vagrant configuration file:

/help/img/idea/2016.3/py_configure_remote_interpreter_vagrant.png

Note that the path mappings are defined automatically. However, you can click /help/img/idea/2016.3/browseButton.png to add your own path mappings:

/help/img/idea/2016.3/py_path_mappings.png

From this point on, you can run any script of your project on the VM:

/help/img/idea/2016.3/vagrant_run.png

What's next? Let's log in to the virtual box via SSH.

Connecting to the SSH terminal

Why do we need it it all? RubyMine lets you log in to your virtual box via SSH and work in its console without leaving the IDE. So, on the main menu choose Tools | Run SSH session.... If you have more than one host already defined, select the one you want to connect to:

/help/img/idea/2016.3/vagrant_console.png

Now that you have direct access to your virtual box, let's first make sure your project directory is properly mapped. To do that, just view the contents of the default vagrant's shared folder /vagrant, and launch one of the available scripts, for example, Solver.py:

/help/img/idea/2016.3/vagrant_map.png
Last modified: 24 December 2016