rss 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4c9e9539fc75445348d13247c59875480824315e591a4158caf8938438bee34
4
- data.tar.gz: 4b923e608e3079bd8bffe3c5c8dcc5ad347a5bb1e53808ac0f74a0db0177a36e
3
+ metadata.gz: 0661103c506f9158deefa370289f1f197422d06b500b92319e63d953d8243842
4
+ data.tar.gz: f855b9669a566ac469b85820a5bbe2ff6d60be14e72040096d997057c653e596
5
5
  SHA512:
6
- metadata.gz: 1734f6dc142b58b73635d354bf78fe9273b7252c2f5fa8bc49859ead33ba27c520009c2d85985ef2f730ff83963f3e06a556a304d3d25adacca139b0c8aa1068
7
- data.tar.gz: daaff41773cd97a209eff268b587a38191b824eb130005d5a740431279a8828a0cf57157c24cdecd8d6c01032e2271941cc5151559f6cca08352b3e7f40d8a48
6
+ metadata.gz: cd38d5deb4396141f6e8a7e384cea8c3af86d7a54c42dc1e8f20d8447129c2e1f12a5fcb169d836353687ab16b6838999618f760b09f8d46246b17442977889e
7
+ data.tar.gz: 4cfaf4d6c6794344edee289fe73a0cc810e8a9ffe95c47f845f47a883c14dcb7ae64cdf6d4ce0a3e89bd1aa96ba8440958a4cb8294a78c648886d3e91e41a857
@@ -1,6 +1,26 @@
1
- sudo: false
1
+ notifications:
2
+ webhooks:
3
+ - https://webhook.commit-email.info/
4
+
2
5
  language: ruby
