airbrake-ruby 3.2.3 → 3.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 540800f5ffc99b82886e6a5055526369ae337bdd
4
- data.tar.gz: 984d90b0ae217f25ecfb05ac23dabb5153a306dc
3
+ metadata.gz: f0151a765b95213dc4a221547aa4afd2cf7da6c0
4
+ data.tar.gz: b13483675acade75535356f679099873ed234888
5
5
  SHA512:
6
- metadata.gz: 0b3cebc4c58fac5589425fde6bf4c74e0ded6dc4d19ce89ddc38463e9a569fbf30ece2215c0eb071b4ba08109c02c4cf1d0f707b01eeca4b4279946b29820731
7
- data.tar.gz: b988834c61b2562b94e39ccea3b0443ac42faadcfae129d40ec33867edf184f6fd3fa02b332dc7693fb57c5c657002dc4d136b1a4f996d464d458b3d47c13a60
6
+ metadata.gz: fe9e46d9281e883be340f1648160989c4e8683c52e7dfec8652ba0403d625d70d2d23874134c2fc6000b0a3d8730dfeb01778832e1cd763999278883ad13c115
7
+ data.tar.gz: 39a05948f1e8176e7862cda8a02d669a9f2f46e078f1aca1901167814192e1ea1ad62f6b0b81df802f8a2b5686fc6ac6f0295b52daa2a121ddaf8d48eb79fc42
@@ -206,7 +206,7 @@ module Airbrake
206
206
  def route_stats=(value)
207
207
  logger.warn(
208
208
  "#{LOG_LABEL} the 'route_stats' option is deprecated. " \
209
- "Use 'performance_stats_flush_period' instead"
209
+ "Use 'performance_stats' instead"
210
210
  )
211
211
  @performance_stats = value
212
212
  end
@@ -11,20 +11,24 @@ module Airbrake
11
11
  def initialize(root_directory)
12
12
  @git_path = File.join(root_directory, '.git')
13
13
  @repository = nil
14
- @git_version = Gem::Version.new(`git --version`.split[2])
14
+ @git_version = detect_git_version
15
15
  @weight = 116
16
16
  end
17
17
 
18
18
  # @macro call_filter
19
19
  def call(notice)
20
20
  return if notice[:context].key?(:repository)
21
+ attach_repository(notice)
22
+ end
21
23
 
24
+ def attach_repository(notice)
22
25
  if @repository
23
26
  notice[:context][:repository] = @repository
24
27
  return
25
28
  end
26
29
 
27
30
  return unless File.exist?(@git_path)
31
+ return unless @git_version
28
32
 
29
33
  @repository =
30
34
  if @git_version >= Gem::Version.new('2.7.0')
@@ -37,6 +41,24 @@ module Airbrake
37
41
  return unless @repository
38
42
  notice[:context][:repository] = @repository
39
43
  end
44
+
45
+ private
46
+
47
+ def detect_git_version
48
+ return unless which('git')
49
+ Gem::Version.new(`git --version`.split[2])
50
+ end
51
+
52
+ # Cross-platform way to tell if an executable is accessible.
53
+ def which(cmd)
54
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
55
+ ENV['PATH'].split(File::PATH_SEPARATOR).find do |path|
56
+ exts.find do |ext|
57
+ exe = File.join(path, "#{cmd}#{ext}")
58
+ File.executable?(exe) && !File.directory?(exe)
59
+ end
60
+ end
61
+ end
40
62
  end
41
63
  end
42
64
  end
@@ -2,5 +2,5 @@
2
2
  # More information: http://semver.org/
3
3
  module Airbrake
4
4
  # @return [String] the library version
5
- AIRBRAKE_RUBY_VERSION = '3.2.3'.freeze
5
+ AIRBRAKE_RUBY_VERSION = '3.2.4'.freeze
6
6
  end
@@ -50,4 +50,12 @@ RSpec.describe Airbrake::Filters::GitRepositoryFilter do
50
50
  )
51
51
  end
52
52
  end
53
+
54
+ context "when git is not in PATH" do
55
+ it "does not attach context/repository" do
56
+ ENV['PATH'] = ''
57
+ subject.call(notice)
58
+ expect(notice[:context][:repository]).to be_nil
59
+ end
60
+ end
53
61
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.3
4
+ version: 3.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-12 00:00:00.000000000 Z
11
+ date: 2019-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbtree3