Skip to content

Commit

Permalink
Merge pull request #1089 from wayneeseguin/fork_tidyup
Browse files Browse the repository at this point in the history
Fork tidyup
  • Loading branch information
mpapis committed Sep 2, 2012
2 parents 65acaa6 + 65fbddc commit 4c7ed0f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
5 changes: 3 additions & 2 deletions contrib/gemset_snapshot
Expand Up @@ -8,9 +8,10 @@ gems=($(gem list | sed 's#[\(|\)]##g' | sed 's#, #,#g' | \tr ' ' ';'))

for gem in "${gems[@]}" ; do

name="$(echo $gem | awk -F';' '{print $1}')"
name="${gem%%;*}"

versions=($(echo $gem | awk -F';' '{print $2}' | sed 's#,# #g'))
versions=${gem#*;}
versions=(${versions/,/ })

for version in "${versions[@]}" ; do

Expand Down
5 changes: 3 additions & 2 deletions scripts/disk-usage
Expand Up @@ -14,14 +14,15 @@ usage()

disk_usage()
{
typeset path name
typeset path name _pre
name="$1"
path="$2"
shift 2
printf "%${length}s" "${name} Usage: "
if [[ -n "$path" && -d "$path" && "$path" != "/" ]]
then
du -hs "$@" "${path}/" | awk '{print $1}'
_pre="$(du -hs "$@" "${path}/")"
echo ${_pre%% *}
else
echo "0B"
fi
Expand Down
2 changes: 1 addition & 1 deletion scripts/docs
Expand Up @@ -3,7 +3,7 @@ rvm_base_except="selector"

source "$rvm_scripts_path/base"

rvm_docs_ruby_string="$(__rvm_env_string | awk -F"${rvm_gemset_separator:-"@"}" '{print $1}')"
rvm_docs_ruby_string="${__rvm_env_string%%${rvm_gemset_seperator:-"@"}*}"

if [[ "$rvm_docs_ruby_string" == "system" || -z "$rvm_docs_ruby_string" ]]
then
Expand Down
18 changes: 12 additions & 6 deletions scripts/functions/checksum
Expand Up @@ -2,6 +2,7 @@

__rvm_md5_calculate()
{
typeset _sum
if
builtin command -v md5 > /dev/null 2>&1
then
Expand All @@ -10,7 +11,8 @@ __rvm_md5_calculate()
elif
builtin command -v md5sum > /dev/null 2>&1
then
md5sum "$@" | \awk 'NR==1{print $1}'
_sum=$(md5sum "$@")
echo ${_sum%% *}
return 0
else
for _path in /usr/gnu/bin /sbin /bin /usr/bin /usr/sbin
Expand All @@ -23,7 +25,8 @@ __rvm_md5_calculate()
elif
[[ -x "${_path}/md5sum" ]]
then
${_path}/md5sum "$@" | \awk 'NR==1{print $1}'
_sum=$(${_path}/md5sum "$@")
echo ${_sum%% *}
return 0
fi
done
Expand All @@ -35,24 +38,27 @@ __rvm_md5_calculate()

__rvm_sha__calculate()
{
typeset bits
typeset bits _sum
bits=${1:-512}
shift

if
builtin command -v sha${bits}sum >/dev/null
then
sha${bits}sum "$@" | \awk 'NR==1{print $1}'
_sum=$(sha${bits}sum "$@")
echo ${_sum% *}
return 0
elif
builtin command -v sha${bits} >/dev/null
then
sha${bits} "$@" | \awk 'NR==1{print $1}'
_sum=$(sha${bits} "$@")
echo ${_sum% *}
return 0
elif
builtin command -v shasum >/dev/null
then
shasum -a${bits} "$@" | \awk 'NR==1{print $1}'
_sum=$(shasum -a${bits} "$@")
echo ${_sum% *}
return 0
fi

Expand Down
4 changes: 2 additions & 2 deletions scripts/functions/install
Expand Up @@ -30,8 +30,8 @@ __rvm_recorded_install_command()
{
typeset recorded_ruby_name recorded_ruby_match

recorded_ruby_name="$("$rvm_scripts_path/tools" strings "$1" \
| awk -F"${rvm_gemset_separator:-"@"}" '{print $1}')"
recorded_ruby_name="$("$rvm_scripts_path/tools" strings "$1")"
recorded_ruby_name=${recorded_ruby_name%%${rvm_gemset_seperator:-"@"}*}

[[ -z "$recorded_ruby_name" ]] && return 1

Expand Down

0 comments on commit 4c7ed0f

Please sign in to comment.