Skip to content

Commit

Permalink
Add script for Ruby 3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
infertux committed Jan 4, 2024
1 parent d14ded1 commit 8bf0a03
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2023 Cédric Félizard
Copyright (c) 2015-2024 Cédric Félizard

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
51 changes: 51 additions & 0 deletions bootstrap_ruby_3.3.sh
@@ -0,0 +1,51 @@
#!/bin/bash -e

# Download, configure and install Ruby and Bundler
# https://github.com/infertux/ruby-bootstrap

VERSION="3.3.0"
SHA256="96518814d9832bece92a85415a819d4893b307db5921ae1f0f751a9a89a56b7d"

[ "$1" = "--force" ] && FORCE=1 || FORCE=""

set -u

[ $UID -eq 0 ] || { echo "Root required"; exit 1; }

# Install Ruby and Bundler if they are missing or the force flag is set
if [ -n "$FORCE" ] || ! command -v ruby >/dev/null; then
# wget: to fetch Ruby and pretty useful anyway
# gcc & make: to compile Ruby
# various libs: libraries for Ruby

if [ -f /etc/debian_version ]; then
apt-get update
apt-get install -y wget gcc make libffi-dev libreadline-dev libssl-dev libyaml-dev zlib1g-dev
elif [ -f /etc/redhat-release ]; then
yum install -y wget gcc make openssl-devel readline-devel zlib-devel
fi

cd /tmp
wget https://cache.ruby-lang.org/pub/ruby/${VERSION%.*}/ruby-${VERSION}.tar.gz
echo "${SHA256} ruby-${VERSION}.tar.gz" | sha256sum -c -
tar --no-same-owner -xf ruby-${VERSION}.tar.gz

pushd ruby-${VERSION}
./configure --disable-install-doc
cpus=$(grep -c processor /proc/cpuinfo)
make -j "$cpus"
make install
popd

rm -rf ruby-${VERSION}.tar.gz ruby-${VERSION}

ln -sfv /usr/local/bin/ruby /bin/ruby
ln -sfv /usr/local/bin/gem /bin/gem
ln -sfv /usr/local/bin/bundle /bin/bundle

ruby -v
gem -v
bundle -v
fi

echo "All good to go, happy Rubying!"
4 changes: 2 additions & 2 deletions bootstrap_ruby_stable.sh
Expand Up @@ -3,8 +3,8 @@
# Download, configure and install Ruby and Bundler
# https://github.com/infertux/ruby-bootstrap

VERSION="3.2.2"
SHA256="96c57558871a6748de5bc9f274e93f4b5aad06cd8f37befa0e8d94e7b8a423bc"
VERSION="3.3.0"
SHA256="96518814d9832bece92a85415a819d4893b307db5921ae1f0f751a9a89a56b7d"

[ "$1" = "--force" ] && FORCE=1 || FORCE=""

Expand Down

0 comments on commit 8bf0a03

Please sign in to comment.