Seed task for projects and platforms

This commit is contained in:
Alexey Nayden 2011-03-10 16:45:19 +03:00
parent 989d228964
commit 1847779319
1 changed files with 14 additions and 0 deletions

View File

@ -15,3 +15,17 @@ TEST_USERS.each do |tuser|
User.create! :name => name, :email => email, :password => pass, :password_confirmation => pass User.create! :name => name, :email => email, :password => pass, :password_confirmation => pass
puts "Created user #{name} (#{email}) and password #{pass}" puts "Created user #{name} (#{email}) and password #{pass}"
end end
TEST_PLATFORMS = %w(cooker Mandriva2010.10 Mandriva2011.4)
TEST_PROJECTS = %w(gcc glibc mysql-dev ruby ruby1.9 mc mesa avrdude vim gvim openssh-server openssh nethack binutils build-essentials rpm rpmtools ffmpeg mkvtoolnix libogg mpg123 openbox openoffice.org)
TEST_PLATFORMS.each do |platform|
p = Platform.find_or_create_by_name(platform)
TEST_PROJECTS.each do |project|
pr = Project.find_or_initialize_by_platform_id_and_name(p.id, project)
puts "#{project} added to #{platform}" if pr.new_record?
pr.save!
end
end