Skip to content

[BMDEV-558] Rework to support rails 8 with zeitwerk, dropped sprockets support#5

Merged
Yegoroff merged 6 commits intoboldtrail:masterfrom
iSunRise:BMDEV-558
Jul 23, 2025
Merged

[BMDEV-558] Rework to support rails 8 with zeitwerk, dropped sprockets support#5
Yegoroff merged 6 commits intoboldtrail:masterfrom
iSunRise:BMDEV-558

Conversation

@iSunRise
Copy link
Copy Markdown
Contributor

@iSunRise iSunRise commented Jun 6, 2025

No description provided.

Comment thread component-framework.gemspec
Comment thread lib/component/framework.rb Outdated
log("Components Initialization Started")
log("Components Path: #{components_base_dir}")

# Collapse directory for nested components
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explain what does "collapse" mean

Rails.autoloaders.main.collapse("components/*/_components")

# ignore non standard routes paths
Rails.autoloaders.main.ignore("#{components_base_dir}/**/routes.rb")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to line 45 and explain how the routes will be loaded

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be ignored here, order matters

Comment thread lib/component/framework.rb Outdated
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) }
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove since we keep root component namespace

Comment thread lib/component/framework.rb Outdated
# Register legacy directories under modules
log("Register legacy directories under modules")
get_components.each do |component_info|
legacy_dir_path = component_info[:path] + "/_legacy"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to _legacy_models

Comment thread lib/component/framework.rb
Comment thread lib/component/framework.rb Outdated
{
name: full_path.split(/\/_?components\//).last,
path: full_path,
sub_component: full_path.include?("_components")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sub_component prop not needed

Comment thread lib/component/framework.rb
Comment thread lib/component/framework.rb Outdated
end
get_components.each do |component_info|
Object.const_set(component_info[:name].camelize, Module.new)
require "#{component_info[:path]}/initialize.rb"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it optional

@Yegoroff Yegoroff merged commit c799412 into boldtrail:master Jul 23, 2025
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

Successfully merging this pull request may close these issues.

2 participants