Notes on RubyMine - The Risberg Family

knifedamagingInternet και Εφαρμογές Web

2 Φεβ 2013 (πριν από 4 χρόνια και 8 μήνες)

269 εμφανίσεις

Page
1

Notes on
RubyMine

Created 06/28/12

Updated 07/05/12,
Updated 07/08/12
, Updated 07/15/12
, Updated 08/25/12
, Updated 10/10/12

Introduction

JetBrains RubyMine

is a commercial
IDE

for
Ruby

and
Ruby on Rails

built on JetBrains'
IntelliJ IDEA

platform.


RubyMine

provides intelligent code completion for Ruby and Ruby on Rails code, on
-
the
-
fly code analysis and
refactoring

support for both plain
Ruby

projects and web applications built with Ruby on Rails
.

It also provides
tools to carry out Rails
-
related operation
s that are typically done at the command line. Plus it will start the execution
of Rails applications, in run or debug modes, and in different deployment contexts.


Since it is built on IntelliJ, it shares all of the same screen/window managemen
t, code ed
iting functions, and file
navigation functions.

It is from the

same c
ompany

as IntelliJ, however, it costs about half the price
.


RubyMine is mentioned as

one

of the leading IDE’s for Rails developers on the Rails community web site and in the
widely
-
read

“Rails Tutorial” by Michael Hartl.


The

current version is 4.5.4

(released
September 11
, 2012). Builds are kept track of by build number.
Cur
rently we
are on build RM
-
119.71
.

New Features in RubyMine 4.5

Sass and slim languages

Sinatra support

MongoDB/M
ongoid support

Ruby Engines support

Deployment with Capistrano

Model diagram improvements

MacRuby support

Sass refactorings

Retina display support

MacOS native help

New Features in RubyMine 4.0

Significantly improved performance

New, streamlined UI for all

platforms

Latest Rails framework support

Dozens of new Ruby code inspections

Formatting for SCSS/LESS language

CoffeeScript code insight and formatting

Minitest 2.10 and RSpec 2.8 support

VCS integration enhancements

Resources

There is no third
-
party docu
mentation at present. However, RubyMine is referred to in several Ruby development
guidebooks.


The RubyMine documentation is at
http://www.jetbrains.com/ruby/documentation/index.html


Th
e RubyMine blog is at
http://blog.jetbrains.com/ruby/


Page
2

There is a review blog at
http://www.leonardoborges.com/writings/2011/02/16/ide
-
review
-
rubymine/

Pricing


Concepts

Manages projects, where projects

have multiple files, and supports edit
ing

in Ruby
source
with color
-
syntax
-
highlighting

and code
-
completion.


A project has a number of Context
Roots, such as Development and T
est.


A project
can be linked to a

source cont
rol system, such as Git or SubVer
sion.



The IDE knows about your Rails
environment (you give the location when config
ur
ing the IDE), and therefore can
run the server, or even run the various Rails and Rake commands (new, migrate, etc.).

It also knows how to
interpret the gems file, to a
id in updating or navigating to code supplied through gems.


The

IDE supports plug
-
ins, and JetBrains maintains a repository of plugins, most of which are at the framework
level and hence work in RubyMine, IntelliJ, and their Python developer’s product.

Page
3

Sa
mple Run


Basic Window Management

Similar to Eclipse.


However, the windows that are minimized slide off the left right, and bottom. They have little arrows that indicate
the direction.


But there isn’t same idea of a perspective being a purpose
-
based co
nfiguration of views. There is simply a current
layout and a default layout.

Using the Project
-
Related

Windows

One of the major means of dealing with a project is the
Project tool window
. It shows a project as a tree of
directories and files. However, if
you are working with a Rails application, you might find it more convenient to
detach from this traditional file
-
based view, and look at your project from a different point. This is what the
Rails
view

is intended for. It shows the logical project structur
e, with its Controllers, Models, Views, or Migrations, rather
that just files and directories, and helps gain quick access to the Rails application elements.


Switching to the Rails view is quite simple. All you have to do is to click View as drop
-
down lis
t on top of the
Project tool window, and choose
Rails
.



