Showing posts with label rake. Show all posts
Showing posts with label rake. Show all posts
Tuesday, April 29, 2008
Databse Migrations using Rake without Rails
Database migrations can be a pain, it is for me anyway when I have to fire up an SQL window and execute commands (I'm lazy). Having used Ruby on Rails for a previous project I came across the command 'rake db:migrate' and loved how the creating of tables, columns and altering of those were reduced to Ruby code which is much easier to read and execute. I wanted to find a way to use that command on a project that wasn't using Rails. I found an excellent post on the subject, but I tweaked it slightly.
Tuesday, January 08, 2008
Using custom rake tasks in your Rails build
With Rails you can create custom Rake tasks (I recommend reading RailsEnvy for a tutorial for rake tasks).
Once you've got your task you can use it in your Rails build by adding the following line to your Rakefile in the Rails base directory:
Rake::Task['namespace:your_rake_task'].invoke
Easy enough, but took me long enough to find it! Now when you run 'rake' in your rails projects, your custom tasks will be executed. Cool eh? Good for copying dependences and such.
Once you've got your task you can use it in your Rails build by adding the following line to your Rakefile in the Rails base directory:
Rake::Task['namespace:your_rake_task'].invoke
Easy enough, but took me long enough to find it! Now when you run 'rake' in your rails projects, your custom tasks will be executed. Cool eh? Good for copying dependences and such.
Subscribe to:
Posts (Atom)