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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db8295562ff11dd6dde0f27681b913c586149370
4
- data.tar.gz: 4b88e9c0be03486280c765be4b4e4869dad102b9
3
+ metadata.gz: c5d1f63130dcbd9664e66c98ebd2881c3f8093d8
4
+ data.tar.gz: 4563077ce8f0b11f7ff3e2cb2031a0e7c3e3bc15
5
5
  SHA512:
6
- metadata.gz: 36aa2db7e1c9f6efddc7760008c46f7dd9115bfb673b4ce7acdbfff4060edfe264a575739568cb176feba771793d9340264fbe2d9baf23b93a3202d7f6e390e3
7
- data.tar.gz: 1f044f83a4f084bfa878467ca61c73a9dfee781311cd2f502f27d2241db810370f72160eec473ba23e7cc5c85d8376c1f91227fd591d83f3b2b5edb42dac6438
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 { require 'airbrake' }
8
- aliased_module.tap do |loaded_module|
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
@@ -1,3 +1,3 @@
1
1
  module Airbadger
2
- VERSION = "0.0.3"
2
+ VERSION = '0.0.4'
3
3
  end
@@ -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.3
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-04 00:00:00.000000000 Z
11
+ date: 2013-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: airbrake