diff options
author | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2007-10-03 18:59:31 +0000 |
---|---|---|
committer | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2007-10-03 18:59:31 +0000 |
commit | c4e74094779d0b0b231bb0a38dc4b8bd608792d9 (patch) | |
tree | b21e1ed269dd6c5e3e440640a8003dbb42cacf2b /lib/feed2imap | |
parent | cedab3030800afe93ca5efdacc75706af2957847 (diff) | |
download | feed2imap-c4e74094779d0b0b231bb0a38dc4b8bd608792d9.tar.gz feed2imap-c4e74094779d0b0b231bb0a38dc4b8bd608792d9.tar.bz2 feed2imap-c4e74094779d0b0b231bb0a38dc4b8bd608792d9.zip |
updated version ; write new cache to temp file then rename
git-svn-id: svn+ssh://svn.gna.org/svn/feed2imap/trunk/feed2imap@133 f70e237a-67f3-0310-a06c-d2b8a7116972
Diffstat (limited to '')
-rw-r--r-- | lib/feed2imap/feed2imap.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/feed2imap/feed2imap.rb b/lib/feed2imap/feed2imap.rb index 061e8c6..08ceb4f 100644 --- a/lib/feed2imap/feed2imap.rb +++ b/lib/feed2imap/feed2imap.rb @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA =end # Feed2Imap version -F2I_VERSION = '0.9' +F2I_VERSION = '0.9.2' require 'feed2imap/config' require 'feed2imap/cache' @@ -244,9 +244,14 @@ class Feed2Imap end @logger.info("Finished. Saving cache ...") begin - File::open(@config.cache, 'w') { |f| @cache.save(f) } + File::open("#{@config.cache}.new", 'w') { |f| @cache.save(f) } rescue - @logger.fatal("Exception caught while writing cache to #{@config.cache}: #{$!}") + @logger.fatal("Exception caught while writing new cache to #{@config.cache}.new: #{$!}") + end + begin + File::rename("#{@config.cache}.new", @config.cache) + rescue + @logger.fatal("Exception caught while renaming #{@config.cache}.new to #{@config.cache}: #{$!}") end @logger.info("Closing IMAP connections ...") @config.imap_accounts.each_value do |ac| |