-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
Insert gems alphabetically #915
Comments
It's true, this came from a switch to using Rails I was not thrilled with the result but assumed no one else cared. But apparently people do! I think the thing to do is to write a custom I don't have the bandwidth to do that over the new few months, unfortunately, but it seems like a surprisingly fun method to write. |
For too long we have [suffered] under the tyranny of Rails' mediocre `gem` action! But Rails 6 took it a step too far: it [no longer] supports a `destroy` generator. [suffered]: #915 [no longer]:#1061 (comment) So it's high time we make our own. In the process, encode the rules we like to see: keep gems alphabetical, and use the `group` block syntax instead of the `:group` argument. When inserting a gem, we have to consider two cases: do we have a group specification? If we don't have a group name, insert it alphabetically before the first non-indented `gem "..."` declaration. If we do have a group name, find the block for that group and insert it alphabetically. But there's also the chance thar we are the first to add this group, in which case we should add the group with the `gem` line at the end. When removing a group, we again consider the groups case. If there is no group specification, remove the first matching non-indented `gem "..."` declaration. If we have a group spec, find the group block in the Gemfile and remove it. If there is no such group block, do nothing. Closes #915.
I think Standard does that for us. |
Here is the Gemfile that is created when suspenders generates an app now:
Not sure what happened -- but it use to be cleaner, like:
Differences:
The text was updated successfully, but these errors were encountered: