install 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env bash
  2. __rvm_record_install()
  3. {
  4. [[ -n "$1" ]] || return
  5. \typeset recorded_ruby_name rvm_install_record_file
  6. recorded_ruby_name="$( "$rvm_scripts_path/tools" strings "$1" )"
  7. rvm_install_record_file="$rvm_user_path/installs"
  8. [[ -f "$rvm_install_record_file" ]] || \command \touch "$rvm_install_record_file"
  9. __rvm_sed_i "$rvm_install_record_file" -e "/^$recorded_ruby_name/d"
  10. #TODO: use `for` so rvm_configure_flags are quoted properly
  11. printf "%b" "$recorded_ruby_name -- ${rvm_configure_flags[*]}\n" >> "$rvm_install_record_file"
  12. }
  13. __rvm_remove_install_record()
  14. {
  15. \typeset recorded_ruby_name rvm_install_record_file
  16. recorded_ruby_name="$( "$rvm_scripts_path/tools" strings "$1" )"
  17. rvm_install_record_file="$rvm_user_path/installs"
  18. if [[ -s "$rvm_install_record_file" ]]
  19. then __rvm_sed_i "$rvm_install_record_file" -e "/^$recorded_ruby_name/d"
  20. fi
  21. }
  22. __rvm_recorded_install_command()
  23. {
  24. \typeset recorded_ruby_name
  25. recorded_ruby_name="$( "$rvm_scripts_path/tools" strings "$1" )"
  26. recorded_ruby_name=${recorded_ruby_name%%${rvm_gemset_seperator:-"@"}*}
  27. [[ -n "$recorded_ruby_name" ]] || return 1
  28. if
  29. [[ -s "$rvm_user_path/installs" ]] &&
  30. __rvm_grep "^$recorded_ruby_name " "$rvm_user_path/installs" >/dev/null 2>&1
  31. then
  32. __rvm_grep "^$recorded_ruby_name " "$rvm_user_path/installs" | \command \head -n 1
  33. else
  34. return 1
  35. fi
  36. }