Module: RDocF95::RI::Paths
- Defined in:
- lib/rdoc-f95/ri/paths.rb
Overview
Encapsulate all the strangeness to do with finding out where to find RDoc files
We basically deal with three directories:
-
The ‘system’ documentation directory, which holds the documentation distributed with Ruby, and which is managed by the Ruby install process
-
The ‘site’ directory, which contains site-wide documentation added locally.
-
The ‘user’ documentation directory, stored under the user’s own home directory.
There’s contention about all this, but for now:
- system
-
$datadir/ri/<ver>/system/…
- site
-
$datadir/ri/<ver>/site/…
- user
-
~/.rdoc
Constant Summary collapse
- DOC_DIR =
"doc/rdoc"
- SYSDIR =
base = File.join(RbConfig::CONFIG, “ri”, version) # RbConfig is invalid in Ruby 1.8.2
File.join(base, "system")
- SITEDIR =
File.join(base, "site")
- HOMEDIR =
nil
- PATH =
This is the search path for ‘ri’
[ SYSDIR, SITEDIR, HOMEDIR ].find_all {|p| p && File.directory?(p)}
Class Method Summary collapse
-
.path(use_system, use_site, use_home, use_gems, *extra_dirs) ⇒ Object
Returns the selected documentation directories as an Array, or PATH if no overriding directories were given.
-
.raw_path(use_system, use_site, use_home, use_gems, *extra_dirs) ⇒ Object
Returns the selected documentation directories including nonexistent directories.
Class Method Details
.path(use_system, use_site, use_home, use_gems, *extra_dirs) ⇒ Object
Returns the selected documentation directories as an Array, or PATH if no overriding directories were given.
81 82 83 84 |
# File 'lib/rdoc-f95/ri/paths.rb', line 81 def self.path(use_system, use_site, use_home, use_gems, *extra_dirs) path = raw_path(use_system, use_site, use_home, use_gems, *extra_dirs) return path.select { |directory| File.directory? directory } end |
.raw_path(use_system, use_site, use_home, use_gems, *extra_dirs) ⇒ Object
Returns the selected documentation directories including nonexistent directories. Used to print out what paths were searched if no ri was found.
90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/rdoc-f95/ri/paths.rb', line 90 def self.raw_path(use_system, use_site, use_home, use_gems, *extra_dirs) return PATH unless use_system or use_site or use_home or use_gems or not extra_dirs.empty? path = [] path << extra_dirs unless extra_dirs.empty? path << SYSDIR if use_system path << SITEDIR if use_site path << HOMEDIR if use_home path << GEMDIRS if use_gems return path.flatten.compact end |