jruby 945 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/env bash
  2. export JRUBY_OPTS
  3. jruby_ngserver_is_running()
  4. {
  5. \command \ps auxww | __rvm_grep -e '[o]rg.jruby.main.NailServerMain' -e '[c]om.martiansoftware.nailgun.NGServer' >/dev/null
  6. }
  7. jruby_ngserver_start()
  8. {
  9. if ! jruby_ngserver_is_running
  10. then
  11. (JRUBY_OPTS='' jruby --ng-server 2>&1 1>/dev/null)&
  12. fi
  13. }
  14. jruby_options_trim()
  15. {
  16. JRUBY_OPTS="${JRUBY_OPTS## }"
  17. JRUBY_OPTS="${JRUBY_OPTS%% }"
  18. }
  19. jruby_options_append()
  20. {
  21. for param in "$@"
  22. do
  23. if
  24. [[ " ${JRUBY_OPTS} " != *" $param "* ]]
  25. then
  26. JRUBY_OPTS="${JRUBY_OPTS} $param"
  27. fi
  28. done
  29. jruby_options_trim
  30. }
  31. jruby_options_remove()
  32. {
  33. JRUBY_OPTS=" ${JRUBY_OPTS} "
  34. for param in "$@"
  35. do
  36. if
  37. [[ "${JRUBY_OPTS}" == *" $param "* ]]
  38. then
  39. JRUBY_OPTS="${JRUBY_OPTS// $param / }"
  40. fi
  41. done
  42. jruby_options_trim
  43. }
  44. jruby_clean_project_options()
  45. {
  46. if [[ -n "${PROJECT_JRUBY_OPTS}" ]]
  47. then
  48. unset PROJECT_JRUBY_OPTS
  49. fi
  50. }