-
Notifications
You must be signed in to change notification settings - Fork 4
/
Setup.sh
executable file
·88 lines (75 loc) · 2.19 KB
/
Setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
# Author: Jed Carty April 13 2020 (@inmysocks on GitHub.com)
#
# Setup script for tiddlywiki plugin development
echo "
Welcome to the setup script!
Run this script to help setup your development environment for tiddlywiki 5.
If you move your plugin development folder you must re-run this script.
"
if [ ! -f ./TiddlyWikiVersion.txt ]; then
cd TiddlyWiki5
TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
cd ..
echo $TAG > ./TiddlyWikiVersion.txt
fi
echo "Checking for newer versions of tiddlywiki"
CURRENTTAG=$(<./TiddlyWikiVersion.txt)
cd TiddlyWiki5
NEWESTTAG=$(git ls-remote --tags | grep -o 'refs/tags/v[0-9]*\.[0-9]*\.[0-9]*' | sort -rV | head -n 1 | grep -o '[^\/]*$')
cd ..
if [ ! $CURRENTTAG == $NEWESTTAG ]; then
echo "You are using version $CURRENTTAG but $NEWESTTAG is available."
echo "Warning: If you have modified the core this will overwrite your
changes!!!"
echo "Do you wish to update to $NEWESTTAG? (enter 1 or 2 for yes or no)"
select yn in "Yes" "No"; do
case $yn in
Yes ) UPDATE="yes"; break;;
No ) UPDATE=""; break;;
esac
done
if [ $UPDATE ]; then
cd TiddlyWiki5
git reset --hard
git fetch --tags
git checkout $NEWESTTAG
cd ..
echo $NEWESTTAG > ./TiddlyWikiVersion.txt
fi
else
echo "You have the newest version, $CURRENTTAG"
fi
#echo "Patching tiddlywiki to work with this version of the plugin library
#creator."
#./PatchMakeLibrary.sh
echo "
Enter the author name, this will be used as the author name for plugins you
create. It can be changed in the future by reruning this script or editing
Author.txt
"
CURRENTNAME="DEFAULTAUTHOR"
CURRENTFOLDER="$(pwd)"
if [ -f ./Author.txt ]; then
CURRENTNAME=$(<./Author.txt)
fi
echo "Author Name (press enter to leave as $CURRENTNAME):"
read AUTHORNAME
if [ "$AUTHORNAME" ]; then
echo $AUTHORNAME > Author.txt
fi
if [ ! -d ./Plugins ]; then
mkdir ./Plugins
fi
if [ ! -d ./Themes ]; then
mkdir ./Themes
fi
if [ ! -d ./Languages ]; then
mkdir ./Languages
fi
if [ ! -d ./Wikis ]; then
mkdir ./Wikis
fi
echo "$CURRENTFOLDER/Plugins" > ./PluginFolder.txt
echo "$CURRENTFOLDER/Themes" > ./ThemeFolder.txt
echo "$CURRENTFOLDER/Languages" > ./LanguageFolder.txt