Commit 924e284ee673173728227632ed2d0f5f5b497784

Authored by Gabriela Navarro
0 parents

Add migrations to change software dates and mirror option for blocks

Signed-off-by: Alexandre Torres <alexandrekry@gmail.com>
Signed-off-by: Brenddon Gontijo <brenddongontijo@msn.com>
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com>
db/migrate/20150720180509_software_release_date.rb 0 → 100644
  1 +++ a/db/migrate/20150720180509_software_release_date.rb
@@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
  1 +class SoftwareReleaseDate < ActiveRecord::Migration
  2 + def up
  3 + softwares = SoftwareInfo.all
  4 + softwares.each do |software|
  5 + if software.community
  6 + name = software.community.name.strip
  7 + software.community.name = name
  8 + software.community.save
  9 + software.community.layout_template = "lefttopright"
  10 + print "." if software.community.save
  11 + boxToMove = software.community.boxes.where(:position => 1).first
  12 + blockToMove = boxToMove.blocks.where(:type => "SoftwareInformationBlock").first
  13 + if blockToMove
  14 + newBox = software.community.boxes.where(:position => 4).first
  15 + blockToMove.box = newBox
  16 + print "." if blockToMove.save
  17 + end
  18 + else
  19 + software.destroy
  20 + end
  21 + end
  22 +
  23 + file = File.new("plugins/spb_migrations/files/date-communities.txt", "r")
  24 + while (line = file.gets)
  25 + result = line.split('|')
  26 + software_name = result[2].gsub("/n", "")
  27 + software = Community.find(:first, :conditions => ["lower(name) = ?", software_name.strip.downcase])
  28 + software.created_at = Time.zone.parse(result[1]) if software
  29 + if software && software.save
  30 + print "."
  31 + else
  32 + print "F"
  33 + puts software_name
  34 + end
  35 + end
  36 + file.close
  37 + puts ""
  38 + end
  39 +
  40 + def down
  41 + end
  42 +end
db/migrate/20150720190133_change_blocks_mirror_option.rb 0 → 100644
  1 +++ a/db/migrate/20150720190133_change_blocks_mirror_option.rb
@@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
  1 +class ChangeBlocksMirrorOption < ActiveRecord::Migration
  2 + def up
  3 + blocks = Block.where(:type => LinkListBlock)
  4 + institution = Community["institution"]
  5 + software = Community["software"]
  6 +
  7 + boxTemplateInstitution = institution.boxes.where(:position => 2).first
  8 +
  9 + boxTemplateInstitution.blocks.each do |block|
  10 + block.mirror = true
  11 + print "." if block.save
  12 + end
  13 +
  14 + boxTemplateSoftware = software.boxes.where(:position => 2).first
  15 +
  16 + boxTemplateSoftware.blocks.each do |block|
  17 + block.mirror = true
  18 + print "." if block.save
  19 + end
  20 +
  21 + blocks.each do |block|
  22 + if !(block.owner.class == Environment) && block.owner.organization? && !block.owner.enterprise?
  23 + if block.owner.software?
  24 + software_block = boxTemplateSoftware.blocks.where(:title => block.title).first
  25 + block.mirror_block_id = software_block.id if software_block
  26 + elsif block.owner.institution?
  27 + institution_block = boxTemplateInstitution.blocks.where(:title => block.title).first
  28 + block.mirror_block_id = institution_block.id if institution_block
  29 + end
  30 + end
  31 + print "." if block.save
  32 + end
  33 + puts ""
  34 + end
  35 +
  36 + def down
  37 + end
  38 +end
files/date-communities.txt 0 → 100644
  1 +++ a/files/date-communities.txt
