airbadger 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/airbadger/airbrake_loader.rb +14 -2
- data/lib/airbadger/version.rb +1 -1
- data/spec/airbrake_loader_spec.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5d1f63130dcbd9664e66c98ebd2881c3f8093d8
|
4
|
+
data.tar.gz: 4563077ce8f0b11f7ff3e2cb2031a0e7c3e3bc15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f104a615416232818187a6f391ef89939ad5eec0cb62ad36bdd4e5cf8d3bb5bd98ec06135e1665e3b88d01172b468980898bce10d4b8c8a7a7e3d637ef567973
|
7
|
+
data.tar.gz: b089057607c5bb3655d2ad350b9d673253bd4697cf77fb454cefd73a4f8a79b665f1cf34138371cee34a7ed1a67603e16854554596775d4b311a2dff9405e900
|
@@ -4,8 +4,11 @@ class Airbadger::AirbrakeLoader
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def load_aliased
|
7
|
-
without_recording_loaded_features
|
8
|
-
|
7
|
+
without_recording_loaded_features do
|
8
|
+
load_airbrake!
|
9
|
+
load_airbrake_rails! if defined?(::Rails)
|
10
|
+
end
|
11
|
+
aliased_module.tap do
|
9
12
|
preserve_namespaced_calls!
|
10
13
|
remove_airbrake_from_global_namespace!
|
11
14
|
end
|
@@ -19,6 +22,15 @@ class Airbadger::AirbrakeLoader
|
|
19
22
|
@endpoint_alias = endpoint_alias.sub(/^Airbrake$/, 'AirbrakeProxied')
|
20
23
|
end
|
21
24
|
|
25
|
+
def load_airbrake!
|
26
|
+
require 'airbrake'
|
27
|
+
end
|
28
|
+
|
29
|
+
def load_airbrake_rails!
|
30
|
+
require 'airbrake/rails/controller_methods'
|
31
|
+
require 'airbrake/rails/javascript_notifier'
|
32
|
+
end
|
33
|
+
|
22
34
|
def aliased_module
|
23
35
|
@aliased_module ||= Object.const_set(endpoint_alias, Airbrake)
|
24
36
|
end
|
data/lib/airbadger/version.rb
CHANGED
@@ -28,5 +28,22 @@ describe Airbadger::AirbrakeLoader do
|
|
28
28
|
|
29
29
|
Errbit.sender.last_notice.should include(now)
|
30
30
|
end
|
31
|
+
|
32
|
+
it 'eager-loads Rails extensions when Rails is running' do
|
33
|
+
Rails = Module.new
|
34
|
+
without_warnings { described_class.load_as('Errbit') }
|
35
|
+
|
36
|
+
defined?(Errbit::Rails::ControllerMethods).should be_true
|
37
|
+
defined?(Errbit::Rails::JavascriptNotifier).should be_true
|
38
|
+
|
39
|
+
Object.send(:remove_const, 'Rails')
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'does not load Rails extensions when Rails is not running' do
|
43
|
+
without_warnings { described_class.load_as('Errbit') }
|
44
|
+
|
45
|
+
defined?(Errbit::Rails::ControllerMethods).should be_false
|
46
|
+
defined?(Errbit::Rails::JavascriptNotifier).should be_false
|
47
|
+
end
|
31
48
|
end
|
32
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airbadger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Jordan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: airbrake
|