Skip to content

nikolalsvk/ordinare

Repository files navigation

ordinare

Build Status Gem Version codecov PRs Welcome FOSSA Status Open Source Helpers

Ordinare sorts gems in your Gemfile alphabetically

ordinare GIF

In order to install the gem, do:

$ gem install ordinare

Usage ⛏️

Position yourself inside Rails project with Gemfile and do:

$ ordinare

And that's it! Ordinare will sort your Gemfile and overwrite your current Gemfile.

If you don't want ordinare to overwrite your Gemfile, see Don't overwrite Gemfile.

NOTE: be sure to do $ bundle install after ordinare sorts your Gemfile just to make sure everything is OK.

Love for the gem groups ❤️

If you're using something along these lines in your Gemfile:

...

group :test do
  gem "webmock"
  gem "cucumber-rails"
end

group :development do
  gem "byebug"
  gem "spring"
do

...

ordinare will consider groups inside your Gemfile and will sort gems inside those groups, not messing them up.

Love for the comment groups 💚

If you're organizing your gems using comments in similar fashion:

...

# Auth
gem "devise"
gem "oauth2"

# Assets
gem "sprockets"
gem "sprockets-es6"
gem "pusher"

...

ordinare will sort gems below your comments, treating them as groups (e.g. "Auth" group and "Assets" group).

Advanced usage ⚒️

Pass in path to Gemfile

You can pass in path to your gemfile:

$ ordinare --path my_awesome_project/Gemfile

And that's it! You can find your ordered Gemfile at my_awesome_project/Gemfile.

Don't overwrite Gemfile

Ordinare has an option that will make Gemfile.ordinare instead of overwriting your original Gemfile.

Just call ordinare like this:

$ ordinare --no-overwrite

And that's it! You can find your ordered Gemfile at Gemfile.ordinare.

Check if Gemfile is sorted

There is an option to check your Gemfile to see if it's sorted. This will not overwrite nor create a new sorted Gemfile.

Call ordinare like this:

ordinare --check

And that's it, ordinare will inform your whether your Gemfile is sorted properly or not. This can be useful on some CI server where you check if Gemfile is sorted.

Contributing ✍️

Any suggestions and improvements are more than welcome 🙇‍♂️.

If you'd like to contribute, you can check CONTRIBUTING.md

License

FOSSA Status