Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How is ExtensionLoader supposed to work? #421

Open
ronald opened this issue Apr 5, 2019 · 5 comments
Open

How is ExtensionLoader supposed to work? #421

ronald opened this issue Apr 5, 2019 · 5 comments

Comments

@ronald
Copy link
Contributor

ronald commented Apr 5, 2019

I'm currently trying to run radiantcms on rails 6 beta.

Since i have no clue how ExtensionLoader is supposed to work, I fiddled with:
[main] application.rb: glob vendor/extensions and add paths to config.autoload_paths

    config.autoload_paths << Rails.root.join('lib/radiant-copy')
    extensions_sub_dirs = Dir.glob('vendor/extensions/**/*/').reject{|f| f=~ %r~/(db|recipes|public|spec|test|views)/~ }
    extensions = Dir.glob('vendor/extensions/*')
    extensions.each do |ext|
      ext_paths = extensions_sub_dirs.select{|d| d.include?(ext)}
      config.autoload_paths.concat(ext_paths)
    end

[radiant] engine.rb:

      el = Radiant::ExtensionLoader.instance
      el.extensions = Radiant::Engine.all_available_extensions
      el.extensions.each do |ext_name|
        ext = el.load_extension(ext_name)
        ext.activate
      end

I'm sure this is not the way EngineLoader is supposed to work.

To be more specfic:
What is Radiant::ExtensionLoader#initializer?
Where is Radiant::ExtensionLoader#gems?

Feedback highly appreciated, @jomz

@saturnflyer
Copy link
Member

I haven't worked on the ExtensionLoader but I'll try to take a look and give some feedback

@saturnflyer
Copy link
Member

Without diving in too deep, I'll give you some history @ronald
Radiant Extensions pre-exist Rails Engines.
Originally there was a UI that allowed you to turn on and off features provided by extensions, but that was dropped and the UI should only now show you the extensions and allow you to configure them (if they provide for that).
The trajectory was to move extensions to just adding them as gems gem "radiant-snippets-extension"
At this point, Extensions should just be Engines and there's support for that in Radiant::Engine.
Old extensions may exist that don't conform as an Engine. I'm ok with dropping support for extensions that are not engines.
I can't give you greater guidance on the particulars of the code since I don't know it well but I'll be happy to help you along with contributions.

@ronald
Copy link
Contributor Author

ronald commented Apr 12, 2019

Thx, Jim.

Do you have one working example of radiant (1.1.4 or 2.alpha) + engine based extension gem?

On Rubygems this one is most popular:
https://rubygems.org/gems/radiant-reader-extension
=> can't find source

Second one is https://github.com/squaretalent/radiant-shop-extension/tree/v0.11.6
=> does not use Rails::Engine

3rd https://rubygems.org/gems/radiant-event_calendar-extension
=> no source online

btw. did u see this one https://github.com/saturnflyer/radiant-snippets-extension/issues/1 ?

@saturnflyer
Copy link
Member

source is here https://github.com/spanner/radiant-reader-extension

I'll see what I can find for other extensions

@jomz
Copy link
Member

jomz commented Apr 19, 2019

Hi Ronald, Jim,

Sorry to not reply here earlier...
The source for event_calendar is over here:
https://github.com/radiant/radiant-event-calendar-extension

.. but to answer your question Ronald; 1.1.4 does not support extensions as engines, as that is still on rails 2.3. To the best of my knowledge, the master branch is not ready to support extensions yet either.
I don't think anyone is using it in production, and I wouldn't recommend it either. It took me quite some hoop-jumping last week to just get an instance set up, and spotting several things along the way that still need fixing.
"The master branch may be broken." is probably understating it a bit...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants