This repository has been archived by the owner on Jul 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
development_update_files.sh
executable file
·65 lines (55 loc) · 2.06 KB
/
development_update_files.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
#!/bin/bash
env=$1
export NODE_ENV=$env
file=$env
file+="_template.ejs"
echo $NODE_ENV
echo $file
# Verify the environment to define the template
if [ $env == "default" ]
then
$file = default_template.ejs
else
# Create env_template.ejs
cp views/default_template.ejs views/$file
fi
# Create javascript directory
mkdir -p public/javascripts
# Create library working directory
mkdir -p public/javascripts/library
# get vendor libraries
# Copy all the js libraries to the public Path
if [ ! -f public/javascripts/library/jquery.js ]; then
wget https://code.jquery.com/jquery-2.2.1.min.js
mv jquery-2.2.1.min.js public/javascripts/library/jquery.js
fi
if [ ! -f public/javascripts/library/jquery-ui.js ]; then
wget https://code.jquery.com/ui/1.11.4/jquery-ui.min.js
mv jquery-ui.min.js public/javascripts/library/jquery-ui.js
fi
# Create stylesheets directory
mkdir -p public/stylesheets
# Copy all the css content to the public path
cp -r css/css_framework/* public/stylesheets
cp css/d3_components/d3Framework.css public/stylesheets
# Copy datamanager.js to public directory
cp build/data/dataManager.js public/javascripts/datamanager.js
# Insert the css files and the js files (from library) into env_template.ejs
# * Notacion *
cssStart="<link rel='stylesheet' href='"
cssEnd="' />"
jsStart="<script type='text/javascript' src='"
jsEnd="'></script>"
# * insert them after tittle html tag *
match="</title>"
# * "files" *
bootstrap="$cssStart/stylesheets/bootstrap.min.css$cssEnd"
framework="$cssStart/stylesheets/framework.css$cssEnd"
d3="$cssStart/stylesheets/d3Framework.css$cssEnd"
jquery="$jsStart/javascripts/library/jquery.js$jsEnd"
jqueryui="$jsStart/javascripts/library/jquery-ui.js$jsEnd"
datamanager="$jsStart/javascripts/datamanager.js$jsEnd"
loadDatamanager="<script type='text/javascript'> window.datamanager.loadData((<%- JSON.stringify(data)%>)); </script>"
# Delete .bak (this is just for mac)
# Replace \\ for \n (this is just for mac)
sed -i.bak "s~$match~$match\\$bootstrap\\$framework\\$d3\\$jquery\\$jqueryui\\$datamanager\\$loadDatamanager~" views/$file