From 5133b894b2f3f8e817054421728bd16a9a5dcf03 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Thu, 8 Feb 2024 22:18:12 +0300 Subject: Add method for commiting changes to the gn-docs git repo. Signed-off-by: Munyoki Kilyungi --- examples/dataset-metadata-git.scm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/examples/dataset-metadata-git.scm b/examples/dataset-metadata-git.scm index 3be4cdb..371d844 100755 --- a/examples/dataset-metadata-git.scm +++ b/examples/dataset-metadata-git.scm @@ -6,8 +6,7 @@ (srfi srfi-26) ((ice-9 regex) #:select (regexp-substitute/global)) ((transform strings) #:select (string-blank?)) - ((transform sql) #:select (call-with-target-database sql-for-each)) - ((transform triples) #:select (string->identifier))) + ((transform sql) #:select (call-with-target-database sql-for-each))) (define (save-file file result) (when result @@ -57,6 +56,16 @@ ("experiment-design.rtf" . ,experiment-design) ("acknowledgment.rtf" . ,acknowledgment))))) +(define* (commit-changes + directory + #:optional (commit-message "Update dataset RTF Files.")) + (chdir directory) + (system "git reset --hard origin") + (system "git pull") + (system "git add .") + (system (format #f "git commit -m ~s" commit-message)) + (system "sudo git push /home/git/public/gn-docs")) + (let* ((option-spec '((settings (single-char #\s) (value #t)))) (options (getopt-long (command-line) option-spec)) @@ -64,14 +73,16 @@ (query "SELECT InfoPageName, Datasets.Summary, Datasets.AboutTissue, InfoFiles.Specifics, Datasets.AboutCases, Datasets.AboutPlatform, Datasets.AboutDataProcessing, Datasets.Notes, Datasets.ExperimentDesign, Datasets.Acknowledgment -FROM InfoFiles LEFT JOIN Datasets USING (DatasetId) LIMIT 2") +FROM InfoFiles LEFT JOIN Datasets USING (DatasetId)") (%connection-settings (call-with-input-file settings read))) - ;; TODO (call-with-target-database %connection-settings (lambda (db) (sql-for-each infopages/sql->rtf db - query)))) + query) + (commit-changes "/export/data/genenetwork/gn-docs/datasets/")))) + + -- cgit v1.2.3