-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhomebrew.ts
46 lines (37 loc) · 1.06 KB
/
homebrew.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// generateRubyFile.js
// Import necessary modules
const fs = require('node:fs');
const path = require('node:path');
// Define the path to the JSON file
const jsonFilePath = path.join(__dirname, 'homebrew.json');
// Read and parse the JSON file
const c= JSON.parse(fs.readFileSync(jsonFilePath, 'utf8'));
// Extract variables from JSON
console.log(c)
// Generate Ruby file content
const rubyFileContent = `class Gild < Formula
desc "Infrastructure as code"
homepage "https://gild.gg"
version "${c.version}"
license "Apache-2.0"
if OS.mac?
if Hardware::CPU.intel?
url "${c.darwin_x64_url}"
sha256 "${c.darwin_x64_hash}"
elsif Hardware::CPU.arm?
url "${c.darwin_arm64_url}"
sha256 "${c.darwin_arm64_hash}"
end
elsif OS.linux?
url "${c.linux_x64_url}"
sha256 "${c.linux_x64_hash}"
end
def install
bin.install "gild"
end
end
`;
// Define the output file name
const outputFileName = 'homebrew-gild/Formula/gild.rb';
// Write the generated content to a Ruby file
fs.writeFileSync(outputFileName, rubyFileContent);