@@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
  1 + 56443993 | 2012-07-24 09:36:30.348122-03 | Ação
  2 + 9677539 | 2009-03-05 13:45:38.24475-03 | Amadeus
  3 + 10374226 | 2009-04-01 15:02:56.691053-03 | Apoena
  4 + 8265263 | 2008-12-18 08:35:49.864072-02 | ASES
  5 + 10157501 | 2009-03-20 10:56:23.37942-03 | Banco de Talentos
  6 + 3585 | 2007-02-06 12:17:18.221666-02 | CACIC - Configurador Automático e Coletor de Informações Computacionais
  7 + 48535178 | 2012-03-07 10:33:23.788233-03 | CAU - Central de Atendimento ao Usuário
  8 + 98687140 | 2014-01-20 15:20:59.784404-02 | Citsmart
  9 + 11791260 | 2009-06-16 17:13:08.465927-03 | CMS - Controle de Marcas e Sinais
  10 + 133801 | 2007-04-03 16:31:16.047284-03 | Cocar
  11 + 27016128 | 2010-12-07 09:28:26.601182-02 | Cortex
  12 + 3632535 | 2008-04-07 15:34:10.143308-03 | Curupira
  13 + 27886394 | 2010-12-22 14:48:39.54407-02 | Demoiselle
  14 + 42650664 | 2011-10-24 18:08:56.902343-02 | DIM - Dispensação Individualizada de Medicamentos
  15 + 15315976 | 2009-10-09 15:15:52.554301-03 | e-cidade
  16 + 21650445 | 2010-06-11 15:04:50.470888-03 | EdiTom
  17 + 20675454 | 2010-04-28 16:57:25.907169-03 | EducatuX
  18 + 22297303 | 2010-07-19 10:29:05.349868-03 | e-ISS
  19 + 24188584 | 2010-09-03 15:05:17.470815-03 | e-Nota
  20 + 31042 | 2007-03-12 09:47:54.97039-03 | e-Proinfo
  21 + 23731755 | 2010-08-24 12:17:02.069138-03 | ERP5 BR
  22 + 126403824 | 2014-12-08 10:28:11.812721-02 | e-Sic Livre
  23 + 11809545 | 2009-06-17 09:19:30.697619-03 | Fila
  24 + 44509627 | 2011-11-30 16:11:20.487561-02 | FormDin
  25 + 30726269 | 2011-03-25 18:15:38.333798-03 | Geosan
  26 + 20483099 | 2010-04-16 14:53:04.201919-03 | Geplanes
  27 + 33752093 | 2011-05-25 13:08:28.449124-03 | GGAS
  28 + 1101545 | 2007-06-18 15:31:22.060335-03 | Ginga
  29 + 30724784 | 2011-03-25 17:44:11.373481-03 | Gnuteca
  30 + 31574974 | 2011-04-15 15:57:57.260004-03 | gpweb
  31 + 1593449 | 2007-08-30 16:51:38.073906-03 | Gsan - Sistema Integrado de Gestão de Serviços de Saneamento
  32 + 66594611 | 2013-04-23 15:06:59.865025-03 | Guarux
  33 + 1444332 | 2007-08-07 08:15:42.941934-03 | i3GEO
  34 + 6552490 | 2008-09-29 13:26:07.553951-03 | i-Educar
  35 + 626732 | 2007-05-07 14:31:51.222225-03 | InVesalius
  36 + 25913900 | 2010-11-09 15:33:43.132943-02 | Jaguar
  37 + 18068594 | 2010-01-06 16:28:29.99099-02 | Koruja
  38 + 601158 | 2007-05-03 14:49:32.350206-03 | KyaPanel
  39 + 3673574 | 2008-04-09 15:18:24.118203-03 | LightBase
  40 + 11809207 | 2009-06-17 09:18:46.708981-03 | Linux Educacional
  41 + 9022831 | 2009-02-04 15:21:13.18503-02 | MDArte
  42 + 11808514 | 2009-06-17 09:10:36.619105-03 | Minuano
  43 + 60993607 | 2012-11-30 10:37:59.581285-02 | NAVi
  44 + 8566986 | 2009-01-14 14:14:24.306736-02 | OASIS
  45 + 4449 | 2007-02-07 10:23:59.658958-02 | OpenACS
  46 + 12702936 | 2009-07-14 09:56:30.44857-03 | Pandorga GNU/Linux
  47 + 9066433 | 2009-02-06 13:37:26.116692-02 | Prefeitura Livre
  48 + 25956481 | 2010-11-11 11:24:24.2039-02 | Provinha Brasil
  49 + 12815452 | 2009-07-20 15:30:32.189921-03 | PW3270
  50 + 18016032 | 2010-01-05 09:51:29.030808-02 | REDECA
  51 + 30725662 | 2011-03-25 17:59:59.551252-03 | Sagu – gestão acadêmica unificada
  52 + 3695494 | 2008-04-11 10:38:11.361528-03 | Sagui
  53 + 15719494 | 2009-10-20 10:38:37.237684-02 | SGA LIVRE - Sistema de Gerenciamento do Atendimento
  54 + 63022108 | 2013-01-30 11:22:50.327218-02 | SGDoc
  55 + 51261 | 2007-03-23 15:10:36.399602-03 | SGD – Sistema de Gestão de Demandas
  56 + 23369799 | 2010-08-13 14:04:43.562233-03 | SGF - Sistema de Gestão de Frotas
  57 + 93658 | 2007-03-29 08:41:09.667033-03 | Sigati
  58 + 3485513 | 2008-03-26 16:45:51.301379-03 | SIMEC - Sistema Integrado de Planejamento Orçamento e Finanças
  59 + 5482 | 2007-02-09 10:05:23.803077-02 | Sisau-Saci-Contra
  60 + 42365353 | 2011-10-19 16:17:57.49005-02 | SAELE
  61 + 44620010 | 2011-12-05 18:03:30.046532-02 | Sistema de Ouvidoria
  62 + 54650395 | 2012-06-29 15:24:43.920424-03 | SIVAC - Sistema on-line de Vacinação
  63 + 26934301 | 2010-12-02 17:40:23.960186-02 | SNEP PBX IP
  64 + 7283318 | 2008-11-11 14:31:33.260701-02 | SPED - Sistema de protocolo eletrônico
  65 + 51053337 | 2012-04-27 13:49:25.11419-03 | Tucunaré
  66 + 103459100 | 2014-02-17 11:28:47.085822-03 | Urbem CNM
  67 + 5986695 | 2008-09-10 15:26:48.814791-03 | WebIntegrator- Produtividade Java WEB
  68 + 4215419 | 2008-05-21 16:57:49.092527-03 | Xemelê
lib/spb_migrations_plugin.rb 0 → 100644
  1 +++ a/lib/spb_migrations_plugin.rb
@@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
  1 +class SpbMigrationsPlugin < Noosfero::Plugin
  2 +
  3 + def self.plugin_name
  4 + # FIXME
  5 + "SpbMigrationsPlugin"
  6 + end
  7 +
  8 + def self.plugin_description
  9 + # FIXME
  10 + _("A plugin that does this and that.")
  11 + end
  12 +
  13 +end