How to install Ruby ri documentation for Ruby v2.1.7 - ruby

Can somebody point me to how I can install the ri documentation for v2.1.7?
I tried "How do I install the Ruby ri documentation?" with no luck.
I would prefer installing ri so that I can lookup specific methods in a class directly without opening the help file.
Also, I had no luck with the following:
C:\Users\ram\ruby>gem install rdoc-data
Fetching: rdoc-data-4.0.1.gem (100%)
rdoc-data is only required for C ruby 1.8.7 or 1.9.1.
rdoc-data is required for JRuby.
To install ri data for RDoc 4.0+ run:
rdoc-data --install
Successfully installed rdoc-data-4.0.1
Parsing documentation for rdoc-data-4.0.1
Installing ri documentation for rdoc-data-4.0.1
Done installing documentation for rdoc-data after 1 seconds
1 gem installed
C:\Users\ram\ruby>ri Array
Nothing known about Array
C:\Users\ram\ruby>rdoc-data --install
Your ruby version 2.1.7 is not supported, only 1.8.7, 1.9.2, 1.9.3, 2.0.0
It seems that for v2.1.7 something else is required.
Note this is for Windows. I want to do it natively without using VM/Cygwin, etc.

As your error message indicates, rdoc-data doesn't support ruby 2.1.7.
If you're using RVM, try:
rvm docs generate
Be patient, it takes several minutes to install the documentation.
If you want the ri documentation installed by default for all gem installations, check your gem config file ~/.gemrc to see if you have defaults set up that excludes documentation. Remove any and all of the following:
install: --no-rdoc --no-ri
update: --no-rdoc --no-ri
install: --no-document
update: --no-document
gem: --no-document
I believe gems install documentation by default. If not, add this to the gem config file
gem: --ri
Since you're on Windows, you can install Cygwin on your Windows machine and then install RVM using Cygwin. Or, you can download the rdocs source files http://ruby-doc.org/downloads/ and extract them to your Ruby docs folder /Users/userprofile/.rvm/gems/ruby-2.1.7/doc/.
I did a cursory glance, and didn't see ruby 2.1.7; it goes straight from 2.1.6 to 2.2.0. You can dump 2.1.6 in the ruby-2.1.7/doc/ folder or update your Ruby version to one that is supported.

Related

Installing Ruby on Rails latest version matching Ruby 3.0

