How to remove installed ri and rdoc?
You can simply remove the doc
directory in the RubyGems installation directory.
rm -r `gem env gemdir`/doc
On Mac OS X by default, it's /Library/Ruby/Gems/1.8/doc
.
Keep in mind that there might be several installation directories for RubyGems.
- RubyGems will try to install to your user directory (something like
~/.gem/ruby/1.8/
) if it can't access the normal installation directory (e.g. you installed a gem withoutsudo
). - RVM also installs RubyGems for each Ruby it installs which will contain a
doc
directory containingrdoc
andri
files (e.g.~/.rvm/gems/ruby-1.9.2-preview1/doc
).
This will merely remove existing files, but new ones will come with new installations anyway, unless you use the --no-document
flag for gem install or make it a default.
How to remove ri and RDoc documentation
If you are OK with manually removing it, it is somewhere in ..../lib/ruby/gems/1.9.1/doc/
- the actual path depends on OS you use and how you install ruby.
How to uninstall gem specific documentation post installation
I haven't had any experience with that gem yet, but I hope this can help you to track your rdoc and ri doc path.
gem env
on my Mac system, I found this path from INSTALLATION DIRECTORY
/opt/experiment/ruby/lib/ruby/gems/1.9.1/doc/
And when I open
it (or explore
in Windows) I saw some gems' rdoc/ri doc inside this path. Try to remove your gem's doc there. Let me know if it works, it's working here on my Mac.
Next time when you install rubygems but don't want ri/rdoc installed, remember to type this --no-rdoc --no-ri
option when you do gem install something
As a reference comparison I'll just copy paste my gem env
here
. gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [i386-darwin9.8.0]
- INSTALLATION DIRECTORY: /opt/experiment/ruby/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /opt/experiment/ruby/bin/ruby
- EXECUTABLE DIRECTORY: /opt/experiment/ruby/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-darwin-9
- GEM PATHS:
- /opt/experiment/ruby/lib/ruby/gems/1.9.1
- /Users/arie/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gemcutter_key" => "********************************"
- :gem => "--no-ri --no-rdoc"
- :sources => ["http://rubygems.org"]
- REMOTE SOURCES:
- http://rubygems.org
.
Update (7/28/2019): --no-ri --no-rdoc
no longer work in Rubygems >= 2.0. Alternatively, you can use --no-document
to omit documentation.
How to make --no-ri --no-rdoc the default for gem install?
You just add the following line to your local ~/.gemrc
file (it is in your home folder):
gem: --no-document
by
echo 'gem: --no-document' >> ~/.gemrc
or you can add this line to the global gemrc
config file.
Here is how to find it (in Linux):
strace gem source 2>&1 | grep gemrc
The --no-document
option is documented in the RubyGems CLI Reference.
How to exclude some classes from rdoc and ri generation during a gem installation in ruby?
The Rake::RDocTask
task has nothing to do with rubygems. Your code will just generate html with
% rake rdoc
command in the doc/rdoc project directory.
To limit the scope for rdoc during the gem installation process, edit the specification for your gem:
require 'rake/gempackagetask'
spec = Gem::Specification.new {|i|
...
i.rdoc_options += ['-m', 'README.rdoc', '-x', 'lib/(?!myclass.rb).*',
'lib/myclass.rb', 'LICENSE', 'README.rdoc']
i.extra_rdoc_files = []
...
}
Rake::GemPackageTask.new(spec).define
The strange regular expression lib/(?!myclass.rb).*
is required, because rubygems automatically adds lib
path for rdoc and we need to
- exclude it (
-x
option); - allow
lib/myclass.rb
file to survive.
Hope this helps.
How do you remove the documentation installed by gem install?
Gem documentation is installed in [RUBY]/lib/ruby/gems/doc, where [RUBY] is the directory into which you installed Ruby (C:/ruby on my machine).
I don't see why you shouldn't just delete the folders representing the gems for which don't don't need documentation: you can always regenerate it.
How to use ri in PowerShell for Ruby Index instead of Remove-Item
If your PowerShell has script execution disabled, there's a couple steps involved in getting PShell set-up to launch with "ri" as the command to start the Ruby Index instead of as an alias for Remove-Item.
1) Skip this step if you already have a PowerShell profile:
New-Item $profile -force -itemtype file
...if you don't, this file will get generated in your docs directory:
C:\Users\User_Name\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
2) Then open your profile to edit it:
notepad $profile
...if it's new, it should be blank.
3) Add the following line to it:
del alias:ri -force
4) Save the file, close notepad and load up the new profile settings with the command below:
. $profile
... or simply close and open Powershell to apply the profile.
NOTE: This, of course, is insufficient if Powershell has script execution disabled... and only members of the Administrators group on the computer can change the execution policy, so:
1) Launch PowerShell with the "Run as Administrator" option (I only know how to do this from the PowerShell icon sub-menu in the Start Menu...)
2) Enable running unsigned scripts by entering:
set-executionpolicy remotesigned
This will allow running unsigned scripts that you write on your local computer and signed scripts from Internet. NOTE: from what little I understand of PowerShell, setting the execution policy to "unrestricted" is strongly advised against. Njoy!
Related Topics
Yaml Indentation for Array in Hash
Building Ruby with Rbenv and Ruby-Build Fails with Undefined Symbol: Sslv2_Method
Sass::Syntaxerror: File to Import Not Found or Unreadable: Compass in Production
Using $ Sudo Bundle Exec ... Raises 'Bundle: Command Not Found' Error
Invalid Gemspec -Illformed Requirement ["#<Yaml::Syck::Defaultkey:0Xb5F9C990> 3.2.0"]
How to Deal with Memory Leaks in Rmagick in Ruby
Heroku: Gemfile.Lock Is Required Issue
Is There a Cucumber Hook to Run Before and After Each Feature
Show Full Path Name of the Ruby File When It Get Loaded
Parse Email Addresses for "From" and "To" Fields in Ruby
What Does ::Myclass Ruby Scope Operator Do
How to "Unflatten" a Ruby Array
Ruby: Combine Date and Time Objects into a Datetime
Notification of Object Destruction in Ruby
Getting Uninitialized Constant Error When Trying to Run Tests