azure-activedirectory-library-for-ruby
azure-activedirectory-library-for-ruby copied to clipboard
Renamed logger and added autoloading to work in rails
If you try to use this as is it breaks in rails. I've updated it to autoload how rails would expect it to, and also renamed the logger so it doesn't clash with the logger in rails.
Hello! Has anyone from Microsoft had a chance to look at this? We are being affected by the logger issue at the moment.
For what its worth, I can reproduce the problem in ruby 2.3.2 but not 2.3.1.
inmac-wks943:wellness_bucks gregwoods$ rvm use 2.3.1
Using /Users/gregwoods/.rvm/gems/ruby-2.3.1
inmac-wks943:wellness_bucks gregwoods$ bin/rails c
Loading development environment (Rails 5.0.1)
[1] pry(main)> exit
inmac-wks943:wellness_bucks gregwoods$ rvm use 2.3.2
Using /Users/gregwoods/.rvm/gems/ruby-2.3.2
inmac-wks943:wellness_bucks gregwoods$ bin/rails c
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/adal-1.0.0/lib/adal/authority.rb:35: warning: already initialized constant ADAL::Authority::AUTHORIZE_PATH
/Users/gregwoods/.rvm/rubies/ruby-2.3.2/lib/ruby/gems/2.3.0/gems/adal-1.0.0/lib/adal/authority.rb:35: warning: previous definition of AUTHORIZE_PATH was here
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/adal-1.0.0/lib/adal/authority.rb:36: warning: already initialized constant ADAL::Authority::COMMON_TENANT
/Users/gregwoods/.rvm/rubies/ruby-2.3.2/lib/ruby/gems/2.3.0/gems/adal-1.0.0/lib/adal/authority.rb:36: warning: previous definition of COMMON_TENANT was here
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/adal-1.0.0/lib/adal/authority.rb:37: warning: already initialized constant ADAL::Authority::DISCOVERY_TEMPLATE
/Users/gregwoods/.rvm/rubies/ruby-2.3.2/lib/ruby/gems/2.3.0/gems/adal-1.0.0/lib/adal/authority.rb:37: warning: previous definition of DISCOVERY_TEMPLATE was here
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/adal-1.0.0/lib/adal/authority.rb:39: warning: already initialized constant ADAL::Authority::TENANT_DISCOVERY_ENDPOINT_KEY
/Users/gregwoods/.rvm/rubies/ruby-2.3.2/lib/ruby/gems/2.3.0/gems/adal-1.0.0/lib/adal/authority.rb:39: warning: previous definition of TENANT_DISCOVERY_ENDPOINT_KEY was here
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/adal-1.0.0/lib/adal/authority.rb:40: warning: already initialized constant ADAL::Authority::TOKEN_PATH
/Users/gregwoods/.rvm/rubies/ruby-2.3.2/lib/ruby/gems/2.3.0/gems/adal-1.0.0/lib/adal/authority.rb:40: warning: previous definition of TOKEN_PATH was here
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/adal-1.0.0/lib/adal/authority.rb:41: warning: already initialized constant ADAL::Authority::WELL_KNOWN_AUTHORITY_HOSTS
/Users/gregwoods/.rvm/rubies/ruby-2.3.2/lib/ruby/gems/2.3.0/gems/adal-1.0.0/lib/adal/authority.rb:41: warning: previous definition of WELL_KNOWN_AUTHORITY_HOSTS was here
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/adal-1.0.0/lib/adal/authority.rb:47: warning: already initialized constant ADAL::Authority::WORLD_WIDE_AUTHORITY
/Users/gregwoods/.rvm/rubies/ruby-2.3.2/lib/ruby/gems/2.3.0/gems/adal-1.0.0/lib/adal/authority.rb:47: warning: previous definition of WORLD_WIDE_AUTHORITY was here
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/adal-1.0.0/lib/adal/cache_driver.rb:37: warning: already initialized constant ADAL::CacheDriver::FIELDS
/Users/gregwoods/.rvm/rubies/ruby-2.3.2/lib/ruby/gems/2.3.0/gems/adal-1.0.0/lib/adal/cache_driver.rb:37: warning: previous definition of FIELDS was here
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'adal'. (Bundler::GemRequireError)
Gem Load Error is: superclass mismatch for class Logger
Backtrace for gem load error is:
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/adal-1.0.0/lib/adal/logger.rb:36:in `<module:ADAL>'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/adal-1.0.0/lib/adal/logger.rb:25:in `<top (required)>'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/adal-1.0.0/lib/adal.rb:24:in `require_relative'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/adal-1.0.0/lib/adal.rb:24:in `block in <top (required)>'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/adal-1.0.0/lib/adal.rb:24:in `each'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/adal-1.0.0/lib/adal.rb:24:in `<top (required)>'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `require'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `block in require'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `each'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `require'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/bundler-1.13.6/lib/bundler.rb:106:in `require'
/Users/gregwoods/Source/sample_app/config/application.rb:7:in `<top (required)>'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:156:in `require'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:156:in `require_application_and_environment!'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:77:in `console'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
/Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/railties-5.0.1/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Bundler Error Backtrace:
from /Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:90:in `block (2 levels) in require'
from /Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
from /Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `block in require'
from /Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `each'
from /Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `require'
from /Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/bundler-1.13.6/lib/bundler.rb:106:in `require'
from /Users/gregwoods/Source/sample_app/config/application.rb:7:in `<top (required)>'
from /Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:156:in `require'
from /Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:156:in `require_application_and_environment!'
from /Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:77:in `console'
from /Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /Users/gregwoods/.rvm/gems/ruby-2.3.2/gems/railties-5.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I am able to start my app using @eavonius's branch without issue.