[BMDEV-558] Rework to support rails 8 with zeitwerk, dropped sprockets support#5
Merged
Yegoroff merged 6 commits intoboldtrail:masterfrom Jul 23, 2025
Merged
Conversation
iSunRise
commented
Jul 1, 2025
iSunRise
commented
Jul 1, 2025
| log("Components Initialization Started") | ||
| log("Components Path: #{components_base_dir}") | ||
|
|
||
| # Collapse directory for nested components |
Contributor
Author
There was a problem hiding this comment.
explain what does "collapse" mean
iSunRise
commented
Jul 1, 2025
| Rails.autoloaders.main.collapse("components/*/_components") | ||
|
|
||
| # ignore non standard routes paths | ||
| Rails.autoloaders.main.ignore("#{components_base_dir}/**/routes.rb") |
Contributor
Author
There was a problem hiding this comment.
move to line 45 and explain how the routes will be loaded
Contributor
Author
There was a problem hiding this comment.
Should be ignored here, order matters
iSunRise
commented
Jul 1, 2025
Comment on lines
+35
to
+37
| # add each _components dir into paths as well (cut component name off the sub component path) | ||
| sub_component_paths = get_components.filter_map { |c| c[:path].gsub(/#{c[:name]}$/, "") if c[:sub_component] } | ||
| sub_component_paths.each { |path| application.config.paths.add(path, eager_load: true) } |
Contributor
Author
There was a problem hiding this comment.
remove since we keep root component namespace
iSunRise
commented
Jul 1, 2025
| # Register legacy directories under modules | ||
| log("Register legacy directories under modules") | ||
| get_components.each do |component_info| | ||
| legacy_dir_path = component_info[:path] + "/_legacy" |
Contributor
Author
There was a problem hiding this comment.
rename to _legacy_models
iSunRise
commented
Jul 1, 2025
iSunRise
commented
Jul 1, 2025
| { | ||
| name: full_path.split(/\/_?components\//).last, | ||
| path: full_path, | ||
| sub_component: full_path.include?("_components") |
Contributor
Author
There was a problem hiding this comment.
sub_component prop not needed
iSunRise
commented
Jul 1, 2025
iSunRise
commented
Jul 1, 2025
| end | ||
| get_components.each do |component_info| | ||
| Object.const_set(component_info[:name].camelize, Module.new) | ||
| require "#{component_info[:path]}/initialize.rb" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.