ruby-changes:54704
From: kou <ko1@a...>
Date: Fri, 25 Jan 2019 15:35:10 +0900 (JST)
Subject: [ruby-changes:54704] kou:r66920 (trunk): Upgrade RSS to 0.2.8
kou 2019-01-25 15:35:04 +0900 (Fri, 25 Jan 2019) New Revision: 66920 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66920 Log: Upgrade RSS to 0.2.8 Added files: trunk/lib/rss/version.rb Removed files: trunk/test/rss/test_version.rb Modified files: trunk/NEWS trunk/lib/rss/itunes.rb trunk/lib/rss/maker/0.9.rb trunk/lib/rss/rss.gemspec trunk/lib/rss/rss.rb trunk/lib/rss.rb trunk/test/rss/rss-assertions.rb trunk/test/rss/test_itunes.rb trunk/test/rss/test_maker_itunes.rb Index: test/rss/test_version.rb =================================================================== --- test/rss/test_version.rb (revision 66919) +++ test/rss/test_version.rb (nonexistent) @@ -1,10 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/test/rss/test_version.rb#L0 -# frozen_string_literal: false -require_relative "rss-testcase" - -module RSS - class TestVersion < TestCase - def test_version - assert_equal("0.2.7", ::RSS::VERSION) - end - end -end Property changes on: test/rss/test_version.rb ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -LF \ No newline at end of property Index: NEWS =================================================================== --- NEWS (revision 66919) +++ NEWS (revision 66920) @@ -26,6 +26,11 @@ sufficient information, see the ChangeLo https://github.com/ruby/ruby/blob/trunk/NEWS#L26 === Stdlib updates (outstanding ones only) +[RSS] + + * Upgrade to RSS 0.2.8. + See https://github.com/ruby/rss/blob/master/NEWS.md. + === Compatibility issues (excluding feature bug fixes) === Stdlib compatibility issues (excluding feature bug fixes) Index: test/rss/rss-assertions.rb =================================================================== --- test/rss/rss-assertions.rb (revision 66919) +++ test/rss/rss-assertions.rb (revision 66920) @@ -1113,8 +1113,11 @@ EOA https://github.com/ruby/ruby/blob/trunk/test/rss/rss-assertions.rb#L1113 :xml_content => target.xhtml, } end - _assert_maker_atom_element(feed_type, maker_readers, feed_readers, - maker_extractor, feed_extractor, + _assert_maker_atom_element(feed_type, + maker_readers, true, + feed_readers, + maker_extractor, + feed_extractor, &block) end @@ -1215,8 +1218,11 @@ EOA https://github.com/ruby/ruby/blob/trunk/test/rss/rss-assertions.rb#L1218 :content => target.content, } end - _assert_maker_atom_element(feed_type, maker_readers, feed_readers, - maker_extractor, feed_extractor, + _assert_maker_atom_element(feed_type, + maker_readers, false, + feed_readers, + maker_extractor, + feed_extractor, &block) end @@ -1248,13 +1254,21 @@ EOA https://github.com/ruby/ruby/blob/trunk/test/rss/rss-assertions.rb#L1254 end end - def _assert_maker_atom_element(feed_type, maker_readers, feed_readers, - maker_extractor, feed_extractor) + def _assert_maker_atom_element(feed_type, + maker_readers, + maker_readers_need_block, + feed_readers, + maker_extractor, + feed_extractor) _wrap_assertion do element = nil feed = RSS::Maker.make("atom:#{feed_type}") do |maker| yield maker - target = chain_reader(maker, maker_readers) {|x| x} + if maker_readers_need_block + target = chain_reader(maker, maker_readers) {|x| x} + else + target = chain_reader(maker, maker_readers) + end element = maker_extractor.call(target) end @@ -1462,8 +1476,11 @@ EOA https://github.com/ruby/ruby/blob/trunk/test/rss/rss-assertions.rb#L1476 :content => target.content, } end - _assert_maker_atom_element(feed_type, maker_readers, feed_readers, - maker_extractor, feed_extractor, + _assert_maker_atom_element(feed_type, + maker_readers, true, + feed_readers, + maker_extractor, + feed_extractor, &block) end @@ -1505,8 +1522,11 @@ EOA https://github.com/ruby/ruby/blob/trunk/test/rss/rss-assertions.rb#L1522 :content => target.content, } end - _assert_maker_atom_element(feed_type, maker_readers, feed_readers, - maker_extractor, feed_extractor, + _assert_maker_atom_element(feed_type, + maker_readers, true, + feed_readers, + maker_extractor, + feed_extractor, &block) end @@ -1623,8 +1643,11 @@ EOA https://github.com/ruby/ruby/blob/trunk/test/rss/rss-assertions.rb#L1643 :uri => target.content, } end - _assert_maker_atom_element(feed_type, maker_readers, feed_readers, - maker_extractor, feed_extractor, + _assert_maker_atom_element(feed_type, + maker_readers, true, + feed_readers, + maker_extractor, + feed_extractor, &block) end @@ -1664,8 +1687,11 @@ EOA https://github.com/ruby/ruby/blob/trunk/test/rss/rss-assertions.rb#L1687 nil end end - _assert_maker_atom_element(feed_type, maker_readers, feed_readers, - maker_extractor, feed_extractor, + _assert_maker_atom_element(feed_type, + maker_readers, true, + feed_readers, + maker_extractor, + feed_extractor, &block) end @@ -1727,8 +1753,11 @@ EOA https://github.com/ruby/ruby/blob/trunk/test/rss/rss-assertions.rb#L1753 :out_of_line => target.out_of_line?, } end - _assert_maker_atom_element(feed_type, maker_readers, feed_readers, - maker_extractor, feed_extractor, + _assert_maker_atom_element(feed_type, + maker_readers, true, + feed_readers, + maker_extractor, + feed_extractor, &block) end Index: test/rss/test_itunes.rb =================================================================== --- test/rss/test_itunes.rb (revision 66919) +++ test/rss/test_itunes.rb (revision 66920) @@ -203,14 +203,18 @@ module RSS https://github.com/ruby/ruby/blob/trunk/test/rss/test_itunes.rb#L203 _assert_itunes_duration(7, 14, 5, "7:14:05", readers, &rss20_maker) _assert_itunes_duration(0, 4, 55, "04:55", readers, &rss20_maker) _assert_itunes_duration(0, 4, 5, "4:05", readers, &rss20_maker) + _assert_itunes_duration(0, 0, 5, "5", readers, &rss20_maker) + _assert_itunes_duration(0, 3, 15, "195", readers, &rss20_maker) + _assert_itunes_duration(1, 0, 1, "3601", readers, &rss20_maker) - _assert_itunes_duration_not_available_value("5", &rss20_maker) _assert_itunes_duration_not_available_value("09:07:14:05", &rss20_maker) _assert_itunes_duration_not_available_value("10:5", &rss20_maker) _assert_itunes_duration_not_available_value("10:03:5", &rss20_maker) _assert_itunes_duration_not_available_value("10:3:05", &rss20_maker) _assert_itunes_duration_not_available_value("xx:xx:xx", &rss20_maker) + + _assert_itunes_duration_not_available_value("", &rss20_maker) end end Index: test/rss/test_maker_itunes.rb =================================================================== --- test/rss/test_maker_itunes.rb (revision 66919) +++ test/rss/test_maker_itunes.rb (revision 66920) @@ -250,14 +250,21 @@ module RSS https://github.com/ruby/ruby/blob/trunk/test/rss/test_maker_itunes.rb#L250 feed_readers) _assert_maker_itunes_duration(0, 4, 5, "4:05", maker_readers, feed_readers) + _assert_maker_itunes_duration(0, 0, 5, "0:05", maker_readers, + feed_readers) + _assert_maker_itunes_duration_by_value(0, 5, 15, "315", maker_readers, + feed_readers) + _assert_maker_itunes_duration_by_value(1, 0, 1, "3601", maker_readers, + feed_readers) - _assert_maker_itunes_duration_invalid_value("5", maker_readers) _assert_maker_itunes_duration_invalid_value("09:07:14:05", maker_readers) _assert_maker_itunes_duration_invalid_value("10:5", maker_readers) _assert_maker_itunes_duration_invalid_value("10:03:5", maker_readers) _assert_maker_itunes_duration_invalid_value("10:3:05", maker_readers) _assert_maker_itunes_duration_invalid_value("xx:xx:xx", maker_readers) + + _assert_maker_itunes_duration_invalid_value("", maker_readers) end end Index: lib/rss/rss.rb =================================================================== --- lib/rss/rss.rb (revision 66919) +++ lib/rss/rss.rb (revision 66920) @@ -68,10 +68,6 @@ require_relative "converter" https://github.com/ruby/ruby/blob/trunk/lib/rss/rss.rb#L68 require_relative "xml-stylesheet" module RSS - - # The current version of RSS - VERSION = "0.2.7" - # The URI of the RSS 1.0 specification URI = "http://purl.org/rss/1.0/" Index: lib/rss/itunes.rb =================================================================== --- lib/rss/itunes.rb (revision 66919) +++ lib/rss/itunes.rb (revision 66920) @@ -277,34 +277,46 @@ module RSS https://github.com/ruby/ruby/blob/trunk/lib/rss/itunes.rb#L277 def parse(duration, do_validate=true) if do_validate and /\A(?: \d?\d:[0-5]\d:[0-5]\d| - [0-5]?\d:[0-5]\d + [0-5]?\d:[0-5]\d| + \d+ )\z/x !~ duration raise ArgumentError, - "must be one of HH:MM:SS, H:MM:SS, MM::SS, M:SS: " + + "must be one of HH:MM:SS, H:MM:SS, MM:SS, M:SS, S+: " + duration.inspect end - components = duration.split(':') - components[3..-1] = nil if components.size > 3 + if duration.include?(':') + components = duration.split(':') + components[3..-1] = nil if components.size > 3 - components.unshift("00") until components.size == 3 - - components.collect do |component| - component.to_i + components.unshift("00") until components.size == 3 + components.collect do |component| + component.to_i + end + else + seconds_to_components(duration.to_i) end end - def construct(hour, minute, second) - components = [minute, second] + def construct(hours, minutes, seconds) + components = [minutes, seconds] if components.include?(nil) nil else - components.unshift(hour) if hour and hour > 0 + components.unshift(hours) if hours and hours > 0 components.collect do |component| "%02d" % component - end.join(":") + end.join(':') end end + + private + def seconds_to_components(total_seconds) + hours = total_seconds / (60 * 60) + minutes = (total_seconds / 60) % 60 + seconds = total_seconds % 60 + [hours, minutes, seconds] + end end content_setup Index: lib/rss/version.rb =================================================================== --- lib/rss/version.rb (nonexistent) +++ lib/rss/version.rb (revision 66920) @@ -0,0 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/lib/rss/version.rb#L1 +module RSS + # The current version of RSS + VERSION = "0.2.8" +end Property changes on: lib/rss/version.rb ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Index: lib/rss/rss.gemspec =================================================================== --- lib/rss/rss.gemspec (revision 66919) +++ lib/rss/rss.gemspec (revision 66920) @@ -1,8 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/lib/rss/rss.gemspec#L1 begin - require_relative "lib/rss" + require_relative "lib/rss/version" rescue LoadError # for Ruby core repository - require_relative "rss" + require_relative "version" end Gem::Specification.new do |spec| @@ -16,18 +16,60 @@ Gem::Specification.new do |spec| https://github.com/ruby/ruby/blob/trunk/lib/rss/rss.gemspec#L16 spec.homepage = "https://github.com/ruby/rss" spec.license = "BSD-2-Clause" - spec.files = [".gitignore", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", - "bin/console", "bin/setup", "lib/rss.rb", "lib/rss/0.9.rb", "lib/rss/1.0.rb", "lib/rss/2.0.rb", - "lib/rss/atom.rb", "lib/rss/content.rb", "lib/rss/content/1.0.rb", "lib/rss/content/2.0.rb", - "lib/rss/converter.rb", "lib/rss/dublincore.rb", "lib/rss/dublincore/1.0.rb", "lib/rss/dublincore/2.0.rb", - "lib/rss/dublincore/atom.rb", "lib/rss/image.rb", "lib/rss/itunes.rb", "lib/rss/maker.rb", - "lib/rss/maker/0.9.rb", "lib/rss/maker/1.0.rb", "lib/rss/maker/2.0.rb", "lib/rss/maker/atom.rb", - "lib/rss/maker/base.rb", "lib/rss/maker/content.rb", "lib/rss/maker/dublincore.rb", "lib/rss/maker/entry.rb", - "lib/rss/maker/feed.rb", "lib/rss/maker/image.rb", "lib/rss/maker/itunes.rb", "lib/rss/maker/slash.rb", - "lib/rss/maker/syndication.rb", "lib/rss/maker/taxonomy.rb", "lib/rss/maker/trackback.rb", - "lib/rss/parser.rb", "lib/rss/rexmlparser.rb", "lib/rss/rss.rb", "lib/rss/slash.rb", "lib/rss/syndication.rb", - "lib/rss/taxonomy.rb", "lib/rss/trackback.rb", "lib/rss/utils.rb", "lib/rss/xml-stylesheet.rb", - "lib/rss/xml.rb", "lib/rss/xmlparser.rb", "lib/rss/xmlscanner.rb", "rss.gemspec"] + spec.files = [ + ".gitignore", + ".travis.yml", + "Gemfile", + "LICENSE.txt", + "NEWS.md", + "README.md", + "Rakefile", + "lib/rss.rb", + "lib/rss/0.9.rb", + "lib/rss/1.0.rb", + "lib/rss/2.0.rb", + "lib/rss/atom.rb", + "lib/rss/content.rb", + "lib/rss/content/1.0.rb", + "lib/rss/content/2.0.rb", + "lib/rss/converter.rb", + "lib/rss/dublincore.rb", + "lib/rss/dublincore/1.0.rb", + "lib/rss/dublincore/2.0.rb", + "lib/rss/dublincore/atom.rb", + "lib/rss/image.rb", + "lib/rss/itunes.rb", + "lib/rss/maker.rb", + "lib/rss/maker/0.9.rb", + "lib/rss/maker/1.0.rb", + "lib/rss/maker/2.0.rb", + "lib/rss/maker/atom.rb", + "lib/rss/maker/base.rb", + "lib/rss/maker/content.rb", + "lib/rss/maker/dublincore.rb", + "lib/rss/maker/entry.rb", + "lib/rss/maker/feed.rb", + "lib/rss/maker/image.rb", + "lib/rss/maker/itunes.rb", + "lib/rss/maker/slash.rb", + "lib/rss/maker/syndication.rb", + "lib/rss/maker/taxonomy.rb", + "lib/rss/maker/trackback.rb", + "lib/rss/parser.rb", + "lib/rss/rexmlparser.rb", + "lib/rss/rss.rb", + "lib/rss/slash.rb", + "lib/rss/syndication.rb", + "lib/rss/taxonomy.rb", + "lib/rss/trackback.rb", + "lib/rss/utils.rb", + "lib/rss/version.rb", + "lib/rss/xml-stylesheet.rb", + "lib/rss/xml.rb", + "lib/rss/xmlparser.rb", + "lib/rss/xmlscanner.rb", + "rss.gemspec", + ] spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] Index: lib/rss/maker/0.9.rb =================================================================== --- lib/rss/maker/0.9.rb (revision 66919) +++ lib/rss/maker/0.9.rb (revision 66920) @@ -278,7 +278,7 @@ module RSS https://github.com/ruby/ruby/blob/trunk/lib/rss/maker/0.9.rb#L278 vars = super if @maker.feed_version == "0.91" vars << "title" unless title {|t| t.have_required_values?} - vars << "link" unless link {|l| l.have_required_values?} + vars << "link" unless link end vars end Index: lib/rss.rb =================================================================== --- lib/rss.rb (revision 66919) +++ lib/rss.rb (revision 66920) @@ -77,6 +77,8 @@ https://github.com/ruby/ruby/blob/trunk/lib/rss.rb#L77 module RSS end +require "rss/version" + require 'rss/1.0' require 'rss/2.0' require 'rss/atom' -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/