This repository has been archived by the owner on Apr 15, 2023. It is now read-only.
/
setup
executable file
·82 lines (68 loc) · 2.36 KB
/
setup
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
#!/usr/bin/env sh
# Set up MoM app. Run this script immediately after cloning the codebase.
command_exists() {
command -v "$1" &>/dev/null
}
has_ruby() {
command_exists "ruby" && ruby -v | grep -q "$1"
}
has_qmake() {
command_exists "qmake" && qmake -v | grep -q "$1"
}
error_title() {
echo "\033[31m == $1 ==\033[0m"
}
link() {
echo "\n \033[4;34m$1\033[0m\n"
}
# Check for qmake
if ! has_qmake "4.8"; then
exec >&2
error_title "We use capybara-webkit for testing our app"
echo "capybara-webkit depends on a WebKit implementation from Qt."
echo "You'll need to download the Qt libraries to build and install the gem."
echo "This page should help you get up and running:"
link "https://github.com/thoughtbot/capybara-webkit#readme"
echo "Once that is installed, re-run this script to resume setup."
exit 1
fi
# PostgreSQL is also an external dependency
if ! command_exists "psql"; then
exec >&2
error_title "We use PostgreSQL as our database"
echo "The PostgreSQL database is needed in order to install the pg gem."
echo "See the Wiki for instructions on how to install it on your operating system:"
link "http://wiki.postgresql.org/wiki/Detailed_installation_guides"
echo "Once that is installed, re-run this script to resume setup."
exit 1
fi
# Check Ruby 2.0 is installed.
if ! has_ruby "2.*"; then
exec >&2
error_title "The application runs on Ruby 2.0"
echo "In order to get the app running, you first need to install Ruby 2.0."
echo "You can see more information on how to get it installed in the following page:"
link "http://www.ruby-lang.org/en/downloads/"
echo "Once Ruby is installed, re-run this script to resume setup."
exit 1
fi
# Check if we have bundler installed
if ! command_exists "bundle"; then
exec >&2
error_title "You need Bundler in order to manage the app dependencies"
echo "In order to get the app dependencies, you need to install the bundler gem."
echo "You can get it installed by running the command:"
link "gem install bundler"
echo "Once that is installed, re-run this script to resume setup."
exit 1
fi
# Set up Ruby dependencies
bundle install
# Set up upstream git remote
if ! git remote -v | grep -q upstream; then
git remote add upstream git://github.com/mission-of-mercy/mission-of-mercy.git
fi
# Set up config files and database
bundle exec rake setup
# Run the tests
bundle exec rake test