@@ -11,17 +11,26 @@ module Masq
1111 # This gem must be loaded **after** Rails in order for the Engine to register itself automatically.
1212 # Otherwise, you'd have to manually require what you need from below.
1313 if defined? ( ::Rails ) && defined? ( ::Rails ::VERSION )
14- if defined? ( ::Rails ::Engine )
15- require "masq/engine"
16- else
17- warn ( <<~WARNING )
18- Unable to load masq2. Please check your configuration.
19- If you're using Rails 5.2 or later, you should add masq2 to your Gemfile and run `bundle install`.
20- Then add:
21- require "masq/engine"
22-
23- If unable to resolve, please report a bug to the issue tracker at https://github.com/oauth-xx/masq2
24- WARNING
14+ begin
15+ require_relative "masq/engine"
16+ require_relative "masq/authenticated_system"
17+ require_relative "masq/openid_server_system"
18+ require_relative "masq/active_record_openid_store/association"
19+ require_relative "masq/active_record_openid_store/nonce"
20+ require_relative "masq/active_record_openid_store/openid_ar_store"
21+ rescue StandardError , LoadError => e
22+ if !defined? ( ::Rails ::Engine )
23+ warn ( "masq2 is a Rails engine, but Rails::Engine isn't defined." )
24+ else
25+ warn ( <<~WARNING )
26+ Unable to load masq2. Please check your configuration.
27+ If you're using Rails 5.2 or later, you should add masq2 to your Gemfile and run `bundle install`.
28+ Then add:
29+ require "masq/engine"
30+
31+ If unable to resolve, please report a bug to the issue tracker at https://github.com/oauth-xx/masq2
32+ WARNING
33+ end
2534 end
2635 else
2736 warn ( "masq2 was loaded before Rails. Please check your configuration." )
0 commit comments