Skip to content

Commit

Permalink
Added -U,--update to replace -L,--latest (issue #421,#384,#345).
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed May 1, 2022
1 parent 14375a0 commit 9196cc4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ List supported Rubies and their current stable versions:

Updates then list the supported Rubies and their current stable versions:

$ ruby-install --latest
$ ruby-install --update

Install the current stable version of Ruby:

$ ruby-install ruby

Install the latest version of Ruby:

$ ruby-install --latest ruby
$ ruby-install --update ruby

Install a stable version of Ruby:

Expand Down
2 changes: 1 addition & 1 deletion doc/man/ruby-install.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ https://github.com/postmodern/ruby-install#readme
`--no-reinstall`
Skip installation if another Ruby is detected in same location.

`-L`, `--latest`
`-U`, `--update`
Downloads the latest ruby versions and checksums from the ruby-versions
repository (https://github.com/postmodern/ruby-versions#readme).

Expand Down
2 changes: 1 addition & 1 deletion share/man/man1/ruby-install.1
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Do not install build dependencies before installing Ruby\.
Skip installation if another Ruby is detected in same location\.
.LP
.TP
\fB-L\fR, \fB--latest\fR
\fB-U\fR, \fB--update\fR
Downloads the latest ruby versions and checksums from the ruby\-versions
repository (https:\[sl]\[sl]github\.com\[sl]postmodern\[sl]ruby\-versions\[sh]readme)\.
.LP
Expand Down
2 changes: 1 addition & 1 deletion share/ruby-install/ruby-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ function parse_options()
shift
;;
-L|--latest)
warn "deprecation: -L,--latest is deprecated. Please use -U,--update instead."
warn "DEPRECATION: -L,--latest is deprecated. Please use -U,--update instead."
force_update=1
shift
;;
Expand Down
21 changes: 21 additions & 0 deletions test/ruby-install-tests/parse_options_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,27 @@ function test_parse_options_with_no_reinstall()
assertEquals "did not set to \$no_reinstall" 1 $no_reinstall
}

function test_parse_options_with_latest()
{
parse_options "--latest" "ruby" 2>/dev/null

assertEquals "did not set to \$force_update" 1 $force_update
}

function test_parse_option_with_latest_deprecation_warning()
{
local output="$(parse_options "--latest" "ruby" 2>&1)"

assertEquals "*** DEPRECATION: -L,--latest is deprecated. Please use -U,--update instead." "$output"
}

function test_parse_options_with_update()
{
parse_options "--update" "ruby" 2>/dev/null

assertEquals "did not set to \$force_update" 1 $force_update
}

function test_parse_options_with_additional_options()
{
local expected=(--enable-shared CFLAGS="-03")
Expand Down

0 comments on commit 9196cc4

Please sign in to comment.