aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Graaff <hans@degraaff.org>2012-10-26 13:28:54 +0200
committerHans de Graaff <hans@degraaff.org>2012-10-26 13:28:54 +0200
commitcdae5ef475bfadf44a3759030aef2778cb471ef4 (patch)
tree2ba0784f171764227c22efb494ff4db73f0b7fbf /lib/gorg/cache.rb
parentImport distributed 0.6.4 release. (diff)
downloadgorg-cdae5ef475bfadf44a3759030aef2778cb471ef4.tar.gz
gorg-cdae5ef475bfadf44a3759030aef2778cb471ef4.tar.bz2
gorg-cdae5ef475bfadf44a3759030aef2778cb471ef4.zip
Fixes for Ruby 1.9.
Collected from the Gentoo patches for gorg 0.6.4 and patch provided in https://bugs.gentoo.org/show_bug.cgi?id=395121 by Tomoh K.
Diffstat (limited to 'lib/gorg/cache.rb')
-rw-r--r--lib/gorg/cache.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/gorg/cache.rb b/lib/gorg/cache.rb
index 543b6a2..3229e35 100644
--- a/lib/gorg/cache.rb
+++ b/lib/gorg/cache.rb
@@ -22,7 +22,13 @@
# . a list of parameters as received by a webserver e.g.
# . a list of files it depends on
-require "parsedate"
+begin
+ require "parsedate"
+ $haveparsedate = true
+rescue LoadError
+ require "time"
+ $haveparsedate = false
+end
require "fileutils"
require "find"
require "digest"
@@ -106,7 +112,11 @@ module Cache
fst = File.stat(f)
raise "Size of #{f} has changed from #{fst.size} to #{s.to_i}" unless fst.size == s.to_i
- raise "Timestamp of #{f} has changed" unless Time.utc(*ParseDate.parsedate(d)) == fst.mtime.utc
+ if $haveparsedate
+ raise "Timestamp of #{f} has changed" unless Time.utc(*ParseDate.parsedate(d)) == fst.mtime.utc
+ else
+ raise "Timestamp of #{f} has changed" unless Time.parse(d) == fst.mtime.utc
+ end
end
mline = meta.shift
end