From a63e1f5e737c051e90f5312e1f12f067b0b40258 Mon Sep 17 00:00:00 2001 From: matic_t Date: Thu, 9 Jul 2020 07:17:36 -0700 Subject: [PATCH 1/5] gitignore update --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7b10cef..522933c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ __pycache__ build/* !build/Makefile !build/download_structure_conversions.sh - +!build/build_and_upload.sh # using kdev4, works fairly nicely! .kdev4 **/*.kdev4 -- 2.36.5 From 64676f725e30dc69ff992409d7a9013bfb2df1b6 Mon Sep 17 00:00:00 2001 From: matic_t Date: Thu, 9 Jul 2020 07:50:47 -0700 Subject: [PATCH 2/5] build and upload template script --- .gitignore | 2 +- build/build_and_upload.sh.template | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 build/build_and_upload.sh.template diff --git a/.gitignore b/.gitignore index 522933c..8c8a0b3 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ __pycache__ build/* !build/Makefile !build/download_structure_conversions.sh -!build/build_and_upload.sh +!build/build_and_upload.sh.template # using kdev4, works fairly nicely! .kdev4 **/*.kdev4 diff --git a/build/build_and_upload.sh.template b/build/build_and_upload.sh.template new file mode 100755 index 0000000..6537e70 --- /dev/null +++ b/build/build_and_upload.sh.template @@ -0,0 +1,20 @@ +#!/bin/bash + +#USERNAME= vps sign in +#VPS_PASSWORD= vps password +#VPS_USERNAME= user name inside vps +#API_KEY= $(cat path/to/api/token/file) +echo "Must uncomment and fill in variables inside build_and_upload.sh" +exit 1 + + +if [[ -z "$1" ]]; then + echo "Must provide plugin name in environment" 1>&2 + exit 1 +fi + +PLUGIN_NAME=$1 + +API_KEY=$API_KEY make +tar czf - ./config.json ./bundle.js ./local.js ./main.css ./main.html | ssh $USERNAME -p $VPS_PASSWORD "cd plugins && mkdir -p $PLUGIN_NAME && cd $PLUGIN_NAME && tar xvzf -" +ssh -t $USERNAME -p $VPS_PASSWORD "sudo ln -s /home/$VPS_USERNAME/plugins/$PLUGIN_NAME /home/ozbolt/plugins/$PLUGIN_NAME" -- 2.36.5 From c79679719f94fe8da1cf9c38e47a1676d4dec19a Mon Sep 17 00:00:00 2001 From: matic_t Date: Thu, 9 Jul 2020 07:59:14 -0700 Subject: [PATCH 3/5] Readme updated --- README.md | 55 ++++++++++++++++++++++++++---- build/build_and_upload.sh.template | 4 +-- 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 8ff17f2..382546c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,49 @@ -# Build - -To build, you need transcrypt, you need to do npm install and then you need api key for gitea (`token=$API_KEY`), just find this on gitea.cjvt.si, not that hard. - -After you have all of this, move to build folder, set `API_KEY` environment variable and then build it just using `make` or for release use `make release` - optimized javascript build. - -For me its `API_KEY=(cat ~/.gitea_api_key) make`. +**Getting started** + - Prerequisites: + - Installed git, npm + - Installed Python 3.7 as default python3 version + - Gitea account and access to `generic` organization + + - Download transcrypt version that supports -od parameter: + - `git clone https://github.com/QQuick/Transcrypt.git` + - `cd Transcrypt` + - `git checkout remotes/origin/dev_fall_2019` + - `git switch -c dev_fall_2019` + - `python3 setup.py build` + - `python3 setup.py install --user` + - Sometimes it will be found as `transcrpyt -V` and sometimes as `python3 -m transcrypt -V` + + - Get api token for requests to lexonomy structure_conversions: + - Login to `https://gitea.cjvt.si/` + - Navigate to Profile -> Settings + - Navigate to Applications + - Generate token, then copy token from the blue field **above** Manage Access Tokens card. If you fail to do so, + delete that token and generate new one + - Save it in a plain file + + - Setup lexonomy_custom_editor: + - `git clone https://gitea.cjvt.si/lexonomy/lexonomy_custom_editor.git` + - `cd lexonomy_custom_editor` + - `npm i` + - `cd build` + - `touch conversions.csv` + - Run make with file content as variable: `API_KEY=$(cat location/to/file/name) make` + - If any error occurs with conversions.csv or inside download_structure_conversions.sh, run make clean before starting the above command again + + This concludes setup of local settings. You are ready to delve into it. To test, you can open main.html file inside /build + + +##### Best way to test is probably to deploy your editor version to https://lexonomy.cjvt.si/ + - SSH required + - You need account and access to CJVT machine which admin can provide + - Connect with `ssh accountName -p password`, admin will provide sudo password + - Create plugins directory on your account + - Move inside directory + - Give it 775 permissions (`sudo chmod 775 .`) + +To deploy new test editor version: +- Navigate to /build and create local build_and_upload.sh script (`cp build_and_upload.sh.template build_and_upload.sh`) +- Open build_and_upload.sh file and uncomment and configure the top 4 variables +- Whenever you want to upload new plugin to lexonomy, simply run `./build_and_upload.sh plugin_name` where you specify plugin_name. If specific plugin already exists, things might go bananas +- You will be requested to enter sudo password for the VPS \ No newline at end of file diff --git a/build/build_and_upload.sh.template b/build/build_and_upload.sh.template index 6537e70..eda8f30 100755 --- a/build/build_and_upload.sh.template +++ b/build/build_and_upload.sh.template @@ -4,8 +4,6 @@ #VPS_PASSWORD= vps password #VPS_USERNAME= user name inside vps #API_KEY= $(cat path/to/api/token/file) -echo "Must uncomment and fill in variables inside build_and_upload.sh" -exit 1 if [[ -z "$1" ]]; then @@ -16,5 +14,5 @@ fi PLUGIN_NAME=$1 API_KEY=$API_KEY make -tar czf - ./config.json ./bundle.js ./local.js ./main.css ./main.html | ssh $USERNAME -p $VPS_PASSWORD "cd plugins && mkdir -p $PLUGIN_NAME && cd $PLUGIN_NAME && tar xvzf -" +tar czf - ./config.json ./bundle.js ./local.js ./main.css ./main.html | ssh $USERNAME -p $VPS_PASSWORD "cd plugins && mkdir $PLUGIN_NAME && cd $PLUGIN_NAME && tar xvzf -" ssh -t $USERNAME -p $VPS_PASSWORD "sudo ln -s /home/$VPS_USERNAME/plugins/$PLUGIN_NAME /home/ozbolt/plugins/$PLUGIN_NAME" -- 2.36.5 From 4dab55bec0ceb342852e63261362d4ec1e7b82bc Mon Sep 17 00:00:00 2001 From: matic_t Date: Thu, 9 Jul 2020 08:03:21 -0700 Subject: [PATCH 4/5] Comments + push default config.json --- .gitignore | 1 + build/build_and_upload.sh.template | 8 ++++++-- build/config.json | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 build/config.json diff --git a/.gitignore b/.gitignore index 8c8a0b3..a67997d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ build/* !build/Makefile !build/download_structure_conversions.sh !build/build_and_upload.sh.template +!build/config.json # using kdev4, works fairly nicely! .kdev4 **/*.kdev4 diff --git a/build/build_and_upload.sh.template b/build/build_and_upload.sh.template index eda8f30..6d8a63d 100755 --- a/build/build_and_upload.sh.template +++ b/build/build_and_upload.sh.template @@ -5,14 +5,18 @@ #VPS_USERNAME= user name inside vps #API_KEY= $(cat path/to/api/token/file) - +# Exit if no argument is passed on run if [[ -z "$1" ]]; then echo "Must provide plugin name in environment" 1>&2 exit 1 fi PLUGIN_NAME=$1 - +# Build the plugin API_KEY=$API_KEY make + +# zip all the required files and upload them to ssh tar czf - ./config.json ./bundle.js ./local.js ./main.css ./main.html | ssh $USERNAME -p $VPS_PASSWORD "cd plugins && mkdir $PLUGIN_NAME && cd $PLUGIN_NAME && tar xvzf -" + +# Create a simlink on VPS that will enable specific plugin on https://lexonomy.cjvt.si/ ssh -t $USERNAME -p $VPS_PASSWORD "sudo ln -s /home/$VPS_USERNAME/plugins/$PLUGIN_NAME /home/ozbolt/plugins/$PLUGIN_NAME" diff --git a/build/config.json b/build/config.json new file mode 100644 index 0000000..3f34b75 --- /dev/null +++ b/build/config.json @@ -0,0 +1,5 @@ +{ + "dependencies": [], "globals": [], + "javascript": "$LOCATION$/bundle.js", + "css": ["$LOCATION$/main.css"] +} -- 2.36.5 From e37cf198cf8c1245620a15442babb007cd56e66a Mon Sep 17 00:00:00 2001 From: matic_t Date: Fri, 10 Jul 2020 04:14:45 -0700 Subject: [PATCH 5/5] Improvement --- README.md | 1 + build/build_and_upload.sh.template | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 382546c..ccdc883 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ - Give it 775 permissions (`sudo chmod 775 .`) To deploy new test editor version: +- **Note:** This script builds current plugin version, uploads it to VPS and creates a symlink to location where server can pick them up. - Navigate to /build and create local build_and_upload.sh script (`cp build_and_upload.sh.template build_and_upload.sh`) - Open build_and_upload.sh file and uncomment and configure the top 4 variables - Whenever you want to upload new plugin to lexonomy, simply run `./build_and_upload.sh plugin_name` where you specify plugin_name. If specific plugin already exists, things might go bananas diff --git a/build/build_and_upload.sh.template b/build/build_and_upload.sh.template index 6d8a63d..987e470 100755 --- a/build/build_and_upload.sh.template +++ b/build/build_and_upload.sh.template @@ -1,8 +1,12 @@ #!/bin/bash +############################################################################# +# NOTE: Update .template if logical changes are made to the script # +############################################################################# -#USERNAME= vps sign in +# Alter these variables +#USERNAME= vps_sign_in(probably name@lexonomy.cjvt.si #VPS_PASSWORD= vps password -#VPS_USERNAME= user name inside vps +#VPS_USERNAME= user name inside vps(probably name from @lexonomy) #API_KEY= $(cat path/to/api/token/file) # Exit if no argument is passed on run @@ -19,4 +23,5 @@ API_KEY=$API_KEY make tar czf - ./config.json ./bundle.js ./local.js ./main.css ./main.html | ssh $USERNAME -p $VPS_PASSWORD "cd plugins && mkdir $PLUGIN_NAME && cd $PLUGIN_NAME && tar xvzf -" # Create a simlink on VPS that will enable specific plugin on https://lexonomy.cjvt.si/ +# Routes must be absolute or it doesn't work. ssh -t $USERNAME -p $VPS_PASSWORD "sudo ln -s /home/$VPS_USERNAME/plugins/$PLUGIN_NAME /home/ozbolt/plugins/$PLUGIN_NAME" -- 2.36.5