0

I come from python background and am learning ruby. IPython is really awesome. I am new to ruby now, and wanted to have some sort of ipython things. As of now am having tough time, going along ruby lines. Seems to be slightly irritating, when pressing tab does not complete things. I hit upon this question and followed the first answer, with max upvotes.

It said to do require 'irb/completion'

I did the same, and got following error:

LoadError: cannot load such file -- readline from /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from (irb):1 from /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>' 

I then tried require 'completion' which eventually led to the following error:

LoadError: cannot load such file -- completion from /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from (irb):3 from /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>' 

Let me know whats wrong, i am using ubuntu 11.04.

3 Answers 3

3

Give a look at Pry which is an alternative to IRB.

It has:

Many convenience commands inspired by IPython, Smalltalk and other advanced REPLs

A few of the features include:

  • Source code browsing (including core C source with the pry-doc gem)
  • Navigation around state (cd, ls and friends)
  • Documentation browsing
  • Live help system
  • Open methods in editors (edit-method Class#method)
  • Syntax highlighting
  • Command shell integration (start editors, run git, and rake from within Pry)
  • Gist integration
  • Runtime invocation (use Pry as a developer console or debugger)
  • Ability to view and replay history

It is also very actively developed with version 0.9.10 released on 7/14/2012.

Sign up to request clarification or add additional context in comments.

5 Comments

i did sudo gem install pry and then Successfully installed coderay-1.0.7 Successfully installed slop-3.3.2 Successfully installed method_source-0.8 Successfully installed pry-0.9.10 4 gems installed Installing ri documentation for coderay-1.0.7... Installing ri documentation for slop-3.3.2... Installing ri documentation for method_source-0.8... Installing ri documentation for pry-0.9.10... now when i go to my command line and type pry the error on the terminal comes: No command 'pry' found, did you mean: Command 'pr' from package 'coreutils' (main) pry: command not found
Sounds like pry wasn't added to your PATH variable. Try opening a new terminal and trying pry command again.
closed the terminal and reopened it, does not help.
After doing some searching around the interwebs, I think it has something to do with RVM. I personally don't use RVM (though I should) so I can't speak to whether it is RVM. I found a solution on a site for fixing the readline problem with pry and Ubuntu. Not sure it will work. I don't have a Ubuntu machine here at work to mess around with for solutions.
i have somehow got the require thing working. thanks for your effort.
2

Even if you try pry it will give errors. Ubuntu does not get along well with ruby, you need few extra libraries. Following is what you can do:

sudo apt-get install libncurses5-dev libreadline5-dev uninstall your current ruby version. sudo apt-get install libreadline-dev rvm install 1.9.3-p194 --with-readline-dir=/usr/include/readline 

This shall fix it.

Comments

1

You likely did not have the necessary libreadline-dev (or somesuch, I forget the exact Ubuntu name) installed before installing Ruby 1.9.3 via RVM. I suggest using apt to install the necessary readline development library and then re-installing Ruby via RVM.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.