homebrew tap

This commit is contained in:
Test User
2025-08-22 15:39:31 +05:00
parent ffcb12e76c
commit 75bb1ea4c6
3 changed files with 124 additions and 5 deletions

55
Formula/chatmock.rb Normal file
View File

@@ -0,0 +1,55 @@
class Chatmock < Formula
include Language::Python::Virtualenv
desc "OpenAI & Ollama compatible API powered by your ChatGPT plan"
homepage "https://github.com/RayBytes/ChatMock"
url "https://github.com/RayBytes/ChatMock/archive/refs/tags/v1.0.0.tar.gz"
sha256 "0000000000000000000000000000000000000000000000000000000000000000"
license "MIT"
head "https://github.com/RayBytes/ChatMock.git", branch: "main"
depends_on "python@3.11"
def install
virtualenv_create(libexec, "python3.11")
system libexec/"bin/pip", "install", "-r", "requirements.txt"
libexec.install "chatmock/"
libexec.install "chatmock.py"
libexec.install "prompt.md"
(bin/"chatmock").write <<~EOS
#!/bin/bash
set -e
CHATMOCK_HOME="#{libexec}"
export PYTHONPATH="#{libexec}:$PYTHONPATH"
exec "#{libexec}/bin/python" "#{libexec}/chatmock.py" "$@"
EOS
chmod 0755, bin/"chatmock"
end
def caveats
<<~EOS
To get started with ChatMock:
1. First, authenticate with your ChatGPT account:
chatmock login
2. Start the local API server:
chatmock serve
3. Use the API at http://127.0.0.1:8000/v1
Note: ChatMock requires a paid ChatGPT Plus or Pro account to function.
For more options and configuration:
chatmock serve --help
EOS
end
test do
output = shell_output("#{bin}/chatmock --help 2>&1", 2)
assert_match "ChatGPT Local", output
end
end

View File

@@ -13,12 +13,25 @@ This does require a paid ChatGPT account.
## Quickstart
### Mac Users
If you use MacOS, you can use the GUI application in the Github releases. Unfortunately, due to not being part of the paid apple developer program, you will have to click "Open anyway" in security after trying to right click and open the app. If that doesn't work you will have to type this command in the terminal on Mac to ensure you can run the application: <br>
`xattr -dr com.apple.quarantine /Applications/ChatMock.app`<br>
*See more info [here](https://github.com/deskflow/deskflow/wiki/Running-on-macOS)*
### Windows Users
Simply download and run the app in the releases. As I do not own a windows computer I cannot fully bug test this, so please do report bugs in issues.
#### GUI Application
If you're on **macOS**, you can download the GUI app from the [GitHub releases](https://github.com/RayBytes/ChatMock/releases).
> **Note:** Since ChatMock isn't signed with an Apple Developer ID, you may need to run the following command in your terminal to open the app:
>
> ```bash
> xattr -dr com.apple.quarantine /Applications/ChatMock.app
> ```
>
> *[More info here.](https://github.com/deskflow/deskflow/wiki/Running-on-macOS)*
#### Command Line (Homebrew)
You can also install ChatMock as a command-line tool using [Homebrew](https://brew.sh/):
```
brew tap RayBytes/ChatMock
brew install chatmock
```
### Python
If you wish to just simply run this as a python flask server, you are also freely welcome too.

51
scripts/update-formula-sha.sh Executable file
View File

@@ -0,0 +1,51 @@
#!/bin/bash
set -e
if [ $# -ne 2 ]; then
echo "Usage: $0 <github-username> <tag-version>"
echo "Example: $0 RayBytes v1.0.0"
exit 1
fi
GITHUB_USER="$1"
TAG_VERSION="$2"
FORMULA_FILE="Formula/chatmock.rb"
VERSION="${TAG_VERSION#v}"
ARCHIVE_URL="https://github.com/${GITHUB_USER}/ChatMock/archive/refs/tags/${TAG_VERSION}.tar.gz"
REPO_URL="https://github.com/${GITHUB_USER}/ChatMock"
echo "Downloading archive to calculate SHA256..."
echo "URL: $ARCHIVE_URL"
SHA256=$(curl -sL "$ARCHIVE_URL" | shasum -a 256 | cut -d' ' -f1)
if [ -z "$SHA256" ]; then
echo "Error: Could not calculate SHA256. Make sure the tag exists and is accessible."
exit 1
fi
echo "Calculated SHA256: $SHA256"
echo "Updating $FORMULA_FILE..."
cp "$FORMULA_FILE" "$FORMULA_FILE.backup"
sed -i.tmp "s|homepage \".*\"|homepage \"$REPO_URL\"|g" "$FORMULA_FILE"
sed -i.tmp "s|url \".*\"|url \"$ARCHIVE_URL\"|g" "$FORMULA_FILE"
sed -i.tmp "s|sha256 \".*\"|sha256 \"$SHA256\"|g" "$FORMULA_FILE"
sed -i.tmp "s|head \".*\"|head \"$REPO_URL.git\", branch: \"main\"|g" "$FORMULA_FILE"
rm "$FORMULA_FILE.tmp"
echo "Formula updated successfully!"
echo "Updated values:"
echo " - Homepage: $REPO_URL"
echo " - URL: $ARCHIVE_URL"
echo " - SHA256: $SHA256"
echo ""
echo "Formula is ready for release. Now:"
echo "1. Test the formula: brew install --build-from-source ./Formula/chatmock.rb"
echo "2. Commit and push the changes"
echo "3. Create the release/tag: git tag $TAG_VERSION && git push origin $TAG_VERSION"