Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Installing Rubinius on Ubuntu 17.x [\#4213](https://github.com/rvm/rvm/pull/4213)
* RailsExpress patches for 2.2.10, 2.3.7, 2.4.4 and 2.5.1 [\#4344](https://github.com/rvm/rvm/pull/4344)
* Add documentation in `rvm help install` for multiple undocumented flags [\#4350](https://github.com/rvm/rvm/pull/4350)
* Add support for TruffleRuby [\#4406](https://github.com/rvm/rvm/pull/4406)

#### Bug fixes:
* ZSH Bad pattern for Gemfile ruby declaration [\#4154](https://github.com/rvm/rvm/issues/4154) [\#4156](https://github.com/rvm/rvm/issues/4156)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ We currently supported following ruby interpreters:
* `opal` - ruby to JavaScript compiler
* `rbx` - Rubinius - a next generation virtual machine VM for ruby
* `topaz` - high performance ruby, written in RPython
* `truffleruby` - high performance ruby using GraalVM

Historical interpreters which you can still install with RVM, but are not anymore developed and supported by their authors:

Expand Down
1 change: 1 addition & 0 deletions bin/rvm-prompt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ then
(ironruby) unicode="♭" ;;
(system) unicode="★" ;;
(topaz) unicode="🐍" ;; # TODO: what is this? can we use something more fonts support?
(truffleruby) unicode="🚀" ;;
(opal) unicode="⬢" ;;
(ruby)
case ${version:-""} in
Expand Down
5 changes: 5 additions & 0 deletions config/db
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ jruby_url=https://s3.amazonaws.com/jruby.org/downloads
jruby_version=9.2.0.0
maven_version=3.5.0
#
# TruffleRuby
#
truffleruby_url=https://github.com/oracle/truffleruby/releases/download
truffleruby_version=1.0.0-rc2
#
# MacRuby
#
macruby_0.10_url=http://macruby.macosforge.org/files
Expand Down
3 changes: 3 additions & 0 deletions config/known
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ rbx-2[.5.8]
rbx-3[.100]
rbx-head

# TruffleRuby
truffleruby[-1.0.0-rc2]

# Opal
opal

Expand Down
1 change: 1 addition & 0 deletions config/known_strings
Original file line number Diff line number Diff line change
Expand Up @@ -353,3 +353,4 @@ ruby-2.5.0
ruby-2.5.1
ruby-2.6.0-preview1
ruby-2.6.0-preview2
truffleruby-1.0.0-rc2
2 changes: 2 additions & 0 deletions config/md5
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,8 @@ rubygems-2.7.3.tgz=fb3a1927a1842b75677a24f48dd63ddc
rubygems-2.7.4.tgz=e9bbf5a4cc9a74293884b91f49603ea0
rubygems-2.7.5.tgz=516a4f219976003feb4b4f797cbc66b0
rubygems-2.7.6.tgz=366cea352c2b1243db726013c3d76fc4
truffleruby-1.0.0-rc2-linux-amd64.tar.gz=3e9afdf72f153e2f66259fc2b6fca594
truffleruby-1.0.0-rc2-macos-amd64.tar.gz=c30459287aec83548cfcb17340fa73d5
yaml-0.1.4.tar.gz=36c852831d02cf90508c29852361d01b
zlib-1.2.3.tar.gz=debc62758716a169df9f62e6ab2bc634
zlib-1.2.5.tar.gz=c735eab2d659a96e5a594c9e8541ad63
2 changes: 2 additions & 0 deletions config/sha512
Original file line number Diff line number Diff line change
Expand Up @@ -785,3 +785,5 @@ rubygems-2.7.3.tgz=2782331b31947a23f85b285a3d5e7b66e34fe5847bc84dca4f1e6bfe33ce1
rubygems-2.7.4.tgz=90f72a46709ef847666a6a23eecf24521abd5c294b2da8a246bb4c7f85daf4af39a0634fc8093c7bb7ded2ac137ea27fac5ed94af3b70c49e78594285c7a40ce
rubygems-2.7.5.tgz=86957f1c438070135df527a15102e40487fcee93a55251463095e4c8794a8616d16ed9bdead0e0ef83c44806bd5016ecd9e178bef608b66af2e68e2c9c49e941
rubygems-2.7.6.tgz=bc168afc40c974dbc7c37eb5678432ba2ed7469c3f007a159699467ff2cff5205c508237193ee8becaa6eb555b043969cc5f92b2aaa6bf7c958dd7c187e258a7
truffleruby-1.0.0-rc2-linux-amd64.tar.gz=5dfb040b746e462c297ebcdf84e0f07cd74b86852055dcf0a7cf1814112099bc674bcccd94b03726aee76b253c9345a45d046cbfea230647644f0fd6b1c1ec96
truffleruby-1.0.0-rc2-macos-amd64.tar.gz=17983c442c54d19196be3626e25c64f5474139c0b973624832ba8730efb047bc747c02e59c82f38397bf012c63ab83f79a9c1b64311cab796f08fe96d7d12a1a
5 changes: 5 additions & 0 deletions man/man1/rvm.1
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ JRuby, Ruby interpreter on the Java Virtual Machine\&.
Rubinius
.RE
.PP
\fBtruffleruby\fR
.RS 4
TruffleRuby, a high performance implementation of Ruby built on GraalVM\&.
.RE
.PP
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I updated rvm.1.gz with gzip -k rvm.1.

\fBree\fR
.RS 4
Ruby Enterprise Edition, MRI Ruby with several custom patches for performance, stability, and memory\&.
Expand Down
Binary file modified man/man1/rvm.1.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion scripts/cli
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ __rvm_parse_args()
rvm_ruby_strings="$rvm_token"
;;

opal*|jruby*|ree*|macruby*|rbx*|rubinius*|mruby|ironruby*|default*|maglev*|topaz*|ruby*|system|default|all)
opal*|jruby*|ree*|macruby*|rbx*|rubinius*|mruby|ironruby*|default*|maglev*|topaz*|truffleruby*|ruby*|system|default|all)
rvm_action="${rvm_action:-use}"
rvm_ruby_interpreter="$rvm_token"
rvm_ruby_string="$rvm_token"
Expand Down
2 changes: 1 addition & 1 deletion scripts/functions/manage/base_fetch
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ __rvm_fetch_ruby_package()
rvm_error "Trying to compile jruby from binary package - this is a bug, please report to RVM."
return 198
;;
(maglev|rubinius|rbx)
(maglev|rubinius|rbx|truffleruby)
true # Should already be set from selector
;;
(*)
Expand Down
6 changes: 4 additions & 2 deletions scripts/functions/manage/base_install
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ __rvm_install_source()
__rvm_post_install()
{
case "$rvm_ruby_interpreter" in
(jruby|ree|rbx|mruby|macruby) true ;; #skip
(jruby|ree|rbx|mruby|macruby|truffleruby) true ;; #skip
(*)
(( ${#binaries[@]} )) || binaries=(gem irb erb ri rdoc testrb rake)
;;
Expand Down Expand Up @@ -291,6 +291,7 @@ __rvm_check_available_space()
(maglev*) __required_space=950 ;;
(ree-*) __required_space=70 ;;
(rbx*|rubinius*) __required_space=170 ;;
(truffleruby*) __required_space=200 ;;
(ruby-1.8.5*) __required_space=20 ;;
(ruby-1.8.6*) __required_space=20 ;;
(ruby-1.8.7*) __required_space=25 ;;
Expand All @@ -315,6 +316,7 @@ __rvm_check_available_space()
(jruby*) let __required_space+=230 ;;
(maglev*) let __required_space+=120 ;;
(rbx*|rubinius*) let __required_space+=600 ;;
(truffleruby*) let __required_space+=160 ;;
(ree-1.8.6*) let __required_space+=40 ;;
(ree-1.8.7*) let __required_space+=130 ;;
(ruby-1.8.5*) let __required_space+=35 ;;
Expand Down Expand Up @@ -402,7 +404,7 @@ https://rvm.io/rubies/named/
__rvm_check_for_compiler || return $?

case "${rvm_ruby_interpreter}" in
opal|macruby|ree|jruby|maglev|rubinius|ironruby|ruby|mruby|topaz)
opal|macruby|ree|jruby|maglev|rubinius|ironruby|ruby|mruby|topaz|truffleruby)
ruby_install_type=$rvm_ruby_interpreter
;;
rbx) ruby_install_type=rubinius ;;
Expand Down
42 changes: 42 additions & 0 deletions scripts/functions/manage/truffleruby
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

truffleruby_install_check_llvm()
{
builtin command -v opt > /dev/null ||
{
rvm_error "TruffleRuby requires LLVM to be installed to run native extensions.
For more details and for setup instructions for your system, please see:
https://github.com/oracle/truffleruby/blob/master/doc/user/installing-llvm.md"
return 1
}
}

truffleruby_install()
{
truffleruby_install_check_llvm || return $?

__rvm_cd "${rvm_src_path}"

__rvm_fetch_ruby || return $?

__rvm_cd "${rvm_src_path}/${rvm_ruby_string}"

__rvm_apply_patches

__rvm_rm_rf "${rvm_ruby_home}" && \command \mkdir -p "$(dirname "${rvm_ruby_home}")" &&
__rvm_log_command "install" "${rvm_ruby_string} - #installing to ${rvm_ruby_home}" \
__rvm_cp -Rf "${rvm_src_path}/${rvm_ruby_string}" "${rvm_ruby_home}" || return $?

__rvm_cd "${rvm_ruby_home}"

# Run the TruffleRuby post-install hook
./lib/truffle/post_install_hook.sh

# Avoid updating RubyGems for now as it seems fragile
rvm_rubygems_version="ignore"
__rvm_initial_gemsets_create "$rvm_ruby_home/bin/ruby"

__rvm_post_install

__rvm_fetch_ruby_cleanup
}
4 changes: 4 additions & 0 deletions scripts/functions/requirements/arch
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ requirements_arch_define()
undesired_check clang llvm llvm-libs
requirements_check clang35 llvm35 llvm35-libs patch curl zlib readline autoconf automake diffutils make libtool bison
;;
(truffleruby*)
requirements_check zlib clang llvm make
requirements_arch_define_openssl "$1"
;;
(ruby-2.3*|ruby-2.2*|ruby-2.1*|ruby-2.0*|ruby-1.9*)
requirements_check gcc patch curl zlib readline autoconf automake diffutils make libtool bison sqlite git
requirements_arch_define_openssl "$1"
Expand Down
5 changes: 5 additions & 0 deletions scripts/functions/requirements/centos
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ requirements_centos_define()
make ncurses-devel openssl-devel readline-devel ruby-devel rubygems zlib-devel
;;

(truffleruby*)
requirements_check zlib-devel clang llvm make
requirements_${_system_name_lowercase}_define_openssl $1
;;

(ir*)
true # not that easy
;;
Expand Down
6 changes: 6 additions & 0 deletions scripts/functions/requirements/debian
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ requirements_debian_define()
requirements_${_system_name_lowercase}_define_clang_llvm "$1"
;;

(truffleruby*)
requirements_debian_define_base
requirements_${_system_name_lowercase}_define_libssl "$1"
requirements_check clang llvm
;;

(*)
requirements_debian_define_base g++ gcc
requirements_${_system_name_lowercase}_define_libssl "$1"
Expand Down
4 changes: 4 additions & 0 deletions scripts/functions/requirements/dragonfly
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ requirements_dragonfly_define()
fi
;;

(truffleruby*)
requirements_check openssl llvm40
;;

(ir*)
requirements_check mono
;;
Expand Down
5 changes: 5 additions & 0 deletions scripts/functions/requirements/fedora_dnf
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ requirements_fedora_define()
make ncurses-devel openssl-devel readline-devel ruby-devel rubygems zlib-devel
;;

(truffleruby*)
requirements_check zlib-devel clang llvm make
requirements_fedora_define_openssl "$1"
;;

(ir*)
true # not that easy
;;
Expand Down
4 changes: 4 additions & 0 deletions scripts/functions/requirements/gentoo
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ requirements_gentoo_define()
fi
;;

(truffleruby*)
requirements_check sys-libs/zlib dev-libs/openssl net-misc/curl sys-devel/clang sys-devel/llvm sys-devel/make
;;

(ir*)
requirements_check dev-lang/mono
;;
Expand Down
4 changes: 4 additions & 0 deletions scripts/functions/requirements/opensuse
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ requirements_opensuse_define()
requirements_check_fallback clang clang6 clang5 clang4
;;

(truffleruby*)
requirements_check zlib-devel libopenssl-devel llvm-clang llvm make
;;

(*)
requirements_opensuse_define_default
requirements_check gcc gcc-c++
Expand Down
4 changes: 4 additions & 0 deletions scripts/functions/requirements/osx_brew
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ requirements_osx_brew_define()
requirements_check node
;;

(truffleruby*)
requirements_check openssl llvm@4
;;

(ruby*head)
__rvm_which git >/dev/null || requirements_check git
requirements_osx_brew_libs_default "$1"
Expand Down
5 changes: 5 additions & 0 deletions scripts/functions/requirements/osx_fink
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ requirements_osx_fink_define()
requirements_check node
;;

(truffleruby*)
requirements_osx_fink_libs_default "$1"
requirements_check clang50 llvm50
;;

(*-head)
__rvm_which git >/dev/null || requirements_check git
requirements_osx_fink_libs_default "$1"
Expand Down
4 changes: 4 additions & 0 deletions scripts/functions/requirements/osx_port
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ requirements_osx_port_define()
requirements_osx_port_libs_ensure node
;;

(truffleruby*)
requirements_check openssl llvm-4.0
;;

(ruby*head)
__rvm_which git >/dev/null || requirements_check git
requirements_osx_port_libs_default "$1"
Expand Down
4 changes: 4 additions & 0 deletions scripts/functions/requirements/pclinuxos
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ requirements_pclinuxos_define()
requirements_check clang clang-devel llvm llvm-devel
;;

(truffleruby*)
requirements_check clang clang-devel llvm llvm-devel lib64openssl-devel zlib zlib-devel make
;;

(*-head)
requirements_check git
requirements_pclinuxos_define "${1%-head}"
Expand Down
1 change: 1 addition & 0 deletions scripts/functions/selector
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ __rvm_ruby_string_find()
else
__rvm_ruby_string_autodetect
case "${rvm_ruby_string}" in
# Should truffleruby-* be added here?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should truffleruby-* be added here? It's not clear to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need

(ruby-+([1-9])|ruby-+([1-9]).+([0-9])|ruby-1.+([1-9]).+([0-9])|jruby-[19]*)
__rvm_ruby_string_latest &&
__rvm_ruby_string_parse_ ||
Expand Down
23 changes: 23 additions & 0 deletions scripts/functions/selector_interpreters
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,29 @@ __rvm_select_interpreter_jruby()
true # for OSX
}

__rvm_select_interpreter_truffleruby()
{
rvm_ruby_version="${rvm_ruby_version:-$(__rvm_db "truffleruby_version")}"

case "${_system_type}" in
"Linux") platform="linux" ;;
"Darwin") platform="macos" ;;
*) rvm_error "TruffleRuby does not support ${_system_type} currently." ;;
esac

case "${_system_arch}" in
"x86_64") arch=amd64 ;;
*) rvm_error "TruffleRuby does not support ${_system_arch} currently." ;;
esac

