Class: Deployed::RepoData

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

Instance Method Summary collapse

Instance Method Details

#branchObject


15
16
17
# File 'lib/deployed_version.rb', line 15

def branch
  @branch ||= git_branch || read_file('BRANCH').strip.presence
end

#extraObject


43
44
45
# File 'lib/deployed_version.rb', line 43

def extra
  @extra ||= version(:extra)
end

#labelObject


31
32
33
# File 'lib/deployed_version.rb', line 31

def label
  tag.presence || branch
end

#majorObject


35
36
37
# File 'lib/deployed_version.rb', line 35

def major
  @major ||= version(:major)
end

#minorObject


39
40
41
# File 'lib/deployed_version.rb', line 39

def minor
  @minor ||= version(:minor)
end

#releaseObject


19
20
21
# File 'lib/deployed_version.rb', line 19

def release
  @release ||= read_file('RELEASE').strip
end

#release_urlObject


23
24
25
# File 'lib/deployed_version.rb', line 23

def release_url
  @release_url ||= read_file('REPO').strip
end

#revisionObject


11
12
13
# File 'lib/deployed_version.rb', line 11

def revision
  @revision ||= git_rev || read_file('REVISION').strip.presence
end

#revision_shortObject


27
28
29
# File 'lib/deployed_version.rb', line 27

def revision_short
  @revision_short ||= revision.slice 0..6
end

#tagObject


7
8
9
# File 'lib/deployed_version.rb', line 7

def tag
  @tag ||= git_tag || read_file('TAG').strip.presence
end

#version_hashObject


47
48
49
# File 'lib/deployed_version.rb', line 47

def version_hash
  @version_hash ||= /\Arelease-(?<major>\d+)\.(?<minor>\d+)\.?(?<extra>\S*)\z/.match(label)
end

#version_labelObject


51
52
53
54
55
56
57
# File 'lib/deployed_version.rb', line 51

def version_label
  if major == 0 && minor == 0 && extra == 0
    'WIP'
  else
    "#{major}.#{minor}.#{extra}"
  end
end