AmbitiousSeeder

Very, very alpha version of gem to add seeds to rails app. At the moment this is very much something I can use - which I may make a bit more production friendly in the future.

Installation

This gem only works with Rails 3. To install, add it to your gemfile:

gem 'ambitious_seeder'

Seeding

To generate a seed:

rails generate seed [seed_name]

Say your seed_name was 'rooms', this will create a seed at:

[app-root]/db/seeds/rooms_seeds.rb

You can add any logic to this file that would work elsewhere in your rails app.

To run, go with:

rake db:seed:up

Once run, this seed cannot be run again - you'll need to reverse it and then run it another time :)

To reverse, try:

rake db:seed:down SEED=[seed_name]

To get a list of all available seeds:

rake db:seed:list

Upcoming features

Stuff I guess I'll need, and notes:

  • Provision in generator to stop duplicated seeds
  • Probably need the ability to depend on a certain version of the schema - this can be added when the seed is created?
  • Transactions?
  • Why isn't query logging going to the normal rails logs?
  • Add better information logging to STDOUT

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright (c) 2011 Sam Phillips. See LICENSE for details.

AmbitionIsGood (tm)

Well... it is!