Class: Vigil::RevisionRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/vigil/revision_repository.rb

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ RevisionRepository

Returns a new instance of RevisionRepository.



4
5
6
7
# File 'lib/vigil/revision_repository.rb', line 4

def initialize(project)
  @os = Vigil.os
  @project = project
end

Instance Method Details

#most_recent_revisionObject



13
14
15
16
17
# File 'lib/vigil/revision_repository.rb', line 13

def most_recent_revision
  id = @os.entries(@project.working_dir).select { |f| f =~ /^\d+$/ }.map {|f| f.to_i}.sort.last
  id ||= 0
  Revision.new(id, @project)
end

#newObject



9
10
11
# File 'lib/vigil/revision_repository.rb', line 9

def new
  Revision.new(most_recent_revision.id+1, @project)
end