Commit 82f42c57a593ce0b9bd08b57b1c4a15e60323d50

Authored by Gabriel Silva
1 parent 1f3009e0

Adds a task to create the SISP software template

Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com>
Signed-off-by: Tallys Martins <tallysmartins@yahoo.com.br>
src/noosfero-spb/software_communities/lib/tasks/import_sisp_software.rake
1 1 # encoding: UTF-8
2 2  
3 3 namespace :software do
  4 + desc "Creates SISP software template"
  5 + task :create_sisp_template => :environment do
  6 + env = Environment.find_by_name("sisp")
  7 +
  8 + if env.present?
  9 + template = Community.where(identifier: "software", environment_id: env).last
  10 + template ||= Community.create!(name: "Software", identifier: "software", is_template: true, environment: env)
  11 +
  12 + template.boxes.find_by_position(1).blocks << StatisticBlock.new
  13 + template.save!
  14 + end
  15 + end
  16 +
4 17 desc "Import sisp software from yml"
5 18 task :import_sisp_from_yml => :environment do
6 19 $imported_data = YAML.load_file('script/sisp-catalogo.yml')
... ...