Class: Airbrake::Filters::GitLastCheckoutFilter Private
- Inherits:
-
Object
- Object
- Airbrake::Filters::GitLastCheckoutFilter
- Includes:
- Loggable
- Defined in:
- lib/airbrake-ruby/filters/git_last_checkout_filter.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Attaches git checkout info to ‘context`. The info includes:
* username
* email
* revision
* time
This information is used to track deploys automatically.
Constant Summary collapse
- MIN_HEAD_COLS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Returns least possible amount of columns in git’s ‘logs/HEAD` file (checkout information is omitted).
6
Instance Attribute Summary collapse
- #weight ⇒ Integer readonly private
Instance Method Summary collapse
-
#call(notice) ⇒ void
private
This is a mandatory method required by any filter integrated with FilterChain.
-
#initialize(root_directory) ⇒ GitLastCheckoutFilter
constructor
private
A new instance of GitLastCheckoutFilter.
Methods included from Loggable
Constructor Details
#initialize(root_directory) ⇒ GitLastCheckoutFilter
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of GitLastCheckoutFilter.
26 27 28 29 30 31 |
# File 'lib/airbrake-ruby/filters/git_last_checkout_filter.rb', line 26 def initialize(root_directory) @git_path = File.join(root_directory, '.git') @weight = 116 @last_checkout = nil @deploy_username = ENV.fetch('AIRBRAKE_DEPLOY_USERNAME', nil) end |
Instance Attribute Details
#weight ⇒ Integer (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/airbrake-ruby/filters/git_last_checkout_filter.rb', line 17 def weight @weight end |
Instance Method Details
#call(notice) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
This is a mandatory method required by any filter integrated with FilterChain.
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/airbrake-ruby/filters/git_last_checkout_filter.rb', line 34 def call(notice) return if notice[:context].key?(:lastCheckout) if @last_checkout notice[:context][:lastCheckout] = @last_checkout return end return unless File.exist?(@git_path) return unless (checkout = last_checkout) notice[:context][:lastCheckout] = checkout end |