Repository navigation
Expand file tree
/
Copy pathsetup
More file actions
executable file
·72 lines (58 loc) · 2.18 KB
/
Copy pathsetup
File metadata and controls
executable file
·72 lines (58 loc) · 2.18 KB
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
<
87FC
div data-line-number="27" class="react-line-number react-code-text" style="padding-right:16px">2728
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
#!/usr/bin/env sh
# Set up Rails app. Run this script immediately after cloning the codebase.
#
# First, you need to create the database user the app will use by manually
# typing the following in your terminal:
#
# $ sudo -u postgres psql -c "CREATE USER ofn WITH SUPERUSER CREATEDB PASSWORD 'f00d'"
#
# This will create the "ofn" user as superuser and allowing it to create
# databases.
# Exit if any command fails
set -e
YELLOW='\033[0;33m'
RED='\033[0;31m'
NO_COLOR='\033[0m'
RUBY_VERSION=$(cat .ruby-version)
NODE_VERSION=$(cat .node-version)
# Check ruby version
if ! ruby --version | grep $RUBY_VERSION > /dev/null; then
printf "${RED}Open Food Network requires ruby ${RUBY_VERSION}${NO_COLOR}. Have a look at: https://github.com/rbenv/rbenv\n"
exit 1
fi
# Check node version
if ! node --version | grep $NODE_VERSION > /dev/null; then
printf "${RED}Open Food Network requires node ${NODE_VERSION}${NO_COLOR}. Have a look at: https://github.com/nodenv/nodenv\n"
exit 1
fi
# Set up Ruby dependencies via Bundler
if ! command -v bundle > /dev/null; then
./script/install-bundler
fi
# Install all dependencies
bundle check || bundle install
npm install
# Set up configurable environment variables
if [ ! -f config/application.yml ]; then
cp config/application.yml.example config/application.yml
printf "${YELLOW}Copied config/application.yml Make sure to fill it with the appropriate configuration values.\n\n${NO_COLOR}"
fi
# Set up newrelic.yml for development environment, used by the newrelic_rpm gem
if [ ! -f config/newrelic.yml ]; then
cp config/newrelic.yml.example config/newrelic.yml
printf "${YELLOW}Copied config/newrelic.yml which configures the development environment for the newrelic_rpm gem.\n\n${NO_COLOR}"
fi
# Set up the database for both development and test
# Confirming the default user and password
printf '\n\n' | bundle exec rake db:setup db:test:prepare
printf '\n'
# Load some default data for your environment
bundle exec rake ofn:sample_data
printf '\n'
printf "${YELLOW}WELCOME TO OPEN FOOD NETWORK!\n"
printf '\n'
printf "To login as the default user, use:"
printf '\n'
printf '\n'
printf ' email: ofn@example.com\n'
printf " password: ofn123\n${NO_COLOR}"