Skip to content

Commit

Permalink
Merge pull request #2297 from rbenv/man-page
Browse files Browse the repository at this point in the history
Add ruby-build(1) man page
  • Loading branch information
mislav committed Nov 7, 2023
2 parents 91c95bb + 1aa0bfc commit 44e4797
Show file tree
Hide file tree
Showing 10 changed files with 366 additions and 32 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/share/man/man[1-8]/*.[1-8] linguist-generated
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
release_version := $(shell grep "^RUBY_BUILD_VERSION" bin/ruby-build | cut -d\" -f2)

.PHONY: install
install:
bash install.sh

share/man/man1/%.1: share/man/man1/%.1.adoc bin/ruby-build
asciidoctor -b manpage -a version=$(release_version:v%=%) -o $@ $<
34 changes: 17 additions & 17 deletions bin/rbenv-install
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
#
# Summary: Install a Ruby version using ruby-build
#
# Usage: rbenv install [-f|-s] [-kpv] <version>
# Usage: rbenv install [-f|-s] [-kpv] <version> [-- <configure-args...>]
# rbenv install [-f|-s] [-kpv] <definition-file>
# rbenv install -l|--list
# rbenv install --list
# rbenv install --version
#
# -l/--list List latest stable versions for each Ruby
# -L/--list-all List all local versions
# -f/--force Install even if the version appears to be installed already
# -s/--skip-existing Skip if the version appears to be installed already
# -l, --list List latest stable versions for each Ruby
# -L, --list-all List all local versions, including outdated ones
# -f, --force Allow overwriting an existing installed version
# -s, --skip-existing Avoid overwriting an existing installed version
#
# ruby-build options:
#
# -k/--keep Keep source tree in $RBENV_BUILD_ROOT after installation
# (defaults to $RBENV_ROOT/sources)
# -p/--patch Apply a patch from stdin before building
# -v/--verbose Verbose mode: print compilation status to stdout
# --version Show version of ruby-build
# -v, --verbose Verbose mode: forward all build output to stdout/stderr
# -p, --patch Apply a patch from stdin before building
# -k, --keep Keep source tree in RBENV_BUILD_ROOT after installation
# (defaults to "RBENV_ROOT/sources")
# --version Show version of ruby-build
#
# For detailed information on installing Ruby versions with
# ruby-build, including a list of environment variables for adjusting
# compilation, see: https://github.com/rbenv/ruby-build#usage
# For detailed information on installing Ruby versions with ruby-build,
# including a list of environment variables for adjusting compilation,
# see: https://github.com/rbenv/ruby-build#usage
#
set -e
[ -n "$RBENV_DEBUG" ] && set -x
Expand Down Expand Up @@ -100,7 +100,7 @@ for option in "${OPTIONS[@]}"; do
[ ! -t 1 ] || {
echo
echo "Only latest stable releases for each Ruby implementation are shown."
echo "Use 'rbenv install --list-all / -L' to show all local versions."
echo "Use \`rbenv install --list-all' to show all local versions."
} 1>&2
exit
;;
Expand Down Expand Up @@ -239,15 +239,15 @@ if [ "$STATUS" == "2" ]; then
echo "$candidates" | indent
fi
echo
echo "See all available versions with \`rbenv install --list'."
echo "See all available versions with \`rbenv install --list-all'."
echo
echo -n "If the version you need is missing, try upgrading ruby-build"
if [ "$here" != "${here#"$(brew --prefix 2>/dev/null)"}" ]; then
printf ":\n\n"
echo " brew upgrade ruby-build"
elif [ -d "${here}/.git" ]; then
printf ":\n\n"
echo " git -C ${here} pull"
echo " git -C ${here/${HOME}\//~/} pull"
else
printf ".\n"
fi
Expand Down
21 changes: 11 additions & 10 deletions bin/ruby-build
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#!/usr/bin/env bash
#
# Usage: ruby-build [-kpv] <definition> <prefix>
# ruby-build --definitions
# Usage: ruby-build [-kpv] <definition> <prefix> [-- <configure-args...>]
# ruby-build {--list|--definitions}
# ruby-build --version
#
# -k/--keep Do not remove source tree after installation
# -p/--patch Apply a patch from stdin before building
# -v/--verbose Verbose mode: print compilation status to stdout
# -4/--ipv4 Resolve names to IPv4 addresses only
# -6/--ipv6 Resolve names to IPv6 addresses only
# --definitions List all local definitions
# -l/--list List latest stable releases for each Ruby
# --version Show version of ruby-build
# -l, --list List latest stable releases for each Ruby
# --definitions List all local definitions, including outdated ones
# --version Show version of ruby-build
#
# -v, --verbose Verbose mode: forward all build output to stdout/stderr
# -p, --patch Apply a patch from stdin before building
# -k, --keep Do not remove source tree after installation
# -4, --ipv4 Resolve names to IPv4 addresses only
# -6, --ipv6 Resolve names to IPv6 addresses only
#

RUBY_BUILD_VERSION="20231025"
Expand Down
4 changes: 3 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ fi

BIN_PATH="${PREFIX}/bin"
SHARE_PATH="${PREFIX}/share/ruby-build"
MAN_PATH="${PREFIX}/share/man/man1"

mkdir -p "$BIN_PATH" "$SHARE_PATH"
mkdir -p "$BIN_PATH" "$SHARE_PATH" "$MAN_PATH"

install -p bin/* "$BIN_PATH"
install -p -m 0644 share/ruby-build/* "$SHARE_PATH"
install -p -m 0644 share/man/man1/*.1 "$MAN_PATH"
3 changes: 2 additions & 1 deletion script/release
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ fi

sed -i.bak -E "s!^(RUBY_BUILD_VERSION=).+!\\1\"${new_version}\"!" "$binfile"
rm -f "${binfile}.bak"
make share/man/man1/ruby-build.1

git commit -m "ruby-build ${new_version}" -- "$binfile"
git commit -m "ruby-build ${new_version}" -- "$binfile" share/man/man1/ruby-build.1

git tag "$version_tag"
git push origin master "${version_tag}"
Expand Down
208 changes: 208 additions & 0 deletions share/man/man1/ruby-build.1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 44e4797

Please sign in to comment.