Files in the project can be opened in the editor windows.


Navigate

commands enable you to quickly jump to the desired classes, files, or symbols specified by names.
RubyMine suggests a look
-
up list
of matching names, from which you can select the desired one, and open it in the
editor.

This navigation honors
CamelCase

and
snake_case

capitalization and wildcards.

Refer to the
tips

for
detailed list of available techniques.


To navigate to a class, file or symbol with the specified name

1.

On the main menu, choose
Navigate | Class
,
File
, or
Symbol

respectively, or use the following shortcuts:


Page
4

o

Class:
Ctrl+N

o

File:
Ctrl+Shift+N

o

Symbol:
Ctrl+Shift+Alt+N

To open an existing project

This operation refers both to the projects created in RubyMine, and the projects from existing sources.

Do one of the following:


1.

On the
Welcome screen
, click
Open Directory

link. Alternatively, locate the desired project in your file
chooser, and then drag and drop it onto the Welcome screen.


2.

On the main menu, choose
File | Open Directory
. In

the
Select Path

dialog box, select the directory that
contains the desired project.


Specify whether you want to open the project in a new frame, close the current project an
d reuse the existing frame,
or open the new project in the same frame with the current one.

Refer to the section
Opening Multiple Projects

for
details.

Switching between

Projects

To be filled in

Deleting a Project

I
s there a way to delete a RMine project from within RubyMine.


Or do you just go to the
Users
\
..
\
RubyMineProjects
\
... folder, and remove them manually?


No, there is no way to remove project from RubyMine, you
have to remove it manually.

Page
5

Code Formatting



The commands most commonly used are to reformat or auto
-
indent.

Running and Debugging

You must set up a Run/Debug configuration for each type of run or debug you want to make. The easiest way to do
this is

to

click on

Edit Configurations…


and create ones from the Defaults.


Then to start the run, select the configuration from the drop
-
down near the center of the toolbar, and click the right
-
facing triangle.


On the run screen, the X icon closes the window,
w
hile the red square icon

just stops the run.

Using Rails Commands

There is a menu for this
, including help in running Rails generate commands

Using Rake Commands

This is on the Tools menu.

It will bring up a popup of the various Rake commands. The ones t
hat we use most
often are the db create and db migrate commands.

Page
6



Using Git

This requires that you have Git already installed on your computer
.


You can che
ck a project out from GitHub in a few simple steps, starting by logging into GitHub.

Extensibility

Hundreds of plugins have been developed, and are located at
http://plugins.intellij.net/?ruby


These fall
into areas such as:


Page
7


Note that the top download is the “Ruby” plug
-
in, which brings the RubyMine functionality to a regular IntelliJ
installation.

Handy for developers using both Java and Ruby.

Managing Tasks and Contexts

RubyMine provides facilities to

set up your workflow according to the issue tracking procedure accepted in your
team. You can bind your account in an issue tracker to your project, and work on it in the discourse of
tasks

and
contexts
.




A
task

is an activity performed in RubyMine and i
s identified by a task name. Normally, a task correlates
with an issue in your issue tracking system. This correlation is set by using the desired issue ID as the task
name. When you switch between tasks, RubyMine cleans your workspace, creates a changelis
t for the task,
and loads a stack trace, if any. Alternatively, you can define a task yourself so it reflects an activity that is
not registered in your issue tracker.



A
context

is a set of files opened in the editor while working on a task or independent
ly from it. You can
switch between contexts by switching between tasks associated with them. Alternatively, you can save and
clear contexts independently from any tasks.

Tips

You can quickly navigate in the currently edited file with Ctrl+F12 (View | File

Structure).


It shows the list of members of the current class.

Select an element you want to navigate to and press the Enter key
or the F4 key.


To easily locate an item in the list, just start typing its name.

Open Questions

/ Issues

Does the contex
t
-
based declaration finder understand the
Ruby syntax and the organization of the Rails files? In
other words, can I jump from views to controllers and vice versa?

Answer: yes, the navigation facilities are quite
good.