improve dev process
This commit is contained in:
parent
17bc42fe85
commit
1cbb8dc9b7
|
@ -5,19 +5,13 @@ DATA_DIR=$SOURCE_DIR/tmp/postgres
|
|||
|
||||
show_help() {
|
||||
cat <<EOF
|
||||
Usage: ${0##*/} [-h] [--init [--patch DIR]]
|
||||
Usage: ${0##*/} [-h] [--init]
|
||||
|
||||
--init perform first-time initialization
|
||||
|
||||
--patch DIR patch ember-data-source with missing dist files from DIR
|
||||
(for example, "--patch ~/repos/ember-source-data/dist")
|
||||
requires --init to also be passed
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
initialize=""
|
||||
patch_source=""
|
||||
|
||||
while [ "${#@}" -ne "0" ]; do
|
||||
case "$1" in
|
||||
|
@ -28,10 +22,6 @@ while [ "${#@}" -ne "0" ]; do
|
|||
-i | --init)
|
||||
initialize="initialize"
|
||||
;;
|
||||
-p | --patch)
|
||||
patch_source="$2"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "unexpected argument: $1" >& 2
|
||||
show_help >& 2
|
||||
|
@ -41,12 +31,6 @@ while [ "${#@}" -ne "0" ]; do
|
|||
shift
|
||||
done
|
||||
|
||||
if [ -n "${patch_source}" ] && [ "${initialize}" != "initialize" ]; then
|
||||
echo "error: the --init flag is required when using --patch" >& 2
|
||||
show_help >& 2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "Using source in: ${SOURCE_DIR}"
|
||||
echo "Using data in: ${DATA_DIR}"
|
||||
|
||||
|
@ -58,14 +42,6 @@ if [ "${initialize}" = "initialize" ]; then
|
|||
echo "Installing gems..."
|
||||
${SCRIPTPATH}/bundle install
|
||||
|
||||
if [ -n "${patch_source}" ]; then
|
||||
echo "Patching ember-data-source-2.3.0.beta.5 gems..."
|
||||
docker exec discourse_dev /bin/bash -c "mkdir -p /usr/local/lib/ruby/gems/2.3.0/gems/ember-data-source-2.3.0.beta.5/dist"
|
||||
for f in "${patch_source}"/globals/*.js; do
|
||||
docker cp $f discourse_dev:/usr/local/lib/ruby/gems/2.3.0/gems/ember-data-source-2.3.0.beta.5/dist/$(basename $f)
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Migrating database..."
|
||||
${SCRIPTPATH}/rake db:migrate
|
||||
|
||||
|
|
|
@ -5,5 +5,5 @@ if [[ $# = 1 ]] && [[ "$1" =~ "s" ]];
|
|||
then
|
||||
PARAMS="$PARAMS -b 0.0.0.0"
|
||||
fi
|
||||
CMD="cd /src && RAILS_ENV=${RAILS_ENV:=development} rails $PARAMS"
|
||||
CMD="cd /src && RACK_HANDLER=puma RAILS_ENV=${RAILS_ENV:=development} rails $PARAMS"
|
||||
docker exec -it -u discourse:discourse discourse_dev /bin/bash -c "$CMD"
|
||||
|
|
Loading…
Reference in New Issue