Permalink
Browse files

0.6

  • Loading branch information...
1 parent 819c50c commit a9f3bcc7fe59a168a104278524fa09fa82192528 @damog committed Mar 6, 2010
Showing with 67 additions and 34 deletions.
  1. +6 −0 ChangeLog
  2. +28 −0 bin/feedbag
  3. +6 −3 feedbag.gemspec
  4. +27 −31 lib/feedbag.rb
View
@@ -1,3 +1,9 @@
+* 0.6 - Fri Mar 5 20:10:33 EST 2010
+ - Added bin/feedbag.
+ - Removed the args[:narrow] option, not really needed.
+ - Handle case where feed URLs contain GET parameters; add tests
+ by Patrick Reagan <patrick.reagan@viget.com>.
@reagent

reagent Mar 11, 2010

Contributor

Just noticed that you had pulled my changes - thanks!

+
* 0.5.99 - Tue May 12 12:52:22 EDT 2009
- Added rails/init.rb to load easily on a Rails app.
View
@@ -0,0 +1,28 @@
+#!/usr/bin/env ruby
+
+require "rubygems"
+require "feedbag"
+
+def usage
+ %Q{
+ #{$0} <url 1> [<url 2> <url 3> ... <url n>]
+ }
+end
+
+if ARGV.empty?
+ puts usage
+ exit 1
+end
+
+ARGV.each do |url|
+ puts "== #{url}:"
+ feeds = Feedbag.find url
+ if feeds.empty?
+ puts " no feeds found!"
+ else
+ feeds.each do |f|
+ puts " - #{f}"
+ end
+ end
+end
+
View
@@ -2,19 +2,22 @@
Gem::Specification.new do |s|
s.name = %q{feedbag}
- s.version = "0.5.100"
+ s.version = "0.6"
s.homepage = "http://axiombox.com/feedbag"
s.rubyforge_project = "feedbag"
s.authors = ["Axiombox", "David Moreno"]
- s.date = %q{2009-02-10}
+ s.date = %q{2010-03-05}
s.description = %q{Ruby's favorite feed auto-discoverty tool}
s.email = %q{david@axiombox.com}
s.extra_rdoc_files = ["README.markdown", "COPYING"]
- s.files = ["lib/feedbag.rb", "benchmark/rfeedfinder_benchmark.rb"]
+ s.files = ["lib/feedbag.rb", "benchmark/rfeedfinder_benchmark.rb", "bin/feedbag"]
s.has_rdoc = true
s.rdoc_options = ["--main", "README.markdown"]
s.summary = %q{Ruby's favorite feed auto-discovery tool}
s.add_dependency("hpricot", '>= 0.6')
+ s.bindir = 'bin'
+ s.default_executable = %q{feedbag}
+ s.executables = ["feedbag"]
end
View
@@ -67,22 +67,20 @@ def self.find(url, args = {})
#url = "#{url_uri.scheme or 'http'}://#{url_uri.host}#{url_uri.path}"
# check if feed_valid is avail
- unless args[:narrow]
- begin
- require "feed_validator"
- v = W3C::FeedValidator.new
- v.validate_url(url)
- return self.add_feed(url, nil) if v.valid?
- rescue LoadError
- # scoo
- rescue REXML::ParseException
- # usually indicates timeout
- # TODO: actually find out timeout. use Terminator?
- $stderr.puts "Feed looked like feed but might not have passed validation or timed out"
- rescue => ex
- $stderr.puts "#{ex.class} error ocurred with: `#{url}': #{ex.message}"
- end
- end
+ begin
+ require "feed_validator"
+ v = W3C::FeedValidator.new
+ v.validate_url(url)
+ return self.add_feed(url, nil) if v.valid?
+ rescue LoadError
+ # scoo
+ rescue REXML::ParseException
+ # usually indicates timeout
+ # TODO: actually find out timeout. use Terminator?
+ # $stderr.puts "Feed looked like feed but might not have passed validation or timed out"
+ rescue => ex
+ $stderr.puts "#{ex.class} error ocurred with: `#{url}': #{ex.message}"
+ end
begin
html = open(url) do |f|
@@ -110,21 +108,19 @@ def self.find(url, args = {})
end
end
- unless args[:narrow]
- (doc/"a").each do |a|
- next unless a["href"]
- if self.looks_like_feed?(a["href"]) and (a["href"] =~ /\// or a["href"] =~ /#{url_uri.host}/)
- self.add_feed(a["href"], url, $base_uri)
- end
- end
-
- (doc/"a").each do |a|
- next unless a["href"]
- if self.looks_like_feed?(a["href"])
- self.add_feed(a["href"], url, $base_uri)
- end
- end
- end
+ (doc/"a").each do |a|
+ next unless a["href"]
+ if self.looks_like_feed?(a["href"]) and (a["href"] =~ /\// or a["href"] =~ /#{url_uri.host}/)
+ self.add_feed(a["href"], url, $base_uri)
+ end
+ end
+
+ (doc/"a").each do |a|
+ next unless a["href"]
+ if self.looks_like_feed?(a["href"])
+ self.add_feed(a["href"], url, $base_uri)
+ end
+ end
end
rescue Timeout::Error => err

0 comments on commit a9f3bcc

Please sign in to comment.