diff options
author | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2005-04-05 14:24:48 +0000 |
---|---|---|
committer | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2005-04-05 14:24:48 +0000 |
commit | 3417edeaabcb2e23bb0d13d984e353385d183f82 (patch) | |
tree | 3bb784f255ddefc42120e41cbe54a487c1431e00 | |
parent | 4838397390499e06c35d0bbb69f0b9d0ff15fe44 (diff) | |
download | feed2imap-3417edeaabcb2e23bb0d13d984e353385d183f82.tar.gz feed2imap-3417edeaabcb2e23bb0d13d984e353385d183f82.tar.bz2 feed2imap-3417edeaabcb2e23bb0d13d984e353385d183f82.zip |
git-svn-id: svn+ssh://svn.gna.org/svn/feed2imap/trunk/feed2imap@10 f70e237a-67f3-0310-a06c-d2b8a7116972
Diffstat (limited to '')
-rwxr-xr-x | bin/feed2imap | 2 | ||||
-rw-r--r-- | lib/feed2imap/config.rb | 3 | ||||
-rw-r--r-- | lib/feed2imap/feed2imap.rb | 5 |
3 files changed, 8 insertions, 2 deletions
diff --git a/bin/feed2imap b/bin/feed2imap index e0a668f..06a6853 100755 --- a/bin/feed2imap +++ b/bin/feed2imap @@ -1,4 +1,4 @@ -#!/usr/bin/ruby -w +#!/usr/bin/ruby $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') diff --git a/lib/feed2imap/config.rb b/lib/feed2imap/config.rb index 8129fd2..002db3e 100644 --- a/lib/feed2imap/config.rb +++ b/lib/feed2imap/config.rb @@ -26,13 +26,14 @@ DEFCACHE = ENV['HOME'] + '/.feed2imap.cache' # Feed2imap configuration class F2IConfig - attr_reader :imap_accounts, :cache, :feeds + attr_reader :imap_accounts, :cache, :feeds, :dumpdir # Load the configuration from the IO stream # TODO should do some sanity check on the data read. def initialize(io) @conf = YAML::load(io) @cache = @conf['cache'] || DEFCACHE + @dumpdir = @conf['dumpdir'] || nil @conf['feeds'] ||= [] @feeds = [] @imap_accounts = ImapAccounts::new diff --git a/lib/feed2imap/feed2imap.rb b/lib/feed2imap/feed2imap.rb index a9a2c59..92cab8f 100644 --- a/lib/feed2imap/feed2imap.rb +++ b/lib/feed2imap/feed2imap.rb @@ -81,6 +81,11 @@ class Feed2Imap end begin body = HTTPFetcher::fetch(f.url, @cache.get_last_check(f.name)) + # dump if requested + if @config.dumpdir + fname = @config.dumpdir + '/' + f.name + '-' + Time::now.xmlschema + File::open(fname, 'w') { |file| file.puts body } + end rescue Timeout::Error @logger.fatal("Timeout::Error while fetching #{f.url}: #{$!}") next |