Skip to content

Commit 75bb1ea

Browse files
author
Test User
committed
homebrew tap
1 parent ffcb12e commit 75bb1ea

File tree

3 files changed

+124
-5
lines changed

3 files changed

+124
-5
lines changed

Formula/chatmock.rb

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
class Chatmock < Formula
2+
include Language::Python::Virtualenv
3+
4+
desc "OpenAI & Ollama compatible API powered by your ChatGPT plan"
5+
homepage "https://github.com/RayBytes/ChatMock"
6+
url "https://github.com/RayBytes/ChatMock/archive/refs/tags/v1.0.0.tar.gz"
7+
sha256 "0000000000000000000000000000000000000000000000000000000000000000"
8+
license "MIT"
9+
head "https://github.com/RayBytes/ChatMock.git", branch: "main"
10+
11+
depends_on "[email protected]"
12+
13+
def install
14+
virtualenv_create(libexec, "python3.11")
15+
16+
system libexec/"bin/pip", "install", "-r", "requirements.txt"
17+
18+
libexec.install "chatmock/"
19+
libexec.install "chatmock.py"
20+
libexec.install "prompt.md"
21+
22+
(bin/"chatmock").write <<~EOS
23+
#!/bin/bash
24+
set -e
25+
CHATMOCK_HOME="#{libexec}"
26+
export PYTHONPATH="#{libexec}:$PYTHONPATH"
27+
exec "#{libexec}/bin/python" "#{libexec}/chatmock.py" "$@"
28+
EOS
29+
30+
chmod 0755, bin/"chatmock"
31+
end
32+
33+
def caveats
34+
<<~EOS
35+
To get started with ChatMock:
36+
1. First, authenticate with your ChatGPT account:
37+
chatmock login
38+
39+
2. Start the local API server:
40+
chatmock serve
41+
42+
3. Use the API at http://127.0.0.1:8000/v1
43+
44+
Note: ChatMock requires a paid ChatGPT Plus or Pro account to function.
45+
46+
For more options and configuration:
47+
chatmock serve --help
48+
EOS
49+
end
50+
51+
test do
52+
output = shell_output("#{bin}/chatmock --help 2>&1", 2)
53+
assert_match "ChatGPT Local", output
54+
end
55+
end

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,25 @@ This does require a paid ChatGPT account.
1313
## Quickstart
1414

1515
### Mac Users
16-
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>
17-
`xattr -dr com.apple.quarantine /Applications/ChatMock.app`<br>
18-
*See more info [here](https://github.com/deskflow/deskflow/wiki/Running-on-macOS)*
1916

20-
### Windows Users
21-
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.
17+
#### GUI Application
18+
19+
If you're on **macOS**, you can download the GUI app from the [GitHub releases](https://github.com/RayBytes/ChatMock/releases).
20+
> **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:
21+
>
22+
> ```bash
23+
> xattr -dr com.apple.quarantine /Applications/ChatMock.app
24+
> ```
25+
>
26+
> *[More info here.](https://github.com/deskflow/deskflow/wiki/Running-on-macOS)*
27+
28+
#### Command Line (Homebrew)
29+
30+
You can also install ChatMock as a command-line tool using [Homebrew](https://brew.sh/):
31+
```
32+
brew tap RayBytes/ChatMock
33+
brew install chatmock
34+
```
2235
2336
### Python
2437
If you wish to just simply run this as a python flask server, you are also freely welcome too.

scripts/update-formula-sha.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ $# -ne 2 ]; then
5+
echo "Usage: $0 <github-username> <tag-version>"
6+
echo "Example: $0 RayBytes v1.0.0"
7+
exit 1
8+
fi
9+
10+
GITHUB_USER="$1"
11+
TAG_VERSION="$2"
12+
FORMULA_FILE="Formula/chatmock.rb"
13+
14+
VERSION="${TAG_VERSION#v}"
15+
16+
ARCHIVE_URL="https://github.com/${GITHUB_USER}/ChatMock/archive/refs/tags/${TAG_VERSION}.tar.gz"
17+
REPO_URL="https://github.com/${GITHUB_USER}/ChatMock"
18+
19+
echo "Downloading archive to calculate SHA256..."
20+
echo "URL: $ARCHIVE_URL"
21+
22+
SHA256=$(curl -sL "$ARCHIVE_URL" | shasum -a 256 | cut -d' ' -f1)
23+
24+
if [ -z "$SHA256" ]; then
25+
echo "Error: Could not calculate SHA256. Make sure the tag exists and is accessible."
26+
exit 1
27+
fi
28+
29+
echo "Calculated SHA256: $SHA256"
30+
31+
echo "Updating $FORMULA_FILE..."
32+
33+
cp "$FORMULA_FILE" "$FORMULA_FILE.backup"
34+
35+
sed -i.tmp "s|homepage \".*\"|homepage \"$REPO_URL\"|g" "$FORMULA_FILE"
36+
sed -i.tmp "s|url \".*\"|url \"$ARCHIVE_URL\"|g" "$FORMULA_FILE"
37+
sed -i.tmp "s|sha256 \".*\"|sha256 \"$SHA256\"|g" "$FORMULA_FILE"
38+
sed -i.tmp "s|head \".*\"|head \"$REPO_URL.git\", branch: \"main\"|g" "$FORMULA_FILE"
39+
40+
rm "$FORMULA_FILE.tmp"
41+
42+
echo "Formula updated successfully!"
43+
echo "Updated values:"
44+
echo " - Homepage: $REPO_URL"
45+
echo " - URL: $ARCHIVE_URL"
46+
echo " - SHA256: $SHA256"
47+
echo ""
48+
echo "Formula is ready for release. Now:"
49+
echo "1. Test the formula: brew install --build-from-source ./Formula/chatmock.rb"
50+
echo "2. Commit and push the changes"
51+
echo "3. Create the release/tag: git tag $TAG_VERSION && git push origin $TAG_VERSION"

0 commit comments

Comments
 (0)