Skip to content

Commit

Permalink
Handle :rdoc from ~/.gemrc
Browse files Browse the repository at this point in the history
  • Loading branch information
drbrain committed Jun 8, 2011
1 parent 37732f2 commit 91511b7
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/rubygems/rdoc.rb
Expand Up @@ -170,8 +170,15 @@ def generate
options.files.push(*@spec.extra_rdoc_files)

args = @spec.rdoc_options

case config_args = Gem.configuration[:rdoc]
when String then
args = args.concat Gem.configuration[:rdoc].split
when Array then
args = args.concat Gem.configuration[:rdoc]
end

delete_legacy_args args
# TODO Gem.configuration[:rdoc]
options.parse args
options.quiet = !Gem.configuration.really_verbose

Expand Down
34 changes: 34 additions & 0 deletions test/rubygems/test_gem_rdoc.rb
Expand Up @@ -69,6 +69,40 @@ def test_generate

assert @rdoc.rdoc_installed?
assert @rdoc.ri_installed?

rdoc = @rdoc.instance_variable_get :@rdoc

refute rdoc.options.hyperlink_all
end

def test_generate_configuration_rdoc_array
skip 'RDoc 3+ required' unless rdoc_3?

Gem.configuration[:rdoc] = %w[-A]

FileUtils.mkdir_p @a.doc_dir
FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')

@rdoc.generate

rdoc = @rdoc.instance_variable_get :@rdoc

assert rdoc.options.hyperlink_all
end

def test_generate_configuration_rdoc_string
skip 'RDoc 3+ required' unless rdoc_3?

Gem.configuration[:rdoc] = '-A'

FileUtils.mkdir_p @a.doc_dir
FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')

@rdoc.generate

rdoc = @rdoc.instance_variable_get :@rdoc

assert rdoc.options.hyperlink_all
end

def test_generate_disabled
Expand Down

0 comments on commit 91511b7

Please sign in to comment.