Skip to content

Commit e630509

Browse files
Merge pull request #35 from garysieling/feature/36-scripts-to-rule-them-all
add scripts-to-rule-them-all pattern
2 parents 367da64 + c48dbed commit e630509

File tree

7 files changed

+138
-0
lines changed

7 files changed

+138
-0
lines changed

script/bootstrap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# See https://github.com/github/scripts-to-rule-them-all
2+
#
3+
# script/bootstrap is used solely for fulfilling dependencies of the project.
4+
#
5+
# The goal is to make sure all required dependencies are installed.
6+
7+
set -eu -o pipefail
8+
shopt -s failglob
9+
10+
docker-compose pull

script/cibuild

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# See https://github.com/github/scripts-to-rule-them-all
2+
#
3+
# script/cibuild is used for your continuous integration server.
4+
# This script is typically only called from your CI server.
5+
#
6+
# You should set up any specific things for your environment here
7+
# before your tests are run. Your test are run simply by calling script/test.
8+
9+
set -eu -o pipefail
10+
shopt -s failglob
11+
12+
scripts/test
13+
14+
docker build -t upenn/chime .
15+
16+
# FUTURE - should the container be pushed anywhere?

script/console

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# See https://github.com/github/scripts-to-rule-them-all
2+
#
3+
# script/console is used to open a console for your application.
4+
#
5+
# A good pattern to support is having an optional argument that
6+
# is an environment name, so you can connect to that environment's console.
7+
#
8+
# You should configure and run anything that needs to happen to
9+
# open a console for the requested environment.
10+
11+
set -eu -o pipefail
12+
shopt -s failglob
13+
14+
if [ -z "$@" ]; then
15+
ENV=local
16+
else
17+
ENV="$1"
18+
fi
19+
20+
case $ENV in
21+
22+
local)
23+
URL=http://localhost:8000
24+
;;
25+
26+
dev)
27+
URL=http://pennchime.herokuapp.com
28+
;;
29+
30+
prod)
31+
URL=http://penn-chime.phl.io
32+
;;
33+
34+
# FUTURE - other targets - Heroku / Linode / Production DNS entry?
35+
36+
esac
37+
38+
39+
open $URL

script/server

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# See https://github.com/github/scripts-to-rule-them-all
2+
#
3+
# script/server is used to start the application.
4+
#
5+
# For a web application, this might start up any extra processes
6+
# that the application requires to run in addition to itself.
7+
#
8+
# script/update should be called ahead of any application booting
9+
# to ensure that the application is up to date and can run appropriately.
10+
11+
12+
set -eu -o pipefail
13+
shopt -s failglob
14+
15+
docker-compose up -d

script/setup

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# See https://github.com/github/scripts-to-rule-them-all
2+
#
3+
# script/setup is used to set up a project in an initial state.
4+
# This is typically run after an initial clone, or, to reset the
5+
# project back to its initial state.
6+
#
7+
# This is also useful for ensuring that your bootstrapping
8+
# actually works well.
9+
10+
set -eu -o pipefail
11+
shopt -s failglob
12+
13+
if [[ ! -f ".env" ]]; then
14+
cp .env.example .env
15+
fi

script/test

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# See https://github.com/github/scripts-to-rule-them-all
2+
#
3+
# script/test is used to run the test suite of the application.
4+
#
5+
# A good pattern to support is having an optional argument that is a file path.
6+
# This allows you to support running single tests.
7+
#
8+
# Linting (i.e. rubocop, jshint, pmd, etc.) can also be considered a
9+
# form of testing. These tend to run faster than tests, so put them
10+
# towards the beginning of a script/test so it fails faster if there's a
11+
# linting problem.
12+
#
13+
# script/test should be called from script/cibuild, so it should
14+
# handle setting up the application appropriately based on the environment.
15+
# For example, if called in a development environment, it should probably
16+
# call script/update to always ensure that the application is up to date.
17+
# If called from script/cibuild, it should probably reset the application
18+
# to a clean state.
19+
20+
21+
set -eu -o pipefail
22+
shopt -s failglob
23+
24+
# FUTURE - tests?
25+
echo "No tests right now"

script/update

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# See https://github.com/github/scripts-to-rule-them-all
2+
#
3+
# script/update is used to update the project after a fresh pull.
4+
#
5+
# If you have not worked on the project for a while,
6+
# running script/update after a pull will ensure that everything
7+
# inside the project is up to date and ready to work.
8+
#
9+
# Typically, script/bootstrap is run inside this script.
10+
# This is also a good opportunity to run database migrations
11+
# or any other things required to get the state of the app into
12+
# shape for the current version that is checked out.
13+
14+
set -eu -o pipefail
15+
shopt -s failglob
16+
17+
docker-compose down
18+
scripts/bootstrap

0 commit comments

Comments
 (0)