I'm building a namespaced Rails Engine gem which will be extendable through additional gems. For example: MyEngine is the main gem which will also be the namespace. MyEngine-blog & MyEngine-support are optional gems to extend the MyEngine gem while inheriting the MyEngine namespace.
MyEngine-blog & MyEngine-support are dependent on MyEngine for core functionality and both gems will include spec.add_dependency "synculus"
in their gemspec files.
What is the proper way to specify the Rails::Engine
for the dependency gems?
Do I have to specify class Engine < ::Rails::Engine
in each of the MyEngine-blog & MyEngine-support gem's engine.rb files?
# lib/myengine/engine.rb
module MyEngine
class Engine < ::Rails::Engine
isolate_namespace MyEngine
end
end
# lib/myengine/blog/engine.rb
module MyEngine
class Engine < ::Rails::Engine
isolate_namespace MyEngine
module Blog
end
end
end
# lib/myengine/support/engine.rb
module MyEngine
class Engine < ::Rails::Engine
isolate_namespace MyEngine
module Support
end
end
end