Skip to content

New plugins symlinks #1510

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

Merged
merged 3 commits into from
May 20, 2025
Merged

New plugins symlinks #1510

merged 3 commits into from
May 20, 2025

Conversation

prioux
Copy link
Member

@prioux prioux commented May 5, 2025

This is a significant improvement in the way plugins are integrated.

The structure of the "installed_plugins" folder was
changed slightly to flatten the subfolder for userfiles.

Previously, we had something like:

installed-plugins/userfiles/text_file/text_files.rb -> (plugin_loc)

and now we have:

installed-plugins/userfiles/text_file.rb -> (plugin_loc)

This means the boot code for the Rails app no longer globs
into a large set of folders to find its Ruby code files, speeding
it up.

But it also means I had to create a new "views" section
to hold the symlinks to the userfiles's "views" subfolders.

The rake task to installed and cleanup the links has been
adjusted, you WILL need to run 'rake cbrain:plugins:install:all'
to adjust all the symlinks. (And even maybe :clean:all first).

The helper method that builds the userfile view paths has also
been updated.

Fixes #816

The structure of the "installed_plugins" folder was
changed slightly to flatten the subfolder for userfiles.

Previously, we had something like:

installed-plugins/userfiles/text_file/text_files.rb -> (plugin_loc)

and now we have:

installed-plugins/userfiles/text_file.rb -> (plugin_loc)

This means the boot code for the Rails app no longer globs
into a large set of folders to find its Ruby code files, speeding
it up.

But it also means I had to create a new "views" section
to hold the symlinks to the userfiles's "views" subfolders.

The rake task to installed and cleanup the links has been
adjusted, you WILL need to run 'rake cbrain:plugins:install:all'
to adjust all the symlinks. (And even maybe :clean:all first).

The helper method that builds the userfile view paths has also
been updated.
@prioux prioux self-assigned this May 5, 2025
@prioux prioux added Enhancement Refactoring Priority: High Admin Features or bugs related to administrative features labels May 5, 2025
@prioux prioux changed the base branch from master to dev May 5, 2025 18:22
@prioux prioux changed the base branch from dev to master May 5, 2025 18:22
@MontrealSergiy
Copy link
Contributor

It might increase risk of file name intersection among different types?

@prioux
Copy link
Member Author

prioux commented May 5, 2025

Not really. Since the file names (e.g. xyz.rb) are for Ruby classes, and there can only be one Ruby class of name "Xyz", there can't be two "xyz.rb" files anyway anywhere within the system.

@prioux
Copy link
Member Author

prioux commented May 17, 2025

I found a few problems with this as I am testing some more. Hang on.

@prioux
Copy link
Member Author

prioux commented May 17, 2025

So this has been tested on a production server (!) that was idle, and it seems to be right.

One happy consequence of the change is that in development mode, the Rails app won't load any of the model file until it's actually needed by a Ruby statement. You can test it in a console (in dev mode) with a statement like this:

in_memory = Userfile.descendants.map(&:to_s)

This will show the models currenly loaded; those were loaded most likely because a database table refer to them.

Pick a Userfile subclass that is not listed but you know exist (e.g. XMLFile) and just type the class name in the console:

XMLFile
 => XMLFile id: integer, name: string, size: decimal, user_id: integer, ...

Then if you run the "in_memory" statement again, you should see the class has been added to the list.

@prioux prioux merged commit c894fe3 into aces:master May 20, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin Features or bugs related to administrative features Enhancement Priority: High Refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Ruby search path scanning at boot time
2 participants