3
- rvm:
4
- - 2.5.1
5
- - ruby-head
6
- before_install: gem install bundler -v 1.16.2
6
+ matrix:
7
+ include:
8
+ - name: "2.3"
9
+ rvm: 2.3
10
+ - name: "2.4"
11
+ rvm: 2.4.5
12
+ - name: "2.5"
13
+ rvm: 2.5.3
14
+ - name: "2.6"
15
+ rvm: 2.6
16
+ - name: "trunk"
17
+ rvm: ruby-head
18
+ - name: "gem"
19
+ rvm: 2.6
20
+ install:
21
+ - rake install
22
+ script:
23
+ - mkdir -p tmp
24
+ - cd tmp
25
+ - cp -a ../test/ ./
26
+ - ../run-test.rb
data/NEWS.md ADDED
@@ -0,0 +1,17 @@
1
+ # News
2
+
3
+ ## 0.2.8 - 2019-01-24
4
+
5
+ ### Improvements
6
+
7
+ * Stopped passing needless blocks.
8
+
9
+ * Added support for seconds only `<itunes:duration>`.
10
+ [GitHub#4][Reported by Jarvis Johnson]
11
+ [GitHub#5][Patch by Aitor García Rey]
12
+
13
+ ### Thanks
14
+
15
+ * Jarvis Johnson
16
+
17
+ * Aitor García Rey
data/README.md CHANGED
@@ -75,9 +75,9 @@ As you can see, this is a very Builder-like DSL. This code will spit out an Atom
75
75
 
76
76
  ## Development
77
77
 
78
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
78
+ After checking out the repo, run `rake test` to run the tests.
79
79
 
80
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
80
+ To install this gem onto your local machine, run `rake install`. To release a new version, update the version number in `lib/rss/version.rb`, and then run `rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
81
81
 
82
82
  ## Contributing
83
83
 
data/Rakefile CHANGED
@@ -1,10 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
- require "rake/testtask"
3
2
 
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/test_*.rb"]
3
+ desc "Run test"
4
+ task :test do
5
+ ruby("run-test.rb")
8
6
  end
9
7
 
10
8
  task :default => :test
data/lib/rss.rb CHANGED
@@ -77,6 +77,8 @@
77
77
  module RSS
78
78
  end
79
79
 
80
+ require "rss/version"
81
+
80
82
  require 'rss/1.0'
81
83
  require 'rss/2.0'
82
84
  require 'rss/atom'
@@ -277,34 +277,46 @@ module RSS
277
277
  def parse(duration, do_validate=true)
278
278
  if do_validate and /\A(?:
279
279
  \d?\d:[0-5]\d:[0-5]\d|
280
- [0-5]?\d:[0-5]\d
280
+ [0-5]?\d:[0-5]\d|
281
+ \d+
281
282
  )\z/x !~ duration
282
283
  raise ArgumentError,
283
- "must be one of HH:MM:SS, H:MM:SS, MM::SS, M:SS: " +
284
+ "must be one of HH:MM:SS, H:MM:SS, MM:SS, M:SS, S+: " +
284
285
  duration.inspect
285
286
  end
286
287
 
287
- components = duration.split(':')
288
- components[3..-1] = nil if components.size > 3
288
+ if duration.include?(':')
289
+ components = duration.split(':')
290
+ components[3..-1] = nil if components.size > 3
289
291
 
290
- components.unshift("00") until components.size == 3
291
-
292
- components.collect do |component|
293
- component.to_i
292
+ components.unshift("00") until components.size == 3
293
+ components.collect do |component|
294
+ component.to_i
295
+ end
296
+ else
297
+ seconds_to_components(duration.to_i)
294
298
  end
295
299
  end
296
300
 
297
- def construct(hour, minute, second)
298
- components = [minute, second]
301
+ def construct(hours, minutes, seconds)
302
+ components = [minutes, seconds]
299
303
  if components.include?(nil)
300
304
  nil
301
305
  else
302
- components.unshift(hour) if hour and hour > 0
306
+ components.unshift(hours) if hours and hours > 0
303
307
  components.collect do |component|
304
308
  "%02d" % component
305
- end.join(":")
309
+ end.join(':')
306
310
  end
307
311
  end
312
+
313
+ private
314
+ def seconds_to_components(total_seconds)
315
+ hours = total_seconds / (60 * 60)
316
+ minutes = (total_seconds / 60) % 60
317
+ seconds = total_seconds % 60
318
+ [hours, minutes, seconds]
319
+ end
308
320
  end
309
321
 
310
322
  content_setup
@@ -278,7 +278,7 @@ module RSS
278
278
  vars = super
279
279
  if @maker.feed_version == "0.91"
280
280
  vars << "title" unless title {|t| t.have_required_values?}
281
- vars << "link" unless link {|l| l.have_required_values?}
281
+ vars << "link" unless link
282
282
  end
283
283
  vars
284
284
  end
@@ -68,10 +68,6 @@ require_relative "converter"
68
68
  require_relative "xml-stylesheet"
69
69
 
70
70
  module RSS
71
-
72
- # The current version of RSS
73
- VERSION = "0.2.7"
74
-
75
71
  # The URI of the RSS 1.0 specification
76
72
  URI = "http://purl.org/rss/1.0/"
77
73
 
@@ -0,0 +1,4 @@
1
+ module RSS
2
+ # The current version of RSS
3
+ VERSION = "0.2.8"
4
+ end
@@ -1,8 +1,8 @@
1
1
  begin
2
- require_relative "lib/rss"
2
+ require_relative "lib/rss/version"
3
3
  rescue LoadError
4
4
  # for Ruby core repository
5
- require_relative "rss"
5
+ require_relative "version"
6
6
  end
7
7
 
8
8
  Gem::Specification.new do |spec|
@@ -16,18 +16,60 @@ Gem::Specification.new do |spec|
16
16
  spec.homepage = "https://github.com/ruby/rss"
17
17
  spec.license = "BSD-2-Clause"
18
18
 
19
- spec.files = [".gitignore", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile",
20
- "bin/console", "bin/setup", "lib/rss.rb", "lib/rss/0.9.rb", "lib/rss/1.0.rb", "lib/rss/2.0.rb",
21
- "lib/rss/atom.rb", "lib/rss/content.rb", "lib/rss/content/1.0.rb", "lib/rss/content/2.0.rb",
22
- "lib/rss/converter.rb", "lib/rss/dublincore.rb", "lib/rss/dublincore/1.0.rb", "lib/rss/dublincore/2.0.rb",
23
- "lib/rss/dublincore/atom.rb", "lib/rss/image.rb", "lib/rss/itunes.rb", "lib/rss/maker.rb",
24
- "lib/rss/maker/0.9.rb", "lib/rss/maker/1.0.rb", "lib/rss/maker/2.0.rb", "lib/rss/maker/atom.rb",
25
- "lib/rss/maker/base.rb", "lib/rss/maker/content.rb", "lib/rss/maker/dublincore.rb", "lib/rss/maker/entry.rb",
26
- "lib/rss/maker/feed.rb", "lib/rss/maker/image.rb", "lib/rss/maker/itunes.rb", "lib/rss/maker/slash.rb",
27
- "lib/rss/maker/syndication.rb", "lib/rss/maker/taxonomy.rb", "lib/rss/maker/trackback.rb",
28
- "lib/rss/parser.rb", "lib/rss/rexmlparser.rb", "lib/rss/rss.rb", "lib/rss/slash.rb", "lib/rss/syndication.rb",
29
- "lib/rss/taxonomy.rb", "lib/rss/trackback.rb", "lib/rss/utils.rb", "lib/rss/xml-stylesheet.rb",
30
- "lib/rss/xml.rb", "lib/rss/xmlparser.rb", "lib/rss/xmlscanner.rb", "rss.gemspec"]
19
+ spec.files = [
20
+ ".gitignore",
21
+ ".travis.yml",
22
+ "Gemfile",
23
+ "LICENSE.txt",
24
+ "NEWS.md",
25
+ "README.md",
26
+ "Rakefile",
27
+ "lib/rss.rb",
28
+ "lib/rss/0.9.rb",
29
+ "lib/rss/1.0.rb",
30
+ "lib/rss/2.0.rb",
31
+ "lib/rss/atom.rb",
32
+ "lib/rss/content.rb",
33
+ "lib/rss/content/1.0.rb",
34
+ "lib/rss/content/2.0.rb",
35
+ "lib/rss/converter.rb",
36
+ "lib/rss/dublincore.rb",
37
+ "lib/rss/dublincore/1.0.rb",
38
+ "lib/rss/dublincore/2.0.rb",
39
+ "lib/rss/dublincore/atom.rb",
40
+ "lib/rss/image.rb",
41
+ "lib/rss/itunes.rb",
42
+ "lib/rss/maker.rb",
43
+ "lib/rss/maker/0.9.rb",
44
+ "lib/rss/maker/1.0.rb",
45
+ "lib/rss/maker/2.0.rb",
46
+ "lib/rss/maker/atom.rb",
47
+ "lib/rss/maker/base.rb",
48
+ "lib/rss/maker/content.rb",
49
+ "lib/rss/maker/dublincore.rb",
50
+ "lib/rss/maker/entry.rb",
51
+ "lib/rss/maker/feed.rb",
52
+ "lib/rss/maker/image.rb",
53
+ "lib/rss/maker/itunes.rb",
54
+ "lib/rss/maker/slash.rb",
55
+ "lib/rss/maker/syndication.rb",
56
+ "lib/rss/maker/taxonomy.rb",
57
+ "lib/rss/maker/trackback.rb",
58
+ "lib/rss/parser.rb",
59
+ "lib/rss/rexmlparser.rb",
60
+ "lib/rss/rss.rb",
61
+ "lib/rss/slash.rb",
62
+ "lib/rss/syndication.rb",
63
+ "lib/rss/taxonomy.rb",
64
+ "lib/rss/trackback.rb",
65
+ "lib/rss/utils.rb",
66
+ "lib/rss/version.rb",
67
+ "lib/rss/xml-stylesheet.rb",
68
+ "lib/rss/xml.rb",
69
+ "lib/rss/xmlparser.rb",
70
+ "lib/rss/xmlscanner.rb",
71
+ "rss.gemspec",
72
+ ]
31
73
  spec.bindir = "exe"
32
74
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
75
  spec.require_paths = ["lib"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-04 00:00:00.000000000 Z
11
+ date: 2019-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -63,10 +63,9 @@ files:
63
63
  - ".travis.yml"
64
64
  - Gemfile
65
65
  - LICENSE.txt
66
+ - NEWS.md
66
67
  - README.md
67
68
  - Rakefile
68
- - bin/console
69
- - bin/setup
70
69
  - lib/rss.rb
71
70
  - lib/rss/0.9.rb
72
71
  - lib/rss/1.0.rb
@@ -106,6 +105,7 @@ files:
106
105
  - lib/rss/taxonomy.rb
107
106
  - lib/rss/trackback.rb
108
107
  - lib/rss/utils.rb
108
+ - lib/rss/version.rb
109
109
  - lib/rss/xml-stylesheet.rb
110
110
  - lib/rss/xml.rb
111
111
  - lib/rss/xmlparser.rb
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "rss"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here