Browse Source

Try to add some documentation and clean script

julien colomb 2 years ago
parent
commit
4e8b5e5a5d

+ 9 - 15
README.md

@@ -5,14 +5,16 @@ Scripts for working with GIN server using the GIN client.
 
 # Bash script for Linux and macOS
 
+The script was only tested in macOS, it is more advanced than the windows script (we are working on its translation).
+
 [sync](./sync): Run from inside a repository to upload any local changes to GIN using the GIN CLI.
 
-- Assumes the repository is already initialised.
-- Does not work with submodules.
+- Assumes the repository is already initialized and you are logged in into gin (via `gin login` or via ssh).
+- work with submodules.
 - Synchronises changes made remotely (on the server) and locally (on the local machine).
-- Does not download large file content by default.
-    - Uncomment lines 40 and 41 to perform a full download at the end of the run.  The line should be `gin get-content .` and the following line should be `checkerror ...`.
-- Double clicking on the file in a file browser should run the script in a terminal.  If the script succeeds, the terminal closes immediately.  If there is an error, it will print an error message and wait for the user to press [Enter] or close the window.
+- Does not download large files and do not delete large files content after upload by default. Change variable `syncopt="remove"` in line 19 to modify this behavior. Current option is download, keep and remove.
+- Double clicking on the file in a file browser should run the script in a terminal. If the script succeeds, the terminal closes immediately.  If there is an error, it will print an error message and wait for the user to press [Enter] or close the window.
+- You may need to make the script an executable: open a terminal window in your repository folder (right-click -- New Terminal at folder) and run `chmod +x sync`. This needs only to be done once.
 
 
 # Batch script for Windows
@@ -32,14 +34,6 @@ _**Note**: This script has not been fully tested yet_
 
 The [old](./old) directory contains old upload scripts that were written while testing different use cases.  They shouldn't be used in their current state, but they may be useful for the future.
 
-# deprecated: TONIC development
-After working on bash script to create new repositories and submodules, for example with: 
-
-```
-sh create_researchrepo organisation projectname projectteam 
-projectteam is optional
+# initiation scripts
 
-example:
-sh create_researchrepo gin4rri testproject testproject 
-```
-We are working on TONIC, an application that will expand GIN functionalities to create research organisation and research repositories from templates. The documentation is visible in [tonic-PLAN](tonic-PLAN.md)
+This folder contain scripts to initialize your computer to work with particular gin instance.

+ 0 - 11
initiation_scripts/SFB1315-portal-initialisation.bat

@@ -1,11 +0,0 @@
-
-:: this script set gin to work with SFB1315 data portal GIN-Tonic instance.
-
-:: add server, named hu
-gin add-server --web https://gindata.biologie.hu-berlin.de:443 --git git@gindata.biologie.hu-berlin.de:10022 hu
-
-:: chose hu server for this computer
-gin use-server hu
-
-:: login to the data portal
-gin login

+ 0 - 11
initiation_scripts/SFB1315-portal-initialisation.command

@@ -1,11 +0,0 @@
-#!/usr/bin/env bash
-# this script set gin to work with SFB1315 data portal GIN-Tonic instance.
-
-# add server, named hu
-gin add-server --web https://gindata.biologie.hu-berlin.de:443 --git git@gindata.biologie.hu-berlin.de:10022 hu
-
-# chose hu server for this computer
-gin use-server hu
-
-# login to the data portal
-gin login

+ 7 - 5
sync

@@ -4,7 +4,6 @@
 # Works with submodules.
 # Assumes gin init was performed or the repository was downloaded via gin get
 
-
 usage() {
     echo "$0 <sync-option>"
     echo
@@ -16,10 +15,10 @@ usage() {
     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 
 
@@ -30,7 +29,7 @@ fi
 
 
 
-
+# Checking synchronisation option and giving feedback
 checkargs() {
     case "$1" in
         download)
@@ -63,11 +62,12 @@ checkerror() {
     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
 
@@ -82,6 +82,7 @@ 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 
@@ -99,6 +100,7 @@ echo "Synchronising main repository"
 gin commit . -m "$commitmessage"
 gin sync
 gin upload
+
 # remove uploaded (annexed) content
 if [[ "$syncopt" == "remove" ]]; then
         gin remove-content