Class: E20::Ops::Revision

Inherits:
Object
  • Object
show all
Defined in:
lib/e20/ops/revision.rb

Instance Method Summary collapse

Constructor Details

#initialize(root = Pathname.new(Dir.pwd)) ⇒ Revision

Returns a new instance of Revision.



7
8
9
# File 'lib/e20/ops/revision.rb', line 7

def initialize(root = Pathname.new(Dir.pwd))
  @root = root
end

Instance Method Details

#to_sObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/e20/ops/revision.rb', line 11

def to_s
  @revision ||= begin
    if revision_file.exist?
      revision_file.read.strip
    elsif revision_from_git.present?
      revision_from_git
    else
      "unknown"
    end
  end
end