...collected together and baked to perfection, ready to serve!
Rake-n-Bake is a collection of widely applicable Rake tasks used on many projects. They have been extracted into a gem to allow them to easily be reused and maintained.
Rake-n-Bake tasks are used on the project itself, so you can always take a peek at our Rakefile or the tasks themselves to work out what is going on
Either:
- Add
gem "rake-n-bake"
to your Gemfile and run bundle install.
or
- Run
gem install rake-n-bake
- Add
require "rake-n-bake"
to your Rakefile - Call the tasks that you want, just as with your usual Rake tasks (examples below!).
For example:
require "rake-n-bake"
task :default => %i[
clean
bake:rubocop
bake:rspec
bake:coverage:check_specs
bake:bundle-audit
bake:rubycritic
bake:ok_rainbow
]
Tasks are namespaced under :bake
to prevent clashes. For example, the :ok
task is called by invoking :bake:ok
For a definitive list, run rake -D
to see all Rake tasks.
You could also see only the Rake-n-Bake tasks by running rake -D | grep -A3 'bake'
.
Below are some highlights of the tasks added.
Each can be invoked with rake bake<task name>
, for example rake bake:brakeman
Run Brakeman to look for security issues on a Rails project
Check the current Gemfile.lock for gem versions with known security issues, courtesy of Bundler Audit
Check that each command in the @external_dependencies
array is present on the system path (and fails the task if it isn't)
For example:
@external_dependencies = ['ruby', 'postgres', 'foo']
You can also use the underlying checker object by creating an instance of RakeNBake::DependencyChecker
with your array of dependencies and calling #check
or #missing
on it.
Look at SimpleCov results for spec coverage in log/coverage/spec
and fail the build if not 100%
Look at SimpleCov results for Cucumber coverage in log/coverage/features
and fail the build if not 100%
Run the fasterer tool to spot performance improvements in your code
Useful at the end of any Rake tasks which test your application, it prints ***** ALL TESTS PASSED *****
.
Run this task last to print a more magical version of :ok
Run this task to run the Rails Best Practices metrics against your Rails project.
Run all the tests in the spec directory with rspec
Run all the specs not in a features or integration directory
Run all the specs in the integration directory
Run all the specs in the requests directory
Run all the specs in the features directory
Run all the specs tagged using mytag: true
Runs Rubocop over the project and lists violations/warnings
Runs the RubyCritic tool and generates a report about the health of your code
Runs Traceroute, a tool for finding unused routes within Rails apps
Runs the yarn integrity check Yarn
Runs the yarn test
- All tasks loaded by
lib/rake_n_bake.rb
will have access to theRakeNBake::Baker
. This is intended for truely common things, like logging out when a particular step runs or passes.
- Make a fork
- Make your changes!
a. Namespace new tasks under
:bake
b. Namespace new helpers underRakeNBake
- Push your changes to your fork
- Create a Pull Request