Skip to content

Commit

Permalink
Converted dependencies.txt files into dependencies.sh files.
Browse files Browse the repository at this point in the history
* This will allow for dynamic dependencies based on the ruby version or
  OS version.
* Added tests for `ruby_dependencies` for each package manager.
* Remoed the `load_dependencies_from()` function.
* Removed the `fetch()` function.
  • Loading branch information
postmodern committed Mar 7, 2024
1 parent 428e660 commit 3779156
Show file tree
Hide file tree
Showing 22 changed files with 1,124 additions and 264 deletions.
14 changes: 3 additions & 11 deletions share/ruby-install/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,13 @@ function pre_install()
}

#
# Loads the packages from the file within the ruby's directory for the current
# package manager and sets $ruby_dependencies.
# Loads the dependencies.sh file for the ruby and sets $ruby_dependencies.
#
function load_dependencies_from()
function load_dependencies()
{
local file="$1"

ruby_dependencies=($(fetch "$ruby/$file" "$package_manager" || return $?))
source "$ruby_install_dir/$ruby/dependencies.sh"
}

#
# Loads the dependencies from dependencies.txt and sets $ruby_dependencies.
#
function load_dependencies() { load_dependencies_from "dependencies"; }

#
# Install the ruby's dependencies.
#
Expand Down
11 changes: 11 additions & 0 deletions share/ruby-install/jruby/dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

case "$package_manager" in
apt) ruby_dependencies=(openjdk-8-jdk) ;;
dnf) ruby_dependencies=(java-openjdk) ;;
yum) ruby_dependencies=(java-openjdk) ;;
pacman) ruby_dependencies=(jre8-openjdk) ;;
zypper) ruby_dependencies=(java-1.8.0-openjdk) ;;
pkg) ruby_dependencies=(openjdk) ;;
xbps) ruby_dependencies=(openjdk) ;;
esac
7 changes: 0 additions & 7 deletions share/ruby-install/jruby/dependencies.txt

This file was deleted.

48 changes: 48 additions & 0 deletions share/ruby-install/mruby/dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash

case "$package_manager" in
apt)
ruby_dependencies=(
build-essential
bison
)
;;
dnf)
ruby_dependencies=(
gcc
make
bison
)
;;
yum)
ruby_dependencies=(
gcc
make
bison
)
;;
port) ruby_dependencies=(bison) ;;
brew) ruby_dependencies=(bison) ;;
pacman)
ruby_dependencies=(
gcc
make
bison
)
;;
zypper)
ruby_dependencies=(
gcc
make
bison
)
;;
pkg)
ruby_dependencies=(
gcc
automake
bison
)
;;
xbps) ruby_dependencies=(base-devel) ;;
esac
9 changes: 0 additions & 9 deletions share/ruby-install/mruby/dependencies.txt

This file was deleted.

137 changes: 137 additions & 0 deletions share/ruby-install/ruby/dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
#!/usr/bin/env bash

case "$package_manager" in
apt)
ruby_dependencies=(
xz-utils
build-essential
bison
zlib1g-dev
libyaml-dev
libssl-dev
libgdbm-dev
libreadline-dev
libncurses5-dev
libffi-dev
)
;;
dnf)
ruby_dependencies=(
xz
gcc
automake
bison
zlib-devel
libyaml-devel
openssl-devel
gdbm-devel
readline-devel
ncurses-devel
libffi-devel
)
;;
yum)
ruby_dependencies=(
xz
gcc
automake
bison
zlib-devel
libyaml-devel
openssl-devel
gdbm-devel
readline-devel
ncurses-devel
libffi-devel
)
;;
port)
ruby_dependencies=(
automake
bison
readline
libyaml
gdbm
libffi
)
;;
brew)
ruby_dependencies=(
automake
bison
readline
libyaml
gdbm
libffi
)
;;
pacman)
ruby_dependencies=(
xz
gcc
make
bison
zlib
ncurses
openssl
readline
libyaml
gdbm
libffi
)
;;
zypper)
ruby_dependencies=(
xz
gcc
make
automake
zlib-devel
libyaml-devel
libopenssl-devel
gdbm-devel
readline-devel
ncurses-devel
libffi-devel
)
;;
pkg)
ruby_dependencies=(
openssl
readline
libyaml
gdbm
libffi
)
;;
xbps)
ruby_dependencies=(
base-devel
openssl-devel
zlib-devel
libyaml-devel
gdbm-devel
readline-devel
ncurses-devel
libffi-develesac
)
;;
esac

case "$package_manager" in
brew|port)
case "$ruby_version" in
2.*|3.0.*) openssl_version="1.1" ;;
*) openssl_version="3" ;;
esac
;;
esac

#
# Install [email protected] or [email protected] depending on the Ruby version,
# only for homebrew.
#
case "$package_manager" in
brew) ruby_dependencies+=("openssl@${openssl_version}") ;;
port) ruby_dependencies+=("openssl${openssl_version/./}") ;;
esac
9 changes: 0 additions & 9 deletions share/ruby-install/ruby/dependencies.txt

This file was deleted.

21 changes: 0 additions & 21 deletions share/ruby-install/ruby/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,6 @@ ruby_dir_name="ruby-$ruby_version"
ruby_mirror="${ruby_mirror:-https://cache.ruby-lang.org/pub/ruby}"
ruby_url="${ruby_url:-$ruby_mirror/$ruby_version_family/$ruby_archive}"

case "$package_manager" in
brew|port)
case "$ruby_version_family" in
2.*|3.0) openssl_version="1.1" ;;
*) openssl_version="3" ;;
esac
;;
esac

#
# Install [email protected] or [email protected] depending on the Ruby version,
# only for homebrew.
#
function install_optional_deps()
{
case "$package_manager" in
brew) install_packages "openssl@${openssl_version}" ;;
port) install_packages "openssl${openssl_version/./}" ;;
esac
}

#
# Configures Ruby.
#
Expand Down
84 changes: 84 additions & 0 deletions share/ruby-install/truffleruby-graalvm/dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env bash

case "$package_manager" in
apt)
ruby_dependencies=(
make
gcc
zlib1g-dev
libssl-dev
libxml2
libyaml-dev
)
;;
dnf)
ruby_dependencies=(
make
gcc
zlib-devel
openssl-devel
libxml2
libyaml-devel
)
;;
yum)
ruby_dependencies=(
make
gcc
zlib-devel
openssl-devel
libxml2
libyaml-devel
)
;;
port)
ruby_dependencies=(
openssl
libyaml
)
;;
brew)
ruby_dependencies=(
[email protected]
libyaml
)
;;
pacman)
ruby_dependencies=(
make
gcc
zlib
openssl
libxml2
libyaml
)
;;
zypper)
ruby_dependencies=(
make
gcc
zlib-devel
libopenssl-devel
libxml2
libyaml-devel
)
;;
pkg)
ruby_dependencies=(
gmake
gcc
openssl
libxml2
libyaml
)
;;
xbps)
ruby_dependencies=(
base-devel
openssl-devel
zlib-devel
libxml2
libyaml-devel
)
;;
esac
9 changes: 0 additions & 9 deletions share/ruby-install/truffleruby-graalvm/dependencies.txt

This file was deleted.

Loading

0 comments on commit 3779156

Please sign in to comment.