Skip to content

Commit

Permalink
Feature: 'rvm install macruby-nightly' now works. Caution: conflicts …
Browse files Browse the repository at this point in the history
…with beta release, advise using nightly builds.
  • Loading branch information
wayneeseguin committed Oct 31, 2009
1 parent e062b35 commit 8394743
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 12 deletions.
1 change: 1 addition & 0 deletions config/db
Expand Up @@ -2,6 +2,7 @@ niceness=0
ruby_repo_url=http://svn.ruby-lang.org/repos/ruby
rubinius_repo_url=git://github.com/evanphx/rubinius.git
shyouhei_repo_url=git://github.com/shyouhei/ruby.git
macruby_version=0.5beta1
macruby_repo_url=git://git.macruby.org/macruby/MacRuby.git
macruby_nightly_url=http://macruby.icoretech.org/latest
jruby_repo_url=git://kenai.com/jruby~main
Expand Down
63 changes: 55 additions & 8 deletions scripts/ruby-installer
Expand Up @@ -25,7 +25,6 @@ function __rvm_install_source {
if [[ $? -gt 0 ]] ; then result=$? ; return $result ; fi
else
if [[ ! -z "$(echo $rvm_url | awk '/^git/')" ]] ; then

if [[ -d "$rvm_ruby_src_path/.git" ]] ; then
cd $rvm_ruby_src_path
if [[ -z "$rvm_ruby_revision" ]] ; then
Expand Down Expand Up @@ -126,16 +125,64 @@ function __rvm_install_ruby {

case "$rvm_ruby_interpreter" in
macruby)
if [[ "$(uname)" = "Darwin" ]] ; then
rvm_url="$(__rvm_db "macruby_nightly_url")"
__rvm_log "info" "Retrieving latest macruby" # $rvm_archives_path/macruby_nightly.pkg
__rvm_fetch $rvm_url
mv $rvm_archives_path/latest $rvm_archives_path/macruby_nightly.pkg
__rvm_run "macruby/extract" "xar -x -f $rvm_archives_path/macruby_nightly.pkg -C $rvm_ruby_home" "Extracting macruby nightly package."
if [[ "Darwin" = "$(uname)" ]] ; then
if [[ "nightly" = "$rvm_ruby_version" ]] ; then
macruby_path="/usr/local/bin"
# TODO: Separated nightly from head.
rvm_url="$(__rvm_db "macruby_nightly_url")"
__rvm_log "info" "Retrieving the latest nightly macruby build..."
__rvm_fetch $rvm_url
mv "$rvm_archives_path/latest" "$rvm_archives_path/macruby_nightly.pkg"
__rvm_run "macruby/extract" "sudo installer -pkg '$rvm_path/archives/macruby_nightly.pkg' -target '/'"
mkdir -p "$rvm_ruby_home/bin"
elif [[ "head" = "$rvm_ruby_version" ]] ; then
# TODO: configure & make variables should be set here.
rvm_url="$(__rvm_db "${rvm_ruby_interpreter}_repo_url")"
if [[ -z "$rvm_url" ]] ; then
__rvm_log "fail" "rvm does not know the rvm repo url for 'ree_${rvm_ruby_version}'"
result=1
else
rvm_ruby_repo_url=$rvm_url
__rvm_install_source $*
fi
else
macruby_path="/usr/local/bin"
# TODO: Separated nightly from head.
rvm_url="$(__rvm_db "macruby_nightly_url")"
__rvm_log "info" "Retrieving latest macruby" # $rvm_archives_path/macruby_nightly.pkg
__rvm_fetch $rvm_url
mv $rvm_archives_path/latest $rvm_archives_path/macruby_nightly.pkg
__rvm_run "macruby/extract" "sudo installer -pkg '$rvm_path/archives/$rvm_ruby_package_file.zip' -target '/'"
mkdir -p "$rvm_ruby_home/bin"

fi

binaries="erb gem irb rake rdoc ri ruby testrb" # Trick to work in more shells :)
for binary_name in $(echo $binaries); do
# if [[ $binary_name != "gem" ]] ; then prefix="-S" ; fi
ruby_wrapper=$(cat <<RubyWrapper
#!/bin/bash
GEM_HOME="$rvm_ruby_gem_home" ; export GEM_HOME
GEM_PATH="$rvm_ruby_gem_home" ; export GEM_PATH
MY_RUBY_HOME="$rvm_ruby_home" ; export MY_RUBY_HOME
PATH="$rvm_ruby_home/bin:$rvm_ruby_gem_home/bin:\$PATH" ; export PATH
exec $macruby_path/mac$binary_name $prefix "\$@"
RubyWrapper
)
files="$rvm_ruby_home/bin/$binary_name $rvm_path/bin/$binary_name-$rvm_ruby_package_name"
for file_name in $(echo $files) ; do
rm -f $file_name
echo "$ruby_wrapper" > $file_name
if [[ -f $file_name ]] ; then chmod +x $file_name ; fi
done
unset file_name ruby_wrapper binary_name files prefix
done
__rvm_irbrc
else
__rvm_log "fail" "MacRuby can only be installed on a Darwin OS."
fi
__rvm_irbrc
;;

ree)
Expand Down
22 changes: 18 additions & 4 deletions scripts/selector
Expand Up @@ -15,11 +15,21 @@ function __rvm_select {
macruby)
if [[ "Darwin" = "$(uname)" ]] ; then
rvm_ruby_repo_url="${rvm_ruby_repo_url:-"$(__rvm_db "macruby_repo_url")"}"
rvm_ruby_version="${rvm_ruby_version:-head}"
rvm_ruby_package_name=${rvm_ruby_interpreter}-${rvm_ruby_version}
#rvm_ruby_version="${rvm_ruby_version:-"$(__rvm_db "macruby_version")"}"
#rvm_ruby_package_name=${rvm_ruby_interpreter}_nightly-${rvm_ruby_version}
#rvm_url="http://dl.getdropbox.com/u/163257/$rvm_ruby_package_name.pkg" # 'nightly' builds
rvm_ruby_string="${rvm_ruby_interpreter}-${rvm_ruby_version}"
if [[ "nightly" = "$rvm_ruby_version" ]] ; then
rvm_url="http://macruby.icoretech.org/latest"
elif [[ "head" = "$rvm_ruby_version" ]] ; then
rvm_ruby_repo_url=${rvm_ruby_repo_url:-"$(__rvm_db "macruby_repo_url")"}
rvm_url="$rvm_ruby_repo_url"
else
rvm_ruby_version="${rvm_ruby_version:-nightly}"
rvm_ruby_version="${rvm_ruby_version:-"$(__rvm_db "macruby_version")"}"
rvm_ruby_package_name="${rvm_ruby_interpreter}_nightly-${rvm_ruby_version}"
rvm_ruby_package_file="MacRuby%200.5%20beta%201.zip"
rvm_url="http://www.macruby.org/files/MacRuby%200.5%20beta%201.zip"
fi

unset rvm_ruby_patch_level
else
__rvm_log "fail" "MacRuby can only be installed on a Darwin OS."
Expand Down Expand Up @@ -264,6 +274,10 @@ __rvm_ruby_string() {
elif [[ "system" = "$string" ]] ; then
rvm_ruby_interpreter="system"
break
elif [[ "nightly" = "$string" ]] ; then
rvm_ruby_version="nightly"
rvm_nightly_flag=1
break
elif match "$string" "^preview" ; then
rvm_ruby_patch_level="$string"
elif match "$string" "^[a-z][a-z]" ; then
Expand Down

0 comments on commit 8394743

Please sign in to comment.