Skip to content

Commit

Permalink
Feature: --branch for use with git head repositories.
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneeseguin committed Oct 21, 2010
1 parent 6095007 commit 019ca70
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
8 changes: 7 additions & 1 deletion scripts/cli
Expand Up @@ -272,6 +272,12 @@ __rvm_parse_args()
fi
;;

--branch)
rvm_ruby_repo_branch="$next_token"
shift
next_token="${2:-""}"
;;

--repository|--repo|--url)
rvm_ruby_repo_url="$next_token"
shift
Expand Down Expand Up @@ -643,7 +649,7 @@ rvm()

rvm_action="${rvm_action:-usage}"

export BUNDLE_PATH GEM_HOME GEM_PATH rvm_action rvm_archflags rvm_bin_flag rvm_bin_path rvm_clang_flag rvm_configure_flags rvm_debug_flag rvm_delete_flag rvm_docs_type rvm_dump_environment_flag rvm_error_message rvm_file_name rvm_gemdir_flag rvm_gemset_name rvm_head_flag rvm_install_arguments rvm_install_on_use_flag rvm_interactive_flag rvm_llvm_flag rvm_loaded_flag rvm_make_flags rvm_niceness rvm_only_path_flag rvm_parse_break rvm_patch_names rvm_patch_original_pwd rvm_pretty_print_flag rvm_prior_cc rvm_proxy rvm_quiet_flag rvm_ree_options rvm_reload_flag rvm_remove_flag rvm_ruby_alias rvm_ruby_aliases rvm_ruby_args rvm_ruby_file rvm_ruby_gem_home rvm_ruby_interpreter rvm_ruby_load_path rvm_ruby_make rvm_ruby_make_install rvm_ruby_patch_level rvm_ruby_repo_url rvm_ruby_require rvm_ruby_string rvm_ruby_strings rvm_ruby_version rvm_script_name rvm_sdk rvm_silent_flag rvm_system_flag rvm_token rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag rvm_wrapper_name
export BUNDLE_PATH GEM_HOME GEM_PATH rvm_action rvm_archflags rvm_bin_flag rvm_bin_path rvm_clang_flag rvm_configure_flags rvm_debug_flag rvm_delete_flag rvm_docs_type rvm_dump_environment_flag rvm_error_message rvm_file_name rvm_gemdir_flag rvm_gemset_name rvm_head_flag rvm_install_arguments rvm_install_on_use_flag rvm_interactive_flag rvm_llvm_flag rvm_loaded_flag rvm_make_flags rvm_niceness rvm_only_path_flag rvm_parse_break rvm_patch_names rvm_patch_original_pwd rvm_pretty_print_flag rvm_prior_cc rvm_proxy rvm_quiet_flag rvm_ree_options rvm_reload_flag rvm_remove_flag rvm_ruby_alias rvm_ruby_aliases rvm_ruby_args rvm_ruby_file rvm_ruby_gem_home rvm_ruby_interpreter rvm_ruby_load_path rvm_ruby_make rvm_ruby_make_install rvm_ruby_patch_level rvm_ruby_repo_url rvm_ruby_repo_branch rvm_ruby_require rvm_ruby_string rvm_ruby_strings rvm_ruby_version rvm_script_name rvm_sdk rvm_silent_flag rvm_system_flag rvm_token rvm_trace_flag rvm_use_flag rvm_user_flag rvm_verbose_flag rvm_wrapper_name

case "$rvm_action" in
use) __rvm_use ;;
Expand Down
25 changes: 25 additions & 0 deletions scripts/manage
Expand Up @@ -1419,6 +1419,31 @@ __rvm_fetch_ruby()
fi
fi

if [[ -z "$rvm_ruby_repo_branch" ]]; then
rvm_ruby_repo_branch="master"
fi

(
remote="origin"

cd "${rvm_repos_path:-"$rvm_path/repos"}/$rvm_ruby_string"

if [[ -z "$(git branch | awk "/$rvm_ruby_repo_branch$/")" ]] ; then

git checkout -b "$rvm_ruby_repo_branch" --track "$remote/$rvm_ruby_repo_branch" 2>/dev/null

elif [[ -z "$(git branch | awk "/\* $rvm_ruby_repo_branch$/")" ]] ; then

if ! git checkout $rvm_ruby_repo_branch 2>/dev/null ; then

"$rvm_path/scripts/log" "error" \
"Branch $remote/$rvm_ruby_repo_branch not found."

fi

fi
)

else
if [[ -n "${rvm_ruby_tag:-""}" ]] ; then
# TODO: Check if tag v is valid
Expand Down
2 changes: 2 additions & 0 deletions scripts/selector
Expand Up @@ -463,10 +463,12 @@ __rvm_ruby_string()
ruby_string=${rvm_ruby_string:-""}
gemset_name=${rvm_gemset_name:-""}
repo_url=${rvm_ruby_repo_url:-""}
branch_name=${rvm_ruby_repo_branch:-""}

__rvm_unset_ruby_variables

rvm_ruby_repo_url=${repo_url:-""}
rvm_ruby_repo_branch=${branch_name:-""}

if [[ ! -z "$gemset_name" ]] ; then
rvm_gemset_name="$gemset_name"
Expand Down
6 changes: 4 additions & 2 deletions scripts/utility
Expand Up @@ -48,7 +48,7 @@ __rvm_teardown()

fi

unset rvm_ruby_strings rvm_head_flag rvm_prior_cc next_token rvm_bin_path rvm_error_message rvm_gems_cache_path rvm_gems_path rvm_gemset_name rvm_interactive_flag rvm_man_path rvm_parse_break rvm_rc_files rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_gem_path rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_log_path rvm_ruby_major_version rvm_ruby_minor_version rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_revision rvm_ruby_selected_flag rvm_ruby_tag rvm_ruby_version rvm_selfcontained rvm_token rvm_ruby_load_path rvm_path_flag rvm_ruby_require rvm_action
unset rvm_ruby_strings rvm_head_flag rvm_prior_cc next_token rvm_bin_path rvm_error_message rvm_gems_cache_path rvm_gems_path rvm_gemset_name rvm_interactive_flag rvm_man_path rvm_parse_break rvm_rc_files rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_gem_path rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_log_path rvm_ruby_major_version rvm_ruby_minor_version rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_repo_branch rvm_ruby_revision rvm_ruby_selected_flag rvm_ruby_tag rvm_ruby_version rvm_selfcontained rvm_token rvm_ruby_load_path rvm_path_flag rvm_ruby_require rvm_action

[[ ${rvm_dump_environment_flag:-0} -eq 1 ]] && __rvm_dump_environment

Expand Down Expand Up @@ -363,7 +363,9 @@ __rvm_nuke_rvm_variables()
# Unset ruby-specific variables
__rvm_unset_ruby_variables()
{
unset rvm_ruby_flag $(env | awk -F= '/^rvm_ruby_/{printf $1" "}')
# unset rvm_ruby_flag $(env | awk -F= '/^rvm_ruby_/{printf $1" "}')
unset rvm_ruby_strings rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_gem_path rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc rvm_ruby_log_path rvm_ruby_major_version rvm_ruby_minor_version rvm_ruby_package_name rvm_ruby_patch_level rvm_ruby_release_version rvm_ruby_repo_url rvm_ruby_repo_branch rvm_ruby_revision rvm_ruby_selected_flag rvm_ruby_tag rvm_ruby_version rvm_ruby_load_path rvm_ruby_require

}

# TODO: Should be able to...
Expand Down

0 comments on commit 019ca70

Please sign in to comment.