lib/common/utils.rb in bake-toolkit-2.37.14 vs lib/common/utils.rb in bake-toolkit-2.38.0
- old
+ new
@@ -13,16 +13,16 @@
hadQuote = false
ar = []
s = ""
str.split("").each do |i|
- hasDoubleQuote = !hasDoubleQuote if !hasQuote and i == '"'
- hasQuote = !hasQuote if !hasDoubleQuote and i == '\''
- hadQuote = true if hasDoubleQuote
+ hasDoubleQuote = !hasDoubleQuote if !hasQuote && i == '"'
+ hasQuote = !hasQuote if !hasDoubleQuote && i == '\''
+ hadQuote = true if hasDoubleQuote || hasQuote
if i == ' '
- if not hasDoubleQuote and not hasQuote
- if hadQuote and removeQuotes
+ if !hasDoubleQuote && !hasQuote
+ if hadQuote && removeQuotes
ar << s[1..-2] if s.length > 2
hadQuote = false
else
ar << s if s.length > 0
end
@@ -30,10 +30,14 @@
next
end
end
s << i
end
- ar << s if s.length > 0
+ if !hasDoubleQuote && !hasQuote && hadQuote && removeQuotes
+ ar << s[1..-2] if s.length > 2
+ elsif s.length > 0
+ ar << s
+ end
ar
end
# Simple helper query the operating system we are running in
module OS