Skip to content

Commit

Permalink
Merge pull request #1431 from wayneeseguin/feature/requirements_exec
Browse files Browse the repository at this point in the history
runable requirements
  • Loading branch information
mpapis committed Jan 19, 2013
2 parents 9dce772 + c9b1b5a commit cfd737d
Show file tree
Hide file tree
Showing 18 changed files with 792 additions and 384 deletions.
10 changes: 1 addition & 9 deletions binscripts/rvm-installer
Expand Up @@ -473,17 +473,9 @@ then
source ${rvm_scripts_path:-${rvm_path}/scripts}/version
__rvm_version

{
echo "Ruby (and needed base gems) for your selection will be installed shortly."
echo "Before it happens, please read and execute the instructions below."
echo "Please use a separate terminal to execute any additional commands."
echo "(use keyboard arrows to navigate)"
echo "Press 'q' to continue."
} | less

for _ruby in ${install_rubies[@]}
do
command rvm install ${_ruby} -j 2
rvm install ${_ruby} -j 2
done
for _ruby in ${install_rubies[@]}
do
Expand Down
13 changes: 3 additions & 10 deletions scripts/cli
Expand Up @@ -212,7 +212,7 @@ __rvm_parse_args()
rvm_error_message="Please note that \`rvm $rvm_token ...\` was removed, try \`$rvm_token $next_token $*\` or \`rvm all do $rvm_token $next_token $*\` instead."
;;

fetch|version|srcdir|reset|debug|reload|update|monitor|notes|implode|seppuku|question|answer|env|unexport|requirements|automount|prepare)
fetch|version|srcdir|reset|debug|reload|update|monitor|notes|implode|seppuku|question|answer|env|unexport|automount|prepare)
rvm_action=$rvm_token
;;

Expand Down Expand Up @@ -241,7 +241,7 @@ __rvm_parse_args()
rvm_remove_flag=1
;;

rtfm|RTFM|rvmrc|usage|help|inspect|list|ls|info|strings|get|current|docs|alias|rubygems|cleanup|tools|disk-usage|snapshot|repair|migrate|upgrade|cron|group|switch|which|config-get)
rtfm|RTFM|rvmrc|usage|help|inspect|list|ls|info|strings|get|current|docs|alias|rubygems|cleanup|tools|disk-usage|snapshot|repair|migrate|upgrade|cron|group|switch|which|config-get|requirements)
case "$rvm_token" in
(ls) rvm_action="list" ;;
(usage) rvm_action="help" ;;
Expand Down Expand Up @@ -1080,14 +1080,7 @@ To reinstall use:
[[ $(find $rvm_rubies_path -maxdepth 1 -mindepth 1 -type d 2>/dev/null | wc -l) -eq 0 ]] &&
rvm_is_a_shell_function no_warning
then
{
echo "Ruby (and needed base gems) for your selection will be installed shortly."
echo "Before it happens, please read and execute the instructions below."
echo "Please use a separate terminal to execute any additional commands."
echo "(use keyboard arrows to navigate)"
"$rvm_scripts_path"/requirements
echo "Press 'q' to continue."
} | less
"$rvm_scripts_path"/requirements run
fi
__rvm_manage_wrapper install "${rvm_ruby_strings}"
fi
Expand Down
64 changes: 64 additions & 0 deletions scripts/functions/requirements/arch
@@ -0,0 +1,64 @@
#!/usr/bin/env bash

set -e

