Sha256: 8fe3784da7bd4dc0c3d6ff01822c7adec403996a2b18c3ff7a15130193dba566
Contents?: true
Size: 938 Bytes
Versions: 2
Compression:
Stored size: 938 Bytes
Contents
# frozen_string_literal: true module Rack class ECG module Check # @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. # # @!method initialize # Returns the SHA1 of the current commit, as reported by the git # executable. 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 CheckRegistry.instance.register(:git_revision, GitRevision) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rack-ecg-0.3.0 | lib/rack/ecg/check/git_revision.rb |
rack-ecg-0.2.0 | lib/rack/ecg/check/git_revision.rb |