From e27fbf1a95592e2326e40a9ffcda0ede5d3ed0b0 Mon Sep 17 00:00:00 2001 From: Nicolas Bouilleaud Date: Wed, 14 Aug 2019 10:47:04 +0200 Subject: [PATCH] Remove nonworking after_party rake tasks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These tasks mention symbols that have been renamed or removed. (Gestionnaire, Procedure.administrateur (single), or VirusScan.) They won’t be run again. I guess some (most) of the other after_party and rake tasks could be removed too; it’s just that those prevent `rake after_party:run` to execute on a clean install. --- ...ure_administrateur_to_administrateurs.rake | 18 --------------- .../20190425102459_migrate_virus_scans.rake | 22 ------------------- ...administrateurs_for_hidden_procedures.rake | 19 ---------------- ...27142239_enable_secured_login_for_all.rake | 8 ------- ..._purge_unattached_piece_justificative.rake | 21 ------------------ 5 files changed, 88 deletions(-) delete mode 100644 lib/tasks/deployment/20190226101524_add_procedure_administrateur_to_administrateurs.rake delete mode 100644 lib/tasks/deployment/20190425102459_migrate_virus_scans.rake delete mode 100644 lib/tasks/deployment/20190429103024_add_procedure_administrateur_to_administrateurs_for_hidden_procedures.rake delete mode 100644 lib/tasks/deployment/20190627142239_enable_secured_login_for_all.rake delete mode 100644 lib/tasks/deployment/20190701131030_purge_unattached_piece_justificative.rake diff --git a/lib/tasks/deployment/20190226101524_add_procedure_administrateur_to_administrateurs.rake b/lib/tasks/deployment/20190226101524_add_procedure_administrateur_to_administrateurs.rake deleted file mode 100644 index 6843a58e2..000000000 --- a/lib/tasks/deployment/20190226101524_add_procedure_administrateur_to_administrateurs.rake +++ /dev/null @@ -1,18 +0,0 @@ -namespace :after_party do - desc 'Deployment task: add_procedure_administrateur_to_administrateurs' - task add_procedure_administrateur_to_administrateurs: :environment do - rake_puts "Running deploy task: 'add_procedure_administrateur_to_administrateurs'" - procedures = Procedure.includes(:administrateurs) - progress = ProgressReport.new(procedures.count) - - procedures.find_each do |procedure| - if !procedure.administrateurs.include?(procedure.administrateur) - procedure.administrateurs << procedure.administrateur - end - progress.inc - end - - progress.finish - AfterParty::TaskRecord.create version: '20190226101524' - end -end diff --git a/lib/tasks/deployment/20190425102459_migrate_virus_scans.rake b/lib/tasks/deployment/20190425102459_migrate_virus_scans.rake deleted file mode 100644 index e72d6c1ee..000000000 --- a/lib/tasks/deployment/20190425102459_migrate_virus_scans.rake +++ /dev/null @@ -1,22 +0,0 @@ -namespace :after_party do - desc 'Deployment task: migrate_virus_scans' - task migrate_virus_scans: :environment do - puts "Running deploy task 'migrate_virus_scans'" - - virus_scans = VirusScan.all - progress = ProgressReport.new(virus_scans.count) - virus_scans.find_each do |virus_scan| - blob = ActiveStorage::Blob.find_by(key: virus_scan.blob_key) - if blob - metadata = { virus_scan_result: virus_scan.status, scanned_at: virus_scan.scanned_at } - blob.update_column(:metadata, blob.metadata.merge(metadata)) - end - progress.inc - end - progress.finish - - # Update task as completed. If you remove the line below, the task will - # run with every deploy (or every time you call after_party:run). - AfterParty::TaskRecord.create version: '20190425102459' - end -end diff --git a/lib/tasks/deployment/20190429103024_add_procedure_administrateur_to_administrateurs_for_hidden_procedures.rake b/lib/tasks/deployment/20190429103024_add_procedure_administrateur_to_administrateurs_for_hidden_procedures.rake deleted file mode 100644 index 182387bf4..000000000 --- a/lib/tasks/deployment/20190429103024_add_procedure_administrateur_to_administrateurs_for_hidden_procedures.rake +++ /dev/null @@ -1,19 +0,0 @@ -namespace :after_party do - desc 'Deployment task: add_procedure_administrateur_to_administrateurs_for_hidden_procedures' - task add_procedure_administrateur_to_administrateurs_for_hidden_procedures: :environment do - rake_puts "Running deploy task: 'add_procedure_administrateur_to_administrateurs_for_hidden_procedures'" - hidden_procedures = Procedure.unscoped.hidden.includes(:administrateurs) - progress = ProgressReport.new(hidden_procedures.count) - - hidden_procedures.find_each do |procedure| - deprecated_administrateur = Administrateur.find_by(id: procedure.administrateur_id) - if deprecated_administrateur && !procedure.administrateurs.include?(deprecated_administrateur) - procedure.administrateurs << deprecated_administrateur - end - progress.inc - end - - progress.finish - AfterParty::TaskRecord.create version: '20190429103024' - end -end diff --git a/lib/tasks/deployment/20190627142239_enable_secured_login_for_all.rake b/lib/tasks/deployment/20190627142239_enable_secured_login_for_all.rake deleted file mode 100644 index 70120bb96..000000000 --- a/lib/tasks/deployment/20190627142239_enable_secured_login_for_all.rake +++ /dev/null @@ -1,8 +0,0 @@ -namespace :after_party do - desc 'Deployment task: enable_secured_login_for_all' - task enable_secured_login_for_all: :environment do - Gestionnaire.update_all(features: { "enable_email_login_token": true }) - - AfterParty::TaskRecord.create version: '20190627142239' - end -end diff --git a/lib/tasks/deployment/20190701131030_purge_unattached_piece_justificative.rake b/lib/tasks/deployment/20190701131030_purge_unattached_piece_justificative.rake deleted file mode 100644 index 5078b5142..000000000 --- a/lib/tasks/deployment/20190701131030_purge_unattached_piece_justificative.rake +++ /dev/null @@ -1,21 +0,0 @@ -namespace :after_party do - desc 'Deployment task: purge_unattached_piece_justificative' - task purge_unattached_piece_justificative: :environment do - puts "Running deploy task 'purge_unattached_piece_justificative'" - - piece_justificatives = PieceJustificative.where(type_de_piece_justificative_id: nil) - progress = ProgressReport.new(piece_justificatives.count) - piece_justificatives.find_each do |pj| - # detach from dossier to ensure we do not trigger touch - pj.update_column(:dossier_id, nil) - pj.remove_content! - pj.destroy - progress.inc - end - progress.finish - - # Update task as completed. If you remove the line below, the task will - # run with every deploy (or every time you call after_party:run). - AfterParty::TaskRecord.create version: '20190701131030' - end -end