forked from sailuh/termite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_offline.sh
executable file
·182 lines (144 loc) · 6.29 KB
/
setup_offline.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/bin/bash
# Termite Set-Up Script
#
# Run once to
# - download necessary library files
# - minify client javascript files
#
#LIBRARY=lib/
#STMT=stmt-0.4.0/
CLIENT_SRC=client-src/
CLIENT_LIB=client-lib/
jar_folder=libraries
# if [ ! -d $LIBRARY ]
# then
# echo
# echo "Creating a library folder: $LIBRARY"
# mkdir $LIBRARY
# fi
if [ ! -d $CLIENT_LIB ]
then
echo
echo "Creating the client template folder: $CLIENT_LIB"
mkdir $CLIENT_LIB
fi
if [ ! -d $jar_folder ]
then
echo
echo "Creating the jar folder: $jar_folder"
mkdir $jar_folder
fi
#------------------------------------------------------------------------------#
# D3 Visualization Javascript Library
# echo
# echo "Downloading D3 javascript library..."
# curl --insecure --location https://github.com/mbostock/d3/releases/download/v3.4.1/d3.v3.zip > $LIBRARY/d3.v3.zip
echo
echo "Uncompressing D3 javascript library..."
unzip $jar_folder/d3.v3.zip d3.v3.js -d $CLIENT_SRC
unzip $jar_folder/d3.v3.zip d3.v3.min.js -d $CLIENT_LIB
echo
echo "Extracting D3 license..."
unzip $jar_folder/d3.v3.zip LICENSE -d $jar_folder
mv $jar_folder/LICENSE $jar_folder/LICENSE-d3
#------------------------------------------------------------------------------#
# jQuery Javascript Library
echo
echo "Moving jQuery javascript library..."
mv $jar_folder/jquery-1.9.1.js $CLIENT_SRC/jquery.js
mv $jar_folder/jquery-1.9.1.min.js $CLIENT_LIB/jquery.min.js
# echo
# echo "Downloading jQuery GitHub archive..."
# curl --insecure --location http://github.com/jquery/jquery/archive/master.zip > $LIBRARY/jquery.zip
echo
echo "Extracting jQuery license..."
unzip $jar_folder/jquery-master.zip jquery-master/LICENSE.txt -d $jar_folder
mv $jar_folder/jquery-master/LICENSE.txt $jar_folder/LICENSE-jquery
rmdir $jar_folder/jquery-master
#------------------------------------------------------------------------------#
# Underscore Javascript Library
# echo
# echo "Downloading Underscore GitHub archive..."
# curl --insecure --location http://github.com/documentcloud/underscore/archive/master.zip > $LIBRARY/underscore-master.zip
echo
echo "Uncompressing Underscore javascript library..."
unzip $jar_folder/underscore-master.zip underscore-master/underscore.js -d $jar_folder
unzip $jar_folder/underscore-master.zip underscore-master/underscore-min.js -d $jar_folder
mv $jar_folder/underscore-master/underscore.js $CLIENT_SRC/underscore.js
mv $jar_folder/underscore-master/underscore-min.js $CLIENT_LIB/underscore.min.js
echo
echo "Extracting Underscore license..."
unzip $jar_folder/underscore-master.zip underscore-master/LICENSE -d $jar_folder
mv $jar_folder/underscore-master/LICENSE $jar_folder/LICENSE-underscore
rmdir $jar_folder/underscore-master
#------------------------------------------------------------------------------#
# Backbone Javascript Library
# echo
# echo "Downloading Backbone GitHub archive..."
# curl --insecure --location http://github.com/documentcloud/backbone/archive/master.zip > $LIBRARY/backbone-master.zip
echo
echo "Uncompressing Backbone javascript library..."
unzip $jar_folder/backbone-master.zip backbone-master/backbone.js -d $jar_folder
unzip $jar_folder/backbone-master.zip backbone-master/backbone-min.js -d $jar_folder
mv $jar_folder/backbone-master/backbone.js $CLIENT_SRC/backbone.js
mv $jar_folder/backbone-master/backbone-min.js $CLIENT_LIB/backbone.min.js
echo
echo "Extracting Backbone license..."
unzip $jar_folder/backbone-master.zip backbone-master/LICENSE -d $jar_folder
mv $jar_folder/backbone-master/LICENSE $jar_folder/LICENSE-backbone
rmdir $jar_folder/backbone-master
#------------------------------------------------------------------------------#
# Mallet (topic modeling library)
# echo
# echo "Downloading MALLET (MAchine Learning for LanguagE Toolkit)..."
# curl --insecure --location http://mallet.cs.umass.edu/dist/mallet-2.0.7.tar.gz > $LIBRARY/mallet-2.0.7.tar.gz
# echo
# echo "Uncompressing MALLET..."
# tar -zxvf $jar_folder/mallet-2.0.7.tar.gz mallet-2.0.7
# echo
# echo "Extracting MALLET License..."
# cp mallet-2.0.7/LICENSE $jar_folder/LICENSE-mallet
#------------------------------------------------------------------------------#
# Stanford Topic Modeling Toolkit
# echo
# echo "Downloading STMT (Stanford Topic Modeling Toolkit)..."
# if [ ! -d $STMT ]
# then
# echo
# echo "Creating a folder for STMT: $STMT"
# mkdir $STMT
# fi
# curl --insecure --location http://nlp.stanford.edu/software/tmt/tmt-0.4/tmt-0.4.0.jar > $STMT/tmt-0.4.0.jar
# curl --insecure --location http://nlp.stanford.edu/software/tmt/tmt-0.4/tmt-0.4.0-src.zip > $LIBRARY/tmt-0.4.0-src.zip
# mv $jar_folder/tmt-0.4.0.jar $STMT/tmt-0.4.0.jar
# echo
# echo "Extracting STMT License..."
# unzip $jar_folder/tmt-0.4.0-src.zip LICENSE -d $jar_folder
# cp $jar_folder/LICENSE $jar_folder/LICENSE-stmt
#------------------------------------------------------------------------------#
# Google closure compiler for Javascript
# echo
# echo "Downloading Google Closure Compiler..."
# curl --insecure --location http://dl.google.com/closure-compiler/compiler-latest.zip > $LIBRARY/compiler-latest.zip
echo
echo "Uncompressing Google Closure Compiler..."
unzip $jar_folder/compiler-latest.zip closure-compiler-v20180506.jar -d $jar_folder
mv $jar_folder/closure-compiler-v20180506.jar $jar_folder/closure-compiler.jar
echo
echo "Extracting Google Closure Compiler License..."
unzip $jar_folder/compiler-latest.zip COPYING -d $jar_folder
cp $jar_folder/COPYING $jar_folder/LICENSE-closure-compiler
#------------------------------------------------------------------------------#
# Slider for Firefox - Requires Java Developer Kit (JDK) - Last tested on JDK 8u231.
echo
echo "Minifying html5slider.js"
java -jar $jar_folder/closure-compiler.jar --js=$CLIENT_SRC/html5slider.js --js_output_file=$CLIENT_LIB/html5slider.min.js
#------------------------------------------------------------------------------#
# Minify javascript files - Requires Java Developer Kit (JDK) - Last tested on JDK 8u231.
echo
echo "Minifying javascript files..."
for JS_FILE in FullTermTopicProbabilityModel SeriatedTermTopicProbabilityModel FilteredTermTopicProbabilityModel TermFrequencyModel TermTopicMatrixView TermFrequencyView ViewParameters StateModel UserControlViews QueryString
do
echo " Minifying $JS_FILE"
java -jar $jar_folder/closure-compiler.jar --js=$CLIENT_SRC/$JS_FILE.js --js_output_file=$CLIENT_LIB/$JS_FILE.min.js
done