forked from exceptional/exceptional
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.rb
39 lines (36 loc) · 1.73 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'
# 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
if (Rails::VERSION::MAJOR < 3)
Exceptional::Config.load(File.join(RAILS_ROOT, "/config/exceptional.yml"))
if Exceptional::Config.should_send_to_api?
Exceptional.logger.info("Loading Exceptional #{Exceptional::VERSION} for #{Rails::VERSION::STRING}")
require File.join('exceptional', 'integration', 'rails')
require File.join('exceptional', 'integration', 'dj') if defined?(Delayed::Job)
end
else
Exceptional::Config.load(File.join(Rails.root, "/config/exceptional.yml"))
if Exceptional::Config.should_send_to_api?
Exceptional.logger.info("Loading Exceptional #{Exceptional::VERSION} for #{Rails::VERSION::STRING}")
Rails.configuration.middleware.use "Rack::RailsExceptional"
require File.join('exceptional', 'integration', 'dj') if defined?(Delayed::Job)
end
end
rescue => e
STDERR.puts "Problem starting Exceptional Plugin. Your app will run as normal. #{e.message}"
Exceptional.logger.error(e.message)
Exceptional.logger.error(e.backtrace)
end
end