lib/hackathon_manager/engine.rb in hackathon_manager-0.9.2 vs lib/hackathon_manager/engine.rb in hackathon_manager-0.10.0
- old
+ new
@@ -1,7 +1,16 @@
+def require_name(dependency_name)
+ case dependency_name
+ when 'devise-doorkeeper'
+ 'devise/doorkeeper'
+ else
+ dependency_name
+ end
+end
+
Gem.loaded_specs['hackathon_manager'].dependencies.each do |d|
- require d.name
+ require require_name(d.name)
end
module HackathonManager
class Engine < ::Rails::Engine
initializer "hackathon_manager.assets.precompile" do |app|
@@ -31,10 +40,14 @@
initializer "static assets" do |app|
app.middleware.insert_before(::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public")
end
initializer 'hackathon_manager.factories', after: 'factory_bot.set_factory_paths' do
- FactoryBot.definition_file_paths << File.expand_path('../../test/factories', __dir__) if defined?(FactoryBot)
+ if defined?(FactoryBot)
+ FactoryBot.definition_file_paths << File.expand_path('../../test/factories', __dir__)
+ # doorkeeper_dir = Gem::Specification.find_by_name('doorkeeper').gem_dir
+ # FactoryBot.definition_file_paths << File.join(doorkeeper_dir, 'spec/factories')
+ end
end
ActionController::Base.class_eval do
# Tell Devise where to redirect the user once they sign in
def after_sign_in_path_for(resource)