From a1be6ee7791451bf5d0cdfbab394dc107f8c1d4c Mon Sep 17 00:00:00 2001 From: Mo Morsi Date: Mon, 1 Aug 2011 18:35:51 -0400 Subject: [PATCH] fix for BZ #720520 --- rubygem-yard.spec | 43 +++++++++++++++----------- yard-rubygems-17-support.patch | 55 ++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 18 deletions(-) create mode 100644 yard-rubygems-17-support.patch diff --git a/rubygem-yard.spec b/rubygem-yard.spec index 8359019..dc6110a 100644 --- a/rubygem-yard.spec +++ b/rubygem-yard.spec @@ -13,13 +13,16 @@ License: MIT and (GPLv2 or Ruby) URL: http://yardoc.org Source0: http://gemcutter.org/downloads/%{gemname}-%{version}.gem -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +# fix for https://github.com/lsegal/yard/issues/272 +# https://github.com/postmodern/yard/commit/f4075ea5ddb3bb85bb79408e4128c877c166a69e +Patch0: yard-rubygems-17-support.patch Requires: rubygems Requires: ruby(abi) = %{rubyabi} BuildRequires: rubygems -BuildRequires(check): rubygem(rake) -BuildRequires(check): rubygem(rspec) -BuildRequires(check): rubygem(RedCloth) +BuildRequires: rubygem(rake) +BuildRequires: rubygem(rspec) +BuildRequires: rubygem(RedCloth) BuildArch: noarch Provides: rubygem(%{gemname}) = %{version} @@ -32,30 +35,33 @@ custom Ruby constructs such as custom class level definitions. %prep %setup -q -T -c +%{__mkdir_p} .%{gemdir} +# FIXME rdoc generation doesn't work w/ +# the yard/rdoc version on F15 +gem install --local --install-dir .%{gemdir} \ + --force -V --no-rdoc --no-ri %{SOURCE0} + +pushd .%{geminstdir} +%patch0 +popd + %build %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{gemdir} -mkdir -p %{buildroot}/%{_bindir} +mv .%{gemdir}/* %{buildroot}%{gemdir} -gem install --local --install-dir ./%{gemdir} \ - --force --rdoc %{SOURCE0} -cp -a ./%{gemdir}/* %{buildroot}/%{gemdir}/. +mkdir -p %{buildroot}/%{_bindir} mv %{buildroot}%{gemdir}/bin/* %{buildroot}/%{_bindir} rmdir %{buildroot}%{gemdir}/bin find %{buildroot}%{geminstdir}/bin -type f | xargs chmod a+x -%clean -rm -rf %{buildroot} - %check -pushd .%{geminstdir} -rake spec || : +pushd %{buildroot}%{geminstdir} +rake spec %files -%defattr(-, root, root, -) %{_bindir}/yardoc %{_bindir}/yri %{_bindir}/yard-graph @@ -64,6 +70,7 @@ rake spec || : %{geminstdir}/lib %{geminstdir}/templates %{geminstdir}/.yardopts +%{geminstdir}/.yardoc %{gemdir}/cache/%{gemname}-%{version}.gem %{gemdir}/specifications/%{gemname}-%{version}.gemspec @@ -75,12 +82,12 @@ rake spec || : %doc %{geminstdir}/benchmarks %doc %{geminstdir}/spec %doc %{geminstdir}/docs -%doc %{gemdir}/doc/%{gemname}-%{version} %changelog -* Wed Feb 09 2011 Fedora Release Engineering -- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild +* Mon Jul 25 2011 Mo Morsi - 0.5.3-4 +- integrated fix for upstream issue 272 +- temp disabled rdoc generation as that is not working on F15 * Mon Feb 22 2010 Mohammed Morsi - 0.5.3-3 - fixed dependencies/package issues according to guidelines diff --git a/yard-rubygems-17-support.patch b/yard-rubygems-17-support.patch new file mode 100644 index 0000000..a45fcd7 --- /dev/null +++ b/yard-rubygems-17-support.patch @@ -0,0 +1,55 @@ +--- Rakefile.orig 2011-07-25 15:55:31.332414239 -0400 ++++ Rakefile 2011-07-25 15:57:04.953215913 -0400 +@@ -1,4 +1,5 @@ + require File.dirname(__FILE__) + '/lib/yard' ++require File.dirname(__FILE__) + '/lib/rubygems_plugin' + + WINDOWS = (RUBY_PLATFORM =~ /win32|cygwin/ ? true : false) rescue false + SUDO = WINDOWS ? '' : 'sudo' +--- lib/rubygems_plugin.rb.orig 2011-08-01 13:23:11.000000000 -0400 ++++ lib/rubygems_plugin.rb 2011-08-01 13:26:09.000000000 -0400 +@@ -1,13 +1,10 @@ + require 'rubygems/specification' ++require 'rubygems/user_interaction' + require 'rubygems/doc_manager' + + class Gem::Specification +- # has_rdoc should not be ignored! +- overwrite_accessor(:has_rdoc) { @has_rdoc } +- overwrite_accessor(:has_rdoc=) {|v| @has_rdoc = v } +- + def has_yardoc=(value) +- @has_rdoc = 'yard' ++ @has_rdoc = value ? 'yard' : false + end + + def has_yardoc +@@ -20,6 +17,28 @@ class Gem::Specification + end + + alias has_yardoc? has_yardoc ++ ++ # has_rdoc should not be ignored! ++ if respond_to?(:overwrite_accessor) ++ overwrite_accessor(:has_rdoc) { @has_rdoc } ++ overwrite_accessor(:has_rdoc=) {|v| @has_rdoc = v } ++ else ++ attr_accessor :has_rdoc ++ end ++ ++ if defined?(Gem::VERSION) && Gem::VERSION =~ /^1\.7\./ ++ def _dump_with_rdoc(limit) ++ dmp = _dump_without_rdoc(limit) ++ dmp[15] = @has_rdoc ++ dmp ++ end ++ alias _dump_without_rdoc _dump ++ alias _dump _dump_with_rdoc ++ ++ @@default_value[:has_rdoc] = true if defined?(@@default_value) ++ @@attributes << 'has_rdoc' if defined?(@@attributes) ++ @@non_nil_attributes << 'has_rdoc' if defined?(@@non_nil_attributes) ++ end + end + + unless defined? Gem::DocManager.load_yardoc