Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
PtPrashantTripathi authored May 23, 2024
1 parent 2ee34f1 commit e7c5f90
Show file tree
Hide file tree
Showing 2 changed files with 157 additions and 57 deletions.
98 changes: 98 additions & 0 deletions cicd/generate_brew_formula.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import requests
import json

github_repo = "https://github.com/vedic-lang/vedic"


def get_tag_number() -> str:
url = "https://api.github.com/repos/vedic-lang/vedic/releases/latest"
response = requests.get(url)
data = json.loads(response.text)
return data["tag_name"].replace("v", "")


tag = get_tag_number()


def get_sha_values() -> dict:
url = f"{github_repo}/releases/download/v{tag}/sha256sums.txt"
response = requests.get(url)
sha_values = {
each.split("/")[-1].strip(): each.split(" ")[0].strip()
for each in str(response.text).split("\n")
}
print(url, response, sha_values)
return sha_values


sha_values = get_sha_values()


# DEFUALT
version = "{version}"
bin = "{bin}"
homepage = "{homepage}"

tap_code = f"""class vedic < Formula
desc "vedic-lang is a Sanskrit programming language"
homepage "{github_repo}"
version "{tag}"
license "MIT"
head "{github_repo}.git", branch: "main"
if OS.mac?
if Hardware::CPU.arm?
url "{github_repo}/releases/download/v#{version}/vedic-darwin-aarch64.tar.gz"
sha256 "{sha_values.get('vedic-darwin-aarch64.tar.gz','')}"
elsif Hardware::CPU.intel?
url "{github_repo}/releases/download/v#{version}/vedic-darwin-x86_64.tar.gz"
sha256 "{sha_values.get('vedic-darwin-aarch64.tar.gz','')}"
else
# Unsupported platform
odie "This platform is not supported."
end
elsif OS.linux?
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
url "{github_repo}/releases/download/v#{version}/vedic-linux-gnu-aarch64.tar.xz"
sha256 "{sha_values.get('vedic-darwin-aarch64.tar.gz','')}"
elsif Hardware::CPU.intel? && Hardware::CPU.is_64_bit?
url "{github_repo}/releases/download/v#{version}/vedic-linux-gnu-x86_64.tar.xz"
sha256 "{sha_values.get('vedic-darwin-aarch64.tar.gz','')}"
elsif Hardware::CPU.intel? && Hardware::CPU.is_32_bit?
url "{github_repo}/releases/download/v#{version}/vedic-linux-gnu-i686.tar.xz"
sha256 "{sha_values.get('vedic-darwin-aarch64.tar.gz','')}"
elsif Hardware::CPU.arm? && Hardware::CPU.is_32_bit?
url "{github_repo}/releases/download/v#{version}/vedic-linux-gnueabihf-armv7.tar.xz"
sha256 "{sha_values.get('vedic-darwin-aarch64.tar.gz','')}"
elsif Hardware::CPU.intel? && Hardware::CPU.is_64_bit? && OS::Linux::Musl.is_detected?
url "{github_repo}/releases/download/v#{version}/vedic-linux-musl-x86_64.tar.xz"
sha256 "{sha_values.get('vedic-darwin-aarch64.tar.gz','')}"
else
# Unsupported platform
odie "This platform is not supported."
end
else
# Unsupported platform
odie "This platform is not supported."
end
def install
bin.install "vedic" # Install the binary
end
def caveats
<<~EOS
To get started, run:
vedic --help
EOS
end
test do
# Simple test to verify the binary is installed
assert_match "Usage:", shell_output("#{bin}/vedic --help")
end
end"""


with open("pyspark-schema-generator/vedic.rb", "w", encoding="utf-8") as f:
f.write(tap_code)
116 changes: 59 additions & 57 deletions cicd/vedic.rb
Original file line number Diff line number Diff line change
@@ -1,57 +1,59 @@
class vedic < Formula
desc "vedic-lang is a Sanskrit programming language"
homepage "https://github.com/vedic-lang/vedic"
version "2.0.6"

