RubyMine 2017.3 Help

Quick Start Guide

This Quick Start Guide is designed to introduce the key concepts and help you make a quick start with the IDE.

Step 0. Before you start

Which languages does RubyMine support?

With RubyMine you can develop applications in Ruby. In addition, one can develop Rails applications. Also, it fully supports HTML (including HTML5), CSS, JavaScript, and XML: these languages are bundled in the IDE via plugins and are switched on for you by default. Support for the other languages and frameworks can also be added via plugins (go to Settings | Plugins or RubyMine | Preferences | Plugins for macOS users, to find out more or set them up during the first IDE launch).

What platforms can I run RubyMine on?

RubyMine is a cross-platform IDE that works on Windows, macOS, and Linux.

If you need assistance installing RubyMine, see the installation instructions for Linux, macOS and Windows.

What do I need to start with RubyMine?

In general to start developing in Ruby with RubyMine you need to download, install and start RubyMine (depending on your platform).

Step 1. Open/Create a project in RubyMine

Why do I need a project?

Everything you do in RubyMine is done within the context of a project. It serves as a basis for coding assistance, bulk refactoring, coding style consistency, etc.

You have three options to start working on a project inside the IDE:

Open an existing project

Begin by opening one of your existing projects stored on your computer. You can do by clicking Open Project on the Welcome screen (or choosig File | Open):

/help/img/idea/2017.3/rm_QST_WelcomeScreen.png

Otherwise select the command Open on the File menu, and specify the directory where the sources exist:

/help/img/idea/2017.3/rm_QST_openProject.png

RubyMine will then create a project from your sources for you.

Refer to the section Importing Project from Existing Source Code for details.

Check out an existing project from Version Control

You can also download sources from a VCS storage or repository. Choose Git (GitHub), CVS, Mercurial, Subversion, Perforce , and then enter your credentials to access the storage.

Then, enter a path to the sources and clone the repository to the local host:

/help/img/idea/2017.3/rm_QST_cloneRepGithub.png

Refer to the section Getting Local Working Copy of the Repository or Setting Up a Local Git Repository for details.

Create a project from scratch

If you prefer to start from scratch, click New Project on the Welcome screen, enter your project’s name in the dialog, and a Ruby project will be created.

Refer to the section Creating and Managing Projects for details:

/help/img/idea/2017.3/rm_QST_sampleProjectCreated.png

Step 2. Look around

When you launch RubyMine for the very first time, or when there are no open projects, you see the Welcome screen. It gives you the main entry points into the IDE: creating or opening a project, checking out a project from version control, viewing documentation, and configuring the IDE.

When a project is opened, you see the main window divided into several logical areas. Let’s take a moment to see the key UI elements here:

/help/img/idea/2017.3/rm_QST_lookAroundThumb.png
  1. Project view on the left side displays your project files.
  2. Editor on the right side, where you actually write your code. It has tabs for easy navigation between open files.
  3. Navigation bar above the editor additionally allows you to quickly run and debug your application as well as do the basic VCS actions.
  4. Left gutter, the vertical stripe next to the editor, shows the breakpoints you have, and provides a convenient way to navigate through the code hierarchy like going to definition/declaration. It also shows line numbers and per-line VCS history.
  5. Right gutter, on the right side of the editor. RubyMine constantly monitors the quality of your code and always shows the results of its code inspections in the right gutter: errors, warnings, etc. The indicator in the top right-hand corner shows the overall status of code inspections for the entire file.
  6. Tool windows are specialized windows attached to the bottom and sides of the workspace and provide access to typical tasks such as project management, source code search and navigation, integration with version control systems, etc.
  7. The status bar indicates the status of your project and the entire IDE, and shows various warnings and information messages like file encoding, line separator, inspection profile, etc.

