Commit adfa080c1741a9d26a0126c18c4bc082bfa94b38
1 parent
2c44c7da
Exists in
master
and in
29 other branches
ActionItem1210: script for sample enterprises
Showing
1 changed file
with
24 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +#!/usr/bin/env ruby | ||
2 | +require File.dirname(__FILE__) + '/../config/environment' | ||
3 | + | ||
4 | +groups = ['Associação', 'Empresa Solidária', 'Cooperativa'] | ||
5 | +what = ['de Produção de Alimentos', 'de Serviços', 'de Artesanato', 'de Comercialização'] | ||
6 | +places = ['de Caximbinha do Sul', 'de Bonito', 'de Reviravolta do Serrado'] | ||
7 | + | ||
8 | +start_time = Time.now | ||
9 | + | ||
10 | +groups.each do |group| | ||
11 | + what.each do |production| | ||
12 | + places.each do |place| | ||
13 | + name = [group, production, place].join(' ') | ||
14 | + Enterprise.create!(:name => name, :identifier => name.to_slug, :enabled => false, :foundation_year => (1990..2008).to_a[rand(18)]) | ||
15 | + print "."; $stdout.flush | ||
16 | + end | ||
17 | + end | ||
18 | +end | ||
19 | +puts | ||
20 | + | ||
21 | +EnterpriseActivation.find(:all, :conditions => ['created_at > ?', start_time]).each do |activation| | ||
22 | + enterprise = activation.enterprise | ||
23 | + puts [activation.code, enterprise.name, enterprise.foundation_year].join(';') | ||
24 | +end |