Browse Source

gin commit from MacBook-Pro-4

New files: 4
julien colomb 3 years ago
parent
commit
e8f66c0655
4 changed files with 137 additions and 0 deletions
  1. 3 0
      06_disseminations/Readme_disseminations.md
  2. 34 0
      README.md
  3. 1 0
      log/gin.log
  4. 99 0
      sync

+ 3 - 0
06_disseminations/Readme_disseminations.md

@@ -0,0 +1,3 @@
+# Res-repo-template_2_0
+
+Template for research repositories, submodules indicated in readme.

+ 34 - 0
README.md

@@ -0,0 +1,34 @@
+# This repository follows the Research repository template, v.2.1, https://doi.org/10.5281/zenodo.3987767.
+
+(.gitkeep empty files were added for empty folders to be uploaded on git platforms)
+
+# Project description
+
+### Abstract:
+
+### list of experiments :
+
+### Contribution
+
+Please use the issue tracking on the gin repository to give feedback.
+
+
+
+
+
+# Cheatsheets about what goes where:
+
+- Prior to data acquisition: 
+    - save all documents related to research planning in the 01-Project_management folder, and update material and methods information as soon as possible. For instance, indicate all information about reagents at the time or purchase. And put any code or variable files created for data acquisition in the 02_material_methods folder.
+
+- Data acquisition and analysis: 
+    - Data is organised first following experiments, make sure to describe every experiment in a readme file and link to the adequate files saved in 02_material_methods.
+    - All files coming directly from your hardware should go in the rawdata folder.
+    - Any file that you want to archive or publish should go in the derivateddata folder. This includes results from manual analysis of the raw data.
+    - Any file created automatically during the analysis and that is easy to recreate should be saved in the processed_data folder: it will not be included in the long term storage or publication of the data.
+    - The 04_data_analysis folder should only include code and documentation of the analysis. If you are using excel to analyse the data, put the files in the processed_data and only add some text describing the analysis in the analysis folder.
+    - The output of your analysis (figures and reproducible reports pdfs) should be saved in the 05_figures or the 06_disseminations/01_report_conferences/01_textreports folders, to facilitates sharing with non-coders.
+
+- Manuscript preparation
+    - Put figures ready for publication in the 05_figures/shared_figures folder
+    - Put the manuscript (or some important versions of it, if using an external tool for writing it) in the 06_disseminations/02_manuscripts folder. Please use full URL to embed figures in the manuscript.

+ 1 - 0
log/gin.log

@@ -0,0 +1 @@
+: Sync script executed

+ 99 - 0
sync

@@ -0,0 +1,99 @@
+#!/usr/bin/env bash
+#
+# Upload changes from inside repository using GIN CLI
+# Works with submodules.
+# Assumes gin init was performed or the repository was downloaded via gin get
+
+
+usage() {
+    echo "$0 <sync-option>"
+    echo
+    echo "<sync-option>     The sync option defines what to do with the content of large files."
+    echo "                  It should be one of the following values:"
+    echo "                     download - Download all large file content from the server"
+    echo "                     keep     - Keep all large file content but do not download missing large files"
+    echo "                     remove   - Do not download large files and remove existing local large file content"
+    exit 1
+}
+
+
+
+syncopt="2"
+
+
+checkargs() {
+    case "$1" in
+        0)
+            echo "Downloading and keep all large file content"
+            ;;
+        1)
+            echo "Keeping existing local large file content, do not downlad extra files"
+            ;;
+        2)
+            echo "Removing all local large file content"
+            ;;
+        *)
+            usage
+            ;;
+    esac
+}
+
+checkargs "${syncopt}"
+
+checkerror() {
+    err=$1
+    msg=$2
+    if [[ ${err} != 0 ]]; then
+        echo "${msg}" >> ./log/gin.log
+	echo "${err}" >> ./log/gin.log
+        echo "${msg}"
+        echo "Press [Enter] to close this window"
+        read -r
+        exit 1
+    fi
+}
+
+loc=$(dirname $0)
+projectdir=$(git -C ${loc} rev-parse --show-toplevel)
+
+pushd ${loc} > /dev/null
+
+mkdir -p ./log
+echo "$(date -r seconds): Sync script executed" >> ./log/gin.log
+
+echo "Synchronising submodules"
+git submodule foreach gin sync
+checkerror $? "Error occurred during 'gin sync'"
+git submodule foreach gin commit .
+checkerror $? "Error occurred during 'gin commit'"
+git submodule foreach gin upload
+checkerror $? "Error occurred during 'gin upload'"
+## remove uploaded (annexed) content
+if [[ "$syncopt" > 1 ]]; then
+        git submodule foreach gin remove-content 
+        checkerror $? "Error occurred during 'gin remove-content'"
+    fi
+# get annexed content 
+if [[ "${syncopt}" <1 ]]; then
+        git submodule foreach gin get-content .
+        checkerror $? "Error occurred during 'gin get-content .'"
+    fi    
+
+
+echo "Synchronising main repository"
+gin sync
+gin commit .
+gin upload
+# remove uploaded (annexed) content
+if [[ "$syncopt" > 1 ]]; then
+        gin remove-content 
+        checkerror $? "Error occurred during 'gin remove-content' in main repo"
+    fi
+# get annexed content 
+if [[ "${syncopt}" <1 ]]; then
+        gin get-content .
+        checkerror $? "Error occurred during 'gin get-content . in main repo'"
+    fi   
+
+
+