Commit df43ced1cdf8d87240b2d2d9335f0cd694cd161d
1 parent
aec9f919
Exists in
master
and in
29 other branches
ActionItem261: flushing after '.'
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2015 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
9 additions
and
4 deletions
Show diff stats
script/fbes_populate_helper.rb
1 | 1 | require File.dirname(__FILE__) + '/../config/environment' |
2 | 2 | |
3 | - STATES = { | |
3 | +STATES = { | |
4 | 4 | 12 => Region.find_by_name('Acre'), |
5 | 5 | 27 => Region.find_by_name('Alagoas'), |
6 | 6 | 13 => Region.find_by_name('Amazonas'), |
... | ... | @@ -30,17 +30,22 @@ require File.dirname(__FILE__) + '/../config/environment' |
30 | 30 | 17 => Region.find_by_name('Tocantins'), |
31 | 31 | } |
32 | 32 | |
33 | +def step | |
34 | + print '.' | |
35 | + $stdout.flush | |
36 | +end | |
37 | + | |
33 | 38 | def new_cat(name, parent = nil) |
34 | 39 | path = (parent ? parent.path + '/' : '') + name.to_slug |
35 | 40 | pc = ProductCategory.find_by_path(path) || ProductCategory.create!(:name => name, :parent => parent, :environment => Environment.default) |
36 | - print '.' | |
41 | + step | |
37 | 42 | pc |
38 | 43 | end |
39 | 44 | |
40 | 45 | def new_region(name, parent, lat, lng) |
41 | 46 | path = (parent ? parent.path + '/' : '') + name.to_slug |
42 | 47 | region = Region.find_by_path(path) || Region.create!(:name => name, :parent => parent, :lat => lat, :lng => lng, :environment => Environment.default) |
43 | - print '.' | |
48 | + step | |
44 | 49 | region |
45 | 50 | end |
46 | 51 | |
... | ... | @@ -59,5 +64,5 @@ require File.dirname(__FILE__) + '/../config/environment' |
59 | 64 | consumptions.each do |c| |
60 | 65 | ent.consumptions.create!(c) unless ent.consumptions.find(:first, :conditions => c) |
61 | 66 | end |
62 | - print '.' | |
67 | + step | |
63 | 68 | end | ... | ... |