diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..c2a1783471 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +/share/man/man[1-8]/*.[1-8] linguist-generated diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..8dd56e7d6a --- /dev/null +++ b/Makefile @@ -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 $@ $< diff --git a/bin/rbenv-install b/bin/rbenv-install index e4e35301d6..3d61f58e6a 100755 --- a/bin/rbenv-install +++ b/bin/rbenv-install @@ -2,27 +2,27 @@ # # Summary: Install a Ruby version using ruby-build # -# Usage: rbenv install [-f|-s] [-kpv] +# Usage: rbenv install [-f|-s] [-kpv] [-- ] # rbenv install [-f|-s] [-kpv] -# 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 @@ -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 ;; @@ -239,7 +239,7 @@ 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 @@ -247,7 +247,7 @@ if [ "$STATUS" == "2" ]; then 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 diff --git a/bin/ruby-build b/bin/ruby-build index 176ace3c4f..e02f3cd592 100755 --- a/bin/ruby-build +++ b/bin/ruby-build @@ -1,17 +1,18 @@ #!/usr/bin/env bash # -# Usage: ruby-build [-kpv] -# ruby-build --definitions +# Usage: ruby-build [-kpv] [-- ] +# 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" diff --git a/install.sh b/install.sh index 94f35311fc..f8156ea169 100755 --- a/install.sh +++ b/install.sh @@ -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" diff --git a/script/release b/script/release index d078bf0adb..e1352e4d80 100755 --- a/script/release +++ b/script/release @@ -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}" diff --git a/share/man/man1/ruby-build.1 b/share/man/man1/ruby-build.1 new file mode 100644 index 0000000000..bb96e2da97 --- /dev/null +++ b/share/man/man1/ruby-build.1 @@ -0,0 +1,208 @@ +'\" t +.\" Title: ruby-build +.\" Author: Mislav Marohnić +.\" Generator: Asciidoctor 2.0.20 +.\" Date: 2023-11-07 +.\" Manual: ruby-build Manual +.\" Source: ruby-build 20231025 +.\" Language: English +.\" +.TH "RUBY\-BUILD" "1" "2023-11-07" "ruby\-build 20231025" "ruby\-build Manual" +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.ss \n[.ss] 0 +.nh +.ad l +.de URL +\fI\\$2\fP <\\$1>\\$3 +.. +.als MTO URL +.if \n[.g] \{\ +. mso www.tmac +. am URL +. ad l +. . +. am MTO +. ad l +. . +. LINKSTYLE blue R < > +.\} +.SH "NAME" +ruby-build \- Download, compile, and install a version of Ruby. +.SH "SYNOPSIS" +.sp +ruby\-build [\-kpv] \fI\fP \fI\fP [\-\- \fI\fP] +.br +ruby\-build {\-\-list|\-\-definitions} +.br +ruby\-build \-\-version +.SH "DESCRIPTION" +.sp +ruby\-build downloads, compiles, and installs a Ruby version named by the +\fIdefinition\fP argument into the location specified by \fIprefix\fP. Optionally, +extra Ruby configure arguments may be added after "\-\-". +.sp +The \fIdefinition\fP argument can be a path to a file on disk, in which case +it is sourced into ruby\-build as a bash script. +.sp +By default, all compile output is redirected to a log file at: +"$TMPDIR/ruby\-build.*.log". Activate the verbose mode to skip the log file +and print everything to standard streams. +.SH "ENVIRONMENT VARIABLES" +.sp +\fBTMPDIR\fP +.RS 4 +The location to write temporary files on disk +.RE +.sp +\fBRUBY_BUILD_BUILD_PATH\fP (default: a timestamped subdirectory of \fITMPDIR\fP) +.RS 4 +The build location for downloading source files to and compiling +.RE +.sp +\fBRUBY_BUILD_CACHE_PATH\fP (default: "~/.rbenv/cache" if invoked as rbenv plugin) +.RS 4 +Where to cache downloaded package files +.RE +.sp +\fBRUBY_BUILD_HTTP_CLIENT\fP (default: first tool found in PATH) +.RS 4 +One of "aria2c", "curl", or "wget" to use for downloading +.RE +.sp +\fBRUBY_BUILD_ARIA2_OPTS\fP +.RS 4 +Additional options to pass to aria2c for downloading +.RE +.sp +\fBRUBY_BUILD_CURL_OPTS\fP +.RS 4 +Additional options to pass to curl for downloading +.RE +.sp +\fBRUBY_BUILD_WGET_OPTS\fP +.RS 4 +Additional options to pass to wget for downloading +.RE +.sp +\fBRUBY_BUILD_MIRROR_URL\fP (default: a sponsored Amazon CloudFront mirror) +.RS 4 +Custom mirror URL root to download packages from +.RE +.sp +\fBRUBY_BUILD_MIRROR_PACKAGE_URL\fP +.RS 4 +Custom complete mirror URL +.RE +.sp +\fBRUBY_BUILD_SKIP_MIRROR\fP +.RS 4 +Bypass the download mirror and fetch all package files from their original URLs +.RE +.sp +\fBRUBY_BUILD_ROOT\fP (default: "share/ruby\-build" within ruby\-build install location) +.RS 4 +Custom build definition directory +.RE +.sp +\fBRUBY_BUILD_TARBALL_OVERRIDE\fP +.RS 4 +Override the URL to fetch the ruby tarball from, optionally followed by "#" +.RE +.sp +\fBRUBY_BUILD_DEFINITIONS\fP +.RS 4 +Paths to search for build definitions in addition to \fIRUBY_BUILD_ROOT\fP +.RE +.sp +\fBCC\fP +.RS 4 +Path to the C compiler +.RE +.sp +\fBRUBY_CFLAGS\fP +.RS 4 +Additional \f(CRCFLAGS\fP options to use for Ruby compilation +.RE +.sp +\fBCONFIGURE_OPTS\fP +.RS 4 +Additional "./configure" arguments +.RE +.sp +\fBMAKE\fP (default: "make") +.RS 4 +Custom make command (e.g., "gmake") +.RE +.sp +\fBMAKE_OPTS\fP, \fBMAKEOPTS\fP +.RS 4 +Additional arguments for "make" +.RE +.sp +\fBMAKE_INSTALL_OPTS\fP +.RS 4 +Additional arguments for "make install" +.RE +.sp +\fBRUBY_CONFIGURE_OPTS\fP +.RS 4 +Additional "./configure" arguments that apply only to Ruby source +.RE +.sp +\fBRUBY_MAKE_OPTS\fP +.RS 4 +Additional make arguments that apply only to Ruby source +.RE +.sp +\fBRUBY_MAKE_INSTALL_OPTS\fP +.RS 4 +Additional "make install" arguments that apply only to Ruby source +.RE +.sp +\fBNO_COLOR\fP (default: allow colors when connected to terminal) +.RS 4 +Disable ANSI colors in output +.RE +.sp +\fBCLICOLOR_FORCE\fP +.RS 4 +Use ANSI colors in output even when not connected to a terminal +.RE +.SH "NOTES" +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +. sp -1 +. IP \(bu 2.3 +.\} +.URL "https://github.com/rbenv/ruby\-build#readme" "" "" +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +. sp -1 +. IP \(bu 2.3 +.\} +.URL "https://github.com/rbenv/ruby\-build/wiki" "" "" +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +. sp -1 +. IP \(bu 2.3 +.\} +.URL "https://github.com/rbenv/ruby\-build/discussions" "" "" +.RE +.SH "AUTHOR" +.sp +Mislav Marohnić \ No newline at end of file diff --git a/share/man/man1/ruby-build.1.adoc b/share/man/man1/ruby-build.1.adoc new file mode 100644 index 0000000000..a72f6c4200 --- /dev/null +++ b/share/man/man1/ruby-build.1.adoc @@ -0,0 +1,111 @@ += ruby-build(1) +Mislav Marohnić +:doctype: manpage +:man manual: ruby-build Manual +:man source: ruby-build {version} +:man-linkstyle: pass:[blue R < >] + +== Name + +ruby-build - Download, compile, and install a version of Ruby. + +== Synopsis + +ruby-build [-kpv] __ __ [-- __] + +ruby-build {--list|--definitions} + +ruby-build --version + +== Description + +ruby-build downloads, compiles, and installs a Ruby version named by the +_definition_ argument into the location specified by _prefix_. Optionally, +extra Ruby configure arguments may be added after "--". + +The _definition_ argument can be a path to a file on disk, in which case +it is sourced into ruby-build as a bash script. + +By default, all compile output is redirected to a log file at: +"$TMPDIR/ruby-build.*.log". Activate the verbose mode to skip the log file +and print everything to standard streams. + +== Environment Variables + +*TMPDIR*:: + The location to write temporary files on disk + +*RUBY_BUILD_BUILD_PATH* (default: a timestamped subdirectory of _TMPDIR_):: + The build location for downloading source files to and compiling + +*RUBY_BUILD_CACHE_PATH* (default: "~/.rbenv/cache" if invoked as rbenv plugin):: + Where to cache downloaded package files + +*RUBY_BUILD_HTTP_CLIENT* (default: first tool found in PATH):: + One of "aria2c", "curl", or "wget" to use for downloading + +*RUBY_BUILD_ARIA2_OPTS*:: + Additional options to pass to aria2c for downloading + +*RUBY_BUILD_CURL_OPTS*:: + Additional options to pass to curl for downloading + +*RUBY_BUILD_WGET_OPTS*:: + Additional options to pass to wget for downloading + +*RUBY_BUILD_MIRROR_URL* (default: a sponsored Amazon CloudFront mirror):: + Custom mirror URL root to download packages from + +*RUBY_BUILD_MIRROR_PACKAGE_URL*:: + Custom complete mirror URL + +*RUBY_BUILD_SKIP_MIRROR*:: + Bypass the download mirror and fetch all package files from their original URLs + +*RUBY_BUILD_ROOT* (default: "share/ruby-build" within ruby-build install location):: + Custom build definition directory + +*RUBY_BUILD_TARBALL_OVERRIDE*:: + Override the URL to fetch the ruby tarball from, optionally followed by "#" + +*RUBY_BUILD_DEFINITIONS*:: + Paths to search for build definitions in addition to _RUBY_BUILD_ROOT_ + +*CC*:: + Path to the C compiler + +*RUBY_CFLAGS*:: + Additional `CFLAGS` options to use for Ruby compilation + +*CONFIGURE_OPTS*:: + Additional "./configure" arguments + +*MAKE* (default: "make"):: + Custom make command (e.g., "gmake") + +*MAKE_OPTS*, *MAKEOPTS*:: + Additional arguments for "make" + +*MAKE_INSTALL_OPTS*:: + Additional arguments for "make install" + +*RUBY_CONFIGURE_OPTS*:: + Additional "./configure" arguments that apply only to Ruby source + +*RUBY_MAKE_OPTS*:: + Additional make arguments that apply only to Ruby source + +*RUBY_MAKE_INSTALL_OPTS*:: + Additional "make install" arguments that apply only to Ruby source + +*NO_COLOR* (default: allow colors when connected to terminal):: + Disable ANSI colors in output + +*CLICOLOR_FORCE*:: + Use ANSI colors in output even when not connected to a terminal + +== Notes + +* https://github.com/rbenv/ruby-build#readme + +* https://github.com/rbenv/ruby-build/wiki + +* https://github.com/rbenv/ruby-build/discussions diff --git a/test/installer.bats b/test/installer.bats index 5fb19fe63c..a39a58aaf8 100644 --- a/test/installer.bats +++ b/test/installer.bats @@ -16,6 +16,8 @@ load test_helper assert [ -e share/ruby-build/1.8.6-p383 ] assert [ -e share/ruby-build/ree-1.8.7-2012.02 ] + assert [ -e share/man/man1/ruby-build.1 ] + assert [ ! -e share/man/man1/ruby-build.1.adoc ] } @test "build definitions don't have the executable bit" { diff --git a/test/rbenv.bats b/test/rbenv.bats index b7727bdbd1..4496b1fef5 100644 --- a/test/rbenv.bats +++ b/test/rbenv.bats @@ -101,11 +101,11 @@ The following versions contain \`1.9.3' in the name: 1.9.3-p0 1.9.3-p194 -See all available versions with \`rbenv install --list'. +See all available versions with \`rbenv install --list-all'. If the version you need is missing, try upgrading ruby-build: - git -C ${BATS_TEST_DIRNAME}/.. pull + git -C ${BATS_TEST_DIRNAME/$HOME\//~/}/.. pull OUT unstub brew @@ -122,7 +122,7 @@ OUT assert_output <