lib/spontaneous/paths.rb in spontaneous-0.2.0.alpha2 vs lib/spontaneous/paths.rb in spontaneous-0.2.0.alpha3
- old
+ new
@@ -2,10 +2,14 @@
require 'pathname'
module Spontaneous
class Paths < ::Hash
+ def self.pad_revision_number(revision)
+ revision.to_s.rjust(5, "0")
+ end
+
def initialize(root)
@root = File.expand_path(root)
super()
end
@@ -13,10 +17,11 @@
self[category] = paths
end
def expanded(category)
self[category].map do |path, glob|
- path = Pathname.new(@root) + path
+ path = Pathname.new(path)
+ path = Pathname.new(@root) + path unless (path.absolute? && path.exist?)
if path.exist?
path = path.cleanpath
path += glob if glob
path.to_s
else