scripts/utility in rvm-0.0.60 vs scripts/utility in rvm-0.0.61
- old
+ new
@@ -80,16 +80,16 @@
eval "${array}[${index}]=${item}"
unset array item
}
function __rvm_clean_path {
- PATH=$(echo $PATH | tr -s ':' '\n' | awk '!($0 in a){a[$0];print}' | tr -s '\n' ':' | sed 's/:$//')
+ PATH=$(echo $PATH | tr -s ':' '\n' | awk '!($0 in a){a[$0];print}' | tr -s '\n' ':' | sed 's#:$##')
export PATH
}
function __rvm_remove_rvm_from_path {
- PATH=$(echo $PATH | tr -s ':' '\n' | grep -v "\.rvm" | tr -s '\n' ':' | sed 's/:$//')
+ PATH=$(echo $PATH | tr -s ':' '\n' | grep -v "\.rvm" | tr -s '\n' ':' | sed 's#:$##')
export PATH
}
function __rvm_gi { gem install -q --no-rdoc --no-ri $* ; }
@@ -350,28 +350,28 @@
if [ -z "$key" ] ; then
__rvm_log "fail" "__rvm_db must be called with at least one argument: __rvm_db key [value]"
else
value="$*"
if [ "unset" = "$value" -o "delete" = "$value" ] ; then
- sed -i.tmp "s/^$key=.*$//" $rvm_hash_file
+ sed -i.tmp "s#^$key=.*$\##" $rvm_hash_file
else
if [ -z "$value" ] ; then # get
grep "^$key=" $rvm_hash_file | head -n 1 | awk -F'=' '{print $2}'
else # set
if [ -z "$(grep "^$key=" $rvm_hash_file)" ] ; then # append
echo "$key=$value" >> $rvm_hash_file
else # overwrite
- sed -i.tmp "s/^$key=.*$/$key=$value/" $rvm_hash_file
+ sed -i.tmp "s#^$key=.*$\#$key=$value#" $rvm_hash_file
fi
fi
fi
fi
}
function __rvm_list {
if [ "$rvm_all_flag" ] ; then
- svn list http://svn.ruby-lang.org/repos/ruby/tags/ | grep 'v1_[8|9]' | sed 's/^v1_//' | sed 's/\/$//' | awk -F'_' '{print "1."$1"."$2 " -l "$3}' | sed 's/p$//'
+ svn list http://svn.ruby-lang.org/repos/ruby/tags/ | grep 'v1_[8|9]' | sed 's#^v1_##' | sed 's#/$##' | awk -F'_' '{print "1."$1"."$2 " -l "$3}' | sed 's#p$##'
echo -e "jruby 1.2.0\njruby 1.3.0\njruby (1.3.1, the default)\njruby 1.4.1\njruby --head"
echo -e "rbx head (rubinius head, the default)\nrbx head --jit"
echo -e "ree 1.8.6 --head\nree (1.8.7, the default)"
else
current_ruby=$(which ruby | xargs dirname | xargs dirname | xargs basename 2> /dev/null)
@@ -467,12 +467,10 @@
rvm_rubinius_repo_url="${rvm_rubinius_repo_url:-"git://github.com/evanphx/rubinius.git"}"
rvm_jruby_repo_url="${rvm_jruby_repo_url:-"git://kenai.com/jruby~main"}"
rvm_ruby_load_path="."
rvm_ruby_require=""
- if [ "Darwin" = "$(uname)" ] ; then rvm_archflags="${rvm_archflags:-'-arch i386 -arch x86_64'}" ; fi
-
__rvm_clean_path
rvm_result=$(echo $PATH | grep 'rvm\/bin:')
if [ -z $rvm_result ] ; then
PATH=$rvm_bin_path:$PATH ; export PATH
fi
@@ -543,18 +541,18 @@
}
__rvm_ruby_do() {
__rvm_select
__rvm_use
- binary="$(echo $rvm_action | sed 's/do$//')"
+ binary="$(echo $rvm_action | sed 's#do$##')"
if [ -x $rvm_ruby_home/bin/$binary ] ; then
load_path="$rvm_ruby_home/bin:$rvm_ruby_load_path"
if [ "ruby" = "$binary" ] ; then
if [ -z "$(echo $rvm_ruby_args | awk '/\.rb$/')" ] ; then
#if [[ $rvm_ruby_args =~ '\.rb$' ]] ; then
if [ -z "$prefix" ] ; then prefix="-S" ; fi
- if [[ ! $rvm_ruby_args =~ $prefix ]] ; then
+ if [[ ! -z "$rvm_ruby_args" ]] && [[ ! "$rvm_ruby_args" =~ "$prefix" ]] ; then
rvm_ruby_args="$prefix $rvm_ruby_args"
fi
fi
rvm_command="$rvm_ruby_home/bin/$binary $rvm_ruby_require -I$load_path $rvm_ruby_args"
else
@@ -619,14 +617,14 @@
function __rvm_summary {
export successes errors statuses
summary="\nSummary:\n\n"
if [ ${#successes[*]} -gt 0 ] ; then
- summary="$summary \033[0;32m${#successes[*]} successful: $(echo "${successes[*]}" | sed 's/ /, /g')\033[0m\n"
+ summary="$summary \033[0;32m${#successes[*]} successful: $(echo "${successes[*]}" | sed 's# #, #g')\033[0m\n"
fi
if [ ${#errors[*]} -gt 0 ] ; then
- summary="$summary \033[0;31m${#errors[*]} errors: $(echo "${errors[*]}" | sed 's/ /, /g')\033[0m\n"
+ summary="$summary \033[0;31m${#errors[*]} errors: $(echo "${errors[*]}" | sed 's# #, #g')\033[0m\n"
fi
total=${#rubies[*]}
if [ ! -z "$ZSH_VERSION" ] ; then array_start=1 ; else array_start=0 ; fi
echo -e "$summary" | tee -a log/summary.log
return ${#errors[*]}
@@ -652,12 +650,12 @@
}
function __rvm_json {
json="{"
json="$json\n \"totals\": { \"rubies\": ${#rubies[*]}, \"successes\": ${#successes[*]}, \"errors\": ${#errors[*]}},"
- json="$json\n \"successful\": [ "$(echo ${successes[*]} | sed 's/ /", "/g')" ],"
- json="$json\n \"errors\": [ "$(echo ${errors[*]} | sed 's/ /", "/g')" ],"
+ json="$json\n \"successful\": [ "$(echo ${successes[*]} | sed 's# #", "#g')" ],"
+ json="$json\n \"errors\": [ "$(echo ${errors[*]} | sed 's# #", "#g')" ],"
json="$json\n \"rubies\": {"
total=${#rubies[*]}
if [ ! -z "$ZSH_VERSION" ] ; then array_start=1 ; else array_start=0 ; fi
for (( index = $array_start ; index < $total + $array_start ; index++ )) ; do
@@ -751,41 +749,104 @@
#
# ruby supporting libraries:
#
function __rvm_readline_install {
+ __rvm_make_flags
__rvm_pushpop $rvm_src_path
package="readline" ; version="5.2" ; archive_format="tar.gz"
# TODO: Figure out how to list, grab and apply the patches
__rvm_log "info" "Retrieving $package-$version.$archive_format"
__rvm_fetch "ftp://ftp.gnu.org/gnu/readline/$package-$version.$archive_format"
__rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" "Extracting $package-$version.$archive_format"
cd "$rvm_src_path/$package-$version"
if [ "Darwin" = "$(uname)" ] ; then
- sdk=$(ls -t /Developer/SDKs/ | head -n 1)
- CFLAGS="-isysroot /Developer/SDKs/$sdk -arch i386 -arch x86_64"
- LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/$sdk -arch i386 -arch x86_64"
- export CFLAGS LDFLAGS
+ #sdk=$(ls -t /Developer/SDKs/ | head -n 1)
+ #CFLAGS="-isysroot /Developer/SDKs/$sdk -arch i386 -arch x86_64"
+ #LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/$sdk -arch i386 -arch x86_64"
+ #export CFLAGS LDFLAGS
__rvm_run "$package/configure" "./configure --prefix=$rvm_path/usr --disable-dependency-tracking --disable-static --enable-shared" "Configuring $package"
else
__rvm_run "$package/configure" "./configure --prefix=$rvm_path/usr --disable-dependency-tracking --disable-static --enable-shared" "Configuring $package"
fi
__rvm_run "$package/make" "/usr/bin/make $rvm_make_flags" "Compiling $package"
__rvm_run "$package/make.install" "/usr/bin/make install" "Installing $package to $rvm_path/usr"
__rvm_pushpop
}
function __rvm_iconv_install {
+ __rvm_make_flags
__rvm_pushpop $rvm_src_path
package="libiconv" ; version=1.13.1 ; archive_format="tar.gz"
__rvm_log "info" "Retrieving $package-$version.$archive_format"
__rvm_fetch "http://ftp.gnu.org/pub/gnu/libiconv/$package-$version.$archive_format"
__rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" "Extracting $package-$version.$archive_format"
cd "$rvm_src_path/$package-$version"
- __rvm_run "$package/configure" "./configure --prefix=$rvm_path/usr --disable-static --enable-shared" "Configuring $package."
+ __rvm_run "$package/configure" "./configure --prefix=$rvm_path/usr" "Configuring $package."
__rvm_run "$package/make" "/usr/bin/make $rvm_make_flags" "Compiling $package"
__rvm_run "$package/make.install" "/usr/bin/make install" "Installing $package to $rvm_path/usr"
__rvm_pushpop
+}
+
+function __rvm_openssl_install {
+ __rvm_make_flags
+ __rvm_pushpop $rvm_src_path
+ package="openssl" ; version="0.9.8k" ; archive_format="tar.gz"
+ __rvm_log "info" "Retrieving $package-$version.$archive_format"
+ __rvm_fetch "http://www.openssl.org/source/$package-$version.tar.gz"
+ __rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" "Extracting $package-$version.$archive_format"
+ cd "$rvm_src_path/$package-$version"
+ __rvm_run "$package/config" "./config --prefix=$rvm_path/usr zlib no-asm no-krb5 shared" "Configuring $package."
+ __rvm_run "$package/make" "/usr/bin/make $rvm_make_flags" "Compiling $package"
+ __rvm_run "$package/make.install" "/usr/bin/make install" "Installing $package to $rvm_path/usr"
+ __rvm_pushpop
+}
+
+function __rvm_zlib_install {
+ __rvm_make_flags
+ __rvm_pushpop $rvm_src_path
+ package="zlib" ; version="1.2.3" ; archive_format="tar.gz"
+ __rvm_log "info" "Retrieving $package-$version.$archive_format"
+ __rvm_fetch "http://www.zlib.net/$package-$version.tar.gz"
+ __rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" "Extracting $package-$version.$archive_format"
+ cd "$rvm_src_path/$package-$version"
+ __rvm_run "$package/configure" "./configure --prefix=$rvm_path/usr" "Configuring $package."
+ __rvm_run "$package/make" "/usr/bin/make $rvm_make_flags" "Compiling $package"
+ __rvm_run "$package/make.install" "/usr/bin/make install" "Installing $package to $rvm_path/usr"
+ __rvm_pushpop
+}
+
+function __rvm_ncurses_install {
+ __rvm_make_flags
+ __rvm_pushpop $rvm_src_path
+ package="ncurses" ; version="5.7" ; archive_format="tar.gz"
+ __rvm_log "info" "Retrieving $package"
+ __rvm_fetch "ftp://invisible-island.net/ncurses/ncurses.tar.gz"
+ __rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package.$archive_format -C $rvm_src_path" "Extracting $package.$archive_format"
+ cd "$rvm_src_path/$package-$version"
+ __rvm_run "$package/configure" "./configure --prefix=$rvm_path/usr --with-shared --disable-rpath --without-debug --without-ada --enable-safe-sprintf --enable-sigwinch --without-progs" "Configuring $package."
+ __rvm_run "$package/make" "/usr/bin/make $rvm_make_flags" "Compiling $package"
+ __rvm_run "$package/make.install" "/usr/bin/make install" "Installing $package to $rvm_path/usr"
+ __rvm_pushpop
+}
+
+__rvm_make_flags() {
+ PATH=.rvm/usr/bin:$PATH ; export PATH
+ if [ "Darwin" = "$(uname)" ] ; then
+ sdk="$(/bin/ls -t /Developer/SDKs/ | head -n 1)"
+ if [ "Darwin" = "$(uname)" ] ; then
+ if [[ "$(sw_vers -productVersion)" =~ ^10.6 ]] ; then
+ rvm_archflags="-arch x86_64"
+ openssl_os="os/compiler darwin64-x86_64-cc"
+ else
+ rvm_archflags="-arch i386"
+ openssl_os="os/compiler darwin-i386-cc"
+ fi
+ fi
+ CFLAGS="-isysroot /Developer/SDKs/$sdk $rvm_archflags" ; export CFLAGS
+ LDFLAGS="-Wl,-syslibroot /Developer/SDKs/$sdk $rvm_archflags" ; export LDFLAGS
+ ARCHFLAGS="$rvm_archflags" ; export ARCHFLAGS
+ fi
}
__rvm_monitor() {
if [ -d test/ ] ; then
: