Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # Place this file at ~/.rvm/hooks/after_use_switch_gemfiles
- # and make it executable.
- #
- # This version copies Ruby-specific Gemfile.lock.x to Gemfile.lock.
- if [ -e "Gemfile" ]; then
- . "${rvm_path}/scripts/functions/hooks/jruby"
- unset current_platform gemfile_platform
- if [[ "${rvm_ruby_string}" =~ "jruby" ]]; then
- current_platform="jruby"
- else
- current_platform="mri"
- fi
- if [ -e "Gemfile.lock" ]; then
- case $(sed -n '/^PLATFORMS/,/^$/ p' "Gemfile.lock" | sed '1d; /^$/d; s/\s*//') in
- java)
- gemfile_platform="jruby"
- ;;
- ruby)
- gemfile_platform="mri"
- ;;
- esac
- fi
- if [ -n "$gemfile_platform" -a -e "Gemfile.lock" ]; then
- /bin/cp -au "Gemfile.lock" "Gemfile.lock.${gemfile_platform}"
- fi
- if [ -n "$current_platform" -a -e "Gemfile.lock${current_platform}" ]; then
- /bin/cp -au "Gemfile.lock.${current_platform}" "Gemfile.lock"
- fi
- unset current_platform gemfile_platform
- fi
Add Comment
Please, Sign In to add comment