Class: OkComputer::AppVersionCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/ok_computer/built_in_checks/app_version_check.rb

Overview

Display app version SHA

  • If ‘ENV` is set, uses that value.

  • Otherwise, checks for Capistrano’s REVISION file in the app root.

  • Failing these, the check fails

Constant Summary

Constants inherited from Check

Check::CheckNotDefined

Instance Attribute Summary

Attributes inherited from Check

#failure_occurred, #message, #registrant_name, #time

Instance Method Summary collapse

Methods inherited from Check

#<=>, #clear, #mark_failure, #mark_message, #run, #success?, #to_json, #to_text, #with_benchmarking

Instance Method Details

#checkObject

Public: Return the application version



9
10
11
12
13
14
# File 'lib/ok_computer/built_in_checks/app_version_check.rb', line 9

def check
  mark_message "Version: #{version}"
rescue UnknownRevision
  mark_failure
  mark_message "Unable to determine version"
end

#versionObject

Public: The application version

Returns a String



19
20
21
# File 'lib/ok_computer/built_in_checks/app_version_check.rb', line 19

def version
  version_from_env || version_from_file || raise(UnknownRevision)
end