class Honeybadger::Util::Revision
Public Class Methods
detect(root = Dir.pwd)
click to toggle source
# File lib/honeybadger/util/revision.rb, line 5 def detect(root = Dir.pwd) from_heroku || from_capistrano(root) || from_git end
Private Class Methods
from_capistrano(root)
click to toggle source
# File lib/honeybadger/util/revision.rb, line 21 def from_capistrano(root) file = File.join(root, 'REVISION') return nil unless File.file?(file) File.read(file).strip rescue nil end
from_git()
click to toggle source
# File lib/honeybadger/util/revision.rb, line 27 def from_git return nil unless File.directory?('.git') `git rev-parse HEAD 2> #{File::NULL}`.strip rescue nil end
from_heroku()
click to toggle source
Requires (currently) alpha platform feature `heroku labs:enable runtime-dyno-metadata`
See devcenter.heroku.com/articles/dyno-metadata
# File lib/honeybadger/util/revision.rb, line 17 def from_heroku ENV['HEROKU_SLUG_COMMIT'] end