function requirements_arch()
{
typeset -a command_to_run command_flags
command_to_run=()
command_flags=()

while
(( $# ))
do
case "$1" in
(echo)
command_to_run+=( $1 )
shift
;;
(run)
shift
;;
(force)
command_flags+=( --noconfirm )
shift
;;
(*)
break
;;
esac
done

(( UID == 0 )) || command_to_run+=( sudo )

while
(( $# ))
do
case "$1" in
(update-system)
true
;;
(rvm)
"${command_to_run[@]}" pacman -SUy --needed --recursive "${command_flags[@]}" bash curl git patch
;;
(jruby*head)
"${command_to_run[@]}" pacman -SUy --needed --recursive "${command_flags[@]}" jdk7-openjdk jre7-openjdk curl apache-ant
;;
(jruby*)
"${command_to_run[@]}" pacman -SUy --needed --recursive "${command_flags[@]}" jdk7-openjdk jre7-openjdk curl
;;
(ir*)
"${command_to_run[@]}" pacman -SUy --needed --recursive "${command_flags[@]}" mono
;;
(opal)
"${command_to_run[@]}" pacman -SUy --needed --recursive "${command_flags[@]}" nodejs
;;
(*)
"${command_to_run[@]}" pacman -SUy --needed --recursive "${command_flags[@]}" gcc patch curl zlib readline libxml2 libxslt git autoconf automake diffutils make libtool bison subversion
;;
esac
shift
done
}

requirements_arch "$@"
61 changes: 61 additions & 0 deletions scripts/functions/requirements/centos
@@ -0,0 +1,61 @@
#!/usr/bin/env bash

set -e

function requirements_yum()
{
typeset -a command_to_run command_flags
command_to_run=()
command_flags=()

while
(( $# ))
do
case "$1" in
(echo)
command_to_run+=( $1 )
shift
;;
(run)
shift
;;
(force)
command_flags+=( -y )
shift
;;
(*)
break
;;
esac
done

(( UID == 0 )) || command_to_run+=( sudo )

while
(( $# ))
do
case "$1" in
(update-system)
true
;;
(rvm)
"${command_to_run[@]}" yum install "${command_flags[@]}" bash curl git patch
;;
(jruby*)
"${command_to_run[@]}" yum install "${command_flags[@]}" java
;;
(ir*)
true # not that easy
;;
(opal)
true # not that easy
;;
(*)
"${command_to_run[@]}" yum install "${command_flags[@]}" gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel
;;
esac
shift
done
}

requirements_yum "$@"
1 change: 1 addition & 0 deletions scripts/functions/requirements/debian
1 change: 1 addition & 0 deletions scripts/functions/requirements/fedora
57 changes: 57 additions & 0 deletions scripts/functions/requirements/gentoo
@@ -0,0 +1,57 @@
#!/usr/bin/env bash

set -e

function requirements_gentoo()
{
typeset -a command_to_run command_flags
command_to_run=()
command_flags=()

while
(( $# ))
do
case "$1" in
(echo)
command_to_run+=( $1 )
shift
;;
(force|run)
shift
;;
(*)
break
;;
esac
done

(( UID == 0 )) || command_to_run+=( sudo )

while
(( $# ))
do
case "$1" in
(update-system)
"${command_to_run[@]}" emerge --sync
;;
(rvm)
"${command_to_run[@]}" emerge bash curl git patch
;;
(jruby*)
"${command_to_run[@]}" emerge dev-java/sun-jdk dev-java/sun-jre-bin
;;
(ir*)
"${command_to_run[@]}" emerge dev-lang/mono
;;
(opal)
"${command_to_run[@]}" emerge nodejs
;;
(*)
"${command_to_run[@]}" emerge libiconv readline zlib openssl curl git libyaml sqlite libxslt libtool gcc autoconf automake bison m4
;;
esac
shift
done
}

requirements_gentoo "$@"
73 changes: 73 additions & 0 deletions scripts/functions/requirements/openbsd
@@ -0,0 +1,73 @@
#!/usr/bin/env bash

set -e

function requirements_gentoo()
{
typeset -a command_to_run __ctr_sudo
typeset __ctr_echo
command_to_run=()
__ctr_sudo=()
__ctr_echo=0

while
(( $# ))
do
case "$1" in
(echo)
command_to_run+=( $1 )
__ctr_echo=1
shift
;;
(force)
shift
;;
(*)
break
;;
esac
done

(( UID == 0 )) ||
{
command_to_run+=( sudo )
__ctr_sudo+=( sudo )
}

while
(( $# ))
do
case "$1" in
(update-system)
[[ -d /usr/ports ]] ||
{
if (( __ctr_echo ))
then echo "curl ftp://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/ports.tar.gz | ${__ctr_sudo[$@]} tar -C /usr -zx"
else curl ftp://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/ports.tar.gz | ${__ctr_sudo[$@]} tar -C /usr -zx
fi
}
;;
(rvm)
"${command_to_run[@]}" pkg_add bash curl git patch
;;
(jruby-head*)
"${command_to_run[@]}" pkg_add jdk apache-ant
;;
(jruby*)
"${command_to_run[@]}" pkg_add jdk
;;
(ir*)
"${command_to_run[@]}" pkg_add mono
;;
(opal)
"${command_to_run[@]}" make -C /usr/ports/www/node install clean
;;
(*)
"${command_to_run[@]}" pkg_add gcc readline libxml2 libxslt autoconf automake diffutils make libtool bison
;;
esac
shift
done
}

requirements_gentoo "$@"
60 changes: 60 additions & 0 deletions scripts/functions/requirements/openindiana
@@ -0,0 +1,60 @@
#!/usr/bin/env bash

set -e

function requirements_gentoo()
{
typeset -a command_to_run command_flags
command_to_run=()
command_flags=()

while
(( $# ))
do
case "$1" in
(echo)
command_to_run+=( $1 )
shift
;;
(force|run)
shift
;;
(*)
break
;;
esac
done

(( UID == 0 )) || command_to_run+=( sudo )

while
(( $# ))
do
case "$1" in
(update-system)
true
;;
(rvm)
"${command_to_run[@]}" pkg install bash curl git patch
;;
(jruby-head*)
"${command_to_run[@]}" pkg install jdk apache-ant
;;
(jruby*)
"${command_to_run[@]}" pkg install jdk
;;
(ir*)
"${command_to_run[@]}" pkg install mono
;;
(opal)
"${command_to_run[@]}" pkg install node-devel
;;
(*)
"${command_to_run[@]}" pkg install text/gnu-patch runtime/gcc developer/library/lint system/header system/library/math/header-math file/gnu-coreutils
;;
esac
shift
done
}

requirements_gentoo "$@"

0 comments on commit cfd737d

Please sign in to comment.