lib/spontaneous/revision.rb in spontaneous-0.2.0.beta5 vs lib/spontaneous/revision.rb in spontaneous-0.2.0.beta6
- old
+ new
@@ -1,34 +1,29 @@
require 'pathname'
module Spontaneous
class Revision
- attr_reader :revision
+ attr_reader :revision, :site
- def initialize(revision)
+ def initialize(revision, site)
@revision = revision.to_i
+ @site = site
end
def root
- ::File.join(Spontaneous::Site.instance.revision_root, padded_revision)
+ ::File.join(site.revision_root, padded_revision)
end
def path(*path)
path = path.flatten
Pathname.new(File.join(root, *path.map(&:to_s)))
end
def padded_revision
- Spontaneous::Paths.pad_revision_number(revision)
+ revision.to_s.rjust(5, "0")
end
def to_i
@revision
- end
-
- module GlobalMethods
- def revision(revision)
- Revision.new(revision)
- end
end
end
end