Skip to content

Commit

Permalink
fix: correctly replace cdata node in hpricot
Browse files Browse the repository at this point in the history
improve: if user has error include appengine gems, do not import appengine agent
  • Loading branch information
siuying committed Jun 7, 2009
1 parent 7756cff commit 5363848
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -8,7 +8,7 @@ require "rake/gempackagetask"

NAME = "fullfeed"
SUMMARY = "Fullfeed RSS creator"
GEM_VERSION = "0.3"
GEM_VERSION = "0.3.1"

spec = Gem::Specification.new do |s|
s.name = NAME
Expand Down
2 changes: 1 addition & 1 deletion fullfeed.gemspec
@@ -1,6 +1,6 @@
NAME = "fullfeed"
SUMMARY = "Fullfeed RSS creator"
GEM_VERSION = "0.3.0"
GEM_VERSION = "0.3.1"

Gem::Specification.new do |s|
s.name = NAME
Expand Down
1 change: 1 addition & 0 deletions lib/fullfeed/agent.rb
Expand Up @@ -16,4 +16,5 @@
gem('appengine-apis')
require "#{File.dirname(__FILE__)}/agent/appengine_agent"
rescue Gem::LoadError
rescue NameError
end
11 changes: 6 additions & 5 deletions lib/fullfeed/feed.rb
Expand Up @@ -65,11 +65,12 @@ def process_item(item)
if link && desc
begin
@logger.debug " Extract item (#{guid}) link: #{link}"
desc.inner_html = extract_cached(guid, link)
desc.children.first.content = extract_cached(guid, link)

rescue StandardError => e
@logger.error "Error fetching content: #{e.inspect}"
end
@logger.error "Error fetching/replacing content: #{e.inspect}"

end
else
@logger.warn "No link or desc node found in item: #{item}"

Expand Down Expand Up @@ -105,9 +106,9 @@ def extract(link)

def to_utf8(text)
if @encoding == "UTF-8"
text
return text
else
Iconv.conv("UTF-8", @encoding, text)
return Iconv.conv("UTF-8", @encoding, text)
end
end
end
Expand Down
21 changes: 21 additions & 0 deletions test/test_db_store.rb
@@ -0,0 +1,21 @@
#!/usr/bin/env ruby

require 'test/unit'
require "#{File.dirname(__FILE__)}/../lib/fullfeed"
require 'load_files'

class TestDbStore < Test::Unit::TestCase
Fullfeed::Store::DbStore.setup("sqlite3:ynews.sqlite3")

def test_store
store = Fullfeed::Store::StoreFactory.store('http://test', 100, :db)

value = rand().to_s
store['/100'] = value
assert_equal store['/100'], value

value = "中文測試"
store['/200'] = value
assert_equal store['/200'], value
end
end

0 comments on commit 5363848

Please sign in to comment.