From 60bde73e2bfa93b01931981f107462db45fa00fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com> Date: Thu, 9 Dec 2021 15:10:45 +0100 Subject: [PATCH] commit message + app fix --- .../communication/website/github_file.rb | 4 +-- lib/tasks/app.rake | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/app/models/communication/website/github_file.rb b/app/models/communication/website/github_file.rb index 9fc025e09..f5da2f81e 100644 --- a/app/models/communication/website/github_file.rb +++ b/app/models/communication/website/github_file.rb @@ -104,11 +104,11 @@ class Communication::Website::GithubFile < ApplicationRecord end def github_commit_message - "[#{about.class.name.demodulize}] Save #{about.to_s}" + "[#{about.class.name.demodulize} - #{manifest_identifier}] Save #{about.to_s}" end def github_remove_commit_message - "[#{about.class.name.demodulize}] Remove #{about.to_s}" + "[#{about.class.name.demodulize} - #{manifest_identifier}] Remove #{about.to_s}" end def github_blob_remove_commit_message(blob) diff --git a/lib/tasks/app.rake b/lib/tasks/app.rake index 8b5b676d3..3766374c1 100644 --- a/lib/tasks/app.rake +++ b/lib/tasks/app.rake @@ -17,6 +17,34 @@ namespace :app do website.update_column(:url, "https://#{website.url}") unless website.url.blank? || website.url.starts_with?('https://') } + [ + Communication::Website::Author, Communication::Website::Category, + Communication::Website::Home, Communication::Website::Menu, + Communication::Website::Page, Communication::Website::Post + ].each do |model| + model.includes(:website).find_each do |object| + object.github_manifest.each do |manifest_item| + Communication::Website::GithubFile.where(website: object.website, about: object, manifest_identifier: manifest_item[:identifier]).first_or_create do |github_file| + github_file.github_path = object.github_path if manifest_item[:identifier] == 'primary' + end + end + end + end + + [ + Education::Program, Education::School, Education::Teacher, + Research::Journal::Article, Research::Journal::Volume, Research::Researcher + ].each do |model| + model.includes(:websites).find_each do |object| + object.websites.each do |website| + object.github_manifest.each do |manifest_item| + Communication::Website::GithubFile.where(website: website, about: object, manifest_identifier: manifest_item[:identifier]).first_or_create do |github_file| + github_file.github_path = object.github_path_generated if manifest_item[:identifier] == 'primary' + end + end + end + end + end end namespace :db do -- GitLab