Created
May 21, 2009 17:49
-
-
Save knu/115591 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: lib/rubygems/doc_manager.rb | |
=================================================================== | |
--- lib/rubygems/doc_manager.rb (revision 2210) | |
+++ lib/rubygems/doc_manager.rb (working copy) | |
@@ -98,6 +98,13 @@ class Gem::DocManager | |
end | |
## | |
+ # Is the RI documentation installed? | |
+ | |
+ def ri_installed? | |
+ File.exist?(File.join(@doc_dir, "ri")) | |
+ end | |
+ | |
+ ## | |
# Generate the RI documents for this gem spec. | |
# | |
# Note that if both RI and RDoc documents are generated from the same | |
Index: lib/rubygems/commands/rdoc_command.rb | |
=================================================================== | |
--- lib/rubygems/commands/rdoc_command.rb (revision 2210) | |
+++ lib/rubygems/commands/rdoc_command.rb (working copy) | |
@@ -8,7 +8,7 @@ class Gem::Commands::RdocCommand < Gem:: | |
def initialize | |
super 'rdoc', 'Generates RDoc for pre-installed gems', | |
:version => Gem::Requirement.default, | |
- :include_rdoc => true, :include_ri => true | |
+ :include_rdoc => true, :include_ri => true, :overwrite => true | |
add_option('--all', | |
'Generate RDoc/RI documentation for all', | |
@@ -21,11 +21,21 @@ class Gem::Commands::RdocCommand < Gem:: | |
options[:include_rdoc] = value | |
end | |
+ add_option('--[no-]rdoc', | |
+ 'Include RDoc generated documents') do |value, options| | |
+ options[:include_rdoc] = value | |
+ end | |
+ | |
add_option('--[no-]ri', | |
'Include RI generated documents') do |value, options| | |
options[:include_ri] = value | |
end | |
+ add_option('--[no-]overwrite', | |
+ 'Overwrite installed documents') do |value, options| | |
+ options[:overwrite] = value | |
+ end | |
+ | |
add_version_option | |
end | |
@@ -58,7 +68,8 @@ class Gem::Commands::RdocCommand < Gem:: | |
if options[:include_ri] | |
specs.each do |spec| | |
- Gem::DocManager.new(spec).generate_ri | |
+ doc = Gem::DocManager.new(spec) | |
+ doc.generate_ri if options[:overwrite] || !doc.ri_installed? | |
end | |
Gem::DocManager.update_ri_cache | |
@@ -66,7 +77,8 @@ class Gem::Commands::RdocCommand < Gem:: | |
if options[:include_rdoc] | |
specs.each do |spec| | |
- Gem::DocManager.new(spec).generate_rdoc | |
+ doc = Gem::DocManager.new(spec) | |
+ doc.generate_rdoc if options[:overwrite] || !doc.rdoc_installed? | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment