forked from exceptional/exceptional
-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.rb
39 lines (37 loc) · 1.27 KB
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'exceptional'
unless Object.const_defined?(:JSON)
begin
require 'json'
rescue LoadError
begin
require 'json-ruby'
rescue LoadError
require 'json_pure'
end
end
end
unless Object.const_defined?(:JSON)
raise "Could not load json gem; make sure you install one of json_pure, json-ruby, or the C-based json gem."
end
# If old plugin still installed then we don't want to install this one.
# In production environments we should continue to work as before, but in development/test we should
# advise how to correct the problem and exit
if (defined?(Exceptional::VERSION::STRING) rescue nil) && %w(development test).include?(RAILS_ENV)
message = %Q(
***********************************************************************
You seem to still have an old version of the Exceptional plugin installed.
Remove it from /vendor/plugins and try again.
***********************************************************************
)
puts message
exit -1
else
begin
Exceptional::Config.load(File.join(RAILS_ROOT, "/config/exceptional.yml"))
Exceptional::Startup.announce
require File.join('exceptional', 'integration', 'rails')
rescue => e
STDERR.puts "Problem starting Exceptional Plugin. Your app will run as normal."
STDERR.puts e
end
end