Also, in the bottom-left corner of the RubyMine window, in the Status bar, you see the button /help/img/idea/2017.3/show_hide_tool_window_bars.png or /help/img/idea/2017.3/show_tool_window_bars.png. This button toggles the showing of the tool window bars. If you hover your mouse pointer over this button, the list of the currently available tool windows show up:

/help/img/idea/2017.3/py_ToolWindowQuickAccess.png

See the pages Status Bar and Manipulating the Tool Windows to learn more about showing or hiding tool windows.

Step 3. Customize your environment

Feel free to tweak the IDE so it suits your needs perfectly and is as helpful and comfortable as it can be. Go to File | Settings (RubyMine | Preferences for macOS users) to see the list of available customization options.

Appearance

The first thing to fine-tune is the general "look and feel." Go to File | Settings | Appearance and Behavior | Appearance (RubyMine | Preferences | Appearance and Behavior | Appearance for macOS users) to select the IDE theme: the default light theme, or Darcula if you prefer a darker setting.

Editor

The many pages available under File | Settings | Editor (RubyMine | Preferences | Editor for macOS users) help you adjust every aspect of the editor’s behavior. A lot of options are available here, from general settings (like Drag'n'Drop enabling, scrolling configuration, etc.), to color configuration for each available language and use case, to tabs and code folding settings, to code completion behavior and even postfix templates.

Refer to the section Customizing RubyMine for details.

Code style

Code style can be defined for each language under File | Settings | Editor | Code Style (RubyMine | Preferences | Editor | Code Style for macOS users). You can also create and save your own coding style scheme.

/help/img/idea/2017.3/rm_QST_codeStyleSettings.png

Refer to Code Style for details.

Keymap

RubyMine uses the keyboard-centric approach, meaning that nearly all actions possible in the IDE are mapped to keyboard shortcuts.

The set of keyboard shortcuts you work with is one of your most intimate habits — your fingers "remember" certain combinations of keys, and changing this habit is easier said than done. RubyMine supplies you with a default keymap (choose Help | Keymap Reference on the main menu) making your coding really productive and convenient. However, you can always change it going to File | Settings | Keymap (RubyMine | Preferences | Keymap for macOS users).

There are also some pre-defined keymaps (like Emacs, Visual Studio, Eclipse, NetBeans etc.), and you can also create your own keymap based on an existing one.

If you feel most productive with vi/Vim, an emulation mode will give you the best of both worlds. Simply enable the IdeaVim plugin in the IDE and select the vim keymap.

Refer to the section Configuring Keyboard Shortcuts for details.

Step 4. Code with smart assistance

RubyMine takes care of the routine so that you can focus on the important. Use the following coding capabilities to create error-free applications without wasting precious time.

Code completion

Code completion is a great time-saver, regardless of the type of file you’re working with.

Basic completion works as you type and completes any name instantly.

Smart type completion analyzes the context you’re currently working in and offers more accurate suggestions based on that analysis.

/help/img/idea/2017.3/rm_QST_smartCodeCompletion.png

Intention actions

RubyMine keeps an eye on what you are currently doing and makes smart suggestions, called intention actions, to save more of your time. Indicated with a lightbulb, intention actions let you apply automatic changes to code that is correct (in contrast to code inspections that provides quick-fixes for code that may be incorrect). Did you forget to add some parameters and field initializers to the constructor? Not a problem with RubyMine. Click the lightbulb (or press Alt+Enter) and select one of the suggested options:

/help/img/idea/2017.3/rm_QST_intentionAction.png

The full list of available intention actions can be found in File | Settings | Editor | Intentions or RubyMine | Preferences | Editor | Intentions for macOS users.

Step 5. Keep your code neat

RubyMine monitors your code and tries to keep it accurate and clean. It detects potential errors and problems and suggests quick-fixes for them.

Every time the IDE finds unused code, an endless loop, and many other things that likely require your attention, you’ll see a lightbulb. Click it, or press Alt+Enter, to apply a fix.

