forked from cfpb/design-manual
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·56 lines (48 loc) · 1.43 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
# ==========================================================================
# Setup script for installing project dependencies.
# NOTE: Run this script while in the project root directory.
# It will not run correctly when run from another directory.
# ==========================================================================
# Set script to exit on any errors.
set -e
# Initialize project dependency directories.
init(){
NODE_DIR=node_modules
BOWER_DIR=bower_components
if [ -f .bowerrc ]; then
# Get the "directory" line from .bowerrc
BOWER_DIR=$(grep "directory" .bowerrc | cut -d '"' -f 4)
fi
echo 'npm components directory:' $NODE_DIR
echo 'Bower components directory:' $BOWER_DIR
}
# Clean project dependencies.
clean(){
# If the node and bower directories already exist,
# clear them so we know we're working with a clean
# slate of the dependencies listed in package.json
# and bower.json.
if [ -d $NODE_DIR ] || [ -d $BOWER_DIR ]; then
echo 'Removing project dependency directories...'
rm -rf $NODE_DIR
rm -rf $BOWER_DIR
fi
echo 'Project dependencies have been removed.'
}
# Install project dependencies.
install(){
echo 'Installing project dependencies...'
bundle install
npm install
bower install --config.interactive=false
}
# Run tasks to build the project for distribution.
build(){
echo 'Building project...'
grunt build
echo 'Your project is ready.'
}
init
clean
install
build