Don't generate documentation on unexpected places.

This commit is contained in:
Vít Ondruch 2014-01-10 16:06:12 +01:00
parent 86a8f5cf5a
commit e11dee8544
3 changed files with 108 additions and 0 deletions

View File

@ -143,6 +143,12 @@ Patch18: ruby-2.1.0-resolv.rb-no-encodings.patch
# Backport regenerated certificates for IMAP tests.
# http://bugs.ruby-lang.org/issues/9341
Patch19: ruby-2.1.1-fix-test-failures-due-to-expired-certs.patch
# Fix documentation generated on unexpected places.
# https://github.com/rubygems/rubygems/issues/758
# https://github.com/rubygems/rubygems/commit/e088c6824209d98eccb0f1e6c7e21f26b4a1178d
Patch20: rubygems-2.2.1-Add-BasicSpecification-source_paths.patch
# https://github.com/rubygems/rubygems/commit/2f03b54b63043aadce9e95b83e98b29712bad21f
Patch21: rubygems-2.2.1-Use-source_paths-for-fallback-rdoc-plugin.patch
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: ruby(rubygems) >= %{rubygems_version}
@ -408,6 +414,8 @@ Tcl/Tk interface for the object-oriented scripting language Ruby.
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
# Provide an example of usage of the tapset:
cp -a %{SOURCE3} .
@ -917,6 +925,7 @@ OPENSSL_ENABLE_MD5_VERIFY=1 make check TESTS="-v $DISABLE_TESTS"
%changelog
* Fri Jan 10 2014 Vít Ondruch <vondruch@redhat.com> - 2.1.0-18
- Don't generate documentation on unexpected places.
- Detect if rubygems are running under rpmbuild and install gem binary
extensions into appropriate place.

View File

@ -0,0 +1,73 @@
From e088c6824209d98eccb0f1e6c7e21f26b4a1178d Mon Sep 17 00:00:00 2001
From: Eric Hodel <drbrain@segment7.net>
Date: Mon, 6 Jan 2014 14:20:18 -0800
Subject: [PATCH] Add BasicSpecification#source_paths
This allows documentation and analysis tools to retrieve paths of source
files in gems. This is needed as the introduction of shared gem
directories means the extension source directory is no longer included
in require_paths (which was meant for $LOAD_PATH, not source code).
---
lib/rubygems/basic_specification.rb | 18 ++++++++++++++++++
test/rubygems/test_gem_specification.rb | 16 ++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
index a52377f..470a6eb 100644
--- a/lib/rubygems/basic_specification.rb
+++ b/lib/rubygems/basic_specification.rb
@@ -207,6 +207,24 @@ def require_paths
end
##
+ # Returns the paths to the source files for use with analysis and
+ # documentation tools. These paths are relative to full_gem_path.
+
+ def source_paths
+ paths = raw_require_paths.dup
+
+ if @extensions then
+ ext_dirs = @extensions.map do |extension|
+ extension.split(File::SEPARATOR, 2).first
+ end.uniq
+
+ paths.concat ext_dirs
+ end
+
+ paths.uniq
+ end
+
+ ##
# Return a Gem::Specification from this gem
def to_spec
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 46db0c4..b72a5d1 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -1809,6 +1809,22 @@ def test_source
assert_kind_of Gem::Source::Installed, @a1.source
end
+ def test_source_paths
+ ext_spec
+
+ @ext.require_paths = %w[lib ext foo]
+ @ext.extensions << 'bar/baz'
+
+ expected = %w[
+ lib
+ ext
+ foo
+ bar
+ ]
+
+ assert_equal expected, @ext.source_paths
+ end
+
def test_full_require_paths
ext_spec
--
1.8.5.1

View File

@ -0,0 +1,26 @@
From 2f03b54b63043aadce9e95b83e98b29712bad21f Mon Sep 17 00:00:00 2001
From: Eric Hodel <drbrain@segment7.net>
Date: Mon, 6 Jan 2014 14:30:07 -0800
Subject: [PATCH] Use source_paths for fallback rdoc plugin
Fixes #758
---
lib/rubygems/rdoc.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/rubygems/rdoc.rb b/lib/rubygems/rdoc.rb
index 52249dc..633bd89 100644
--- a/lib/rubygems/rdoc.rb
+++ b/lib/rubygems/rdoc.rb
@@ -193,7 +193,7 @@ def generate
::RDoc::Parser::C.reset
args = @spec.rdoc_options
- args.concat @spec.require_paths
+ args.concat @spec.source_paths
args.concat @spec.extra_rdoc_files
case config_args = Gem.configuration[:rdoc]
--
1.8.5.1