Difference between revisions of "Ruby"

From WikEmacs
Jump to navigation Jump to search
(change headings)
Line 1: Line 1:
 +
Let's configure Emacs as a productive environment for Ruby and Rails development !
 +
 
== ruby-mode ==
 
== ruby-mode ==
  
 
'''{{ModeLink|ruby-mode}}''' provides basic font-locking, indentation and navigation support for Ruby source code. It was first included in Emacs 23 (previously it was a third party package, maintained by Ruby's developers). While {{Mode|ruby-mode}} is fairly barebone package it could be augmented by a multitude of minor modes such as [http://github.com/rejeep/ruby-end ruby-end], ...
 
'''{{ModeLink|ruby-mode}}''' provides basic font-locking, indentation and navigation support for Ruby source code. It was first included in Emacs 23 (previously it was a third party package, maintained by Ruby's developers). While {{Mode|ruby-mode}} is fairly barebone package it could be augmented by a multitude of minor modes such as [http://github.com/rejeep/ruby-end ruby-end], ...
  
=== Ruby on Rails ===
+
== Ruby on Rails ==
 
 
Let's configure Emacs as a productive environment for Rails development !
 
  
==== [[Rinari]] ====
+
=== [[Rinari]] ===
  
 
[https://github.com/eschulte/rinari Rinari] (in melpa) stands for Rinari Is Not A Rails IDE. It is an Emacs minor mode for Rails that is actively maintained.   
 
[https://github.com/eschulte/rinari Rinari] (in melpa) stands for Rinari Is Not A Rails IDE. It is an Emacs minor mode for Rails that is actively maintained.   
Line 21: Line 21:
 
The [http://rinari.rubyforge.org/ official documentation] is alright, but for best information check out the source.
 
The [http://rinari.rubyforge.org/ official documentation] is alright, but for best information check out the source.
  
==== Syntax checking: flymake ====
+
== Syntax checking: flymake ==
  
 
See [[Flymake]], and install [https://github.com/purcell/flymake-ruby flymake-ruby] (in melpa).  
 
See [[Flymake]], and install [https://github.com/purcell/flymake-ruby flymake-ruby] (in melpa).  
Line 32: Line 32:
 
</source>
 
</source>
  
==== Ruby shell inside Emacs ====
+
== Ruby shell inside Emacs ==
  
 
[https://github.com/nonsequitur/inf-ruby inf-ruby] provides a REPL buffer connected to a Ruby subprocess. It is available through the package manager. To bind to a shortcut, do something like:
 
[https://github.com/nonsequitur/inf-ruby inf-ruby] provides a REPL buffer connected to a Ruby subprocess. It is available through the package manager. To bind to a shortcut, do something like:
Line 40: Line 40:
 
</source>
 
</source>
  
==== RVM integration ====
+
== RVM integration ==
  
 
Pick [https://github.com/senny/rvm.el rvm.el]. Once installed you will just have to call rvm-activate-corresponding-ruby and rvm.el will automatically pick up your ruby version and gemset from your <code>.rvmrc</code> file.
 
Pick [https://github.com/senny/rvm.el rvm.el]. Once installed you will just have to call rvm-activate-corresponding-ruby and rvm.el will automatically pick up your ruby version and gemset from your <code>.rvmrc</code> file.

Revision as of 09:51, 17 May 2017

Let's configure Emacs as a productive environment for Ruby and Rails development !

ruby-mode

ruby-mode provides basic font-locking, indentation and navigation support for Ruby source code. It was first included in Emacs 23 (previously it was a third party package, maintained by Ruby's developers). While ruby-mode is fairly barebone package it could be augmented by a multitude of minor modes such as ruby-end, ...

Ruby on Rails

Rinari

Rinari (in melpa) stands for Rinari Is Not A Rails IDE. It is an Emacs minor mode for Rails that is actively maintained.

Rinari features:

  • for 'jumps' between Model, View, Controller and their RSpec examples and Test Unit tests,
  • as well as Cucumber steps and features.
  • running of a console session with full Rails application loaded for interactive use,
  • SQL console,
  • starting of the web server (rails server).

The official documentation is alright, but for best information check out the source.

Syntax checking: flymake

See Flymake, and install flymake-ruby (in melpa).

To make sure it is started along with ruby mode, add:

(require 'flymake-ruby)
(add-hook 'ruby-mode-hook 'flymake-ruby-load)

Ruby shell inside Emacs

inf-ruby provides a REPL buffer connected to a Ruby subprocess. It is available through the package manager. To bind to a shortcut, do something like:

(global-set-key (kbd "C-c r r") 'inf-ruby)

RVM integration

Pick rvm.el. Once installed you will just have to call rvm-activate-corresponding-ruby and rvm.el will automatically pick up your ruby version and gemset from your .rvmrc file.

For a keybinding:

(global-set-key (kbd "C-c r a") 'rvm-activate-corresponding-ruby)

External links

ruby-mode at Ruby's Subversion repo