-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
97 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const https = require("https"); | ||
const fs = require("fs"); | ||
|
||
const verMatch = /"([a-f]|[0-9])+"/; | ||
|
||
module.exports = new Promise((resolve, reject) => { | ||
https.get( | ||
{ | ||
href: "https://api.github.com/repos/libsdl-org/SDL/branches/main", | ||
headers: { "user-agent": "chiissu-macchiato/1.0." }, | ||
}, | ||
(res) => { | ||
let data = ""; | ||
|
||
// A chunk of data has been received. | ||
res.on("data", (chunk) => { | ||
data += chunk; | ||
}); | ||
|
||
// The whole response has been received. | ||
res.on("end", async () => { | ||
let res = JSON.parse(data); | ||
resolve(await check(res)); | ||
}); | ||
}, | ||
); | ||
}); | ||
|
||
async function check(data) { | ||
const path = "Formula/sdl3-nightly.rb"; | ||
var file = fs.readFileSync(path).toString(); | ||
const localVer = file.match(verMatch)[0].replaceAll('"', ""); | ||
const remoteVer = data.commit.sha; | ||
|
||
if (localVer == remoteVer) { | ||
console.log("SDL3 is up to date"); | ||
return ""; | ||
} | ||
|
||
file = file.replace(verMatch, `"${remoteVer}"`); | ||
fs.writeFileSync(path, file); | ||
|
||
return `- Update SDL3 to ${remoteVer}\n`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const https = require("https"); | ||
const fs = require("fs"); | ||
|
||
const verMatch = /"([a-f]|[0-9])+"/; | ||
|
||
module.exports = new Promise((resolve, reject) => { | ||
https.get( | ||
{ | ||
href: "https://api.github.com/repos/libsdl-org/SDL/branches/main", | ||
headers: { "user-agent": "chiissu-macchiato/1.0." }, | ||
}, | ||
(res) => { | ||
let data = ""; | ||
|
||
// A chunk of data has been received. | ||
res.on("data", (chunk) => { | ||
data += chunk; | ||
}); | ||
|
||
// The whole response has been received. | ||
res.on("end", async () => { | ||
let res = JSON.parse(data); | ||
resolve(await check(res)); | ||
}); | ||
}, | ||
); | ||
}); | ||
|
||
async function check(data) { | ||
const path = "Formula/sdl3_image-nightly.rb"; | ||
var file = fs.readFileSync(path).toString(); | ||
const localVer = file.match(verMatch)[0].replaceAll('"', ""); | ||
const remoteVer = data.commit.sha; | ||
|
||
if (localVer == remoteVer) { | ||
console.log("SDL3_Image is up to date"); | ||
return ""; | ||
} | ||
|
||
file = file.replace(verMatch, `"${remoteVer}"`); | ||
fs.writeFileSync(path, file); | ||
|
||
return `- Update SDL3_Image to ${remoteVer}\n`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters