-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·42 lines (29 loc) · 885 Bytes
/
run.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
#!/usr/bin/env bash
# Load RVM into a shell session *as a function*
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
# First try to load from a user install
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
# Then try to load from a root install
source "/usr/local/rvm/scripts/rvm"
else
printf "ERROR: An RVM installation was not found.\n"
fi
# Use the correct Ruby version.
rvm use ruby-2.3.3@file-line-service
# Make sure the file exists and is readable.
if [[ ! -r $1 ]] ; then
echo "file not found or not readable"
exit
fi
# Determine if provided path is relative or absolute.
if [[ $1 =~ ^\/ ]] ; then
FILE_PATH=$1
else
FILE_PATH="../$1"
fi
echo $FILE_PATH
# Symlink the provided file name argument to the default location.
ln -sf $FILE_PATH config/file.txt
# Boot the app.
RAILS_ENV=production bundle exec rails s Puma