When I try the following, after installing Ruby 3.0 from snap on Ubuntu 18.04::
gem install rails
I get this error:
/snap/ruby/201/lib/ruby/3.0.0/x86_64-linux/rbconfig.rb:13:in `<module:RbConfig>': ruby lib version (3.0.0) doesn't match executable version (2.5.1) (RuntimeError)
It was right after using
rails new rest-api-messages --api --database=postgresql
and trying to install PostGRES
gem install pg -v '1.2.3' --source 'https://rubygems.org/'
How could I solve this? is Ruby on Rails only for version 2.5.1 and lower?
edit: Then I got
Can't find the 'libpq-fe.h header when trying to install pg gem
Solved with
sudo apt-get install libpq-dev
Duplicate from Can't find the 'libpq-fe.h header when trying to install pg gem
My guess is you already had Ruby 2.5 installed and they are stepping on each other. Ruby versions don't overwrite each other. You need to uninstall Ruby 3.0 and 2.5 and install a Ruby version manager then install Ruby using it. This will also give you a path to move forward easily. Check out Ruby version manager like rbenv or RVM. Take a look at both. For what it's worth. I have used both and finally settled on rbenv.

Ruby ri file - Nothing known about File error

I tried installing a gem first gem install rdoc-data
After it successfully installed, I tried rdoc-data --install However, I get the error:
Your ruby version 2.1.1 is not supported, only 1.8.7, 1.9.2, 1.9.3, 2.0.0
Does this mean I have to downgrade to Ruby 2.0.0?
I tried running ri File to read the documentation however all I get is the message: Nothing known about File.
Did some research into older Stack Overflow posts and someone suggested running rvm docs generate however all I get is "Currently 'rvm docs ...' does not work with non-rvm rubies.
Install ri documentation first:
rvm docs generate-ri
I used
gem install rdoc-data
gem rdoc --all --ri --no-rdoc
Don't forget to open a new terminal window, then ri "test" ri "if" etc should thereafter.
These commands came from here and here

Long installing ri documentation for rails-4.0.2

I'm have two machines with Ubuntu and Debian.
I installed RVM on every machines, and installed latest stable ruby. But when i'm trying make
gem install rails gem starting install all gems and stopping on "Installing ri documentation for rails-4.0.2".
What i'm doing wrong? Thank you
It is good that it installs all dependency gems first, but strange that halts. How much time the installation of ri get?
Anyway, to disable ri or rdoc installation, add the following file inside of your home folder in yaml format:
~/.gemrc
---
gem: --no-ri --no-rdoc
verbose: true
backtrace: true
NOTE: The verbose and backtrace are useful, but optional parameters.

How to prevent installing documentation for gems automatically using gem v. 2.0

Previously set up my system to suppress installing gem documentation with --no-ri and --no-rdoc.
Ruby 2.0.0 and gem 2.0.0 seems to have removed the --no-ri flag (and functionality?).
Even when specifying --no-rdoc, I still get installing documentation:
~/dev/ruby> gem install bundler --no-rdoc
Fetching: bundler-1.3.1.gem (100%)
Successfully installed bundler-1.3.1
Done installing documentation for bundler (0 sec).
How to see whether or not documentation is installed? If it is installed, how to suppress for all gem installs?
As gem help install states:
Usage: gem install GEMNAME [GEMNAME ...] [options] -- --build-flags [options]
...
Install/Update Options:
...
--[no-]document [TYPES] Generate documentation for installed gems
List the documentation types you wish to
generate. For example: rdoc,ri
-N, --no-document Disable documentation generation
In short:
--no-rdoc is now --no-document rdoc
--no-ri is now --no-document ri.
You can prevent both from installing with either --no-document or -N.
(Unfortunately as of this writing the documentation on Rubygems.org is currently out-of-date, so ignore that for now.)
The option has changed to --no-document (see http://rubygems.rubyforge.org/rubygems-update/History_txt.html)

Can't install gemcutter as a Ruby Gem source

I'm trying to install the thinking sphinx gem, which is on gemcutter.org
When I run the command
gem sources -a http://gemcutter.org
I get the error:
Error fetching http://gemcutter.org:
bad response Not Found 404 (http://gemcutter.org/specs.4.8)
If I change the above URL to http://gemcutter.org.specs.4.8.gz it finds a file. How do I tell rubygems to download with the .gz extension?
It looks like a temporary Gemcutter failure. It works fine to me.
Make sure you are running the latest RubyGems version and install the latest gemcutter gem.
$ gem install gemcutter --source http://gemcutter.org
With the gemcutter GEM you type gem tumble to add Gemcutter as source.
$ gem tumble
EDIT. I just noticed you are using a really outdated RubyGems version.
Update RubyGems first.
$ gem update --system
If it tells you there's nothing to update, you have a buggy version (RubyGems 1.2 selfupdate was buggy). Upgrade with the following command.
$ gem install rubygems-update
$ update_rubygems
Then add the source.
What version of Rubygems are you running (gem --version)? If less than 1.3.5, you may want to update Rubygems and try again. (gem update --system)
This is working for me with the following sources defined:
http://gems.rubyforge.org/
http://gems.github.com
as I said this is working for me:
gem install thinking-sphinx \
> --source http://gemcutter.org
If you're upgrading, you should read this:
http://freelancing-god.github.com/ts/en/upgrading.html
Successfully installed thinking-sphinx-1.3.2
Successfully installed activesupport-2.3.4
2 gems installed
Installing ri documentation for thinking-sphinx-1.3.2...
Installing ri documentation for activesupport-2.3.4...

Resources