From b29719e00d212cb90be368ef6ba92231d1f45983 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Tue, 25 Sep 2007 20:53:13 +0000 Subject: [PATCH] ActionItem65: populating anhetegua sample data --- script/anhetegua | 24 ++++++++++++++++++++++++ script/populate | 2 ++ script/reset_db | 1 + 3 files changed, 27 insertions(+), 0 deletions(-) create mode 100644 script/anhetegua diff --git a/script/anhetegua b/script/anhetegua new file mode 100644 index 0000000..e68a452 --- /dev/null +++ b/script/anhetegua @@ -0,0 +1,24 @@ +#!/usr/bin/env ruby +require File.dirname(__FILE__) + '/../config/environment' + +Environment.default.categories.destroy_all + +def new_category(parent, name, color = nil) + category = Environment.default.categories.build(:name => name, :display_color => color, :parent_id => (parent ? parent.id: nil)) + category.save! + category +end + +tematicas = new_category(nil, 'Temáticas', 1) +new_category(tematicas, 'Finanças Solidárias') +new_category(tematicas, 'Marco Legal') +new_category(tematicas, 'Software Livre') + +territorios = new_category(nil, 'Territórios', 2) +new_category(territorios, 'Bahia') +new_category(territorios, 'Distrito Federal') +new_category(territorios, 'Rio Grande do Sul') + +cadeias = new_category(nil, 'Cadeias', 3) +new_category(cadeias, 'Algodão') +new_category(cadeias, 'Tecnologia de Informação') diff --git a/script/populate b/script/populate index de782fc..9c7e03d 100755 --- a/script/populate +++ b/script/populate @@ -5,3 +5,5 @@ User.create!(:login => 'testprofile', :email => 'admin@example.com', :password = User.create!(:login => 'user', :email => 'user@example.com', :password => 'user', :password_confirmation => 'user') User.create!(:login => 'usuario', :email => 'usuario@example.com', :password => 'usuario', :password_confirmation => 'usuario') User.create!(:login => 'ze', :email => 'ze@example.com', :password => 'test', :password_confirmation => 'test') + + diff --git a/script/reset_db b/script/reset_db index 701a8f7..fd8d69f 100755 --- a/script/reset_db +++ b/script/reset_db @@ -5,3 +5,4 @@ system "rm #{RAILS_ROOT}/tmp/*.db" system "rake db:migrate VERSION=0" system "rake db:migrate" system "ruby #{RAILS_ROOT}/script/populate" +system "rake db:test:prepare" -- libgit2 0.21.2