diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gorg/base.rb | 4 | ||||
-rw-r--r-- | lib/gorg/cache.rb | 14 |
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 |