[rubygems/rubygems] Expand and comment the regex
https://github.com/rubygems/rubygems/commit/0dd0e93bde
This commit is contained in:
parent
6e46b9b8b3
commit
8fa1db79bd
@ -43,7 +43,16 @@ module Bundler
|
|||||||
def normalize_ruby_file(filename)
|
def normalize_ruby_file(filename)
|
||||||
file_content = Bundler.read_file(gemfile.dirname.join(filename))
|
file_content = Bundler.read_file(gemfile.dirname.join(filename))
|
||||||
# match "ruby-3.2.2", ruby = "3.2.2" or "ruby 3.2.2" capturing version string up to the first space or comment
|
# match "ruby-3.2.2", ruby = "3.2.2" or "ruby 3.2.2" capturing version string up to the first space or comment
|
||||||
if /^ruby[\s-]*(?:=\s*)?"?([^\s#"]+)"?/.match(file_content)
|
if /^ # Start of line
|
||||||
|
ruby # Literal "ruby"
|
||||||
|
[\s-]* # Optional whitespace or hyphens (for "ruby-3.2.2" format)
|
||||||
|
(?:=\s*)? # Optional equals sign with whitespace (for ruby = "3.2.2" format)
|
||||||
|
"? # Optional opening quote
|
||||||
|
( # Start capturing group
|
||||||
|
[^\s#"]+ # One or more chars that aren't spaces, #, or quotes
|
||||||
|
) # End capturing group
|
||||||
|
"? # Optional closing quote
|
||||||
|
/x.match(file_content)
|
||||||
$1
|
$1
|
||||||
else
|
else
|
||||||
file_content.strip
|
file_content.strip
|
||||||
|
Loading…
x
Reference in New Issue
Block a user