diff --git a/src/noosfero-spb/software_communities/lib/tasks/import_sisp_software.rake b/src/noosfero-spb/software_communities/lib/tasks/import_sisp_software.rake index a70c049..15ec96c 100755 --- a/src/noosfero-spb/software_communities/lib/tasks/import_sisp_software.rake +++ b/src/noosfero-spb/software_communities/lib/tasks/import_sisp_software.rake @@ -3,18 +3,20 @@ namespace :software do desc "Creates SISP software template" task :create_sisp_template => :environment do - # env = Environment.find_by_name("sisp") - env = Environment.default #TODO change this to correct environment + env = Environment.find_by_name("sisp") if env.present? template = Community.where(identifier: "sisp-software", environment_id: env).last + template ||= Community.create!(name: "Sisp Software", identifier: "sisp-software", is_template: true, environment: env) - unless template - template ||= Community.create!(name: "Sisp Software", identifier: "sisp-software", is_template: true, environment: env) + template.boxes.find_by_position(1).blocks = [] + template.boxes.find_by_position(1).blocks << SoftwareInformationBlock.new + template.boxes.find_by_position(1).blocks << SispTabDataBlock.new + template.boxes.find_by_position(1).blocks << OrganizationRatingsBlock.new + template.save! - template.boxes.find_by_position(1).blocks << StatisticBlock.new - template.save! - end + env.community_default_template = template + env.save! end end -- libgit2 0.21.2