Commit 003bfdd8c1f1798997b0d8585694cdfe6a13d126

Authored by Gabriel Silva
1 parent e8fdb715

Finishing SISP software template

Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com>
src/noosfero-spb/software_communities/lib/tasks/import_sisp_software.rake
@@ -3,18 +3,20 @@ @@ -3,18 +3,20 @@
3 namespace :software do 3 namespace :software do
4 desc "Creates SISP software template" 4 desc "Creates SISP software template"
5 task :create_sisp_template => :environment do 5 task :create_sisp_template => :environment do
6 - # env = Environment.find_by_name("sisp")  
7 - env = Environment.default #TODO change this to correct environment 6 + env = Environment.find_by_name("sisp")
8 7
9 if env.present? 8 if env.present?
10 template = Community.where(identifier: "sisp-software", environment_id: env).last 9 template = Community.where(identifier: "sisp-software", environment_id: env).last
  10 + template ||= Community.create!(name: "Sisp Software", identifier: "sisp-software", is_template: true, environment: env)
11 11
12 - unless template  
13 - template ||= Community.create!(name: "Sisp Software", identifier: "sisp-software", is_template: true, environment: env) 12 + template.boxes.find_by_position(1).blocks = []
  13 + template.boxes.find_by_position(1).blocks << SoftwareInformationBlock.new
  14 + template.boxes.find_by_position(1).blocks << SispTabDataBlock.new
  15 + template.boxes.find_by_position(1).blocks << OrganizationRatingsBlock.new
  16 + template.save!
14 17
15 - template.boxes.find_by_position(1).blocks << StatisticBlock.new  
16 - template.save!  
17 - end 18 + env.community_default_template = template
  19 + env.save!
18 end 20 end
19 end 21 end
20 22