From 8fe308c1397e792778769a1c391b4b9c1a43db8d Mon Sep 17 00:00:00 2001 From: nelson Date: Fri, 7 Feb 2025 12:51:00 -0800 Subject: [PATCH] chore: add documentation to rake commands --- lib/tasks/data.rake | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lib/tasks/data.rake b/lib/tasks/data.rake index 90008e0d..6015a2ad 100644 --- a/lib/tasks/data.rake +++ b/lib/tasks/data.rake @@ -1,4 +1,13 @@ namespace(:data) do + # locally + # bundle exec rake data:load_survey_responses + + # on heroku staging environment + # heroku run:detached -a mciea-beta bundle exec rake data:load_survey_responses + + # on heroku production environment + # heroku run:detached -a mciea-dashboard bundle exec rake data:load_survey_responses + desc("load survey responses") task(load_survey_responses: :environment) do survey_item_response_count = SurveyItemResponse.count @@ -15,6 +24,17 @@ namespace(:data) do Rails.cache.clear end + # Usage: + # SFTP_PATH=/data/survey_responses/clean/2022_23 bundle exec rake data:load_survey_responses_from_path + # You can also swap the order of the commands and environment variables + # bundle exec rake data:load_survey_responses_from_path SFTP_PATH=/ecp/data/survey_responses/clean/2024_25 + + # on heroku staging environment + # heroku run:detached -a mciea-beta SFTP_PATH=/ecp/data/survey_responses/clean/2024_25 bundle exec rake data:load_survey_responses_from_path + + # on heroku production environment + # heroku run:detached -a mciea-dashboard SFTP_PATH=/ecp/data/survey_responses/clean/2024_25 bundle exec rake data:load_survey_responses_from_path + desc("load survey responses from a specific directory") task(load_survey_responses_from_path: :environment) do survey_item_response_count = SurveyItemResponse.count @@ -31,6 +51,15 @@ namespace(:data) do Rails.cache.clear end + # locally + # $ bundle exec rake data:load_admin_data + + # on heroku staging environment + # $ heroku run:detached -a mciea-beta bundle exec rake data:load_admin_data + + # on heroku production environment + # $ heroku run:detached -a mciea-dashboard bundle exec rake data:load_admin_data + desc("load admin_data") task(load_admin_data: :environment) do original_count = AdminDataValue.count