Quickly and easily create seed data for your ruby application. Names, first and last, female and male. Randomly generate users with appropriate names and matching email addresses.
It works by combining a couple of lists of names and providing a simple way to retrieve personas.
Using bundler just
gem install babynames
Then you are good to go
person = BabyNames.person User.create(:first_name => person.first_name, :last_name => person.last_name, :email => person.email, :male => person.male?)
Tested with 1.8.7, 1.9.2, 1.9.3. Should work on most others too.
Making it repeatable with seeds
If you want to make sure that the seed data is always the same when run (still random, but the same random sequence when rerun) you can keep the seed number and use it again
BabyNames.seed 3890 BabyNames.name "Thelma" BabyNames.name "Ronnie" BabyNames.name "Joanna" BabyNames.seed(3890) 3890 BabyNames.name "Thelma" BabyNames.name "Ronnie" BabyNames.name "Joanna"
> require "rubygems" => true > require "babynames" => true > BabyNames.name => "Mickey" > BabyNames.female_name => "Valarie" > BabyNames.male_name => "Julius" > BabyNames.persons_name => ["Darin", "Odonnell"] > BabyNames.persons_name(:male) => ["Brad", "Downs"] > BabyNames.persons_name(:female) => ["Karen", "House"] > BabyNames.email => "firstname.lastname@example.org" > BabyNames.email(:male) => "email@example.com" > BabyNames.email(:female) => "firstname.lastname@example.org" > person = BabyNames.person => #<BabyNames::Person:0x100612668 @gender=:male, @middle_name="Carmine", @email="email@example.com", @last_name="Mcdonald", @first_name="Edwin"> > person.first_name => "Edwin" > person.last_name => "Mcdonald" > person.email => "firstname.lastname@example.org" > person.middle_name => "Carmine" > person.male? => true > person.female? => false
Contributing to babynames
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
- Fork the project
- Start a feature/bugfix branch
- Commit and push until you are happy with your contribution
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright (c) 2011 Jordan Carter. See LICENSE.txt for further details.