Skip to content

Commit

Permalink
script: add rero-ils-ui install from tgz
Browse files Browse the repository at this point in the history
* Updates bootstrap script to install rero-ils-ui from .tgz if needed.
* Adds a variable to set version in bundles.py.

Co-Authored-by: Alicia Zangger <[email protected]>
  • Loading branch information
Alicia Zangger authored and AoNoOokami committed Jan 15, 2020
1 parent d881212 commit 2a167ae
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 22 deletions.
9 changes: 6 additions & 3 deletions rero_ils/bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
from pkg_resources import resource_filename


RERO_ILS_UI_VERSION = '0.0.9'


def catalog(domain):
"""Return glob matching path to tranlated messages for a given domain."""
return os.path.join(
Expand Down Expand Up @@ -77,7 +80,7 @@ def catalog(domain):
'node_modules/@rero/rero-ils-ui/dist/admin/main.*.js',
output='gen/rero_ils_admin_ui.%(version)s.js',
npm={
'@rero/rero-ils-ui': '0.0.9'
'@rero/rero-ils-ui': '~{version}'.format(version=RERO_ILS_UI_VERSION)
}
)

Expand All @@ -89,7 +92,7 @@ def catalog(domain):
'node_modules/@rero/rero-ils-ui/dist/public-search/main.*.js',
output='gen/rero_ils_public-search_ui.%(version)s.js',
npm={
'@rero/rero-ils-ui': '0.0.9'
'@rero/rero-ils-ui': '~{version}'.format(version=RERO_ILS_UI_VERSION)
}
)

Expand All @@ -98,6 +101,6 @@ def catalog(domain):
'node_modules/@rero/rero-ils-ui/dist/search-bar/main.*.js',
output='gen/rero_ils_search-bar_ui.%(version)s.js',
npm={
'@rero/rero-ils-ui': '0.0.9'
'@rero/rero-ils-ui': '~{version}'.format(version=RERO_ILS_UI_VERSION)
}
)
56 changes: 37 additions & 19 deletions scripts/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,41 @@ success_msg() {
# Displays program name
msg "PROGRAM: ${PROGRAM}"

# The real bootstrap script starts 20 lines below ;-)
# options may be followed by one colon to indicate they have a required argument
if ! options=$(getopt -o dsb -l -t deploy,ci,tgz_path: -- "$@")
then
# something went wrong, getopt will put out an error message for us
exit 1
fi

# The real bootstrap script starts with app installation below ;-)
flags=()
deploy=false
cmd="pipenv sync"
ci=false
while test $# -gt 0; do
case "$1" in
--deploy)
# We are probably inside travis, check for env variables
deploy=true
shift
;;
--ci)
# We are probably inside travis, check for env variables
ci=true
shift
;;
*)
# Use the flags that are passed to the script directly to install
flags+=("$1")
shift
;;
esac
TGZ_PATH=""
while test $# -gt 0
do
case "$1" in
-d|--deploy)
# We are probably inside travis, check for env variables
deploy=true ;;
-c|--ci)
# We are probably inside travis, check for env variables
ci=true ;;
-t|--tgz_path)
TGZ_PATH=$2
if [ -z $2 ]
then
error_msg+exit "Please give path to .tgz"
else
TGZ_PATH=$2
fi ;;
(--) shift; break;;
(-*) flags+=("$1") ;;
(*) break;;
esac
shift
done

if ! $deploy || $ci ; then
Expand All @@ -95,6 +107,7 @@ fi
# go generate a clean lock file
# pipenv --rm; pipenv install --sequential

# BOOTSTRAP START
# install the application and all the dependencies
info_msg "Install with command: ${cmd} ${flags[@]}"
${cmd} ${flags[@]}
Expand All @@ -119,6 +132,11 @@ info_msg "Search static folder location"
static_folder=$(pipenv run invenio shell --no-term-title -c "print('static_folder:%s' % app.static_folder)"|grep static_folder| cut -d: -f2-)
info_msg "Install static folder npm dependencies in: ${static_folder}"
pipenv run npm install --prefix "${static_folder}"
if [ ! -d $TGZ_PATH ]
then
info_msg "Install RERO-ILS-UI from tgz"
pipenv run npm install "${TGZ_PATH}" --prefix "${static_folder}"
fi

# build the web assets
info_msg "Build web assets: collect"
Expand Down

0 comments on commit 2a167ae

Please sign in to comment.