Guest User

Untitled

a guest
Oct 19th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # Place this file at ~/.rvm/hooks/after_use_switch_gemfiles
  4. # and make it executable.
  5. #
  6. # This version copies Ruby-specific Gemfile.lock.x to Gemfile.lock.
  7.  
  8. if [ -e "Gemfile" ]; then
  9. . "${rvm_path}/scripts/functions/hooks/jruby"
  10. unset current_platform gemfile_platform
  11.  
  12. if [[ "${rvm_ruby_string}" =~ "jruby" ]]; then
  13. current_platform="jruby"
  14. else
  15. current_platform="mri"
  16. fi
  17.  
  18. if [ -e "Gemfile.lock" ]; then
  19. case $(sed -n '/^PLATFORMS/,/^$/ p' "Gemfile.lock" | sed '1d; /^$/d; s/\s*//') in
  20. java)
  21. gemfile_platform="jruby"
  22. ;;
  23. ruby)
  24. gemfile_platform="mri"
  25. ;;
  26. esac
  27. fi
  28.  
  29. if [ -n "$gemfile_platform" -a -e "Gemfile.lock" ]; then
  30. /bin/cp -au "Gemfile.lock" "Gemfile.lock.${gemfile_platform}"
  31. fi
  32. if [ -n "$current_platform" -a -e "Gemfile.lock${current_platform}" ]; then
  33. /bin/cp -au "Gemfile.lock.${current_platform}" "Gemfile.lock"
  34. fi
  35.  
  36. unset current_platform gemfile_platform
  37. fi
Add Comment
Please, Sign In to add comment