I've recently installed Ruby 1.9.1 on Windows 7, and apparently it doesn't come with the standard ri documentation. So when I do 'ri Array', I get:
C:\>ri Array
Nothing known about Array
Is there a way I can install this documentation so that the above works?
In case people on other platforms need to install their ri docs (like I did). This article gives the why and the how:
http://jstorimer.com/ri.html
The command is:
gem rdoc --all --ri --no-rdoc
If you are using rvm you should rvm docs generate (or just rvm docs generate-ri)
See this info (2011August) about rvm and ri
None of the proposed solutions worked for me. In the end the solution I found was super simple, so I'll leave it here. (I'm running ruby 2.2.4 on win7 x64 in case that's relevant)
(captain obvious alert: ruby must be installed and in your PATH)
-open cmd
-$ gem install rdoc-data
-$ rdoc-data --install
And you're set! test that it worked by running:
-$ ri Array It should give you all the lovely documentation for the class!
Hope this helps!
ps. I just noticed that this is the solution that Luis Lavena proposed in a comment, but his comment wasn't clear to me so I had continued searching. Basically this is the same solution but explained more clearly so that that doesn't happen to anyone else :)
Cheers!
Things are still largely the same with Ruby Installer 2.4.1.2 (year 2017). If I run ri Array, it shows Array < Object and nothing else. If I run ri "Array#each", I get the familiar "Nothing known..." message. In short, the ri-format documentation on Ruby core and standard libraries are missing.
Here's how I got my copy of core/stdlib ri-documentation. Of course, Ruby must be installed prior to this.
Get ruby's source code that most closely matches my version from their Github releases page.
Extract the .zip or .tar.gz archive to some folder
Open cmd.exe/Powershell, cd to that folder and run rdoc --all --ri
This command parses .c files, .rb files, and a few other file types in the current directory recursively and generates ri-documentation to ~/.rdoc directory.
Took about 5 minutes on my laptop with i7-3520M processor to complete, with no errors.
Delete the archive and the directory containing the source code because we don't need them anymore.
Now if you try running ri Array or ri "Array#each" you'll get the documentation in all its glory.
tl;dr
Run rdoc --all --ri on directory containing source code for same ruby version as your installed version.
Appendix Z: Comments on other answers
The rvm docs generate-ri could work, but you have to use Cygwin or Ubuntu on Windows (if on Windows 10) to use rvm.
gem rdoc --all --ri --no-rdoc installs ri-documentation for all your gems. It doesn't install the core/stdlib documentations.
gem install rdoc-data followed by rdoc-data --install only works for Ruby versions up to 2.3.0.
Seems you have installer Ruby 1.9.1 distributed by the RubyInstaller project.
You can use the Windows Help Files (CHM) that came with the installer instead of the ri documentation.
The problem of the RI documentation is that some versions of RDoc have problems generating it and also generated more than 10 thousands files which slowed down the installers considerably.
RVM does not automatically generate and install each Ruby's ri / rdoc documentation. You can generate using the following command:
rvm docs generate
All the Ruby Docs are at http://www.ruby-doc.org
So the array documentation is at:
http://ruby-doc.org/core/classes/Array.html
Never tried it on windows but because its saying Nothing Known about X its not that its not installed just not got anything there.
Try installing a gem as you can then ri GEM_CLASS as that should provide defentions, should let us see if its missing documentation or if ri's not looking in the right place
You might run into this issue under Docker. The official docker images come with no documentation, and apparently disable installing gem documentation.
If image's and system ruby versions match (specifically, RbConfig::CONFIG["ruby_version"], which is e.g. 2.6.0 for ruby-2.6.1), you can:
# apk add ruby-doc
# cp -r /usr/share/ri /usr/local/share/ri
Related
I have installed Ruby 2.0.0 with rvm and want to have local html documentation. So I run
$ rvm docs generate
Installing rdoc-data................................................................
Generating gems documentation.......
$ rvm docs open
rdoc docs are missing, perhaps run 'rvm docs generate' first?
What is wrong?
Here's what works for me for RVM:
rdoc $MY_RUBY_HOME -o ~/ruby_docs
That puts the HTML documentation for the core and standard libraries in your $HOME/ruby_docs directory. Then, if you're on Mac OS, simply run:
open ~/ruby_docs/index.html
or navigate to the directory and open index.html somehow for other OSes.
I recommend using this app https://itunes.apple.com/gb/app/dash-docs-snippets/id458034879?mt=12 Allows you to access documentation for any language.
Try gem update rdoc and then generate the docs. I had the same issue and this solved it.
After a couple of days of not doing pretty much anything on the ubuntu box, I decided to try out some ruby stuff. For this, I wanted to fire up pry. Unfortunately, I was presented with
Sorry, you can't use Pry without Readline or a compatible library.
Please gem install rb-readline or recompile Ruby --with-readline.
~/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require': libreadline.so.5: cannot open shared object file: No such
file or directory -
~/.rbenv/versions/2.1.1/lib/ruby/2.1.0/x86_64-linux/readline.so
(LoadError)
Being quite new to linux in general, I figured I'd just do as it said, and install this rb-readline. The installation passes just fine, but doesnt seem to do anything at all. If I do gem list p, the package just doesn't appear.
So yeah, I just don't know what to do to get it working again, and the only thing I managed to find by searching was related to an installation without rbenv and had something to do with sudo etc.
Any ideas?
Without understanding the problem and following the advice in option 2 of the message:
Sorry, you can't use Pry without Readline or a compatible library.
Possible solutions:
* Rebuild Ruby with Readline support using `--with-readline`
* Use the rb-readline gem, which is a pure-Ruby port of Readline <==== Option 2
* Use the pry-coolline gem, a pure-ruby alternative to Readline
I added the gem into the Gemfile (as follows), bundled and pry was then available.
group :development, :test do
gem 'pry'
gem 'rb-readline'
end
I had this problem too. I am using rbenv and reinstalling ruby via
rbenv install -f 2.2.3
did fixed it for me. Of course you'd put in your respective version. -f forces the installation even though you already have that specific version installed. use rbenv global to find out what version you have installed and set.
I have some problem. But I don't want to add gem 'rb-readline'. So try it...
$ln -s /usr/local/opt/readline/lib/libreadline.8.0.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
Do a sudo apt-get install libreadline-dev, seems like you're missing the readline shared library that pry is wanting. If it worked before, not sure why the library isn't there anymore.
I ended up doing rbenv uninstall, followed by rbenv install and re-installing all the gems, and got it back to working. Still no idea what caused it in the first place, but it works now.
I have Ubuntu 11.10 and am using rvm with ruby 1.9.2. I followed this exactly to install Ruby: http://blog.sudobits.com/2011/10/27/how-to-install-ruby-on-rails-in-ubuntu-11-10/
I generate the docs with
rvm docs generate
This seems to work for a one time terminal session, but as soon as I exit out and start again, I have to generate the docs again, otherwise i get the Nothing is Known error This takes a long time, so I rather not have to generate the docs every time I start a terminal session.
Is there anything I can do to permanently have the docs available?
There are definitely similar questions to this -- but I don't have a problem with generating the docs, or using them, just keeping them installed.
This is what I did to install ri docs on my Ubuntu box (I'm not using RVM):
gem install rdoc rdoc-data
rdoc-data --install
In ubuntu: sudo apt-get install ri1.9.1
I'm trying to lookup help for Ruby methods in Textmate through the Ctrl+H shortcut, but I'm always getting this error:
/Users/tomdeleu/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:388:in
bin_path': can't find gem rdoc ([">=
0"]) with executable ri
(Gem::GemNotFoundException) from
/Users/tomdeleu/.rvm/gems/ruby-1.9.2-p180/bin/ri:19:in
'
Platform:
MacOS X 10.6.8
RVM 1.6.20
Textmate 1.5.10 (1631)
TM_RUBY set to /Users/tomdeleu/.rvm/bin/rvm-auto-ruby
installed osx-plist update as detailed in the RVM integration docs
installed DrNic's Rails bundle
Ri works fine from the command-line (I ran "rvm docs generate" to install docs for 1.9.2).
I've searched around but can't find a solution. Can anyone help?
After a lot of searching (and asking) around, solved it by reinstalling both Textmate (including delete of all customizations), and Ruby 1.9.2 (through RVM). Afterwards I installed the osx-plist update + some bundles again. Note that the osx-plist update (as detailed here) should be done with system Ruby, not a Ruby 1.9, otherwise other errors occur. Also in Textmate make sure the PATH variable does not have a custom Ruby before your system Ruby.
With these settings, everything works fine now. Hopefully this is useful to anyone encountering this error in the future...
I'm using Windows XP SP2, and installed Ruby through Ruby 1.9 one click installer. Then when I try to using ri, I get the following response, can anyone help me with my problem?
C:\Documents and Settings\eyang>ruby --version
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]
C:\Documents and Settings\eyang>ri --version
ri 2.2.2
C:\Documents and Settings\eyang>ri String
Updating class cache with 0 classes...
Nothing known about String
C:\Documents and Settings\eyang>ri
Updating class cache with 0 classes...
No ri data found
If you've installed Ruby yourself, you need to generate documentation using:
make install-doc
from the same place you ran `make` to build ruby.
If you installed Ruby from a packaging system, then you may need to
install an additional package, or ask the packager to enable ri generation.
C:\Documents and Settings\eyang>
By the way, when I try to use gem, I got the following error messages too, anyone can explain it?
C:\Documents and Settings\eyang>gem --version
1.3.5
C:\Documents and Settings\eyang>gem query --remote
*** REMOTE GEMS ***
ERROR: While executing gem ... (Errno::ENOMEM)
Not enough space - <STDOUT>
C:\Documents and Settings\eyang>
Go to the same folder where your ruby is installed. Then do:
rdoc --all --ri
RubyInstaller do not bundle RI documentation, as it increased the size of the distribution and the time to install the package.
Instead, we bundled CHM (Windows Help) files for both Core and StdLib API.
This was discussed in the RubyInstaller group and the decision was made on that base.
As for your other point, two things: you need to provide a gem name or part of it, since there are 12K gems in RubyForge.
Also, depending on your console configuration (Latin or something) the Not Enough space error will be related to the terminal itself, not RubyGems.
windows rubyinstaller doesn't come with the ri for core by default, so install the rdoc-data gem, then it will have it.
If you are using rvm try $ rvm docs generate-ri
What might be helpful:
When I ran ri.cmd -l command, it worked, though there were no known Classes/Modules
When I ran ri.cmd --list-doc-dirs, I've got:
C:/Ruby25-x64/share/ri/2.5.0/system
C:/Ruby25-x64/share/ri/2.5.0/site
C:/Users/username/.rdoc</ul>
Nonetheless, there was no physical .rdoc folder (C:/Users/username/.rdoc)
Running rdoc --all --ri as recommended #GregMoreno did the trick