From 7b998913fe90ce70dd144270dca0f1a865060172 Mon Sep 17 00:00:00 2001 From: kou Date: Sat, 27 Jun 2009 04:50:37 +0000 Subject: [PATCH] Merge r24865:23867 from trunk. * NEWS, lib/rss/maker/base.rb, test/rss/test_maker_2.0.rb: add item.guid.permanent_link? and item.guid.permanent_link=. * NEWS: rss: 0.2.5 -> 0.2.7. * lib/rss/rss.rb, test/rss/test_version.rb: 0.2.6 -> 0.2.7. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 9 +++++++++ NEWS | 7 ++++++- lib/rss/maker/base.rb | 8 ++++++++ lib/rss/rss.rb | 2 +- test/rss/test_maker_2.0.rb | 20 ++++++++++++++++++++ test/rss/test_version.rb | 2 +- 6 files changed, 45 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9fe27692e1..5e79ff988b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Sat Jun 27 13:47:19 2009 Kouhei Sutou + + * NEWS, lib/rss/maker/base.rb, test/rss/test_maker_2.0.rb: add + item.guid.permanent_link? and item.guid.permanent_link=. + + * NEWS: rss: 0.2.5 -> 0.2.7. + + * lib/rss/rss.rb, test/rss/test_version.rb: 0.2.6 -> 0.2.7. + Fri Jun 26 11:02:28 2009 NAKAMURA Usaku * lib/mkmf.rb (CXX_EXT): cygwin's filesystem (= Windows) is case diff --git a/NEWS b/NEWS index 5801a6bb7b..29f92ca116 100644 --- a/NEWS +++ b/NEWS @@ -144,7 +144,7 @@ with all sufficient information, see the ChangeLog file. * rss - * 0.2.4 -> 0.2.5 + * 0.2.4 -> 0.2.7. * RSS::Maker.make * raise an exception not returns nil for invalid feed making. @@ -156,6 +156,11 @@ with all sufficient information, see the ChangeLog file. * RSS::Maker.supported?(version) * new method to check whether given version is supported. + * RSS::Maker: item.guid.permanent_link? + * new alias of item.guid.isPermaLink + * RSS::Maker: item.guid.permanent_link= + * new alias of item.guid.isPermaLink= + * REXML * REXML::Document.entity_expansion_limit= diff --git a/lib/rss/maker/base.rb b/lib/rss/maker/base.rb index 15b4a3173e..3722d5e987 100644 --- a/lib/rss/maker/base.rb +++ b/lib/rss/maker/base.rb @@ -746,6 +746,14 @@ module RSS attr_accessor element add_need_initialize_variable(element) end + + def permanent_link? + isPermaLink + end + + def permanent_link=(bool) + self.isPermaLink = bool + end end class EnclosureBase < Base diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb index 48bfb1ec1d..f68001a47b 100644 --- a/lib/rss/rss.rb +++ b/lib/rss/rss.rb @@ -53,7 +53,7 @@ require "rss/xml-stylesheet" module RSS - VERSION = "0.2.6" + VERSION = "0.2.7" URI = "http://purl.org/rss/1.0/" diff --git a/test/rss/test_maker_2.0.rb b/test/rss/test_maker_2.0.rb index 290164d354..a45a086da4 100644 --- a/test/rss/test_maker_2.0.rb +++ b/test/rss/test_maker_2.0.rb @@ -488,6 +488,26 @@ module RSS assert_equal(content, guid.content) end + def test_guid_permanent_link + content = "http://inessential.com/2002/09/01.php#a2" + + rss = RSS::Maker.make("2.0") do |maker| + setup_dummy_channel(maker) + setup_dummy_item(maker) + + guid = maker.items.last.guid + assert_equal(nil, guid.permanent_link?) + assert_equal(guid.isPermaLink, guid.permanent_link?) + guid.permanent_link = true + assert_equal(true, guid.permanent_link?) + assert_equal(guid.isPermaLink, guid.permanent_link?) + guid.content = content + end + guid = rss.channel.items.last.guid + assert_equal(true, guid.isPermaLink) + assert_equal(content, guid.content) + end + def test_not_valid_guid content = "http://inessential.com/2002/09/01.php#a2" diff --git a/test/rss/test_version.rb b/test/rss/test_version.rb index ee94b80f16..17679012d3 100644 --- a/test/rss/test_version.rb +++ b/test/rss/test_version.rb @@ -3,7 +3,7 @@ require "rss-testcase" module RSS class TestVersion < TestCase def test_version - assert_equal("0.2.6", ::RSS::VERSION) + assert_equal("0.2.7", ::RSS::VERSION) end end end