Skip to content
This repository

Facilitating creation of an inferior process running rails console instead of irb #16

Closed
wants to merge 2 commits into from

2 participants

Amitav Mohanty Dmitry Gutov
Amitav Mohanty

Hello

With inf-ruby, we can run irb as a subprocess and I can see that for various ruby implementations you have added the corresponding irb commands. However, most rails developers use the rails console more often than irb. Also, given that rails console is a superset of irb, I thought of adding rails console to the list. So, essentially it will be treated as another irb implementation.

This of course has one drawback and that is the fact that for rails console to load successfully the current directory of emacs has to the root of a rails application. I believe this should not be a pain for most rails developers as they usually work with their app root as their current directory. However, this has to set by the user using M-x cd unless emacs is started from that directory.

Your ideas and comments are welcome.

Thanks,
Amitav

Dmitry Gutov
Collaborator

It's preferable to use rinari-console from rinari to do this, for example because Rails console usually has a different prompt, not covered by inf-ruby-prompt-pattern, see #6.
It also prepends the command with the standard bundle exec.

Amitav Mohanty

Well I intended to use inf-ruby only and not rinari. However, you might be right that rinari-console is a better option. Its just that I use it this way and thought others might benefit from it too.

Amitav Mohanty

I just tried robe mode with my edit to inf-ruby and I can easily navigate code within a rails app.

Dmitry Gutov
Collaborator

Nothing surprising about that. :)

Does input history (M-p, M-n) work for you in the repl buffer?

Amitav Mohanty

Yes input history does work fine for me. In fact, I also tried navigating to code in custom rails plugins and even that works out fine for me.

Dmitry Gutov
Collaborator

Yes input history does work fine for me.

Ah, I guess you're not using RVM. I forgot it's required to trigger the problem.

In fact, I also tried navigating to code in custom rails plugins and even that works out fine for me.

Sure, jumping to any code loaded in the console should work fine.

Amitav Mohanty

Yes input history does work fine for me.

Ah, I guess you're not using RVM. I forgot it's required to trigger the problem.

Yes I am not using RVM.

Dmitry Gutov dgutov closed this pull request from a commit July 26, 2013
Dmitry Gutov Add commands to launch different types of consoles
Bump the version

Close #16
164f2dd
Dmitry Gutov dgutov closed this in 164f2dd July 25, 2013
Dmitry Gutov
Collaborator
dgutov commented July 25, 2013

M-x inf-ruby-console-auto
or
M-x inf-ruby-console-rails

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 5 additions and 0 deletions. Show diff stats Hide diff stats

  1. 5  inf-ruby.el
5  inf-ruby.el
@@ -54,6 +54,11 @@
54 54
   '(("ruby"     . "irb --inf-ruby-mode -r irb/completion")
55 55
     ("jruby"    . "jruby -S irb -r irb/completion")
56 56
     ("rubinius" . "rbx -r irb/completion")
  57
+    ("rails"    . "rails c")
  58
+    ;; This will be optionally invoked by the user 
  59
+    ;; and it will be the user's responsibility to ensure that
  60
+    ;; emacs' current directory is a rails app root, else
  61
+    ;; the user will get a message about rails usage.
57 62
     ("yarv"     . "irb1.9 --inf-ruby-mode -r irb/completion")) ;; TODO: ironruby?
58 63
   "An alist of ruby implementations to irb executable names.")
59 64
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.