aboutsummaryrefslogtreecommitdiff
path: root/lib
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
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')
-rw-r--r--lib/gorg/base.rb4
-rw-r--r--lib/gorg/cache.rb14
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/gorg/base.rb b/lib/gorg/base.rb
index c3851a9..44dab99 100644
--- a/lib/gorg/base.rb
+++ b/lib/gorg/base.rb
@@ -89,7 +89,7 @@ module Gorg
}
else
# Scan xml for stylesheet names
- path.each { |line| styles << $1 if regexp.match(line) }
+ path.each_line { |line| styles << $1 if regexp.match(line) }
end
# Use default stylesheet if none were found in the doc
styles << $Config["defaultXSL"] if styles.length == 0
@@ -338,7 +338,7 @@ module Gorg
private
def parseConfig(h, config)
- config.each {|line|
+ config.each_line {|line|
line.strip!
next if line.length == 0 or line[0,1] == '#' # Skip blank lines and comments
raise "Invalid Configuration (#{line})" unless line =~ /^([a-zA-Z_]*)\s*=\s*/
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