nshki / chusaku

Annotate your Rails controllers with route info.
https://rubygems.org/gems/chusaku
MIT License
89 stars 5 forks source link

feat: add Rake task #41

Closed nshki closed 9 months ago

nshki commented 9 months ago

Issue

Closes #40.

Overview

As the title states, this PR adds a Rake task for Chusaku. This allows users to use a Rake task to execute Chusaku in addition to the executable it ships with like such:

bin/rake chusaku -- --dry-run

Loading the gem's Rake tasks is a matter of adding a one-liner to a project's Rakefile:

Chusaku.load_tasks

Users will need to update their Gemfile such that Chusaku isn't being required with the require: false flag:

# BAD
gem "chusaku", require: false

# GOOD
gem "chusaku"
nshki commented 9 months ago

Thanks for taking a look! I've confirmed that the Rake task works with the same CLI flags and that it works in all the common forms:

bin/rake chusaku -- --dry-run
bundle exec rake chusaku -- --dry-run
rake chusaku -- --dry-run

If you don't mind giving this a whirl on your local machine tomorrow, that would be fantastic.

nshki commented 9 months ago

Thank you for the thorough review, @G-Rath! Happy to ship this with the fix you suggested.

Also, thank you for pointing out the weirdness in the output especially when it's next to Annotate's output. Will set aside some time when possible for that, but if you'd like to make a PR, you are more than welcome to!