Skip to content
This repository
Browse code

Merge branch 'master' of github.com:wayneeseguin/rvm

  • Loading branch information...
commit 9f8b69a0a1c43a0a2b2a06743c92108fc1b0c704 2 parents 3696687 + 58718ac
Wayne E. Seguin authored
2  contrib/bootstrap_rails_environment
@@ -39,7 +39,7 @@ else
39 39 sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev
40 40 elif command -v pacman
41 41 then
42   - sudo pacman -S --noconfirm gcc patch curl bison zlib readline libxml2 libxslt git autoconf diffutils patch bison make
  42 + sudo pacman -S --noconfirm gcc patch curl bison zlib readline libxml2 libxslt git autoconf diffutils patch make
43 43 elif command -v yum
44 44 then
45 45 sudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel
2  scripts/functions/implode
@@ -7,7 +7,7 @@ __rvm_implode_binaries()
7 7 (
8 8 source "$rvm_scripts_path/base"
9 9
10   - rvm_log "Removing rvm-shipped binaries (rvm-prompt, rvm, rvm-sudom rvm-shell and rvm-auto-ruby)"
  10 + rvm_log "Removing rvm-shipped binaries (rvm-prompt, rvm, rvm-sudo rvm-shell and rvm-auto-ruby)"
11 11 for entry in "$rvm_bin_path/"{rvm-prompt,rvm,rvmsudo,rvm-shell,rvm-auto-ruby} ; do
12 12 __rvm_rm_rf "$entry"
13 13 done
109 scripts/md5
... ... @@ -1,5 +1,114 @@
1 1 #!/usr/bin/env bash
2 2
  3 +#
  4 +# ## variable_is_nonempty()
  5 +#
  6 +# Test to see if a variable is empty.
  7 +#
  8 +# ### Input Parameters
  9 +#
  10 +# First parameter is a string containing a variable name.
  11 +#
  12 +# ### Stream Outputs
  13 +#
  14 +# None.
  15 +#
  16 +# ### Environmental effects
  17 +#
  18 +# None.
  19 +#
  20 +# ### Return Codes
  21 +#
  22 +# 0 for success.
  23 +#
  24 +# ### Failure Scenarios
  25 +#
  26 +# Fails if no variable name was given as the first argument.
  27 +#
  28 +# ### Usage Examples
  29 +#
  30 +# user$ variable_is_nonempty asdf
  31 +# user$ echo $?
  32 +# 1
  33 +#
  34 +# user$ asdf="w00t! "
  35 +# user$ variable_is_nonempty asdf
  36 +# user$ echo $?
  37 +# 0
  38 +#
  39 +variable_is_nonempty()
  40 +{
  41 + # Store the first parameter, which should be the variable name, in the
  42 + # variable variable :)
  43 + local _variable="${1:-}"
  44 +
  45 + # If the variable name is nonempty
  46 + if [[ -n "${_variable}" ]]
  47 + then
  48 + # If the evaluation of a nonempty test with the variable name used [huh???]
  49 + eval "[[ -n \"\${${_variable}:-}\" ]]"
  50 + else
  51 + # Otherwise no parameters were passed in; this is a programming error.
  52 + # Send a failure message which also triggers a backtrace enabling the
  53 + # developer to quickly pinpoint and fix their error.
  54 + fail "Cannot check if variable is nonempty; no variable was given."
  55 + fi
  56 +
  57 +}
  58 +
  59 +#
  60 +# ## command\_exists()
  61 +#
  62 +# Checks to see whether a command exists within the current environment and PATH.
  63 +#
  64 +# ### Input Parameters
  65 +#
  66 +# First parameter is a command name.
  67 +#
  68 +# ### Stream Outputs
  69 +#
  70 +# None.
  71 +#
  72 +# ### Environmental effects
  73 +#
  74 +# none.
  75 +#
  76 +# ### return codes
  77 +#
  78 +# 0 if the command was found in the current environment.
  79 +# 1 if the command was not found in the current environment.
  80 +#
  81 +# ### failure scenarios
  82 +#
  83 +# Fails if no command name was given.
  84 +#
  85 +# ### usage examples
  86 +#
  87 +# user$ command_exists adsf
  88 +# user$ echo $?
  89 +# 1
  90 +#
  91 +# user$ command_exists ls
  92 +# user$ echo $?
  93 +# 0
  94 +#
  95 +command_exists()
  96 +{
  97 + local _name="${1:-}"
  98 +
  99 + if variable_is_nonempty _name
  100 + then
  101 + if command -v "${_name}" > /dev/null 2>&1
  102 + then
  103 + return 0
  104 + else
  105 + return 1
  106 + fi
  107 + else
  108 + fail "Cannot test if command exists; no command name was given."
  109 + fi
  110 +}
  111 +
3 112 if (( ${rvm_trace_flag:=0} == 2 ))
4 113 then
5 114 set -x
2  scripts/notes
@@ -83,7 +83,7 @@ dependencies:
83 83 rvm: bash curl git
84 84
85 85 # For Ruby (MRI & Ree) you should install the following OS dependencies:
86   - ruby: pacman -Sy --noconfirm gcc patch curl bison zlib readline libxml2 libxslt git autoconf diffutils bison make
  86 + ruby: pacman -Sy --noconfirm gcc patch curl bison zlib readline libxml2 libxslt git autoconf diffutils make
87 87 ruby-head: pacman -Sy --noconfirm subversion
88 88
89 89 # For JRuby (if you wish to use it) you will need:

0 comments on commit 9f8b69a

Please sign in to comment.
Something went wrong with that request. Please try again.