Class: Groovestack::Auth::Engine
- Inherits:
-
Rails::Engine
- Object
- Rails::Engine
- Groovestack::Auth::Engine
- Includes:
- Base::CoreRailtie
- Defined in:
- lib/groovestack/auth/engine.rb
Instance Method Summary collapse
- #dx_validations ⇒ Object
- #missing_configuration_msg ⇒ Object
- #module_description ⇒ Object
- #providers_missing_configuration ⇒ Object
Instance Method Details
#dx_validations ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/groovestack/auth/engine.rb', line 11 def dx_validations [ { eval: proc { raise if ::Groovestack::Auth.enabled_providers_sans_configuration.present? }, message: missing_configuration_msg } ] end |
#missing_configuration_msg ⇒ Object
28 29 30 31 32 |
# File 'lib/groovestack/auth/engine.rb', line 28 def missing_configuration_msg msg = "\n\tWarning: enabled providers are missing required credentials:\n\t\t" msg += providers_missing_configuration.join("\n\t\t") "#{msg}\n\tAdd them to your credentials file or disable the providers by adding them to Groovestack::Auth.disabled_providers." # rubocop:disable Layout/LineLength end |
#module_description ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/groovestack/auth/engine.rb', line 34 def module_description avail = ::Groovestack::Auth.available_providers.map(&:k).map(&:to_s).map(&:titleize) descr = "\n\tAvailable auth providers: #{avail.join(', ')}" enabled = ::Groovestack::Auth.enabled_providers.map(&:k).map(&:to_s).map(&:titleize) descr += "\n\tEnabled auth providers: #{enabled.join(', ')}" descr end |
#providers_missing_configuration ⇒ Object
22 23 24 25 26 |
# File 'lib/groovestack/auth/engine.rb', line 22 def providers_missing_configuration ::Groovestack::Auth.enabled_providers_sans_configuration.map do |h| "#{h.provider.to_s.titleize} - #{h.required_credentials.join(', ')}" end end |