From f70b1c735c2e12ad0ce390d00f76872c0a4c4e38 Mon Sep 17 00:00:00 2001 From: Max Cai Date: Sat, 4 Nov 2023 19:23:36 -0700 Subject: [PATCH] rebuild --- Formula/cowponder.rb | 2 +- resources/contents/cowponder | 23 +++++++++++++--- resources/contents/ponder | 29 +++++++++++++-------- resources/cowponder-homebrew-v0.0.2.tar.gz | Bin 3784 -> 3882 bytes 4 files changed, 38 insertions(+), 16 deletions(-) diff --git a/Formula/cowponder.rb b/Formula/cowponder.rb index ac7eb3e..e353f0c 100644 --- a/Formula/cowponder.rb +++ b/Formula/cowponder.rb @@ -2,7 +2,7 @@ class Cowponder < Formula desc "Simple terminal command to display random philosophical thoughts from a cow" homepage "https://github.com/maxcai314/homebrew-cowponder" url "https://max.xz.ax/cowponder/cowponder-homebrew-v0.0.2.tar.gz" - sha256 "4ddfbae2d0bfd305753304f1a7e834e84e5d8f7b2a461cba9f216969dcf83810" + sha256 "9c0fdb7a962c858e69c3d10a6583da79217e13e6dc95fa7418e9e1e7830a0d44" depends_on "cowsay" depends_on "python@3" diff --git a/resources/contents/cowponder b/resources/contents/cowponder index 6371203..2d97f62 100755 --- a/resources/contents/cowponder +++ b/resources/contents/cowponder @@ -1,6 +1,7 @@ #!/usr/bin/python3 import argparse +import requests import subprocess from random import SystemRandom from os import path, popen @@ -53,14 +54,28 @@ args = vars(ap.parse_args()) if args["help"]: print(ap.description) exit() + if args['version']: - subprocess.run(["cowthink", "cowponder version 0.0.1"]) + subprocess.run(["brew", "info", "cowponder"]) # print("cowponder version 0.0.1") exit() + if args['update']: - subprocess.run(["wget", "-q", "-O", cowthoughts_path, "https://raw.githubusercontent.com/maxcai314/cowponder/master/cowponder_0.0.1-1_all/etc/cowthoughts.txt"]) - subprocess.run(["cowthink", "updated thoughtbook"]) - exit() + try: + response = requests.get('https://max.xz.ax/cowponder/cowthoughts.txt') + if response.status_code == 200: + with open(cowthoughts_path, 'w') as f: + f.write(response.text) + print("updated thoughtbook (moo)") + exit() + else: + print("failed to download cowthoughts.txt") + print("no changes written to local cowthoughts file") + exit() + except Exception as e: + print(f"Error while downloading cowthoughts.txt: {e}") + exit() + if thought := args['add']: with open(cowthoughts_path, "a") as f: print(thought, file=f) diff --git a/resources/contents/ponder b/resources/contents/ponder index c190993..3c98114 100755 --- a/resources/contents/ponder +++ b/resources/contents/ponder @@ -1,6 +1,7 @@ #!/usr/bin/python3 import argparse +import requests import subprocess import os from random import SystemRandom @@ -18,18 +19,24 @@ ap.add_argument("-a", "--add", help="Add custom thought to thoughtbook.") args = vars(ap.parse_args()) if args['version']: - print("cowponder version 0.0.1") - exit() -if args['update']: - subprocess.run(["wget", "-q", "-O", cowthoughts_path, "https://max.xz.ax/cowponder/cowthoughts.txt"]) - print("updated thoughtbook (moo)") - exit() -if thought := args['add']: - with open(cowthoughts_path, "a") as f: - print(thought, file=f) - print('"', thought, '" added to thoughtbook (moo)', sep='') - exit() + subprocess.run(["brew", "info", "cowponder"]) + exit() +if args['update']: + try: + response = requests.get('https://max.xz.ax/cowponder/cowthoughts.txt') + if response.status_code == 200: + with open(cowthoughts_path, 'w') as f: + f.write(response.text) + print("updated thoughtbook (moo)") + exit() + else: + print("failed to download cowthoughts.txt") + print("no changes written to local cowthoughts file") + exit() + except Exception as e: + print(f"Error while downloading cowthoughts.txt: {e}") + exit() with open(cowthoughts_path) as thinkbook: thoughts = [thought for thought in thinkbook.read().split("\n") if thought] diff --git a/resources/cowponder-homebrew-v0.0.2.tar.gz b/resources/cowponder-homebrew-v0.0.2.tar.gz index 0a124f1444409a253dc556e0ed709b604af4c3bf..115b3c2b455bef7a63804acbf985c8c946a02423 100644 GIT binary patch literal 3882 zcmV+_57qD=iwFP!000001MOPNa@@uh<<|I$_INQvYdGYP5*f=Gr|ihKw24&~wMZ$9 z+ygX#76CNe-QaMP%J-zQ%RhLRugbZ%0nG3vTd`$F6?8cw0rcZO&po%9+5XNu9|ssG zClBc7{N%xvpWWD*-+yp8e{gaAbRc&ik?N z@9CKB$7bb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