2021-10-02 11:37:54 +02:00
|
|
|
#!/bin/bash -e
|
2021-10-02 11:22:02 +02:00
|
|
|
|
|
|
|
echo "Setting up interoperability with Overleaf..."
|
|
|
|
echo "Note that you need ability to clone repos from Overleaf."
|
|
|
|
|
|
|
|
original_git_url=$(git remote get-url origin)
|
2021-10-02 11:37:54 +02:00
|
|
|
|
|
|
|
echo "Make sure $original_git_url exists at your git server."
|
|
|
|
echo "It should be created as en empty repo, *uncheck* option"
|
|
|
|
echo "'Initialize repository with a README' or similar."
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "Press ENTER to start"
|
|
|
|
read
|
|
|
|
|
2021-10-02 11:22:02 +02:00
|
|
|
here_dir=$(basename $PWD)
|
|
|
|
|
|
|
|
|
|
|
|
make
|
|
|
|
make source-pack
|
|
|
|
|
|
|
|
source_pack={{cookiecutter.paper_id}}.zip
|
|
|
|
|
2021-10-02 12:24:32 +02:00
|
|
|
echo ""
|
2021-10-02 11:22:02 +02:00
|
|
|
echo "Go to Overleaf, click New Project / Upload Project,"
|
|
|
|
echo "then upload $source_pack from here ($(pwd)/$source_pack)"
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "When it is uploaded, click Menu / Git, copy the URL"
|
|
|
|
echo "(something like https://git.overleaf.com/123456789ec0830001af836f),"
|
|
|
|
echo "paste here and press ENTER"
|
|
|
|
|
|
|
|
read
|
|
|
|
overleaf_git_url=$REPLY
|
2022-02-12 12:17:43 +01:00
|
|
|
# remove "git clone" in case it was directly copied from Overleaf
|
|
|
|
overleaf_git_url=${overleaf_git_url#git clone }
|
2021-10-02 11:22:02 +02:00
|
|
|
overleaf_git_id=$(basename $overleaf_git_url)
|
|
|
|
|
2021-10-02 12:19:44 +02:00
|
|
|
|
2021-10-02 11:22:02 +02:00
|
|
|
cd ..
|
2021-10-02 12:19:44 +02:00
|
|
|
|
|
|
|
backup_dir=${here_dir}-backup
|
|
|
|
mv $here_dir ${here_dir}-backup
|
|
|
|
|
|
|
|
git clone $overleaf_git_url $here_dir
|
2021-10-02 11:22:02 +02:00
|
|
|
|
2021-10-02 12:24:32 +02:00
|
|
|
cd $here_dir
|
2021-10-02 11:22:02 +02:00
|
|
|
|
|
|
|
git remote add overleaf $overleaf_git_url
|
|
|
|
git remote set-url origin $original_git_url
|
|
|
|
|
|
|
|
git config credential.helper "cache --timeout=10000000"
|
|
|
|
|
2022-01-17 18:04:23 +01:00
|
|
|
cp ../$backup_dir/.cookiecutter.yml .
|
|
|
|
|
|
|
|
git add .cookiecutter.yml
|
|
|
|
git commit -m 'Back cookiecutter config'
|
|
|
|
|
2022-04-13 20:37:34 +02:00
|
|
|
cookiecutter https://git.wmi.amu.edu.pl/filipg/paper-cutter.git --checkout 5.3.0 --output-dir .. --config-file .cookiecutter.yml --no-input --overwrite-if-exists
|
2022-01-17 18:04:23 +01:00
|
|
|
|
|
|
|
git add --all
|
|
|
|
git commit -m 'Bring back all the files'
|
|
|
|
|
2021-10-02 11:37:54 +02:00
|
|
|
perl -pne 's{OVERLEAF_GIT_URL=}{OVERLEAF_GIT_URL='$overleaf_git_url'}' -i helpers/vars
|
2021-10-02 11:22:02 +02:00
|
|
|
|
2021-10-02 12:30:18 +02:00
|
|
|
git add helpers/vars
|
|
|
|
git commit -m 'Set vars'
|
|
|
|
|
2021-10-02 11:22:02 +02:00
|
|
|
git push overleaf master
|
|
|
|
git push origin master
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "DONE"
|
2021-10-02 12:19:44 +02:00
|
|
|
echo "Left ${backup_dir}, now type 'cd ..' and you can remove it"
|