if OS.mac?
if Hardware::CPU.arm?
url "https://github.com/vedic-lang/vedic/releases/download/v#{version}/vedic-darwin-aarch64.tar.gz"
sha256 "69c2ec15825502f85478f21ce86ff64eade278a26ab70d4cf2a5299945d6e1a3"
elsif Hardware::CPU.intel?
url "https://github.com/vedic-lang/vedic/releases/download/v#{version}/vedic-darwin-x86_64.tar.gz"
sha256 "f2622649af902dbc6909d1a1d2836a31cfd576daa50d0a5b1895cbc579962779"
else
# Unsupported platform
odie "This platform is not supported."
end
elsif OS.linux?
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
url "https://github.com/vedic-lang/vedic/releases/download/v#{version}/vedic-linux-gnu-aarch64.tar.xz"
sha256 "0ed48b0af33f87421d0a60c5cffe831c8a1de388a103f42b666894a738fc0fff"
elsif Hardware::CPU.intel? && Hardware::CPU.is_64_bit?
url "https://github.com/vedic-lang/vedic/releases/download/v#{version}/vedic-linux-gnu-x86_64.tar.xz"
sha256 "33b643c211121f5679636809e845354e672031814c85bb10527f4e5af4a7f18d"
elsif Hardware::CPU.intel? && Hardware::CPU.is_32_bit?
url "https://github.com/vedic-lang/vedic/releases/download/v#{version}/vedic-linux-gnu-i686.tar.xz"
sha256 "affc9a338a50021b62505076ed9544df569f2430c207bf2f82c5595403c4c34c"
elsif Hardware::CPU.arm? && Hardware::CPU.is_32_bit?
url "https://github.com/vedic-lang/vedic/releases/download/v#{version}/vedic-linux-gnueabihf-armv7.tar.xz"
sha256 "e4c3d44dcb75b63411e3fe844eb3c8f4e70c727a888bc2b27a6edf361b00eec4"
elsif Hardware::CPU.intel? && Hardware::CPU.is_64_bit? && OS::Linux::Musl.is_detected?
url "https://github.com/vedic-lang/vedic/releases/download/v#{version}/vedic-linux-musl-x86_64.tar.xz"
sha256 "3b8fd6f14b7da520d06190430fbf5870418e6d93f1afc6b87f54cc1d7a4fb30b"
else
# Unsupported platform
odie "This platform is not supported."
end
else
# Unsupported platform
odie "This platform is not supported."
end

def install
bin.install "vedic" # Install the binary
end

def caveats
<<~EOS
To get started, run:
vedic --help
EOS
end

test do
# Simple test to verify the binary is installed
assert_match "Usage:", shell_output("#{bin}/vedic --help")
end
end
class vedic < Formula
desc "vedic-lang is a Sanskrit programming language"
homepage "https://github.com/vedic-lang/vedic"
version "2.0.6"
license "MIT"
head "https://github.com/vedic-lang/vedic.git", branch: "main"

if OS.mac?
if Hardware::CPU.arm?
url "https://github.com/vedic-lang/vedic/releases/download/v#{version}/vedic-darwin-aarch64.tar.gz"
sha256 "bbd827b70e20b8ac1821b5e56d9fa5e7195327ea50a71df912c3088795b1384e"
elsif Hardware::CPU.intel?
url "https://github.com/vedic-lang/vedic/releases/download/v#{version}/vedic-darwin-x86_64.tar.gz"
sha256 "bbd827b70e20b8ac1821b5e56d9fa5e7195327ea50a71df912c3088795b1384e"
else
# Unsupported platform
odie "This platform is not supported."
end
elsif OS.linux?
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
url "https://github.com/vedic-lang/vedic/releases/download/v#{version}/vedic-linux-gnu-aarch64.tar.xz"
sha256 "bbd827b70e20b8ac1821b5e56d9fa5e7195327ea50a71df912c3088795b1384e"
elsif Hardware::CPU.intel? && Hardware::CPU.is_64_bit?
url "https://github.com/vedic-lang/vedic/releases/download/v#{version}/vedic-linux-gnu-x86_64.tar.xz"
sha256 "bbd827b70e20b8ac1821b5e56d9fa5e7195327ea50a71df912c3088795b1384e"
elsif Hardware::CPU.intel? && Hardware::CPU.is_32_bit?
url "https://github.com/vedic-lang/vedic/releases/download/v#{version}/vedic-linux-gnu-i686.tar.xz"
sha256 "bbd827b70e20b8ac1821b5e56d9fa5e7195327ea50a71df912c3088795b1384e"
elsif Hardware::CPU.arm? && Hardware::CPU.is_32_bit?
url "https://github.com/vedic-lang/vedic/releases/download/v#{version}/vedic-linux-gnueabihf-armv7.tar.xz"
sha256 "bbd827b70e20b8ac1821b5e56d9fa5e7195327ea50a71df912c3088795b1384e"
elsif Hardware::CPU.intel? && Hardware::CPU.is_64_bit? && OS::Linux::Musl.is_detected?
url "https://github.com/vedic-lang/vedic/releases/download/v#{version}/vedic-linux-musl-x86_64.tar.xz"
sha256 "bbd827b70e20b8ac1821b5e56d9fa5e7195327ea50a71df912c3088795b1384e"
else
# Unsupported platform
odie "This platform is not supported."
end
else
# Unsupported platform
odie "This platform is not supported."
end

def install
bin.install "vedic" # Install the binary
end

def caveats
<<~EOS
To get started, run:
vedic --help
EOS
end

test do
# Simple test to verify the binary is installed
assert_match "Usage:", shell_output("#{bin}/vedic --help")
end
end

0 comments on commit e7c5f90

Please sign in to comment.