Class: Rack::ECG::Check::GitRevision Deprecated

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/ecg/check/git_revision.rb

Overview

Deprecated.

This check requires the presence of the git executable, and executes it every time to determine the current revision. Consider checking the revision at initialization time, and returning it via a Static check instead.

Instance Method Summary collapse

Constructor Details

#initializeObject

Returns the SHA1 of the current commit, as reported by the git executable.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rack/ecg/check/git_revision.rb', line 13

class GitRevision
  def result
    _stdin, stdout, stderr, wait_thread = Open3.popen3("git rev-parse HEAD")

    success = wait_thread.value.success?

    status = success ? Status::OK : Status::ERROR

    value = success ? stdout.read : stderr.read
    value = value.strip

    Result.new(:git_revision, status, value)
  end
end

Instance Method Details

#resultObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rack/ecg/check/git_revision.rb', line 14

def result
  _stdin, stdout, stderr, wait_thread = Open3.popen3("git rev-parse HEAD")

  success = wait_thread.value.success?

  status = success ? Status::OK : Status::ERROR

  value = success ? stdout.read : stderr.read
  value = value.strip

  Result.new(:git_revision, status, value)
end