Permalink
Browse files

Feature: 'rvm X --rvmrc'.

  • Loading branch information...
1 parent 76d8ecd commit 58fc290848d33c185a1fd00fbb1372c7663765de @wayneeseguin wayneeseguin committed Feb 12, 2010
Showing with 21 additions and 7 deletions.
  1. +1 −1 scripts/cli
  2. +9 −6 scripts/manage
  3. +1 −0 scripts/selector
  4. +10 −0 scripts/utility
View
@@ -280,7 +280,7 @@ __rvm_parse_args() {
--disable-llvm|--disable-jit) export rvm_llvm_flag=0 ;;
--enable-llvm|--enable-jit) export rvm_llvm_flag=1 ;;
- --self|--gem|--rubygems|--reconfigure|--default|--debug|--force|--all|--dump|--summary|--latest|--yaml|--json|--archive|--shebang|--env|--path|--tail|--delete|--verbose|--load|--passenger|--editor)
+ --self|--gem|--rubygems|--reconfigure|--default|--debug|--force|--all|--dump|--summary|--latest|--yaml|--json|--archive|--shebang|--env|--path|--tail|--delete|--verbose|--load|--rvmrc|--passenger|--editor)
export rvm_$(echo $rvm_token | sed 's#-##g')_flag=1
if [[ "--debug" = "$rvm_token" ]] ; then export rvm_debug_flag ; fi
;;
View
@@ -42,12 +42,15 @@ __rvm_install_source() {
if [[ "1.8.5" = "$rvm_ruby_version" ]] ; then
# How to install ruby 1.8.5... "sneaky sneaky, sir"
- if [[ ! -d "$HOME/.rvm/src/ruby-1.8.7-p248/ext/openssl/" ]] ; then $rvm_path/bin/rvm fetch 1.8.6-p248 > /dev/null ; fi
- if [[ ! -d "$HOME/.rvm/src/ruby-1.8.6-p383/ext/openssl/" ]] ; then $rvm_path/bin/rvm fetch 1.8.6-p383 > /dev/null ; fi
- cp ~/.rvm/src/ruby-1.8.7-p248/ext/openssl/extconf.rb ~/.rvm/src/ruby-1.8.5-p231/ext/openssl/
- cp ~/.rvm/src/ruby-1.8.7-p248/ext/openssl/openssl_missing.* ~/.rvm/src/ruby-1.8.5-p231/ext/openssl/
- cp ~/.rvm/src/ruby-1.8.7-p248/ext/openssl/ossl_hmac.c ~/.rvm/src/ruby-1.8.5-p231/ext/openssl/
- cp ~/.rvm/src/ruby-1.8.6-p383/ext/readline/* ~/.rvm/src/ruby-1.8.5-p231/ext/readline/
+ src_dir="ruby-1.8.7-p$(__rvm_db "ruby_1.8.7_patch_level")"
+ if [[ ! -d "$HOME/.rvm/src/$src_dir/ext/openssl/" ]] ; then $rvm_path/bin/rvm fetch 1.8.6-p248 > /dev/null ; fi
+ cp ~/.rvm/src/$src_dir/ext/openssl/extconf.rb ~/.rvm/src/ruby-1.8.5-p231/ext/openssl/
+ cp ~/.rvm/src/$src_dir/ext/openssl/openssl_missing.* ~/.rvm/src/ruby-1.8.5-p231/ext/openssl/
+ cp ~/.rvm/src/$src_dir/ext/openssl/ossl_hmac.c ~/.rvm/src/ruby-1.8.5-p231/ext/openssl/
+ src_dir="ruby-1.8.6-p$(__rvm_db "ruby_1.8.6_patch_level")"
+ if [[ ! -d "$HOME/.rvm/src/$src_dir/ext/openssl/" ]] ; then $rvm_path/bin/rvm fetch 1.8.6-p383 > /dev/null ; fi
+ cp ~/.rvm/src/$src_dir/ext/readline/* ~/.rvm/src/ruby-1.8.5-p231/ext/readline/
+ unset src_dir
fi
if [[ -s ./Makefile ]] && [[ -z "$rvm_reconfigure_flag" ]] ; then
View
@@ -334,6 +334,7 @@ __rvm_use() {
if [[ ! -z "$rvm_symlink_name" ]] ; then $rvm_scripts_path/symlink "$rvm_symlink_name" ; unset rvm_symlink_name ; fi
if [[ ! -z "$rvm_editor_flag" ]] ; then $rvm_scripts_path/symlink "editor" ; unset rvm_editor_flag ; fi
if [[ ! -z "$rvm_passenger_flag" ]] ; then $rvm_scripts_path/symlink "passenger" ; unset rvm_passenger_flag ; fi
+ if [[ ! -z "$rvm_rvmrc_flag" ]] ; then __rvm_set_rvmrc ; fi
# Export ruby string and gem set name for extrnal scripts to take advantage of them.
if [[ ! -z "$rvm_ruby_string" ]] ; then export rvm_ruby_string ; fi
if [[ ! -z "$rvm_gem_set_name" ]] ; then export rvm_gem_set_name ; fi
View
@@ -158,6 +158,16 @@ __rvm_unset_ruby_variables() {
unset rvm_ruby_interpreter rvm_ruby_version rvm_url rvm_ruby_repo_url rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_make rvm_ruby_make_install rvm_ruby_revision rvm_ruby_tag rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_ruby_binary rvm_ruby_home rvm_ruby_log_path rvm_ruby_src_path rvm_ruby_irbrc rvm_ruby_selected_flag rvm_ruby_string rvm_ruby_string rvm_ruby_src_path rvm_ruby_repo_url rvm_major_version rvm_minor_version rvm_ruby_gem_home rvm_head_flag rvm_ruby_configure rvm_ruby_mode rvm_ruby_package_file rvm_ruby_package_name rvm_ruby_gem_path
}
+__rvm_set_rvmrc() {
+ if [[ "$HOME" != "$(pwd)" ]] ; then
+ if [[ -s .rvmrc ]] ; then
+ mv .rvmrc .rvmrc.$(date +%m.%d.%Y-%H:%M:%S)
+ fi
+ echo "rvm use $(basename $rvm_ruby_gem_home)" > .rvmrc
+ else
+ echo -e "Not setting a project specific rvmrc file, currently in the HOME directory."
+ fi
+}
__rvm_load_rvmrc() {
if [[ -f /etc/rvmrc ]] ; then source /etc/rvmrc ; fi
if [[ -f "$HOME/.rvmrc" ]] ; then source "$HOME/.rvmrc" ; fi

0 comments on commit 58fc290

Please sign in to comment.