diff --git a/script/sample-data b/script/sample-data new file mode 100755 index 0000000..5db90d6 --- /dev/null +++ b/script/sample-data @@ -0,0 +1,44 @@ +#!/usr/bin/env ruby +require File.dirname(__FILE__) + '/../config/environment' + +people = [] + +NAMES = %w[ José João Antonio Paulo Maria Joana Paula Angela ] +SURNAMES = %w[ Silva Santos Abreu Oliveira Machado Bonfim ] +User.destroy_all +print "Creating users: " +for name in NAMES + for surname in SURNAMES + full_name = [name, surname].join(' ') + user = User.create!( + :login => full_name.to_slug, + :email => full_name.to_slug + '@localhost.localdomain', + :password => 'test', + :password_confirmation => 'test' + ) + user.person.name = full_name + user.person.save! + people << user.person + + print '.'; $stdout.flush + end +end +puts + +VERBS = ['Save', 'I like', 'I hate', 'Use'] +STUFF = ['Free Software', 'Organic food', 'the wales', 'the environment', 'Barack Obama', 'Osama Bin Laden', 'Lula'] +Community.destroy_all +print "Creating communities: " +for verb in VERBS + for stuff in STUFF + name = [verb, stuff].join(' ') + community = Community.create!(:name => name) + rand(10).times do + community.add_member(people.rand) + end + print '.'; $stdout.flush + end +end +puts + + -- libgit2 0.21.2