Mémo Rake
Rake est un outil puissant et extensible, distribué avec Rails. Il permet d’automatiser toutes sortes d’actions. En voici un rappel de quelques unes peu citées dans les tutorial commun mais pour autant très utiles :
rake db:migrate:redo
Rollbacks the database one migration and re migrate up. If you want to rollback more than one step, define STEP=xrake db:migrate:reset
Resets your database using your migrations for the current environmentrake db:reset
Drops and recreates the database from db/schema.rb for the current environment.rake db:rollback
Rolls the schema back to the previous version. Specify the number of steps with STEP=nrake db:schema:dump
Create a db/schema.rb file that can be portably used against any DB supported by ARrake db:schema:load
Load a schema.rb file into the database
rake log:clear
Truncates all *.log files in log/ to zero bytes
rake tmp:cache:clear
Clears all files and directories in tmp/cacherake tmp:clear
Clear session, cache, and socket files from tmp/rake tmp:create
Creates tmp directories for sessions, cache, and socketsrake tmp:pids:clear
Clears all files in tmp/pidsrake tmp:sessions:clear
Clears all files in tmp/sessionsrake tmp:sockets:clear
Clears all files in tmp/sockets
rake notes
Enumerate all annotationsrake notes:fixme
Enumerate all FIXME annotationsrake notes:optimize
Enumerate all OPTIMIZE annotationsrake notes:todo
Enumerate all TODO annotations
rake rails:freeze:edge
Lock to latest Edge Rails or a specific revision with REVISION=X (ex: REVISION=4021) or a tag with TAG=Y (ex: TAG=rel_1-1-0)rake rails:freeze:gems
Lock this application to the current gems (by unpacking them into vendor/rails)rake rails:unfreeze
Unlock this application from freeze of gems or edge and return to a fluid use of system gemsrake rails:update
Update both configs, scripts and public/javascripts from Railsrake rails:update:configs
Update config/boot.rb from your current rails installrake rails:update:javascripts
Update your javascripts from your current rails installrake rails:update:scripts
Add new scripts to the application script/ directory
rake routes
Print out all defined routes in match order, with names.