Skip to content
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

Introduce suspenders:cleanup:organize_gemfile task #1181

Merged

Conversation

stevepolitodesign
Copy link
Contributor

Introduce Suspenders::Cleanup::OrganizeGemfile class and corresponding task in an effort to reduce duplicate groups in the modified Gemfile.

This is because the gem_group method does not modify existing groups. I've opened #49512 in an effort to fix this, but until then, this task will suffice.

This class is designed to be run after suspenders:install:web, and does not account for all edge cases. For example, it assumes gems are grouped by symbols (i.e. :test and not "test"), and does not account for inline syntax:

gem 'my-gem', group: [:cucumber, :test]

We could consider extracting this into a Gem (with a fun name, of course. Maybe "Polish"), but for now, I think this simple procedural code if just fine.

Additionally, this commit removes duplicate Rake task that was generated with the plugin.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is exactly how suspenders:install:web modifies the Gemfile.

@stevepolitodesign stevepolitodesign force-pushed the suspenders-3-0-0-organize-gemfile branch 2 times, most recently from 8f493f5 to 6b4ae1b Compare March 30, 2024 09:30
@mike-burns
Copy link
Contributor

Potentially closes #915.

Introduce `Suspenders::Cleanup::OrganizeGemfile` class and corresponding
task in an effort to reduce duplicate groups in the modified Gemfile.

This is because the [gem_group][] method does not modify existing
groups. I've opened [#49512][] in an effort to fix this, but until then,
this task will suffice.

This class is designed to be run after `suspenders:install:web`, and
does not account for all edge cases. For example, it assumes gems are
grouped by symbols (i.e. :test and not "test"), and does not account for
inline syntax:

```ruby
gem 'my-gem', group: [:cucumber, :test]
```

We could consider extracting this into a Gem (with a fun name, of
course. Maybe "Polish"), but for now, I think this simple procedural
code if just fine.

Additionally, this commit removes duplicate Rake task that was generated
with the plugin.

[gem_group]: https://api.rubyonrails.org/classes/Rails/Generators/Actions.html#method-i-gem_group
[#49512]: rails/rails#49512
@stevepolitodesign stevepolitodesign force-pushed the suspenders-3-0-0-organize-gemfile branch from fd6db90 to e2f6a0b Compare April 2, 2024 23:45
@stevepolitodesign stevepolitodesign merged commit f6c6f45 into suspenders-3-0-0 Apr 2, 2024
2 checks passed
@stevepolitodesign stevepolitodesign deleted the suspenders-3-0-0-organize-gemfile branch April 2, 2024 23:48
stevepolitodesign added a commit that referenced this pull request May 10, 2024
Introduce `Suspenders::Cleanup::OrganizeGemfile` class and corresponding
task in an effort to reduce duplicate groups in the modified Gemfile.

This is because the [gem_group][] method does not modify existing
groups. I've opened [#49512][] in an effort to fix this, but until then,
this task will suffice.

This class is designed to be run after `suspenders:install:web`, and
does not account for all edge cases. For example, it assumes gems are
grouped by symbols (i.e. :test and not "test"), and does not account for
inline syntax:

```ruby
gem 'my-gem', group: [:cucumber, :test]
```

We could consider extracting this into a Gem (with a fun name, of
course. Maybe "Polish"), but for now, I think this simple procedural
code if just fine.

Additionally, this commit removes duplicate Rake task that was generated
with the plugin.

[gem_group]: https://api.rubyonrails.org/classes/Rails/Generators/Actions.html#method-i-gem_group
[#49512]: rails/rails#49512
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