Conversation
Add a new generator that allows users to generate all components at once using the command `bin/rails g ruby_ui:component:all`. This makes it easier for users who want to install the complete set of components without having to run individual commands for each component. In my notebook, it's tanking 1m 3s to generate all components. We can improve this but i tried to keep the same approach as the component generator to make it easier to maintain.
cirdes
added a commit
to ruby-ui/web
that referenced
this pull request
May 11, 2025
Verify_components.yml workflow ensures components are properly generated ruby-ui/ruby_ui#289 should be merged first Button, Checkbox, Link, Separator, TableFooter, TableRow components were out of sync with ruby_ui.
stephannv
approved these changes
May 12, 2025
| def generate_components | ||
| say "Generating all components..." | ||
|
|
||
| Dir.children(self.class.source_root).each do |folder_name| |
Contributor
There was a problem hiding this comment.
If you do something like Dir.glob("path/to/ruby_ui/*/") you will get ruby_ui folders, then you won't need to do next if folder_name == "base.rb".
Collaborator
Author
There was a problem hiding this comment.
It started to return the full path. I decided to check if the string ends_with?(".rb") to make it more generic and robust
folder_name: /Users/cirdes/Workspace/ruby-ui/ruby_ui/lib/ruby_ui/accordion/
| next if folder_name == "base.rb" | ||
|
|
||
| component_name = folder_name.camelize | ||
| run "bin/rails generate ruby_ui:component #{component_name} --force true" |
Contributor
There was a problem hiding this comment.
I'm not sure if this should be --force true by default since it is an irreversible action if the overwritten files are not in git.
Collaborator
Author
There was a problem hiding this comment.
@stephannv , good point. I have changed it to be an option with default: false now
I was getting a segmentation fault when running the tests on head
cirdes
added a commit
to ruby-ui/web
that referenced
this pull request
May 12, 2025
* Add verify_components.yml workflow Verify_components.yml workflow ensures components are properly generated ruby-ui/ruby_ui#289 should be merged first Button, Checkbox, Link, Separator, TableFooter, TableRow components were out of sync with ruby_ui. * add endline
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.
Add a new generator that allows users to generate all components at once using the command
bin/rails g ruby_ui:component:all.This makes it easier for users who want to install the complete set of components without having to run individual commands for each component.
In my notebook, it's tanking 1m 3s to generate all components. We can improve this but i tried to keep the same approach as the component generator to make it easier to maintain.