Skip to content

Commit

Permalink
Ease consumption (#125)
Browse files Browse the repository at this point in the history
Don't take `maint-` -prefixed versions into account unless they're asked for it
specifically
At the same time, while fetching versions, make sure we identify them better so that
25 does not end up pulling maint-25 instead of OTP-25.0, as it should
  • Loading branch information
paulo-ferraz-oliveira authored Aug 1, 2022
1 parent caa49b0 commit 69fb25b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6191,12 +6191,12 @@ async function maybeInstallRebar3(rebar3Spec) {

async function getOTPVersion(otpSpec0, osVersion) {
const otpVersions = await getOTPVersions(osVersion)
const otpSpec = otpSpec0.match(/^(OTP-)?([^ ]+)/)
const otpSpec = otpSpec0.match(/^(OTP-|maint-)?([^ ]+)/)
let otpVersion
if (otpSpec[1] && !isStrictVersion()) {
throw new Error(
`Requested Erlang/OTP version (${otpSpec0}) ` +
"should not contain 'OTP-'",
"should not contain 'OTP-, or maint-'",
)
}
if (otpSpec) {
Expand Down Expand Up @@ -6310,7 +6310,7 @@ async function getOTPVersions(osVersion) {
.trim()
.split('\n')
.forEach((line) => {
const otpMatch = line.match(/^(OTP-)?([^ ]+)/)
const otpMatch = line.match(/^(OTP-|maint-)?([^ ]+)/)
const otpVersion = otpMatch[2]
otpVersions.set(otpVersion, otpMatch[0]) // we keep the original for later reference
})
Expand Down
6 changes: 3 additions & 3 deletions src/setup-beam.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ async function maybeInstallRebar3(rebar3Spec) {

async function getOTPVersion(otpSpec0, osVersion) {
const otpVersions = await getOTPVersions(osVersion)
const otpSpec = otpSpec0.match(/^(OTP-)?([^ ]+)/)
const otpSpec = otpSpec0.match(/^(OTP-|maint-)?([^ ]+)/)
let otpVersion
if (otpSpec[1] && !isStrictVersion()) {
throw new Error(
`Requested Erlang/OTP version (${otpSpec0}) ` +
"should not contain 'OTP-'",
"should not contain 'OTP-, or maint-'",
)
}
if (otpSpec) {
Expand Down Expand Up @@ -258,7 +258,7 @@ async function getOTPVersions(osVersion) {
.trim()
.split('\n')
.forEach((line) => {
const otpMatch = line.match(/^(OTP-)?([^ ]+)/)
const otpMatch = line.match(/^(OTP-|maint-)?([^ ]+)/)
const otpVersion = otpMatch[2]
otpVersions.set(otpVersion, otpMatch[0]) // we keep the original for later reference
})
Expand Down

0 comments on commit 69fb25b

Please sign in to comment.