Permalink
Browse files

allow installing rvm without part of default gems, update #1034

  • Loading branch information...
1 parent 551180b commit 32ddc5d39dafa2239122ae4cca0f5937f384a184 @mpapis mpapis committed Jul 2, 2012
Showing with 45 additions and 35 deletions.
  1. +13 −3 binscripts/rvm-installer
  2. +4 −0 help/upgrade-notes.txt
  3. +2 −2 scripts/functions/environment
  4. +23 −30 scripts/functions/installer
  5. +3 −0 scripts/install
View
@@ -257,6 +257,11 @@ do
printf "%b" "Turning on ${token/_/ } mode.\n"
;;
+ --without-gems=*)
+ export rvm_without_gems="${token#--without-gems=}"
+ printf "%b" "Installing RVM without gems: ${rvm_without_gems}.\n"
+ ;;
+
--version|version)
version="$1"
shift
@@ -381,8 +386,9 @@ case "${version}" in
;;
esac
-# No matter which one we are doing we install the same way, using the RVM installer script.
-flags=()
+# required flag - path to install
+flags=( --path "$rvm_path" )
+
if (( rvm_trace_flag == 1 ))
then flags+=("--trace")
fi
@@ -395,8 +401,12 @@ if (( rvm_auto_flag == 1 ))
then flags+=("--auto")
fi
+if [[ -n "${rvm_without_gems:-}" ]]
+then flags+=("--without-gems=${rvm_without_gems}")
+fi
+
chmod +x ./scripts/install
-./scripts/install ${flags[*]} --path "$rvm_path"
+./scripts/install "${flags[@]}"
(
source ${rvm_scripts_path:-${rvm_path}/scripts}/rvm
View
@@ -53,3 +53,7 @@
* Optionally you can run \`rvm tools rvm-env ruby bash\` which will generate
shebang wrappers for easier selecting ruby in scripts.
+
+ * RVM comes with set of default gems including 'bundler', 'rake', 'rubygems-bundler' and 'rvm' gems,
+ if you do not wish to get this gems install RVM with this flag: --without-gems="rvm rubygems-bundler"
+ this option is remembered, it's enough to use it once.
@@ -228,7 +228,7 @@ __rvm_setup()
export rvm_head_flag rvm_ruby_selected_flag rvm_user_install_flag rvm_path_flag rvm_cron_flag rvm_static_flag rvm_default_flag rvm_loaded_flag rvm_llvm_flag rvm_skip_autoreconf_flag rvm_18_flag rvm_19_flag rvm_force_autoconf_flag rvm_autoconf_flags rvm_dump_environment_flag rvm_verbose_flag rvm_debug_flag rvm_trace_flag rvm_pretty_print_flag rvm_create_flag rvm_remove_flag rvm_gemdir_flag rvm_reload_flag rvm_auto_reload_flag rvm_ignore_gemsets_flag rvm_skip_gemsets_flag rvm_install_on_use_flag
export rvm_gems_cache_path rvm_gems_path rvm_man_path rvm_ruby_gem_path rvm_ruby_log_path rvm_ruby_load_path rvm_gems_cache_path rvm_archives_path rvm_docs_path rvm_environments_path rvm_examples_path rvm_gems_path rvm_gemsets_path rvm_help_path rvm_hooks_path rvm_lib_path rvm_log_path rvm_patches_path rvm_repos_path rvm_rubies_path rvm_scripts_path rvm_src_path rvm_tmp_path rvm_user_path rvm_usr_path rvm_wrappers_path rvm_externals_path
export rvm_ruby_strings rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc 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_tag rvm_ruby_sha rvm_ruby_version rvm_ruby_require rvm_ruby_package_file rvm_ruby_name rvm_ruby_name rvm_ruby_args rvm_ruby_user_tag rvm_ruby_patch detected_rvm_ruby_name
- export __rvm_env_loaded next_token rvm_error_message rvm_gemset_name rvm_parse_break rvm_token rvm_action rvm_export_args rvm_gemset_separator rvm_expanding_aliases rvm_architectures rvm_patch_names rvm_tar_command rvm_tar_options rvm_ree_options rvm_patch_original_pwd rvm_project_rvmrc rvm_archive_extension rvm_autoinstall_bundler_flag rvm_codesign_identity rvm_expected_gemset_name
+ export __rvm_env_loaded next_token rvm_error_message rvm_gemset_name rvm_parse_break rvm_token rvm_action rvm_export_args rvm_gemset_separator rvm_expanding_aliases rvm_architectures rvm_patch_names rvm_tar_command rvm_tar_options rvm_ree_options rvm_patch_original_pwd rvm_project_rvmrc rvm_archive_extension rvm_autoinstall_bundler_flag rvm_codesign_identity rvm_expected_gemset_name rvm_without_gems
# Setup only on first load.
if (( __rvm_env_loaded != 1 ))
@@ -309,7 +309,7 @@ __rvm_teardown()
unset rvm_head_flag rvm_ruby_selected_flag rvm_user_install_flag rvm_path_flag rvm_cron_flag rvm_static_flag rvm_default_flag rvm_loaded_flag rvm_llvm_flag rvm_skip_autoreconf_flag rvm_18_flag rvm_19_flag rvm_force_autoconf_flag rvm_autoconf_flags rvm_dump_environment_flag rvm_verbose_flag rvm_debug_flag rvm_trace_flag rvm_pretty_print_flag rvm_create_flag rvm_remove_flag rvm_gemdir_flag rvm_reload_flag rvm_auto_reload_flag rvm_ignore_gemsets_flag rvm_skip_gemsets_flag rvm_install_on_use_flag
unset rvm_gems_cache_path rvm_gems_path rvm_man_path rvm_ruby_gem_path rvm_ruby_log_path rvm_ruby_load_path rvm_gems_cache_path rvm_archives_path rvm_docs_path rvm_environments_path rvm_examples_path rvm_gems_path rvm_gemsets_path rvm_help_path rvm_hooks_path rvm_lib_path rvm_log_path rvm_patches_path rvm_repos_path rvm_rubies_path rvm_scripts_path rvm_src_path rvm_tmp_path rvm_user_path rvm_usr_path rvm_wrappers_path rvm_externals_path
unset rvm_ruby_strings rvm_ruby_binary rvm_ruby_gem_home rvm_ruby_home rvm_ruby_interpreter rvm_ruby_irbrc 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_tag rvm_ruby_sha rvm_ruby_version rvm_ruby_require rvm_ruby_package_file rvm_ruby_name rvm_ruby_name rvm_ruby_args rvm_ruby_user_tag rvm_ruby_patch detected_rvm_ruby_name
- unset __rvm_env_loaded next_token rvm_error_message rvm_gemset_name rvm_parse_break rvm_token rvm_action rvm_export_args rvm_gemset_separator rvm_expanding_aliases rvm_architectures rvm_patch_names rvm_tar_command rvm_tar_options rvm_ree_options rvm_patch_original_pwd rvm_project_rvmrc rvm_archive_extension rvm_autoinstall_bundler_flag rvm_codesign_identity rvm_expected_gemset_name
+ unset __rvm_env_loaded next_token rvm_error_message rvm_gemset_name rvm_parse_break rvm_token rvm_action rvm_export_args rvm_gemset_separator rvm_expanding_aliases rvm_architectures rvm_patch_names rvm_tar_command rvm_tar_options rvm_ree_options rvm_patch_original_pwd rvm_project_rvmrc rvm_archive_extension rvm_autoinstall_bundler_flag rvm_codesign_identity rvm_expected_gemset_name rvm_without_gems
if builtin command -v __rvm_cleanup_download >/dev/null 2>&1
then
@@ -102,30 +102,6 @@ determine_install_path()
{
export HOME="${HOME%%+(\/)}" # Remove trailing slashes if they exist on HOME
- if (( ${rvm_ignore_rvmrc:=0} == 0 ))
- then
- : rvm_stored_umask:${rvm_stored_umask:=$(umask)}
-
- rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc")
- if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
- then rvm_rvmrc_files+=( "${rvm_prefix}/.rvmrc" )
- fi
- for rvmrc in "${rvm_rvmrc_files[@]}"
- do
- if [[ -f "$rvmrc" ]]
- then
- if GREP_OPTIONS="" \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
- then
- printf "%b" "\nError: $rvmrc is for rvm settings only.\nrvm CLI may NOT be called from within $rvmrc. \nSkipping the loading of $rvmrc"
- return 1
- else
- source "$rvmrc"
- fi
- fi
- done
- unset rvm_rvmrc_files
- fi
-
if [[ -z "${rvm_path:-}" ]]
then
if (( UID == 0 ))
@@ -159,6 +135,7 @@ print_install_header()
configure_installation()
{
+ typeset save_rvm_without_gems
install_source_path="$(dirname "$0" | sed 's#\/scripts$##')"
if [[ -d "$install_source_path/scripts" \
@@ -170,18 +147,17 @@ configure_installation()
# Save scripts path
scripts_path=${rvm_scripts_path:-""}
rvm_scripts_path="${PWD%%+(\/)}/scripts"
- # Load scripts.
+ save_rvm_without_gems="${rvm_without_gems:-}"
+ # Load scripts.
source "$PWD/scripts/initialize"
source "$PWD/scripts/functions/init"
source "$PWD/scripts/version"
-
- # What does this do that scripts/initialize not do?:
__rvm_initialize
# Restore Scripts Path
rvm_scripts_path=${scripts_path:-"$rvm_path/scripts"}
- #
+ rvm_without_gems="${save_rvm_without_gems:-${rvm_without_gems}}"
item="* "
question="\n<?>"
@@ -443,18 +419,35 @@ install_gemsets()
then
destination_path="${destination%/*}"
[[ -d "$destination_path" ]] || mkdir -p "$destination_path"
- cp "$gemset_file" "$destination"
+ if
+ [[ -n "${rvm_without_gems:-}" ]]
+ then
+ sed -E '/^('"${rvm_without_gems// /|}"')/ d' < "$gemset_file" > "$destination"
+ else
+ cp "$gemset_file" "$destination"
+ fi
fi
done
fi
+
+ if [[ -n "${rvm_without_gems:-}" ]]
+ then
+ if GREP_OPTIONS="" \grep "rvm_without_gems=" ~/.rvmrc >/dev/null
+ then
+ sed -i 's/^rvm_without_gems=.*$/rvm_without_gems="'"${rvm_without_gems}"'"/' ~/.rvmrc
+ else
+ echo "rvm_without_gems=\"${rvm_without_gems}\"" >> ~/.rvmrc
+ fi
+ fi
}
update_gemsets_install_rvm()
{
typeset paths path installed found missing
typeset -a missing
- if [[ ${rvm_keep_gemset_defaults_flag:-0} == 0 ]]
+ if [[ ${rvm_keep_gemset_defaults_flag:-0} == 0 ]] &&
+ ! [[ " ${rvm_without_gems:-} " =~ " rvm " ]]
then
# rvm /gems
paths=($(
View
@@ -48,6 +48,9 @@ do
(--auto)
rvm_auto_flag=1
;;
+ (--without-gems=*)
+ export rvm_without_gems="${token#--without-gems=}"
+ ;;
(--path)
rvm_path="$1"
shift

0 comments on commit 32ddc5d

Please sign in to comment.