Browse Source

Merge pull request #1 from jcolomb/jcolomb-patch-1

Jcolomb patch 1
Julien Colomb 3 years ago
parent
commit
8370833b45
4 changed files with 207 additions and 0 deletions
  1. 4 0
      README.md
  2. 83 0
      datacite.yml
  3. 113 0
      sync
  4. 7 0
      sync.bat

+ 4 - 0
README.md

@@ -19,3 +19,7 @@
 ## Other information
 ## Other information
 
 
 **Note:** This repository follows the Research repository template, v.2.2, see [further information offline](.doc/information.md) or [the online documentation page](https://gin-tonic.netlify.app/).
 **Note:** This repository follows the Research repository template, v.2.2, see [further information offline](.doc/information.md) or [the online documentation page](https://gin-tonic.netlify.app/).
+
+## Synchronisation scripts
+
+Scripts were added to make updates with gin easier, please visit https://github.com/tonic-team/synchronisation_scripts for information about how to use it/them.

+ 83 - 0
datacite.yml

@@ -0,0 +1,83 @@
+# Metadata for DOI registration according to DataCite Metadata Schema 4.1.
+# For detailed schema description see https://doi.org/10.5438/0014
+
+## Required fields
+
+# The main researchers involved. Include digital identifier (e.g., ORCID)
+# if possible, including the prefix to indicate its type.
+authors:
+  -
+    firstname: "Matthew E."
+    lastname: "Larkum"
+    affiliation: "Institut für Biologie, Neurocure Center for Excellence, Chariteplatz 1 / Virchowweg 6, Charité Universitätsmedizin Berlin & Humboldt Universität, Berlin, 10117 Germany."
+    id: "ORCID:0000-0001-9799-2656"
+    role: "Funding acquisition"
+    role: "Project administration"
+    role: "Supervision"
+    role: "Conceptualization"
+  -
+    firstname: "Julien"
+    lastname: "Colomb"
+    affiliation: "Institut für Biologie, Virchowweg 6, Humboldt Universität, Berlin, 10117 Germany."
+    id: "ORCID:0000-0002-3127-5520"
+    role: "Data curation"
+
+
+# A title to describe the published resource.
+title: "Example Title"
+
+# Additional information about the resource, e.g., a brief abstract.
+description: |
+  Example description
+  that can contain linebreaks
+  but has to maintain indentation.
+
+# Lit of keywords the resource should be associated with.
+# Give as many keywords as possible, to make the resource findable.
+keywords:
+  - Neuroscience
+  - Electrophysiology
+
+# License information for this resource. Please provide the license name and/or a link to the license.
+# Please add also a corresponding LICENSE file to the repository.
+license:
+  name: "Creative Commons CC0 1.0 Public Domain Dedication"
+  url: "https://creativecommons.org/publicdomain/zero/1.0/"
+
+
+
+## Optional Fields
+
+# Funding information for this resource.
+# Separate funder name and grant number by comma.
+funding:
+  - "DFG, DFG.2112280105"
+  - "DFG, DFG.LA 3442/3-1"
+  - "DFG, DFG.LA 3442/5-1"
+  - "DFG, DFG.327654276"
+  - "EU, EU.670118"
+  - "EU, EU.720270"
+  - "Einstein Stiftung"
+
+
+# Related publications. reftype might be: IsSupplementTo, IsDescribedBy, IsReferencedBy.
+# Please provide digital identifier (e.g., DOI) if possible.
+# Add a prefix to the ID, separated by a colon, to indicate the source.
+# Supported sources are: DOI, arXiv, PMID
+references:
+  -
+    id: "doi:10.xxx/zzzz"
+    reftype: "IsSupplementTo"
+    name: "PublicationName1"
+  -
+    id: "arxiv:mmmm.nnnn"
+    reftype: "IsSupplementTo"
+    name: "PublicationName2"
+  -
+    id: "pmid:nnnnnnnn"
+    reftype: "IsReferencedBy"
+    name: "PublicationName3"
+
+
+# Resource type. Default is Dataset, other possible values are Software, DataPaper, Image, Text.
+resourcetype: 

+ 113 - 0
sync

@@ -0,0 +1,113 @@
+#!/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
+}
+
+# Set the variable for synchronisation option, see above 
+syncopt="remove"
+
+# Set commit message
+echo "Optionally enter a commit message, and hit return: "  
+read commitmessage 
+
+if [[ "$commitmessage" == "" ]]; then
+        echo "using date as commit message"
+	commitmessage="commit on $(date +%Y-%m-%d)"    
+fi
+
+
+
+# Checking synchronisation option and giving feedback
+checkargs() {
+    case "$1" in
+        download)
+            echo "Downloading and keep all large file content"
+            ;;
+        keep)
+            echo "Keeping existing local large file content, do not downlad extra files"
+            ;;
+        remove)
+            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
+}
+
+# Set folder where script will be executed 
+loc=$(dirname $0)
+projectdir=$(git -C ${loc} rev-parse --show-toplevel)
+
+pushd ${loc} > /dev/null
+# write log
+mkdir -p ./.log
+echo "$(date +'%Y-%m-%dT%H:%M:%S'): Sync script executed" >> ./.log/gin.log
+
+echo "intialise submodules"
+git submodule foreach gin init
+
+echo "Synchronising submodules"
+git submodule foreach gin commit . -m "$commitmessage"
+checkerror $? "Error occurred during 'gin commit'"
+git submodule foreach gin sync
+checkerror $? "Error occurred during 'gin sync'"
+
+git submodule foreach gin upload
+checkerror $? "Error occurred during 'gin upload'"
+
+## remove uploaded (annexed) content
+if [[ "$syncopt" == "remove" ]]; then
+        git submodule foreach gin remove-content 
+        checkerror $? "Error occurred during 'gin remove-content'"
+    fi
+# get annexed content 
+if [[ "${syncopt}" == "download" ]]; then
+        git submodule foreach gin get-content .
+        checkerror $? "Error occurred during 'gin get-content .'"
+    fi    
+
+
+echo "Synchronising main repository"
+
+gin commit . -m "$commitmessage"
+gin sync
+gin upload
+
+# remove uploaded (annexed) content
+if [[ "$syncopt" == "remove" ]]; then
+        gin remove-content 
+        checkerror $? "Error occurred during 'gin remove-content' in main repo"
+    fi
+# get annexed content 
+if [[ "${syncopt}" == "download" ]]; then
+        gin get-content .
+        checkerror $? "Error occurred during 'gin get-content . in main repo'"
+    fi   

+ 7 - 0
sync.bat

@@ -0,0 +1,7 @@
+:: this script should run the sync bash script on windows, once cygwin has been installed
+
+set curdir=%~dp0
+
+C:\cygwin64\bin\bash -l %curdir%sync.sh
+
+pause