Skip to content

Commit

Permalink
Ignore has_rdoc
Browse files Browse the repository at this point in the history
git-svn-id: http://rubygems.rubyforge.org/svn/trunk@2194 3d4018f9-ac1a-0410-99e9-8a154d859a19
  • Loading branch information
drbrain committed May 4, 2009
1 parent e0cb6c7 commit 11ece07
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 40 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
@@ -1,5 +1,12 @@
# -*- coding: utf-8 -*-

2009-05-04 Eric Hodel <drbrain@segment7.net>

* lib/rubygems/specification.rb: Default has_rdoc to true, ignore
its value.
* lib/rubygems/doc_manager.rb: Always generate RDoc regardless of
#has_rdoc?

2009-05-02 Eric Hodel <drbrain@segment7.net>

* lib/rubygems/commands/server_command.rb: Allow port names with
Expand Down
12 changes: 4 additions & 8 deletions lib/rubygems/doc_manager.rb
Expand Up @@ -105,10 +105,8 @@ def rdoc_installed?
# RI docs generation to fail if run after RDoc).

def generate_ri
if @spec.has_rdoc then
setup_rdoc
install_ri # RDoc bug, ri goes first
end
setup_rdoc
install_ri # RDoc bug, ri goes first

FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir)
end
Expand All @@ -121,10 +119,8 @@ def generate_ri
# RI docs generation to fail if run after RDoc).

def generate_rdoc
if @spec.has_rdoc then
setup_rdoc
install_rdoc
end
setup_rdoc
install_rdoc

FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir)
end
Expand Down
23 changes: 18 additions & 5 deletions lib/rubygems/specification.rb
Expand Up @@ -894,9 +894,6 @@ def validate
alert_warning 'description and summary are identical'
end

alert_warning "RDoc will not be generated (has_rdoc == false)" unless
has_rdoc

alert_warning "deprecated autorequire specified" if autorequire

executables.each do |executable|
Expand Down Expand Up @@ -1139,9 +1136,11 @@ def ruby_code(obj)
##
# :attr_accessor: has_rdoc
#
# True if this gem is RDoc-compliant
# Deprecated and ignored, defaults to true.
#
# Formerly used to indicate this gem was RDoc-capable.

attribute :has_rdoc, false
attribute :has_rdoc, true

##
# True if this gem supports RDoc
Expand Down Expand Up @@ -1300,6 +1299,20 @@ def ruby_code(obj)

attribute_alias_singular :test_file, :test_files

##
# has_rdoc is now ignored

overwrite_accessor :has_rdoc do
true
end

##
# has_rdoc is now ignored

overwrite_accessor :has_rdoc= do |value|
@has_rdoc = true
end

overwrite_accessor :version= do |version|
@version = Gem::Version.create(version)
self.required_rubygems_version = '> 1.3.1' if @version.prerelease?
Expand Down
53 changes: 26 additions & 27 deletions test/test_gem_specification.rb
Expand Up @@ -197,8 +197,8 @@ def test_initialize
assert_equal [], spec.requirements
assert_equal [], spec.dependencies
assert_equal 'bin', spec.bindir
assert_equal false, spec.has_rdoc
assert_equal false, spec.has_rdoc?
assert_equal true, spec.has_rdoc
assert_equal true, spec.has_rdoc?
assert_equal '>= 0', spec.required_ruby_version.to_s
assert_equal '>= 0', spec.required_rubygems_version.to_s
end
Expand Down Expand Up @@ -281,7 +281,7 @@ def test_initialize_copy
assert_equal 'bin', spec.bindir
assert_same spec.bindir, new_spec.bindir

assert_equal false, spec.has_rdoc
assert_equal true, spec.has_rdoc
assert_same spec.has_rdoc, new_spec.has_rdoc

assert_equal '>= 0', spec.required_ruby_version.to_s
Expand Down Expand Up @@ -431,7 +431,7 @@ def test_equals2_cgikit
s.homepage = %q{http://www.spice-of-life.net/download/cgikit/}
s.autorequire = %q{cgikit}
s.bindir = nil
s.has_rdoc = nil
s.has_rdoc = true
s.required_ruby_version = nil
s.platform = nil
s.files = ["lib/cgikit", "lib/cgikit.rb", "lib/cgikit/components", "..."]
Expand Down Expand Up @@ -578,6 +578,17 @@ def test_has_rdoc_eh
assert @a1.has_rdoc?
end

def test_has_rdoc_equals

use_ui @ui do
@a1.has_rdoc = false
end

assert_equal '', @ui.output

assert_equal true, @a1.has_rdoc
end

def test_hash
assert_equal @a1.hash, @a1.hash
assert_equal @a1.hash, @a1.dup.hash
Expand Down Expand Up @@ -748,7 +759,6 @@ def test_to_ruby
s.description = %q{This is a test description}
s.email = %q{example@example.com}
s.files = [\"lib/code.rb\"]
s.has_rdoc = true
s.homepage = %q{http://example.com}
s.require_paths = [\"lib\"]
s.rubygems_version = %q{#{Gem::RubyGemsVersion}}
Expand Down Expand Up @@ -800,7 +810,6 @@ def test_to_ruby_fancy
s.executables = [\"exec\"]
s.extensions = [\"ext/a/extconf.rb\"]
s.files = [\"lib/code.rb\", \"test/suite.rb\", \"bin/exec\", \"ext/a/extconf.rb\"]
s.has_rdoc = %q{true}
s.homepage = %q{http://example.com}
s.licenses = [\"MIT\"]
s.require_paths = [\"lib\"]
Expand Down Expand Up @@ -1061,14 +1070,19 @@ def test_validate_executables
end

def test_validate_empty_require_paths
util_setup_validate
if win_platform? then
skip 'test_validate_empty_require_paths skipped on MS Windows'
else
util_setup_validate

@a1.require_paths = []
e = assert_raises Gem::InvalidSpecificationException do
@a1.validate
end
@a1.require_paths = []
e = assert_raises Gem::InvalidSpecificationException do
@a1.validate
end

assert_equal 'specification must have at least one require_path', e.message
assert_equal 'specification must have at least one require_path',
e.message
end
end

def test_validate_files
Expand Down Expand Up @@ -1122,21 +1136,6 @@ def test_validate_homepage
end
end

def test_validate_has_rdoc
util_setup_validate

Dir.chdir @tempdir do
@a1.has_rdoc = false

use_ui @ui do
@a1.validate
end

assert_equal "WARNING: RDoc will not be generated (has_rdoc == false)\n",
@ui.error, 'error'
end
end

def test_validate_name
util_setup_validate

Expand Down

0 comments on commit 11ece07

Please sign in to comment.