Rails on the Run

Rails experiments by Matt Aimonetti

Browsing Posts tagged rake

That’s kind of cool, I was reading a post about DHH Keynote at RailsConf Europe when I realized that DHH mentioned one of my contribution to Rails Edge.

“small, but to me significant improvement has also found its way to Rails 2.0: You can now create the needed databases with a rake command. By running this command, all referenced databases in your database.yml will be created”


rake db:create:all

I’m glad to see that my contribution is appreciated, as a reminder you also have the following options:

Only create your current environment database (can be useful to bootstrap your application):


rake db:create

Another command I use often in development is:


rake db:reset

It simply drops your current environment database, re create it and migrate it :)
(btw, your new database will be utf-8 by default)

Here is a list of the new rake tasks:

1
2
3
4
rake db:create                       # Create the local database defined in config/database.yml for the current RAILS_ENV
rake db:create:all                   # Create all the local databases defined in config/database.yml
rake db:drop                         # Drops the database for the current environment
rake db:reset                         # Drops, creates and then migrates the database for the current environment. Target specific version with VERSION=x

Read DHH Keynote summary there

The Seattle.rb guys did it again! seattle.rb

After releasing the excellent Zentest suite, imageScience, Heckle and much more, Ryan Davis and his crew came back with great news.

From Saturday, August 4th to Tuesday, August 7th, the Ruby Hit Squad was in full effect. After almost 4 days working almost none stop, they released Vlad the Deployer

What’s Vlad?

Some sort of simple and efficient version of Capistrano with simple goals:

  • Do the simplest thing that could possibly work.
  • Nothing to 1.0 in four(ish) days.
  • Targets the 80% use case.
  • Uses Rake, as god intended.
  • Use the right tool for the job (ssh, rsync, etc).
  • Fold in the Rails Machine recipes.
  • Clever is bad. Period.

If you are like me, you love Capistrano and couldn’t imagine working without it, but you also wonder Jamis decided not to extend Rake instead of creating something similar but not really. You would also really appreciate the last objective:

  • Clever is bad. Period.

I didn’t have the opportunity to test it yet, but I have to say that I’m excited to see alternative solutions in the Rails world. I like conventions, but I like having the choice of which conventions I want to follow ;)

Josh knowles and Matt Heidemann from Integrum and I released few weeks a go a cool plugin called rake_tasks

The thing is that the plugin was getting too big when I started hacking the MySQL adapter and adding utf-8 support we figured out it was smarter to split the plugin and create dbtasks and svntasks

I temporarily hosted db_tasks there:

http://svn.aimonetti.net/public/plugins/db_tasks/

ruby script/plugin install http://svn.aimonetti.net/public/plugins/db_tasks/

check your Rake tasks:

  • rake db:create Creates the databases defined in your config/database.yml (unless they already exist) You can also specify the charset and collation you want your dbs to use: rake db:create CHARSET=’latin1′ COLLATION=’latin1_bin’)
  • rake db:drop Drops the database for your currenet RAILS_ENV as defined in config/database.yml
  • rake db:reset Drops, creates and then migrates the database for your current RAILS_ENV
  • rake db:shell Launches the database shell using the values defined in config/database.yml
  • rake db:charset Returns the charset of your current RAILS_ENV database
  • rake db:collation Returns the collation of your current RAILS_ENV database
  • rake db:update_connection_settings add the encoding format to each environment in the database.yml file

By default, your new databases will be utf8, you can automatically create your databases by typing:

rake db:create

or reset your databases (drop, create, migrate)

rake db:reset

Another simple plugin for lazy developers.