Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Rake tasks to make working with Rails apps a bit easier.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
tasks
CHANGES
MIT-LICENSE
README.rdoc

README.rdoc

LazyDeveloper

Copyright (C) 2007-2009 Brian P. Hogan and Kevin Gisi

Developers are lazy. I know I am. If I have to do things over and over, I want them to be automated. Maybe that's efficient and not lazy. However, lazy is a shorter word and it's funnier to call this plugin LazyDeveloper.

This plugin provides some useful Rake tasks that will make your life a little easier. I use them in many of my projects and I invite you to do the same.

Usage

Databases

rake db:migrate

Everyone I know forgets to clone the test database when they make changes, so I decided to override rake:db:migrate so that when you run it, it automatically clones the test database, which is really useful if you run tests individually via TextMate or through the command line.

rake db:migrate
rake db:migrate:up
rake db:migrate:down

are all supported.

rake db:remigrate

Sometimes you just need to wipe out your database tables and start over. This task drops your tables and starts over by dropping the tables directly and then re-running your migrations. This provides a great way to test to make sure you haven't broken migrations at some point, which will happen to you at some point.

rake db:to_yaml (formerly rake:db:import)

Dump your database to fixtures. Stores them in RAILS_ROOT/production_data. You can then use this to load the data back into another database, even one of a different type. We've used this to move data from SQL Server to MySQL and back again.

rake db:from_yaml (formerly rake:db:export)

Load fixtures from RAILS_ROOT/production_data into your database. Loads fixtures dumped by using rake db:export

Subversion

rake svn:root

Displays the root of your repository

rake svn:tags

Displays all the tags. Assumes you use a tags/ folder and a /trunk folder

rake svn:tags:last

Displays the last tag.

rake svn:tag TAG=rel_1-0-0

Creates a new tag from the trunk.

Rcov

Thanks to Kevin Gisi for these tasks that make running RCov a bit easier. Requires the RCov gem and the rails_rcov plugin

rake rcov:models

Runs coverage on your models

rake rcov:controllers

Runs coverage on your controllers

rake rcov:full

Runs coverage on models and controllers

Tests

Based on an idea from Geoffrey Grosenbach, you can run all tests in unitsuser_test.rb by doing

rake test:units:user:all

Or run a specific test by specifying all or part of a name. For example, if I wanted to run the “test_create” test case, I would use

rake test:units:user:create

The same rules apply to functional tests

rake test:functionals:users:list

Specs

RSpec gets some love here. If you need nice output for your specs, we overrode some of the built-in specs.

Running all model specs

rake spec:models

Running all controller specs

rake spec:controllers

Running a specific model or controller spec

rake spec:model:user
rake spec:controller:sessions

Plugins

Create a file in your Home folder called .plugins and you can have all of your favorite plugins easily installed by doing

rake rails:install:plugins

Just put each plugin name or repository on its own line.

Windows users need to set the HOME environment variable.

Cleaning Up

Run

rake rails:clear

to clean up tmp, logs, and docs in one easy command.

Copyright © 2007-2009 Brian Hogan and Kevin Gisi. Released under the MIT license

Something went wrong with that request. Please try again.