diff --git a/app/models/communication/website/github_file.rb b/app/models/communication/website/github_file.rb index 9fc025e09dc6d402c084fedcd6c6b6692b3e8a8b..f5da2f81eee59be25c49f2502fa7a366a645c137 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 8b5b676d38c3beea307b3ea8336da0396607aacb..3766374c1aa663522a35360ab948ae858214b637 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