I'm trying to better understand how rake
works. I've looked on the rake website to see how it works but there isn't a clear explanation for how rake
searches for Rakefiles and the steps it goes through in resolving dependencies. Can someone explain how rake
works?
相关问题
- Rake custom arguments for all tasks?
- how to detect if --quiet option is specified with
- Rake aborted! Don't know how to build task
- Testing a rake task with passed parameters in rspe
- Rake Default Task and Namespaces
相关文章
- Rails: rake db:test:prepare Vs rake test:prepare
- Rails 3 > Rendering views in rake task
- Rake Task: error handling
- Why does a Rake task in a loop execute only once?
- rails s: Could not find rake-10.4.2 in any of the
- Call methods from a task in Rake files
- already initialized constant RUBY: heroku rake db:
- rake / rails .save! not updating database
By default
rake
will look for one of these files under the directory you execute it from:You can look at Rake's Application docs to see this list
Additionally, any ruby file including other rakefiles can be included with a standard Ruby
require
command:alternatively, you can
import
them:To make a set of Rake tasks available for use from any directory, create a
.rake
subdirectory within your home directory, and place the appropriate Rake files there. Any rake command with the-g
option will use these global Rake files (read more here):Additionally, if
-g
option is set, Rake will first try to load the files formRAKE_SYSTEM
environment variable, if that is not set, it will default to ahome user directory/.rake/*.rake
. These files will be loaded/imported in addition to one of the default files listed above.Otherwise it will load the first default file (from the above list), and additionally import all the rake files from the
rakelib
directory (under location you runrake
from), OR this directory can be specified using: