Combine Multiple Rake Commands Without &&
Ordinarily, to successively run commands whose execution depends on the previous command's success, you would separate the commands with two &
's.
This includes rake
commands:
The downside to this, however, is that the Rails
environment is loaded with each rake
invocation. Thus, in this example the Rails
environment is loaded three times.
This is slow. To speed up the process, we can load the Rails
environment just once as follows:
We still run all the tasks but don't have to wait an eternity for Rails
to get its act together and load rake
. Hooray!
Hat-tip @mrmicahcooper
Tweet