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=x
- rake db:migrate:reset
- Resets your database using your migrations for the current environment
- rake 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=n
- rake db:schema:dump
- Create a db/schema.rb file that can be portably used against any DB supported by AR
- rake 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/cache
- rake tmp:clear
- Clear session, cache, and socket files from tmp/
- rake tmp:create
- Creates tmp directories for sessions, cache, and sockets
- rake tmp:pids:clear
- Clears all files in tmp/pids
- rake tmp:sessions:clear
- Clears all files in tmp/sessions
- rake tmp:sockets:clear
- Clears all files in tmp/sockets
- rake notes
- Enumerate all annotations
- rake notes:fixme
- Enumerate all FIXME annotations
- rake notes:optimize
- Enumerate all OPTIMIZE annotations
- rake 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 gems
- rake rails:update
- Update both configs, scripts and public/javascripts from Rails
- rake rails:update:configs
- Update config/boot.rb from your current rails install
- rake rails:update:javascripts
- Update your javascripts from your current rails install
- rake rails:update:scripts
- Add new scripts to the application script/ directory
- rake routes
- Print out all defined routes in match order, with names.
23 février 2008 à 11:57
Saurais-tu comment charger un schema ayant un nom différent de schema.rb avec:
rake db:schema:load
Par exemple:
rake db:schema:load un_autre_schema.rb
ne fonctionne pas
Une idée?
23 février 2008 à 03:59
@Guillaume
Je n’en ai aucune idée. Faudrait regarder le code source de cette tache pour voir si il y a un paramètre possible.