scripts/gemsets in rvm-0.1.45 vs scripts/gemsets in rvm-0.1.46
- old
+ new
@@ -41,24 +41,24 @@
$rvm_scripts_path/log "info" "Removing the global cache (note: this will empty the caches)"
for directory_name in $(\ls "$rvm_gems_path"); do
current_cache_path="$rvm_gems_path/$directory_name/cache"
if [[ -L "$current_cache_path" && "$(readlink "$current_cache_path")" == "$rvm_gems_cache_path" ]]; then
$rvm_scripts_path/log "info" "Reverting the gem cache for $directory_name to an empty directory."
- rm -f "$current_cache_path" 2>/dev/null
- mkdir -p "$current_cache_path" 2>/dev/null
+ \rm -f "$current_cache_path" 2>/dev/null
+ \mkdir -p "$current_cache_path" 2>/dev/null
fi
done; unset full_directory_path directory_name
$rvm_scripts_path/db "$rvm_config_path/user" "use_gemset_globalcache" "delete"
elif [[ "$1" == "enable" ]]; then
$rvm_scripts_path/log "info" "Enabling global cache for gems."
- mkdir -p "$rvm_gems_cache_path"
+ \mkdir -p "$rvm_gems_cache_path"
for directory_name in $(\ls "$rvm_gems_path"); do
current_cache_path="$rvm_gems_path/$directory_name/cache"
if [[ -d "$current_cache_path" && ! -L "$current_cache_path" ]]; then
$rvm_scripts_path/log "info" "Moving the gem cache for $directory_name to the global cache."
mv "$current_cache_path/"*.gem "$rvm_gems_cache_path/" 2>/dev/null
- rm -rf "$current_cache_path"
+ \rm -rf "$current_cache_path"
ln -nfs "$rvm_gems_cache_path" "$current_cache_path"
fi
done; unset full_directory_path directory_name
$rvm_scripts_path/db "$rvm_config_path/user" "use_gemset_globalcache" "true"
else
@@ -78,16 +78,16 @@
gemset_create() {
rvm_ruby_gem_prefix=$(echo $rvm_ruby_gem_home | sed 's/'${rvm_gemset_separator}'.*$//')
for gemset in $(echo $gems_args) ; do
gem_home="${rvm_ruby_gem_prefix}${rvm_gemset_separator}${gemset}"
- mkdir -p "$gem_home"
+ \mkdir -p "$gem_home"
# When the globalcache is enabled, we need to ensure we setup the cache directory correctly.
if __rvm_using_gemset_globalcache; then
if [[ -d "$gem_home/cache" && ! -L "$gem_home/cache" ]]; then
mv "$gem_home/cache"/*.gem "$rvm_gems_cache_path/" 2>/dev/null
- rm -rf "$gem_home/cache"
+ \rm -rf "$gem_home/cache"
fi
ln -nfs "$rvm_gems_cache_path" "$gem_home/cache"
fi
$rvm_scripts_path/log "info" "Gemset '$gemset' created."
done ; unset gem_home
@@ -112,18 +112,18 @@
gemset_delete() {
if [[ -z "$rvm_ruby_selected_flag" ]] ; then __rvm_select ; fi
if [[ ! -z "$rvm_gemset_name" ]] ; then
gemdir="$rvm_gems_path/$rvm_ruby_string${rvm_gemset_separator}$rvm_gemset_name"
if [[ -d "$gemdir" ]] && [[ "$gemdir" != '/' ]] && [[ ! -z "$rvm_force_flag" ]] ; then
- rm -rf "$gemdir"
+ \rm -rf "$gemdir"
elif [[ -d "$gemdir" ]] ; then
$rvm_scripts_path/log "warn" "Are you SURE you wish to remove the entire gemset directory '$rvm_gemset_name' ($gemdir)?"
echo -n "(anything other than 'yes' will cancel) > "
read response
if [[ "yes" = "$response" ]] ; then
- rm -f $gemdir/cache 2>/dev/null
- rm -rf $gemdir
+ \rm -f $gemdir/cache 2>/dev/null
+ \rm -rf $gemdir
else
$rvm_scripts_path/log "info" "Not doing anything, phew... close call that one eh?"
fi
else
$rvm_scripts_path/log "info" "$gemdir already does not exist."
@@ -135,17 +135,17 @@
gemset_empty() {
if [[ -z "$rvm_ruby_gem_home" ]] ; then __rvm_select ; fi
gemdir="$rvm_ruby_gem_home"
if [[ -d "$gemdir" ]] && [[ "$gemdir" != '/' ]] && [[ ! -z "$rvm_force_flag" ]] ; then
- builtin cd $gemdir && rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
+ builtin cd $gemdir && \rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
elif [[ -d "$gemdir" ]] ; then
$rvm_scripts_path/log "warn" "Are you SURE you wish to remove the installed gemset for gemset '$(basename $gemdir)' ($gemdir)?"
echo -n "(anything other than 'yes' will cancel) > "
read response
if [[ "yes" = "$response" ]] ; then
- builtin cd $gemdir && rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
+ builtin cd $gemdir && \rm -rf ./bin/* ./doc/* ./gems/* ./specifications/*
else
$rvm_scripts_path/log "info" "Not doing anything, phew... close call that one eh?"
fi
else
$rvm_scripts_path/log "info" "$gemdir already does not exist."
@@ -154,35 +154,35 @@
# Migrate gemsets from ruby X to ruby Y
gemset_copy() {
local source_ruby="$(echo "$gems_args" | awk '{print $1}')"
local destination_ruby="$(echo "$gems_args" | awk '{print $2}')"
-
+
if [[ -z "$destination_ruby" || -z "$source_ruby" ]] ; then
$rvm_scripts_path/log "error" "Source and destination must be specified: 'rvm gemset copy X Y'"
return 1
fi
-
+
local source_path="$(rvm_silence_logging=1 rvm "$source_ruby" gem env gemdir)"
local destination_path="$(rvm_silence_logging=1 rvm "$destination_ruby" gem env gemdir)"
-
+
if [[ -z "$source_path" ]]; then
$rvm_scripts_path/log "error" "Unable to expand ruby '$source_ruby'"
return 1
fi
-
+
if [[ -z "$destination_path" ]]; then
$rvm_scripts_path/log "error" "Unable to expand ruby '$destination_ruby'"
return 1
fi
-
+
if [[ -d "$source_path" ]] ; then
- [[ ! -d "$destination_path" ]] && mkdir -p "$destination_path"
+ [[ ! -d "$destination_path" ]] && \mkdir -p "$destination_path"
$rvm_scripts_path/log "info" "Copying gemset from $source_ruby to $destination_ruby"
for dir in bin doc gems specifications cache ; do
- mkdir -p "$destination_path/$dir"
- cp -Rf "$source_path/$dir" "$destination_path/"
+ \mkdir -p "$destination_path/$dir"
+ \cp -Rf "$source_path/$dir" "$destination_path/"
done
$rvm_scripts_path/log "info" "Making gemset for $destination_ruby pristine."
__rvm_run_with_env "gemset.pristine" "$destination_ruby" "rvm gemset pristine"
else
$rvm_scripts_path/log "error" "Gems directory does not exist for $source_path ($source_path)"
@@ -207,11 +207,11 @@
fi
fi
$rvm_scripts_path/log "info" "Exporting current environments gemset to $rvm_file_name"
- touch $rvm_file_name
+ \touch $rvm_file_name
echo "# $rvm_file_name generated gem export file. Note that any env variable settings will be missing. Append these after using a ';' field separator" > $rvm_file_name
for gem in $(gem list | sed 's#[\(|\)]##g' | sed 's#, #,#g' | \tr ' ' ';') ; do
name="$(echo $gem | awk -F';' '{print $1}')"
if [[ -z "$rvm_latest_flag" ]] ; then
versions="$(echo $gem | awk -F';' '{print $2}' | sed 's#,# #g')"
@@ -249,11 +249,11 @@
else
$rvm_scripts_path/log "error" "No *.gems file found."
return 1
fi
- mkdir -p "$rvm_gems_cache_path" # Ensure the base cache dir is initialized.
+ \mkdir -p "$rvm_gems_cache_path" # Ensure the base cache dir is initialized.
if [[ -s "$rvm_file_name" ]] ; then
echo "Importing $rvm_file_name file..."
rvm_ruby_gem_list=$(\ls $rvm_ruby_gem_home/specifications/ 2> /dev/null | sed 's#.gems.*$##' 2> /dev/null)
@@ -333,11 +333,11 @@
if [[ -z "$rvm_force_flag" ]] && [[ -s "${rvm_ruby_gem_home}/specifications/$(basename $gem_file_name)spec" ]] ; then
unset gem # already installed, not forcing reinstall.
$rvm_scripts_path/log "info" "$gem_name $gem_version exists, skipping (--force to re-install)"
else
if [[ -s "$(__rvm_current_gemcache_dir)/$(basename $gem_file_name)" ]] ; then
- mkdir -p "$rvm_tmp_path/$$/"
+ \mkdir -p "$rvm_tmp_path/$$/"
mv "$(__rvm_current_gemcache_dir)/$gem_file_name" "$rvm_tmp_path/$$/$gem_file_name"
gem="$rvm_tmp_path/$$/$gem_file_name -f -l"
else
gem="$cache_file"
fi
@@ -384,11 +384,11 @@
}
gemset_prune() {
temporary_cache_path="$GEM_HOME/temporary-cache"
live_cache_path="$GEM_HOME/cache"
- mkdir -p "$temporary_cache_path"
+ \mkdir -p "$temporary_cache_path"
$rvm_scripts_path/log "info" "Moving active gems into temporary cache..."
while read -r used_gem; do
gem_name="$(echo "$used_gem" | sed -e 's/ .*//')"
versions="$(echo "$used_gem" | sed -e 's/.* (//' -e 's/)//' | \tr ', ' ' ')"
for version in $versions; do
@@ -399,21 +399,21 @@
fi
done
done < <(gem list --versions)
$rvm_scripts_path/log "info" "Removing live cache and restoring temporary cache..."
# Switch the cache back.
- rm -rf "$live_cache_path"
+ \rm -rf "$live_cache_path"
mv "$temporary_cache_path" "$live_cache_path"
}
gemset_pristine() {
gem pristine --all
}
# Loads the default gemsets for the current interpreter and gemset.
gemset_initial() {
$rvm_scripts_path/log "info" "Importing initial gemsets for $(__rvm_environment_identifier)."
- mkdir -p "$rvm_gemsets_path/$(echo "$rvm_ruby_string" | \tr '-' '/')" 2>/dev/null
+ \mkdir -p "$rvm_gemsets_path/$(echo "$rvm_ruby_string" | \tr '-' '/')" 2>/dev/null
for gemsets_path in $(__rvm_ruby_string_paths_under "$rvm_gemsets_path") ; do
if [[ -n "$rvm_gemset_name" ]] ; then
if [[ -s "${gemsets_path}/${rvm_gemset_name}.gems" ]] ; then
(source "$rvm_scripts_path/rvm"; rvm gemset import "${gemsets_path}/${rvm_gemset_name}.gems") > /dev/null
fi