truffleruby_version="${rvm_ruby_version}${rvm_ruby_patch_level:+-}${rvm_ruby_patch_level:-}"
rvm_ruby_package_name="truffleruby-${truffleruby_version}"
rvm_ruby_package_file="${rvm_ruby_package_name}-${platform}-${arch}"
rvm_ruby_url="${rvm_ruby_repo_url:-$(__rvm_db "truffleruby_url")/vm-${truffleruby_version}/${rvm_ruby_package_file}.tar.gz}"

true # for OSX
}

__rvm_select_interpreter_maglev()
{
rvm_ruby_patch_level=""
Expand Down
2 changes: 1 addition & 1 deletion scripts/functions/selector_parse
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ __rvm_ruby_string_parse_()
rvm_ruby_interpreter="rbx"
;;

(opal|ruby|rbx|jruby|macruby|ree|maglev|ironruby|mruby|topaz)
(opal|ruby|rbx|jruby|macruby|ree|maglev|ironruby|mruby|topaz|truffleruby)
rvm_ruby_interpreter="$string"
;;

Expand Down
2 changes: 1 addition & 1 deletion scripts/functions/support
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ __rvm_ruby_config_save_generic()
"$ruby_path" -rrbconfig -e '\
File.open("'"$config_path"'","w") { |file|
RbConfig::CONFIG.sort.each{|key,value|
file.write("#{key.gsub(/\.|-/,"_")}=\"#{value.gsub("$","\\$")}\"\n")
file.write("#{key.gsub(/\.|-/,"_")}=\"#{value.to_s.gsub("$","\\$")}\"\n")
}
}
' >/dev/null 2>&1
Expand Down
2 changes: 2 additions & 0 deletions scripts/functions/utility_system
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ __rvm_remote_extension()
# params: ruby-string-to-transform
__rvm_ruby_package_file()
{
# What's this? Is it just for binary rubies? Do we need to change something for TruffleRuby?
# We already set rvm_ruby_package_file in __rvm_select_interpreter_truffleruby().
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this function?
Is it just for binary rubies?
Do we need to change something for TruffleRuby?
Note that we already set rvm_ruby_package_file in __rvm_select_interpreter_truffleruby().

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would make sense if we install TruffleRuby, prepare binary for it, upload it to RVM binaries and then people download them, I'm not sure this would work with TruffleRuby license, but still could be used for multiserver deploys in private environment.

I guess we can add this in separate PR.

case "$1" in
*.tar.*)
rvm_ruby_package_file="/$1"
Expand Down
1 change: 1 addition & 0 deletions scripts/mount
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ external_select_name()
fi
}

# Should we add an entry for truffleruby here? What's the purpose of this function?
Copy link
Contributor Author

@eregon eregon Jun 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I add an entry for truffleruby here?
What's the purpose of this function?
Is it for guessing a good name based on the URL/archive given to mount?

rvm mount -r 'https://github.com/oracle/truffleruby/releases/download/vm-1.0.0-rc2/truffleruby-1.0.0-rc2-linux-amd64.tar.gz' seems to choose truffleruby-1.0.0-rc2-linux-amd64 as the name currently.
It's mostly fine, except we might want to drop the -linux-amd64.
OTOH, it would then conflict with the normal name from rvm install truffleruby, which I'm not sure is a good idea.
Maybe it should have some prefix or suffix when rvm mount-ed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see the comment in scripts/functions/utility_system

external_propose_name()
{
\typeset parts __tmp1 __tmp2
Expand Down