[rubygem-tilt] Fixes RDoc >= 3.10 compatibility. Enabled coffee-script and redcarpet tests.
Vít Ondruch
vondruch at fedoraproject.org
Mon Jul 23 13:31:45 UTC 2012
commit e99ed4c688d0b6fd4a895ecf8b8f6eab9f7ccb18
Author: Vít Ondruch <vondruch at redhat.com>
Date: Mon Jul 23 15:31:20 2012 +0200
Fixes RDoc >= 3.10 compatibility.
Enabled coffee-script and redcarpet tests.
rubygem-tilt.spec | 35 ++++++-
tilt-1.3.3-Redcarpet2-as-default.patch | 68 ++++++++++++
...ecs-to-RDoc-3.10-which-outputs-header-ids.patch | 31 ++++++
...ffee-script-test-examples-force-a-closure.patch | 114 ++++++++++++++++++++
...utoloads-everything-so-you-_have_-to-requ.patch | 69 ++++++++++++
5 files changed, 314 insertions(+), 3 deletions(-)
---
diff --git a/rubygem-tilt.spec b/rubygem-tilt.spec
index eaa66b9..3b7ea88 100644
--- a/rubygem-tilt.spec
+++ b/rubygem-tilt.spec
@@ -6,11 +6,25 @@
Summary: Generic interface to multiple Ruby template engines
Name: rubygem-%{gem_name}
Version: 1.3.3
-Release: 4%{?dist}
+Release: 5%{?dist}
Group: Development/Languages
License: MIT
URL: http://github.com/rtomayko/%{gem_name}
Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
+# Fixes RDoc >= 3.10 compatibility.
+# https://github.com/rtomayko/tilt/commit/ecdf14893b40cc1bc21aaedca9578d36d264f89e
+Patch0: tilt-1.3.3-rdoc-3.10-autoloads-everything-so-you-_have_-to-requ.patch
+# https://github.com/rtomayko/tilt/commit/ff097e8722056dfef6ac4523d406bdbca6eae87d
+Patch1: tilt-1.3.3-adjusted-specs-to-RDoc-3.10-which-outputs-header-ids.patch
+
+# Fix for redcarpet test failures.
+# https://github.com/rtomayko/tilt/commit/87f0358d7e9968c55a28356e2a221d938fc51775
+Patch2: tilt-1.3.3-Redcarpet2-as-default.patch
+
+# coffee-script test fixes.
+# https://github.com/rtomayko/tilt/commit/173ade03fb72ade7f3aed948e104e26de043f6cf
+Patch3: tilt-1.3.3-ensure-coffee-script-test-examples-force-a-closure.patch
+
Requires: ruby(abi) = %{rubyabi}
Requires: ruby(rubygems)
Requires: ruby
@@ -18,13 +32,16 @@ BuildRequires: ruby(abi) = %{rubyabi}
BuildRequires: rubygems-devel
BuildRequires: ruby
%if 0%{bootstrap} < 1
+BuildRequires: rubygem(rdoc)
BuildRequires: rubygem(minitest)
BuildRequires: rubygem(nokogiri)
BuildRequires: rubygem(erubis)
BuildRequires: rubygem(haml)
BuildRequires: rubygem(builder)
BuildRequires: rubygem(RedCloth)
-%endif
+BuildRequires: rubygem(redcarpet)
+BuildRequires: rubygem(coffee-script)
+BuildRequires: rubygem(therubyracer)
# Markaby test fails. It is probably due to rather old version found in Fedora.
# https://github.com/rtomayko/tilt/issues/96
@@ -32,6 +49,7 @@ BuildRequires: rubygem(RedCloth)
# RDiscount test fails. Is it due to old version in Fedora?
# BuildRequires: rubygem(rdiscount)
+%endif
BuildArch: noarch
Provides: rubygem(%{gem_name}) = %{version}
@@ -55,6 +73,13 @@ gem install --local --install-dir .%{gem_dir} \
--bindir .%{_bindir} \
--force %{SOURCE0}
+pushd .%{gem_instdir}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+popd
+
%build
%install
@@ -98,6 +123,10 @@ popd
%changelog
+* Mon Jul 23 2012 Vít Ondruch <vondruch at redhat.com> - 1.3.3-5
+- Fixes RDoc >= 3.10 compatibility.
+- Enabled coffee-script and redcarpet tests.
+
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.3.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
@@ -125,7 +154,7 @@ popd
* Thu Feb 10 2011 Vít Ondruch <vondruch at redhat.com> - 1.2.2-2
- Test moved to doc subpackage
-- %{gem_name} macro used whenever possible.
+- %%{gem_name} macro used whenever possible.
* Mon Feb 07 2011 Vít Ondruch <vondruch at redhat.com> - 1.2.2-1
- Initial package
diff --git a/tilt-1.3.3-Redcarpet2-as-default.patch b/tilt-1.3.3-Redcarpet2-as-default.patch
new file mode 100644
index 0000000..eb268c6
--- /dev/null
+++ b/tilt-1.3.3-Redcarpet2-as-default.patch
@@ -0,0 +1,68 @@
+From 87f0358d7e9968c55a28356e2a221d938fc51775 Mon Sep 17 00:00:00 2001
+From: Davide D'Agostino <d.dagostino at lipsiasoft.com>
+Date: Thu, 23 Feb 2012 18:29:33 +0100
+Subject: [PATCH] Redcarpet2 as default
+
+---
+ lib/tilt/markdown.rb | 2 +-
+ test/tilt_markdown_test.rb | 2 +-
+ test/tilt_redcarpettemplate_test.rb | 9 +++++++--
+ 3 files changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/lib/tilt/markdown.rb b/lib/tilt/markdown.rb
+index 322b0f8..396fb12 100644
+--- a/lib/tilt/markdown.rb
++++ b/lib/tilt/markdown.rb
+@@ -53,7 +53,7 @@ module Tilt
+ end
+
+ def prepare
+- klass = [Redcarpet1, Redcarpet2].detect { |e| e.engine_initialized? }
++ klass = [Redcarpet2, Redcarpet1].detect { |e| e.engine_initialized? }
+ @engine = klass.new(file, line, options) { data }
+ end
+
+diff --git a/test/tilt_markdown_test.rb b/test/tilt_markdown_test.rb
+index f67a8e2..ba83e60 100644
+--- a/test/tilt_markdown_test.rb
++++ b/test/tilt_markdown_test.rb
+@@ -98,7 +98,7 @@ begin
+
+ def test_smarty_pants_true
+ html = nrender "Hello ``World'' -- This is --- a test ...", :smartypants => true
+- assert_equal "<p>Hello “World” – This is — a test …</p>", html
++ assert_equal "<p>Hello “World'' – This is — a test …</p>", html
+ end
+ end
+ rescue LoadError => boom
+diff --git a/test/tilt_redcarpettemplate_test.rb b/test/tilt_redcarpettemplate_test.rb
+index 2fb0835..54723d1 100644
+--- a/test/tilt_redcarpettemplate_test.rb
++++ b/test/tilt_redcarpettemplate_test.rb
+@@ -37,6 +37,11 @@ begin
+ end
+ end
+
++ test "redcarpet2 is our default choice" do
++ template = Tilt::RedcarpetTemplate.new {}
++ assert_equal Tilt::RedcarpetTemplate::Redcarpet2, template.prepare.class
++ end
++
+ test "preparing and evaluating templates on #render" do
+ template = Tilt::RedcarpetTemplate.new { |t| "# Hello World!" }
+ assert_equal "<h1>Hello World!</h1>\n", template.render
+@@ -48,9 +53,9 @@ begin
+ end
+
+ test "smartypants when :smart is set" do
+- template = Tilt::RedcarpetTemplate.new(:smart => true) { |t|
++ template = Tilt::RedcarpetTemplate.new(:smartypants => true) { |t|
+ "OKAY -- 'Smarty Pants'" }
+- assert_match /<p>OKAY &[nm]dash; ‘Smarty Pants’<\/p>/,
++ assert_match /<p>OKAY – 'Smarty Pants'<\/p>/,
+ template.render
+ end
+ end
+--
+1.7.10.4
+
diff --git a/tilt-1.3.3-adjusted-specs-to-RDoc-3.10-which-outputs-header-ids.patch b/tilt-1.3.3-adjusted-specs-to-RDoc-3.10-which-outputs-header-ids.patch
new file mode 100644
index 0000000..5f7bbf0
--- /dev/null
+++ b/tilt-1.3.3-adjusted-specs-to-RDoc-3.10-which-outputs-header-ids.patch
@@ -0,0 +1,31 @@
+From ff097e8722056dfef6ac4523d406bdbca6eae87d Mon Sep 17 00:00:00 2001
+From: HannesG <hag at informatik.uni-kiel.de>
+Date: Sun, 8 Jan 2012 21:15:26 +0100
+Subject: [PATCH] adjusted specs to RDoc >= 3.10 ( which outputs header ids )
+
+---
+ test/tilt_rdoctemplate_test.rb | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/test/tilt_rdoctemplate_test.rb b/test/tilt_rdoctemplate_test.rb
+index 309a048..33d8e20 100644
+--- a/test/tilt_rdoctemplate_test.rb
++++ b/test/tilt_rdoctemplate_test.rb
+@@ -12,12 +12,12 @@ begin
+
+ test "preparing and evaluating the template with #render" do
+ template = Tilt::RDocTemplate.new { |t| "= Hello World!" }
+- assert_equal "<h1>Hello World!</h1>", template.render.strip
++ assert_equal "<h1 id=\"label-Hello+World%21\">Hello World!</h1>", template.render.strip
+ end
+
+ test "can be rendered more than once" do
+ template = Tilt::RDocTemplate.new { |t| "= Hello World!" }
+- 3.times { assert_equal "<h1>Hello World!</h1>", template.render.strip }
++ 3.times { assert_equal "<h1 id=\"label-Hello+World%21\">Hello World!</h1>", template.render.strip }
+ end
+ end
+ rescue LoadError => boom
+--
+1.7.10.4
+
diff --git a/tilt-1.3.3-ensure-coffee-script-test-examples-force-a-closure.patch b/tilt-1.3.3-ensure-coffee-script-test-examples-force-a-closure.patch
new file mode 100644
index 0000000..7edd2b9
--- /dev/null
+++ b/tilt-1.3.3-ensure-coffee-script-test-examples-force-a-closure.patch
@@ -0,0 +1,114 @@
+From 173ade03fb72ade7f3aed948e104e26de043f6cf Mon Sep 17 00:00:00 2001
+From: Joshua Peek <josh at joshpeek.com>
+Date: Tue, 10 Jan 2012 11:01:12 -0600
+Subject: [PATCH] Ensure coffee-script test examples force a closure
+
+---
+ test/tilt_coffeescripttemplate_test.rb | 62 ++++++++++++++++++++++++++------
+ 1 file changed, 52 insertions(+), 10 deletions(-)
+
+diff --git a/test/tilt_coffeescripttemplate_test.rb b/test/tilt_coffeescripttemplate_test.rb
+index 8be7bd5..e52bf26 100644
+--- a/test/tilt_coffeescripttemplate_test.rb
++++ b/test/tilt_coffeescripttemplate_test.rb
+@@ -9,6 +9,10 @@ begin
+ assert_equal Tilt::CoffeeScriptTemplate, Tilt['test.coffee']
+ end
+
++ test "bare is disabled by default" do
++ assert_equal false, Tilt::CoffeeScriptTemplate.default_bare
++ end
++
+ test "compiles and evaluates the template on #render" do
+ template = Tilt::CoffeeScriptTemplate.new { |t| "puts 'Hello, World!'\n" }
+ assert_match "puts('Hello, World!');", template.render
+@@ -20,18 +24,25 @@ begin
+ end
+
+ test "disabling coffee-script wrapper" do
+- str = "puts 'Hello, World!'\n"
++ str = 'name = "Josh"; puts "Hello #{name}"'
++
++ template = Tilt::CoffeeScriptTemplate.new { str }
++ assert_match "(function() {", template.render
++ assert_match "puts(\"Hello \" + name);\n", template.render
+
+ template = Tilt::CoffeeScriptTemplate.new(:bare => true) { str }
+- assert_equal "puts('Hello, World!');", template.render
++ assert_not_match "(function() {", template.render
++ assert_equal "var name;\n\nname = \"Josh\";\n\nputs(\"Hello \" + name);\n", template.render
+
+ template2 = Tilt::CoffeeScriptTemplate.new(:no_wrap => true) { str}
+- assert_equal "puts('Hello, World!');", template.render
++ assert_not_match "(function() {", template.render
++ assert_equal "var name;\n\nname = \"Josh\";\n\nputs(\"Hello \" + name);\n", template.render
+ end
+
+- context "disabling coffee-script wrapper globally" do
++ context "wrapper globally enabled" do
+ setup do
+ @bare = Tilt::CoffeeScriptTemplate.default_bare
++ Tilt::CoffeeScriptTemplate.default_bare = false
+ end
+
+ teardown do
+@@ -39,19 +50,50 @@ begin
+ end
+
+ test "no options" do
+- template = Tilt::CoffeeScriptTemplate.new { |t| "puts 'Hello, World!'\n" }
+- assert_match "puts('Hello, World!');", template.render
++ template = Tilt::CoffeeScriptTemplate.new { |t| 'name = "Josh"; puts "Hello, #{name}"' }
++ assert_match "puts(\"Hello, \" + name);", template.render
+ assert_match "(function() {", template.render
+ end
+
+ test "overridden by :bare" do
+- template = Tilt::CoffeeScriptTemplate.new(:bare => false) { "puts 'Hello, World!'\n" }
+- assert_not_equal "puts('Hello, World!');", template.render
++ template = Tilt::CoffeeScriptTemplate.new(:bare => true) { |t| 'name = "Josh"; puts "Hello, #{name}"' }
++ assert_match "puts(\"Hello, \" + name);", template.render
++ assert_not_match "(function() {", template.render
+ end
+
+ test "overridden by :no_wrap" do
+- template = Tilt::CoffeeScriptTemplate.new(:no_wrap => false) { "puts 'Hello, World!'\n" }
+- assert_not_equal "puts('Hello, World!');", template.render
++ template = Tilt::CoffeeScriptTemplate.new(:no_wrap => true) { |t| 'name = "Josh"; puts "Hello, #{name}"' }
++ assert_match "puts(\"Hello, \" + name);", template.render
++ assert_not_match "(function() {", template.render
++ end
++ end
++
++ context "wrapper globally disabled" do
++ setup do
++ @bare = Tilt::CoffeeScriptTemplate.default_bare
++ Tilt::CoffeeScriptTemplate.default_bare = true
++ end
++
++ teardown do
++ Tilt::CoffeeScriptTemplate.default_bare = @bare
++ end
++
++ test "no options" do
++ template = Tilt::CoffeeScriptTemplate.new { |t| 'name = "Josh"; puts "Hello, #{name}"' }
++ assert_match "puts(\"Hello, \" + name);", template.render
++ assert_not_match "(function() {", template.render
++ end
++
++ test "overridden by :bare" do
++ template = Tilt::CoffeeScriptTemplate.new(:bare => false) { |t| 'name = "Josh"; puts "Hello, #{name}"' }
++ assert_match "puts(\"Hello, \" + name);", template.render
++ assert_match "(function() {", template.render
++ end
++
++ test "overridden by :no_wrap" do
++ template = Tilt::CoffeeScriptTemplate.new(:no_wrap => false) { |t| 'name = "Josh"; puts "Hello, #{name}"' }
++ assert_match "puts(\"Hello, \" + name);", template.render
++ assert_match "(function() {", template.render
+ end
+ end
+ end
+--
+1.7.10.4
+
diff --git a/tilt-1.3.3-rdoc-3.10-autoloads-everything-so-you-_have_-to-requ.patch b/tilt-1.3.3-rdoc-3.10-autoloads-everything-so-you-_have_-to-requ.patch
new file mode 100644
index 0000000..3d30d66
--- /dev/null
+++ b/tilt-1.3.3-rdoc-3.10-autoloads-everything-so-you-_have_-to-requ.patch
@@ -0,0 +1,69 @@
+From ecdf14893b40cc1bc21aaedca9578d36d264f89e Mon Sep 17 00:00:00 2001
+From: Tim Felgentreff <timfelgentreff at gmail.com>
+Date: Mon, 10 Oct 2011 18:50:29 -0700
+Subject: [PATCH] rdoc 3.10 autoloads everything, so you _have_ to require
+ 'rdoc' directly. leave other requires for backwards compat
+
+---
+ TEMPLATES.md | 6 +++---
+ lib/tilt/rdoc.rb | 7 ++++---
+ test/tilt_rdoctemplate_test.rb | 1 +
+ 3 files changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/TEMPLATES.md b/TEMPLATES.md
+index 929fc01..f931415 100644
+--- a/TEMPLATES.md
++++ b/TEMPLATES.md
+@@ -407,9 +407,9 @@ library.
+
+ ### Usage
+
+-__NOTE:__ It's suggested that your program `require 'rdoc/markup'` and
+-`require 'rdoc/markup/to_html'` at load time when using this template
+-engine in a threaded environment.
++__NOTE:__ It's suggested that your program `require 'rdoc'`,
++`require 'rdoc/markup'`, and `require 'rdoc/markup/to_html'` at load time
++when using this template engine in a threaded environment.
+
+ ### See also
+
+diff --git a/lib/tilt/rdoc.rb b/lib/tilt/rdoc.rb
+index cbec4d1..33450e5 100644
+--- a/lib/tilt/rdoc.rb
++++ b/lib/tilt/rdoc.rb
+@@ -4,9 +4,9 @@ module Tilt
+ # RDoc template. See:
+ # http://rdoc.rubyforge.org/
+ #
+- # It's suggested that your program require 'rdoc/markup' and
+- # 'rdoc/markup/to_html' at load time when using this template
+- # engine.
++ # It's suggested that your program `require 'rdoc/markup'` and
++ # `require 'rdoc/markup/to_html'` at load time when using this template
++ # engine in a threaded environment.
+ class RDocTemplate < Template
+ self.default_mime_type = 'text/html'
+
+@@ -15,6 +15,7 @@ module Tilt
+ end
+
+ def initialize_engine
++ require_template_library 'rdoc'
+ require_template_library 'rdoc/markup'
+ require_template_library 'rdoc/markup/to_html'
+ end
+diff --git a/test/tilt_rdoctemplate_test.rb b/test/tilt_rdoctemplate_test.rb
+index 49d6a09..309a048 100644
+--- a/test/tilt_rdoctemplate_test.rb
++++ b/test/tilt_rdoctemplate_test.rb
+@@ -2,6 +2,7 @@ require 'contest'
+ require 'tilt'
+
+ begin
++ require 'rdoc'
+ require 'rdoc/markup'
+ require 'rdoc/markup/to_html'
+ class RDocTemplateTest < Test::Unit::TestCase
+--
+1.7.10.4
+
More information about the scm-commits
mailing list