forked from github/scripts-to-rule-them-all
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsole
executable file
·28 lines (24 loc) · 891 Bytes
/
console
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
#!/bin/sh
# script/console: Launch a console for the application. Optionally allow an
# environment to be passed in to let the script handle the
# specific requirements for connecting to a console for that
# environment.
set -e
cd "$(dirname "$0")/.."
if [ -n "$1" ]; then
# use first argument as an environment name. Use this to decide how to connect
# to the appropriate console.
if [ "$1" = "production" ]; then
heroku run rails console --app heroku-app-name
elif [ "$1" = "staging" ]; then
heroku run rails console --app heroku-app-name-staging
else
echo "Sorry, I don't know how to connect to the '$1' environment."
exit 1
fi
else
# no argument provided, so just run the local console in the development
# environment. Ensure the application is up to date first.
script/update
bin/rails console
fi