Commit 392679a7 authored by Mislav Marohnić's avatar Mislav Marohnić
Browse files

Fix `irb`, `rake`, `rdoc`, `ri` for rbx-2.2.1

We symlink Rubinius' `PREFIX/gems/bin` into `PREFIX/bin` so that new
RubyGems binstubs get added to the main bin directory and therefore
become available to rbenv.

However, by throwing away `irb`, `rake`, `rdoc`, and `ri` binstubs
during this process (which are non-executable and have an invalid
shebang), we break the same commands in latest versions of Rubinius.

This change ensures that these binstubs get preserved, their shebang
corrected to `#!PREFIX/bin/rbx`, their executable bit flipped on, and
copied over to the main bin directory.

Fixes #468
parent a2d9ac49
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -537,10 +537,14 @@ fix_rbx_gem_binstubs() {
  local prefix="$1"
  local gemdir="${prefix}/gems/bin"
  local bindir="${prefix}/bin"
  local file binstub
  # Symlink Rubinius' `gems/bin/` into `bin/`
  if [ -d "$gemdir" ]; then
    for file in "$gemdir"/*; do
      [ -x "$file" ] && mv "$file" "$bindir"
      binstub="${bindir}/${file##*/}"
      rm -f "$binstub"
      sed -E "s:^#\!.+:#\!${bindir}/ruby:" < "$file" > "$binstub"
      chmod +x "$binstub"
    done
    rm -rf "$gemdir"
    ln -s ../bin "$gemdir"