The complete list of available inspections can be found under Settings | Editor | Inspections (or RubyMine | Preferences | Editor | Inspections for macOS users). Disable some of them, or enable others, plus adjust the severity of each inspection. You decide whether it should be considered an error or just a warning.

Step 6. Generate some code

Writing code can be a lot easier and quicker when you use the code generation options available in RubyMine. The Code | Generate menu (Alt+Insert) will help you with creating symbols from usage, as well as suggest overriding/implementing some functions:

/help/img/idea/2017.3/rm_QST_impl_over.png

Use live templates (choose Code | Insert Live Template or press Ctrl+J) to produce the entire code constructs. You can explore the available ready-to-use live templates in the Settings/Preferences dialog (Settings | Editor | Live templates or RubyMine | Preferences | Editor | Live Templates if you are a macOS user).

If you see that you are lacking something especially important for your development, extend this set of templates with your own. Also, consider quickly surrounding your code with complete constructs (choose Code | Surround With or press Ctrl+Alt+T. For example, select an if statement:

/help/img/idea/2017.3/rm_QST_surround_with_1.png

and you will get:

/help/img/idea/2017.3/rm_QST_surround_with_2.png

Step 7. Find your way through

When your project is big, or when you have to work with someone else’s code, it’s vital to be able to quickly find what you are looking for and dig into the code. This is why RubyMine comes with a set of navigation and search features that help you find your way through any code no matter how tangled it is.

Basic search

With these search facilities, you can find and replace any fragment of code both in the currently opened file (Ctrl+F), or in an entire project (Ctrl+Shift+F).

Search for usages

To find where a particular symbol is used, RubyMine suggests full-scale search via Find Usages (Alt+F7):

/help/img/idea/2017.3/rm_QST_find_usages.png

Project navigation

You can tell a lot just looking at your File Structure, with its imports or call hierarchies:

/help/img/idea/2017.3/rm_QST_file_structure.png

Also, you can navigate to:

The icons in the left-hand gutter can also help you with navigation:

/help/img/idea/2017.3/rm_QST_goToSubclass.png

Navigate through the timeline

Remembering all your activity in the project, RubyMine can easily navigate you to the Recent Files (Ctrl+E) or Recently Changed Files (Shift+Alt+C).

To go through the history of changes, try using Back/Forward navigation (Ctrl+Alt+Left/ Ctrl+Alt+Right) and/or go to last edit location (Ctrl+Shift+Backspace).

Find Action

Take advantage of many smart actions possible with RubyMine. For example, use the Find Action search (Ctrl+Shift+A): just type a part of the action name, and the IDE will show you the list of all available options. Then, select the action you need:

/help/img/idea/2017.3/cl_QST_findAction.png

Search Everywhere

If you have a general idea of what you're looking for, you can always locate the corresponding element using one of the existing navigation features. But what if you really want to look for something in every nook and cranny? The answer is to use Search Everywhere!

To try it, click the magnifying glass button in the upper right-hand corner of the window, or invoke it with Double Shift (press Shift twice).

/help/img/idea/2017.3/rm_QST_search_everywhere.png

Step 8. Run, debug and test

Now when you’ve played with the code and discovered what you can do with it, it’s time to run, debug and test your app.

Run configuration

When you perform run, debug, or test operations with RubyMine, you always start a process based on one of the existing run/debug configurations, using its parameters.

Open the Run/Debug Configurations dialog Run | Edit Configurations to see all the available options. For example, if you want to run some script before/after the build phase, you can do this easily by creating an external tool:

/help/img/idea/2017.3/rm_QST_runDebugConfiguration.png

To run a configuration, press Shift+F10.

Run

The easiest way to run an application is to right-click its background in the editor, and then choose Run <name> on the context menu:

/help/img/idea/2017.3/rm_run_context_menu.png

Debug

Does your application stumble on a run-time error? To find out what’s causing it, you will have to do some debugging. RubyMine supports the debugger on all platforms.

Debugging starts with placing breakpoints at which program execution will be suspended, so you can explore program data. Just click the left gutter of the line where you want the breakpoint to appear.

To start debugging your application, press Shift+F9. Then go through the program execution step by step (see the available options in the Run menu or in the Debug tool window), evaluate any arbitrary expression, add watches and manually set values for the variables.

/help/img/idea/2017.3/py_QST_debugger.png

Refer to the section Debugging for details.

Test

It goes without saying that you need to write tests. Let’s just explore RubyMine’s testing support, which extends to all the major frameworks: RSpec, Cucumber, Shoulda, MiniTest and Test::Unit.

Creating a test is as simple as creating any new file. Just go to File | New... and choose from a list of test templates, for example, RSpec Test Template:

/help/img/idea/2017.3/rm_rspec.png

RubyMine allows launching all tests in a directory, test scripts or scenarios, and even individual test methods or examples. Go to the context menu of a test or directory, or create your own run/debug configuration.

Finally, view and work with the test results in the special test runner UI, which opens in a tab of the Run tool window:

/help/img/idea/2017.3/rm_test_runner_tab1.png

Step 9. Keep your source code under Version Control

VCS

If you are keeping your source code under version control, you will be glad to know that RubyMine integrates with many popular version control systems: Git (or GitHub), Mercurial, Perforce Subversion and CVS. To specify credentials and any settings specific to a particular VCS, go to Settings | Version Control (or RubyMine | Preferences | Version Control if you are a macOS user).

The VCS menu gives you a clue about what commands are available. For example, you can see the changes you’ve made, commit them, create changelists and much more from the Local Changes view: VCS | Show Changes (or just press Alt+9). Also find some VCS basic commands in the Navigation bar above the editor:

/help/img/idea/2017.3/rm_QST_VCSbasic.png

Refer to the section Version Control with RubyMine for details.

Local history

In addition to traditional version control, you can use the local history. With Local History, RubyMine automatically tracks changes you make to the source code, the results of refactoring, etc.

Local history is always enabled. To view it for a file or a folder, bring up Local History by selecting VCS | Local History | Show History. Here you can review the changes, revert them or create a patch.

Step 10. Remote development

With RubyMine, one can use project interpreters located remotely (in the Settings/Preferences dialog, choose the page Ruby SDK and Gems and click /help/img/idea/2017.3/add.png :

/help/img/idea/2017.3/rm_interpreter_types_remote.png

First, you can deploy your local applications to some remote server. To learn about deployment servers, refer to the section Configuring Synchronization with a Web Server.

Having deployed an application, you can run, debug and test it remotely. RubyMine also helps you compare local and remote folders, and synchronize the local copy with that deployed on the server.

Step 11. Databases

As you might have noticed already, creating projects of the various types (Rails, for example) requires a data source. It is also quite possible that you inject SQL statements into your source code.

RubyMine does not enable you to create databases, but provides facilities to manage and query them. Once you are granted access to a certain database, you can configure one or more data sources within RubyMine that reflect the structure of the database and store the database access credentials. Based on this information, RubyMine establishes connection to the database and provides the ability to retrieve or change information contained therein.

Access to the databases is provided by the Database tool window (View | Tool Windows | Database). This tool window allows you to work with the databases. It lets you view and modify data structures in your databases, and perform other associated tasks.

/help/img/idea/2017.3/DBToolWindow.png

See Databases and SQL for details.

Step 12. That’s it! Go ahead and develop with pleasure!

We hope this brief overview of essential RubyMine features will give you a quick start. There are many important features that make a developer’s life easier and more fun, and the source code neater and cleaner. Take these first few steps now, and then dig deeper when you feel the time is right. Enjoy RubyMine!

With any questions please visit our Discussion Forum, twitter and blog, where you can find news, updates, and useful tips and tricks. Also, don't hesitate to report any problems to our support team) or the RubyMine issue tracker.

See Also

Language and Framework-Specific Guidelines:

Last modified: 15 September 2017