This essentially reverts one of the changes made in PR #8.
The $1 global variable has different values at line 16 and line 18. In line 16, the $1 represents the parsed gem version number found in the gem list --remote "^#{name}$" command that was run on line 13 and parsed on 14. The raw output from the command would look something like this:
*** REMOTE GEMS ***
rails (4.1.4)
And would parse 4.1.4 and set it to $1.
The second usage of $1 (which was mistakenly changed to version in the aforementioned PR) is the value of the match in the regex of the gsub command. This was the original value, and should remain that since we don't want to replace the portions of the gem name with the version, but to upcase the character following any dash and removing any existing dashes.
This essentially reverts one of the changes made in PR #8.
The
$1
global variable has different values at line 16 and line 18. In line 16, the$1
represents the parsed gem version number found in thegem list --remote "^#{name}$"
command that was run on line 13 and parsed on 14. The raw output from the command would look something like this:And would parse
4.1.4
and set it to$1
.The second usage of
$1
(which was mistakenly changed to version in the aforementioned PR) is the value of the match in the regex of the gsub command. This was the original value, and should remain that since we don't want to replace the portions of the gem name with the version, but to upcase the character following any dash and removing any existing dashes.