Method: Oxidized::Output::GitCrypt#version

Defined in:
lib/oxidized/output/gitcrypt.rb

#version(node, group) ⇒ Object

give a hash of all oid revision for the given node, and the date of the commit



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/oxidized/output/gitcrypt.rb', line 107

def version(node, group)
  repo, path = yield_repo_and_path(node, group)

  repo = Git.open repo
  unlock repo
  walker = repo.log.path(path)
  i = -1
  tab = []
  walker.each do |commit|
    hash = {}
    # We keep :date for reverse compatibility on oxidized-web <= 0.15.1
    hash[:date] = commit.date.to_s
    # date as a Time instance for more flexibility in oxidized-web
    hash[:time] = commit.date
    hash[:oid] = commit.objectish
    hash[:author] = commit.author
    hash[:message] = commit.message
    tab[i += 1] = hash
  end
  walker.reset
  tab
rescue StandardError
  'node not found'
end