Today we’ll set up a complete Ruby On Rails development environment on Linux. For an IDE we’ll use Emacs and for host system - OpenSUSE.
Let’s install latest Ruby+Rails bundle before configuring Emacs. You can refer to nice article on that. In short, you need get RVM and follow through script steps in terminal:
> bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Then load path to installed RVM in current bash session:
> . ~/.bash_profile
It’s a bit frustrating that if bash finds a .bash_profile file, it ignores .bashrc, so be careful. Usually, I just move this one line from .bash_profile to .profile or .bashrc.
Then check requirements and install everything what is needed
> rvm requirements
Now let’s set ruby version to 2.0 and install rails (4):
> rvm install 2.0 > rvm use 2.0 > gem install rails > gem install sqlite3
Now, when everything is ready, we can configure Emacs installation. I assume you’ve already installed emacs package via your favorite package manager.
Then lets add some custom configuration file for ruby configs in the .emacs.d directory, say ruby-configuration.el and add it to your .emacs file using
I use next packages for Emacs + Ruby + Rails development:
You can easily google how to install and use them. I can only point at some interesting moments. First, you can set some git submodules, as I did:
[submodule ".emacs.d/web-mode"] path = .emacs.d/web-mode url = https://github.com/fxbois/web-mode [submodule ".emacs.d/rvm"] path = .emacs.d/rvm url = http://github.com/djwhitt/rvm.el.git [submodule ".emacs.d/rhtml"] path = .emacs.d/rhtml url = https://github.com/eschulte/rhtml.git [submodule ".emacs.d/yaml-mode"] path = .emacs.d/yaml-mode url = http://github.com/yoshiki/yaml-mode.git [submodule ".emacs.d/inf-ruby"] path = .emacs.d/inf-ruby url = https://github.com/nonsequitur/inf-ruby [submodule ".emacs.d/rinari"] path = .emacs.d/rinari url = https://github.com/eschulte/rinari.git [submodule ".emacs.d/fold-dwim"] path = .emacs.d/fold-dwim url = https://github.com/emacsmirror/fold-dwim
Do not forget to add appropriate directories to your load path using function
(add-to-list 'load-path "your/directory/with/submodule")
My other configuration are mostly copy-and-pasted from EmacsWiki for those packages I mentioned in a list of my Ruby packages. You can find my configuration at GitHub.