OSC / nginx_stage

[MOVED] Stages & controls the per-user NGINX environment
https://github.com/OSC/ondemand/tree/master/nginx_stage
MIT License
0 stars 1 forks source link

Remove absolute path to Ruby wrapper in nginx_stage script #27

Closed nickjer closed 6 years ago

nickjer commented 6 years ago

This line in particular is annoying during development of the wrapper script:

https://github.com/OSC/nginx_stage/blob/4f549e42ca220095d16b5e476020bd63174b7d17/sbin/nginx_stage#L1

as it points to the system-installed wrapper script instead of the one being developed.

This can be resolved with something similar to what I did for an update in ood-portal-generator with:

#!/usr/bin/env bash

SCL_SOURCE=$(command -v scl_source)
[[ "${SCL_SOURCE}" ]] && source "${SCL_SOURCE}" enable rh-ruby22 &> /dev/null

ROOT_DIR="$(dirname "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")")"

exec \
  /usr/bin/env ruby \
    -I"${ROOT_DIR}/lib" \
    -rood_portal_generator \
    -e "OodPortalGenerator::Application.start" \
    -- "${@}"

where ROOT_DIR is set to the root path of nginx_stage for the respective script that was called.