airbrake-ruby 3.2.3-java → 3.2.4-java

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: b6cc676f0b3c50c252a974f5c07321e15aa322d5
4
- data.tar.gz: 984d90b0ae217f25ecfb05ac23dabb5153a306dc
3
+ metadata.gz: 24bab865b5db1b667a166cc1bd41b5708152de65
4
+ data.tar.gz: b13483675acade75535356f679099873ed234888
5
5
  SHA512:
6
- metadata.gz: 343a7da97d6b078efa9fbc06d9134ff8a0104298dccac655deef31dc579d8e7ea7bf8e9dff0514fe5991407726ae9e29e6ea4530433aa7e132d6a957903f509d
7
- data.tar.gz: b988834c61b2562b94e39ccea3b0443ac42faadcfae129d40ec33867edf184f6fd3fa02b332dc7693fb57c5c657002dc4d136b1a4f996d464d458b3d47c13a60
6
+ metadata.gz: 0eeb206a23d7068c1d4b812adb5a048f154c3ae7eef70803556ce550550d3c792b67cdd95a7561b270dd621ba378fc879c38f8a0a622d7c5aecae346260bc3cb
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: java
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: rbtree-jruby