autolibs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #!/usr/bin/env bash
  2. source "$rvm_scripts_path/functions/db"
  3. __rvm_autolibs_set()
  4. {
  5. __rvm_db_ "$rvm_user_path/db" "autolibs" "$rvm_autolibs_flag"
  6. }
  7. __rvm_autolibs_get()
  8. {
  9. if [[ -z "${rvm_autolibs_flag:-}" ]]
  10. then rvm_autolibs_flag="$( __rvm_db_ "$rvm_user_path/db" "autolibs" )"
  11. fi
  12. rvm_autolibs_flag="${rvm_autolibs_flag:=4}"
  13. }
  14. __rvm_autolibs_reset()
  15. {
  16. __rvm_db_ "$rvm_user_path/db" "autolibs" "delete"
  17. }
  18. __rvm_autolibs_translate()
  19. {
  20. case "${1:-$rvm_autolibs_flag}" in
  21. (0|disable|disabled)
  22. rvm_autolibs_flag_number=0
  23. rvm_autolibs_flag_runner="${_system_name_lowercase}"
  24. ;;
  25. (1|read|read-only)
  26. rvm_autolibs_flag_number=1
  27. rvm_autolibs_flag_runner="${_system_name_lowercase}"
  28. ;;
  29. (2|fail|read-fail)
  30. rvm_autolibs_flag_number=2
  31. rvm_autolibs_flag_runner="${_system_name_lowercase}"
  32. ;;
  33. (3|packages|install-packages)
  34. rvm_autolibs_flag_number=3
  35. rvm_autolibs_flag_runner="${_system_name_lowercase}"
  36. ;;
  37. (portage|gentoo_portage)
  38. rvm_autolibs_flag_number=3
  39. rvm_autolibs_flag_runner="gentoo_portage"
  40. ;;
  41. (paludis|gentoo_paludis)
  42. rvm_autolibs_flag_number=3
  43. rvm_autolibs_flag_runner="gentoo_paludis"
  44. ;;
  45. (pkgcore|gentoo_pkgcore)
  46. rvm_autolibs_flag_number=3
  47. rvm_autolibs_flag_runner="gentoo_pkgcore"
  48. ;;
  49. (4|enable|enabled)
  50. rvm_autolibs_flag_number=4
  51. rvm_autolibs_flag_runner="${_system_name_lowercase}"
  52. ;;
  53. (brew|homebrew|osx_brew)
  54. rvm_autolibs_flag_number=4
  55. rvm_autolibs_flag_runner="osx_brew"
  56. ;;
  57. (port|macports|osx_port)
  58. rvm_autolibs_flag_number=4
  59. rvm_autolibs_flag_runner="osx_port"
  60. ;;
  61. (fink|osx_fink)
  62. rvm_autolibs_flag_number=4
  63. rvm_autolibs_flag_runner="osx_fink"
  64. ;;
  65. (smf|rvm_pkg)
  66. rvm_autolibs_flag_number=4
  67. rvm_autolibs_flag_runner="${rvm_autolibs_flag}"
  68. ;;
  69. (*)
  70. rvm_debug "Unknown 'rvm_autolibs_flag' value '$rvm_autolibs_flag'."
  71. return 1
  72. ;;
  73. esac
  74. if [[ -n "${1:-}" ]]
  75. then rvm_autolibs_flag="$1"
  76. fi
  77. }
  78. __rvm_autolibs_translate_description()
  79. {
  80. __rvm_autolibs_translate
  81. case "${rvm_autolibs_flag_number}" in
  82. (0)
  83. rvm_autolibs_flag_description="Limit RVM automation as much as possible."
  84. ;;
  85. (1)
  86. rvm_autolibs_flag_description="Allow RVM to use package manager if found but do not install or fail if dependencies are missing."
  87. ;;
  88. (2)
  89. rvm_autolibs_flag_description="Allow RVM to use package manager if found, fail if dependencies are missing. This is default."
  90. ;;
  91. (3)
  92. rvm_autolibs_flag_description="Allow RVM to use package manager if found, install missing dependencies."
  93. ;;
  94. (4)
  95. rvm_autolibs_flag_description="Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."
  96. ;;
  97. esac
  98. }