From 64bfc10054ab8966603abbd9ac766053466baa4f Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Wed, 7 Sep 2022 22:18:04 -0500 Subject: [PATCH 01/33] Wrote some stuff I should've done a hot minute ago --- .github/workflows/reusable.yml | 7 ++++++- scripts/rename-gitinfo.py | 7 +++++++ scripts/run-gaxios-fancy.py | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 scripts/rename-gitinfo.py create mode 100644 scripts/run-gaxios-fancy.py diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index 254e7d8..fc65e8c 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -142,10 +142,15 @@ jobs: env: CONFIG_DATA: ${{ secrets.IN_CONFIG_DATA }} # 🐧 + + - name: rename git-info and give it an A + id: rename-git-info-in-python + run: /bin/python3 deploy-data/scripts/modify-git-info.py + - name: Push script to scripts.google.com id: clasp-push if: ${{ github.event_name != 'schedule' }} - run: clasp push -f + run: /bin/python3 deploy-data/scripts/run-gaxios-fancy.py - name: Deploy Script id: clasp-deploy diff --git a/scripts/rename-gitinfo.py b/scripts/rename-gitinfo.py new file mode 100644 index 0000000..2564467 --- /dev/null +++ b/scripts/rename-gitinfo.py @@ -0,0 +1,7 @@ +import os + +input_source = "git-info.js" + +output_dest = "aaa-git-info.js" + +os.rename(input_source,output_dest) diff --git a/scripts/run-gaxios-fancy.py b/scripts/run-gaxios-fancy.py new file mode 100644 index 0000000..ac337ba --- /dev/null +++ b/scripts/run-gaxios-fancy.py @@ -0,0 +1,34 @@ +import subprocess + +# custom exception type +class killAction(Exception): + pass + +# the thing that runs clasp pushing +result = subprocess.run(["clasp","push","-f"],stdout=subprocess.PIPE) + +# wrote this as a function so that I could write tests for it +def wasSuccessful(data): + + returnVal = True + + gaxios = "GaxiosError:" + pushFailure = "Push failed. Errors:" + + gaxiosFail = (gaxios in data) # true if GaxiosError: is in the log + pushFail = (pushFailure in data) # true if Push Failure is in the log + # print(gaxiosFail,pushFail) + if gaxiosFail or pushFail: + returnVal = False + return returnVal + + +claspRun = wasSuccessful(result.stdout) + +if claspRun == False: + print("throwing an error") + raise killAction("Clasp had an internal error!") + # and then throw an error. +else: + print(result.stdout) + print("Push succeeded.") From 63725e43913ec04247244dfb3169f41e0cf374d7 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Wed, 7 Sep 2022 22:24:57 -0500 Subject: [PATCH 02/33] trying to get out of relative path? --- scripts/rename-gitinfo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/rename-gitinfo.py b/scripts/rename-gitinfo.py index 2564467..bbf390d 100644 --- a/scripts/rename-gitinfo.py +++ b/scripts/rename-gitinfo.py @@ -1,7 +1,7 @@ import os -input_source = "git-info.js" +input_source = "/git-info.js" -output_dest = "aaa-git-info.js" +output_dest = "/aaa-git-info.js" os.rename(input_source,output_dest) From 0e0921ee5726a2bc7267b3c30b83512c50a76c73 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Wed, 7 Sep 2022 22:26:57 -0500 Subject: [PATCH 03/33] oops --- .github/workflows/reusable.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index fc65e8c..97f25d2 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -145,7 +145,7 @@ jobs: - name: rename git-info and give it an A id: rename-git-info-in-python - run: /bin/python3 deploy-data/scripts/modify-git-info.py + run: /bin/python3 deploy-data/scripts/rename-info.py - name: Push script to scripts.google.com id: clasp-push From d2e5b4c196ee9bc2dbf0f3ed50a2dc115369a234 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Wed, 7 Sep 2022 22:28:18 -0500 Subject: [PATCH 04/33] second time I've named it the wrong thing... --- .github/workflows/reusable.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index 97f25d2..5645caf 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -145,7 +145,7 @@ jobs: - name: rename git-info and give it an A id: rename-git-info-in-python - run: /bin/python3 deploy-data/scripts/rename-info.py + run: /bin/python3 deploy-data/scripts/rename-gitinfo.py - name: Push script to scripts.google.com id: clasp-push From ea85f3f7ce13864ccf5b64d8922dfb699e8eacc3 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Wed, 7 Sep 2022 23:55:20 -0500 Subject: [PATCH 05/33] Update reusable.yml --- .github/workflows/reusable.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index 5645caf..29e7211 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -145,7 +145,7 @@ jobs: - name: rename git-info and give it an A id: rename-git-info-in-python - run: /bin/python3 deploy-data/scripts/rename-gitinfo.py + run: /bin/python3 deploy-data/scripts/renamegitinfo.py - name: Push script to scripts.google.com id: clasp-push From 0d606096fc0d64d535d939505781fb7371fd4858 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Wed, 7 Sep 2022 23:56:16 -0500 Subject: [PATCH 06/33] Update and rename rename-gitinfo.py to renamegitinfo.py --- scripts/{rename-gitinfo.py => renamegitinfo.py} | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename scripts/{rename-gitinfo.py => renamegitinfo.py} (75%) diff --git a/scripts/rename-gitinfo.py b/scripts/renamegitinfo.py similarity index 75% rename from scripts/rename-gitinfo.py rename to scripts/renamegitinfo.py index bbf390d..f961e53 100644 --- a/scripts/rename-gitinfo.py +++ b/scripts/renamegitinfo.py @@ -3,5 +3,6 @@ input_source = "/git-info.js" output_dest = "/aaa-git-info.js" - +print("renaming") os.rename(input_source,output_dest) +print("finished") From 05ab4f1e0791343c09ed6fd184110bf60a9c01f6 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Thu, 8 Sep 2022 13:57:55 -0500 Subject: [PATCH 07/33] Update add-config.py Testing things... --- scripts/add-config.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/add-config.py b/scripts/add-config.py index a9ae8b1..88a3b6f 100644 --- a/scripts/add-config.py +++ b/scripts/add-config.py @@ -1,4 +1,5 @@ import sys +import os nameOfScript = sys.argv[0] commandLineArgs = sys.argv[1] @@ -21,4 +22,12 @@ line_out = line.replace('//PYTHON_STICKS_CONFIG_DATA_HERE', argumentString) file_out.write(line_out) -file_out.close() \ No newline at end of file +file_out.close() + + +input_source = "/git-info.js" + +output_dest = "/aaa-git-info.js" +print("renaming") +os.rename(input_source,output_dest) +print("finished") From fb2ccc51516fc5ce908e574d879afa0ebf5e0f52 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Thu, 8 Sep 2022 13:58:43 -0500 Subject: [PATCH 08/33] Update reusable.yml --- .github/workflows/reusable.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index 29e7211..a70623c 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -143,9 +143,9 @@ jobs: CONFIG_DATA: ${{ secrets.IN_CONFIG_DATA }} # 🐧 - - name: rename git-info and give it an A - id: rename-git-info-in-python - run: /bin/python3 deploy-data/scripts/renamegitinfo.py + # - name: rename git-info and give it an A + # id: rename-git-info-in-python + # run: /bin/python3 deploy-data/scripts/renamegitinfo.py - name: Push script to scripts.google.com id: clasp-push From 431e938a950c4660ccde30c6918e4f5d3a265a1b Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Thu, 8 Sep 2022 14:11:39 -0500 Subject: [PATCH 09/33] Update add-config.py --- scripts/add-config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/add-config.py b/scripts/add-config.py index 88a3b6f..87f5f23 100644 --- a/scripts/add-config.py +++ b/scripts/add-config.py @@ -31,3 +31,5 @@ print("renaming") os.rename(input_source,output_dest) print("finished") + +print("why is this not showing up?") From e38677c10ee15e2daba58576b77bd4917c222c57 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Thu, 8 Sep 2022 21:42:53 -0500 Subject: [PATCH 10/33] un-recommented thingies. --- .github/workflows/reusable-stubby.yml | 2 +- .github/workflows/reusable.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/reusable-stubby.yml b/.github/workflows/reusable-stubby.yml index 453e1a9..2cff980 100644 --- a/.github/workflows/reusable-stubby.yml +++ b/.github/workflows/reusable-stubby.yml @@ -12,7 +12,7 @@ on: jobs: call-workflow-passing-data: - uses: texas-mcallen-mission/deploy-google-app-script-action-typescript/.github/workflows/reusable.yml@main + uses: texas-mcallen-mission/deploy-google-app-script-action-typescript/.github/workflows/reusable.yml@fixes-and-updates with: # Github repository information sha: ${{ github.sha }} diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index a70623c..f313bc7 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -143,9 +143,9 @@ jobs: CONFIG_DATA: ${{ secrets.IN_CONFIG_DATA }} # 🐧 - # - name: rename git-info and give it an A - # id: rename-git-info-in-python - # run: /bin/python3 deploy-data/scripts/renamegitinfo.py + - name: rename git-info and give it an A + id: rename-git-info-in-python + run: /bin/python3 deploy-data/scripts/renamegitinfo.py "testArg" - name: Push script to scripts.google.com id: clasp-push From d7e9d9130c8fccd375febdb0f4f4f0d18d7f6c62 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Fri, 9 Sep 2022 13:05:13 -0500 Subject: [PATCH 11/33] re-added renamegitinfo --- scripts/add-config.py | 10 +++++----- scripts/renamegitinfo.py | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/add-config.py b/scripts/add-config.py index 87f5f23..f44de97 100644 --- a/scripts/add-config.py +++ b/scripts/add-config.py @@ -25,11 +25,11 @@ file_out.close() -input_source = "/git-info.js" +# input_source = "/git-info.js" -output_dest = "/aaa-git-info.js" -print("renaming") -os.rename(input_source,output_dest) -print("finished") +# output_dest = "/aaa-git-info.js" +# print("renaming") +# os.rename(input_source,output_dest) +# print("finished") print("why is this not showing up?") diff --git a/scripts/renamegitinfo.py b/scripts/renamegitinfo.py index f961e53..fa4df51 100644 --- a/scripts/renamegitinfo.py +++ b/scripts/renamegitinfo.py @@ -1,8 +1,8 @@ import os -input_source = "/git-info.js" - -output_dest = "/aaa-git-info.js" +input_source = "git-info.js" +print("current working directory:",os.getcwd()) +output_dest = "aaa-git-info.js" print("renaming") os.rename(input_source,output_dest) print("finished") From 49a253910f4427e220f9565b08cefcaed0b2e011 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Fri, 9 Sep 2022 22:13:25 -0500 Subject: [PATCH 12/33] added step, going to try this agaiiiin --- .github/workflows/reusable.yml | 7 +++++++ scripts/pleasework.py | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 scripts/pleasework.py diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index f313bc7..a6bc1f7 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -143,6 +143,13 @@ jobs: CONFIG_DATA: ${{ secrets.IN_CONFIG_DATA }} # 🐧 + - name: git-info try two + id: mod-git-info-3 + if: ${{ github.event_name != 'schedule' && env.CONFIG_DATA }} + run: /bin/python3 deploy-data/scripts/pleasework.py + + + - name: rename git-info and give it an A id: rename-git-info-in-python run: /bin/python3 deploy-data/scripts/renamegitinfo.py "testArg" diff --git a/scripts/pleasework.py b/scripts/pleasework.py new file mode 100644 index 0000000..fa4df51 --- /dev/null +++ b/scripts/pleasework.py @@ -0,0 +1,8 @@ +import os + +input_source = "git-info.js" +print("current working directory:",os.getcwd()) +output_dest = "aaa-git-info.js" +print("renaming") +os.rename(input_source,output_dest) +print("finished") From 44bcc4cdef7d5e02b7e87fa6e275708844d44ab2 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Fri, 9 Sep 2022 22:15:32 -0500 Subject: [PATCH 13/33] poosh --- .github/workflows/reusable.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index a6bc1f7..5f1c0f3 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -145,7 +145,7 @@ jobs: - name: git-info try two id: mod-git-info-3 - if: ${{ github.event_name != 'schedule' && env.CONFIG_DATA }} + if: ${{ github.event_name != 'schedule'}} run: /bin/python3 deploy-data/scripts/pleasework.py From 8ab425afed12a16e14f744b1180305750cdeecd0 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Fri, 9 Sep 2022 22:17:24 -0500 Subject: [PATCH 14/33] more problems? --- scripts/add-config.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/add-config.py b/scripts/add-config.py index f44de97..1f474d0 100644 --- a/scripts/add-config.py +++ b/scripts/add-config.py @@ -8,7 +8,7 @@ numArgs = len(sys.argv) -print(nameOfScript," arguments: ",numArgs) +print(nameOfScript," arguments: ",numArgs,"running with rename script internally.") file_in = open("git-info.js", "rt") @@ -25,11 +25,11 @@ file_out.close() -# input_source = "/git-info.js" +input_source = "/git-info.js" -# output_dest = "/aaa-git-info.js" -# print("renaming") -# os.rename(input_source,output_dest) -# print("finished") +output_dest = "/aaa-git-info.js" +print("renaming") +os.rename(input_source,output_dest) +print("finished") print("why is this not showing up?") From cc304acf0c69a7583b8578b1b30393d172fb9fe4 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Fri, 9 Sep 2022 22:42:10 -0500 Subject: [PATCH 15/33] Update reusable.yml --- .github/workflows/reusable.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index 5f1c0f3..3606733 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -99,6 +99,7 @@ jobs: with: repository: texas-mcallen-mission/deploy-google-app-script-action-typescript path: deploy-data + ref: 'fixes-and-updates' - name: Set scriptId in .clasp.json file id: set-script-id From c034090f84065726584b82f37e3d2458bd1eb76a Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Sat, 10 Sep 2022 21:14:16 -0500 Subject: [PATCH 16/33] trying things- added conditionals --- .github/workflows/reusable.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index 3606733..48d6dca 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -95,6 +95,7 @@ jobs: - name: Pull Script Tooling id: pull-python-script + if: ${{github.event_name != 'schedule' }} uses: actions/checkout@v3 with: repository: texas-mcallen-mission/deploy-google-app-script-action-typescript @@ -153,6 +154,7 @@ jobs: - name: rename git-info and give it an A id: rename-git-info-in-python + if: ${{github.event_name != 'schedule' }} run: /bin/python3 deploy-data/scripts/renamegitinfo.py "testArg" - name: Push script to scripts.google.com From 912636068bb081463c33a7a7ed327dde8f418c8d Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Sat, 10 Sep 2022 21:21:14 -0500 Subject: [PATCH 17/33] oopdate --- scripts/add-config.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/add-config.py b/scripts/add-config.py index 1f474d0..f5ecf57 100644 --- a/scripts/add-config.py +++ b/scripts/add-config.py @@ -25,11 +25,11 @@ file_out.close() -input_source = "/git-info.js" +# input_source = "/git-info.js" -output_dest = "/aaa-git-info.js" -print("renaming") -os.rename(input_source,output_dest) -print("finished") +# output_dest = "/aaa-git-info.js" +# print("renaming") +# os.rename(input_source,output_dest) +# print("finished") -print("why is this not showing up?") +# print("why is this not showing up?") From d0b86681479bdcf979db0ee1bfd761a39474b397 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Sat, 10 Sep 2022 21:25:32 -0500 Subject: [PATCH 18/33] y33t --- .github/workflows/reusable.yml | 2 +- scripts/{pleasework.py => rename-git-info.py} | 4 ++++ scripts/renamegitinfo.py | 8 -------- 3 files changed, 5 insertions(+), 9 deletions(-) rename scripts/{pleasework.py => rename-git-info.py} (63%) delete mode 100644 scripts/renamegitinfo.py diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index 48d6dca..17fb397 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -155,7 +155,7 @@ jobs: - name: rename git-info and give it an A id: rename-git-info-in-python if: ${{github.event_name != 'schedule' }} - run: /bin/python3 deploy-data/scripts/renamegitinfo.py "testArg" + run: /bin/python3 deploy-data/scripts/rename-git-info.py "testArg" - name: Push script to scripts.google.com id: clasp-push diff --git a/scripts/pleasework.py b/scripts/rename-git-info.py similarity index 63% rename from scripts/pleasework.py rename to scripts/rename-git-info.py index fa4df51..6fa83af 100644 --- a/scripts/pleasework.py +++ b/scripts/rename-git-info.py @@ -1,4 +1,8 @@ import os +import glob + +# trying to figure out what the right way to get to git-info.js is. +print(glob.glob(os.getcwd())) input_source = "git-info.js" print("current working directory:",os.getcwd()) diff --git a/scripts/renamegitinfo.py b/scripts/renamegitinfo.py deleted file mode 100644 index fa4df51..0000000 --- a/scripts/renamegitinfo.py +++ /dev/null @@ -1,8 +0,0 @@ -import os - -input_source = "git-info.js" -print("current working directory:",os.getcwd()) -output_dest = "aaa-git-info.js" -print("renaming") -os.rename(input_source,output_dest) -print("finished") From b68a815c843087948947870c30e5751066600cae Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Sat, 10 Sep 2022 21:28:34 -0500 Subject: [PATCH 19/33] I did the same thingy twice. Oops. --- .github/workflows/reusable.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index 17fb397..a5e2340 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -145,10 +145,10 @@ jobs: CONFIG_DATA: ${{ secrets.IN_CONFIG_DATA }} # 🐧 - - name: git-info try two - id: mod-git-info-3 - if: ${{ github.event_name != 'schedule'}} - run: /bin/python3 deploy-data/scripts/pleasework.py + # - name: git-info try two + # id: mod-git-info-3 + # if: ${{ github.event_name != 'schedule'}} # seems like a linter problem here hopefully lol + # run: /bin/python3 deploy-data/scripts/pleasework.py From 1cab77b123230c4fa808404d62a7c14fd0683106 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Sat, 10 Sep 2022 21:38:46 -0500 Subject: [PATCH 20/33] debugging the clasp-runner --- scripts/run-gaxios-fancy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/run-gaxios-fancy.py b/scripts/run-gaxios-fancy.py index ac337ba..2caa324 100644 --- a/scripts/run-gaxios-fancy.py +++ b/scripts/run-gaxios-fancy.py @@ -14,7 +14,7 @@ def wasSuccessful(data): gaxios = "GaxiosError:" pushFailure = "Push failed. Errors:" - + print("data type:",type(data),"gaxios",type(gaxios),"pushFailure",type(pushFailure)) gaxiosFail = (gaxios in data) # true if GaxiosError: is in the log pushFail = (pushFailure in data) # true if Push Failure is in the log # print(gaxiosFail,pushFail) @@ -22,7 +22,7 @@ def wasSuccessful(data): returnVal = False return returnVal - +print("result type",type(result)) claspRun = wasSuccessful(result.stdout) if claspRun == False: From ac2e97ce8421c34acd596f7d0d963480b6611c82 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Sat, 10 Sep 2022 21:39:16 -0500 Subject: [PATCH 21/33] renamed file --- .github/workflows/reusable.yml | 2 +- scripts/{run-gaxios-fancy.py => run-clasp-fancy.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename scripts/{run-gaxios-fancy.py => run-clasp-fancy.py} (100%) diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index a5e2340..a9ddd92 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -160,7 +160,7 @@ jobs: - name: Push script to scripts.google.com id: clasp-push if: ${{ github.event_name != 'schedule' }} - run: /bin/python3 deploy-data/scripts/run-gaxios-fancy.py + run: /bin/python3 deploy-data/scripts/run-clasp-fancy.py - name: Deploy Script id: clasp-deploy diff --git a/scripts/run-gaxios-fancy.py b/scripts/run-clasp-fancy.py similarity index 100% rename from scripts/run-gaxios-fancy.py rename to scripts/run-clasp-fancy.py From df41bac6a887b9b64915e7b131bc987b8e124ba6 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Sat, 10 Sep 2022 21:42:26 -0500 Subject: [PATCH 22/33] converted stdout from class Bytes to class String --- scripts/run-clasp-fancy.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/run-clasp-fancy.py b/scripts/run-clasp-fancy.py index 2caa324..48b9206 100644 --- a/scripts/run-clasp-fancy.py +++ b/scripts/run-clasp-fancy.py @@ -23,7 +23,9 @@ def wasSuccessful(data): return returnVal print("result type",type(result)) -claspRun = wasSuccessful(result.stdout) +encoding = 'utf-8' +parsedResult = str(result.stdout,encoding) +claspRun = wasSuccessful(parsedResult) if claspRun == False: print("throwing an error") From db1060016505033ef864a605832c7b24424e9e4c Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Sat, 10 Sep 2022 21:58:15 -0500 Subject: [PATCH 23/33] About to get even fancier. Switched to utf-16. --- .github/workflows/reusable.yml | 12 ++++-------- scripts/pre-setup.py | 11 +++++++++++ scripts/run-clasp-fancy.py | 13 ++++++++++--- 3 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 scripts/pre-setup.py diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index a9ddd92..f6a67a6 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -117,7 +117,10 @@ jobs: PARENT_ID: ${{ secrets.IN_PARENT_ID }} # Somewhere in here: push in github commit number and information to a stubby information js file - + - name: Set up things to make it easier to transition over. + id: repo-setup + if: ${{ github.event_name != 'schedule'}} + run: /bin/python3 deploy-data/scripts/pre-setup.py # read the guide at docs/ci-setup.md! - name: update git-info.js id: modify-git-info @@ -144,13 +147,6 @@ jobs: env: CONFIG_DATA: ${{ secrets.IN_CONFIG_DATA }} # 🐧 - - # - name: git-info try two - # id: mod-git-info-3 - # if: ${{ github.event_name != 'schedule'}} # seems like a linter problem here hopefully lol - # run: /bin/python3 deploy-data/scripts/pleasework.py - - - name: rename git-info and give it an A id: rename-git-info-in-python diff --git a/scripts/pre-setup.py b/scripts/pre-setup.py new file mode 100644 index 0000000..ef44e06 --- /dev/null +++ b/scripts/pre-setup.py @@ -0,0 +1,11 @@ +print("placeholder ATM") + +checklist = """ +Things to check for: +Does git-info.js (or TS?) exist yet? - if not, copy over local version + +Does .claspignore exist yet? - if not, create a file, and put /deploy-data in it + - also just pipe in deploy-data/ in there, it really doesn't matter if it's there twice + +Could also stick an empty .gs file in there as a watermark, lol? +""" \ No newline at end of file diff --git a/scripts/run-clasp-fancy.py b/scripts/run-clasp-fancy.py index 48b9206..5a35245 100644 --- a/scripts/run-clasp-fancy.py +++ b/scripts/run-clasp-fancy.py @@ -1,5 +1,11 @@ import subprocess +# The new-and-improved CLASP runner! +# This bad boi checks the output of CLASP and makes sure that it doesn't throw an error. +# Previously, if clasp didn't succeed, it'd just continue on without any indication of problems. +# Now, it'll throw an error and spit out the logs if it breaks. *WAY* better. :) +# + # custom exception type class killAction(Exception): pass @@ -14,7 +20,7 @@ def wasSuccessful(data): gaxios = "GaxiosError:" pushFailure = "Push failed. Errors:" - print("data type:",type(data),"gaxios",type(gaxios),"pushFailure",type(pushFailure)) + # print("data type:",type(data),"gaxios",type(gaxios),"pushFailure",type(pushFailure)) gaxiosFail = (gaxios in data) # true if GaxiosError: is in the log pushFail = (pushFailure in data) # true if Push Failure is in the log # print(gaxiosFail,pushFail) @@ -22,13 +28,14 @@ def wasSuccessful(data): returnVal = False return returnVal -print("result type",type(result)) -encoding = 'utf-8' +# print("result type",type(result)) +encoding = 'utf-16' parsedResult = str(result.stdout,encoding) claspRun = wasSuccessful(parsedResult) if claspRun == False: print("throwing an error") + print(parsedResult) raise killAction("Clasp had an internal error!") # and then throw an error. else: From 214f11935d2b26ff0a0be39b00c21ba51a3b67e1 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Sat, 10 Sep 2022 22:01:57 -0500 Subject: [PATCH 24/33] didn't like utf-16... --- scripts/run-clasp-fancy.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/run-clasp-fancy.py b/scripts/run-clasp-fancy.py index 5a35245..9c94c87 100644 --- a/scripts/run-clasp-fancy.py +++ b/scripts/run-clasp-fancy.py @@ -29,13 +29,15 @@ def wasSuccessful(data): return returnVal # print("result type",type(result)) -encoding = 'utf-16' +encoding = 'utf-8' parsedResult = str(result.stdout,encoding) claspRun = wasSuccessful(parsedResult) +# *might* add some extra parsing here to make the result easier to read? + +print(parsedResult) if claspRun == False: print("throwing an error") - print(parsedResult) raise killAction("Clasp had an internal error!") # and then throw an error. else: From 93ed49e762bd4fdc08dde34116cb100f76cb814c Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Sat, 10 Sep 2022 22:04:53 -0500 Subject: [PATCH 25/33] even cleaner. --- scripts/pre-setup.py | 2 ++ scripts/run-clasp-fancy.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/pre-setup.py b/scripts/pre-setup.py index ef44e06..b9e00e5 100644 --- a/scripts/pre-setup.py +++ b/scripts/pre-setup.py @@ -8,4 +8,6 @@ - also just pipe in deploy-data/ in there, it really doesn't matter if it's there twice Could also stick an empty .gs file in there as a watermark, lol? + +Basically I need to find *everything* necessary to make an empty repo and push it and make a local, basic copy. """ \ No newline at end of file diff --git a/scripts/run-clasp-fancy.py b/scripts/run-clasp-fancy.py index 9c94c87..727ea15 100644 --- a/scripts/run-clasp-fancy.py +++ b/scripts/run-clasp-fancy.py @@ -41,5 +41,5 @@ def wasSuccessful(data): raise killAction("Clasp had an internal error!") # and then throw an error. else: - print(result.stdout) - print("Push succeeded.") + print(""" + Push succeeded.""") From 9932fd7266759b0c0401227580109fc58f6f78d5 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Sat, 10 Sep 2022 22:45:09 -0500 Subject: [PATCH 26/33] Getting MVP demo setup. --- required-files/clasp.json | 7 +++++++ git-info.js => required-files/git-info.js | 0 scripts/pre-setup.py | 19 ++++++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 required-files/clasp.json rename git-info.js => required-files/git-info.js (100%) diff --git a/required-files/clasp.json b/required-files/clasp.json new file mode 100644 index 0000000..9246855 --- /dev/null +++ b/required-files/clasp.json @@ -0,0 +1,7 @@ +{ + "scriptId": "SCRIPT_ID", + "rootDir": "./", + "parentId": [ + "PARENT_ID" + ] +} \ No newline at end of file diff --git a/git-info.js b/required-files/git-info.js similarity index 100% rename from git-info.js rename to required-files/git-info.js diff --git a/scripts/pre-setup.py b/scripts/pre-setup.py index b9e00e5..c2b9c7b 100644 --- a/scripts/pre-setup.py +++ b/scripts/pre-setup.py @@ -1,7 +1,12 @@ +import os +import shutil print("placeholder ATM") checklist = """ Things to check for: + +Does clasp.json exist yet? + Does git-info.js (or TS?) exist yet? - if not, copy over local version Does .claspignore exist yet? - if not, create a file, and put /deploy-data in it @@ -10,4 +15,16 @@ Could also stick an empty .gs file in there as a watermark, lol? Basically I need to find *everything* necessary to make an empty repo and push it and make a local, basic copy. -""" \ No newline at end of file +""" + +claspJsonPath = "clasp.json" + +reqFileDir = "deploy-data/required-files/" + +if os.path.exists(claspJsonPath) == False: + shutil.copy2(claspJsonPath,reqFileDir+claspJsonPath) + +gitInfo_path = "git-info.js" +if os.path.exists(gitInfo_path) == False: + shutil.copy2(gitInfo_path,reqFileDir+gitInfo_path) + From 029df259e9e65c52ec58642ec78a5a5afcd2f3a2 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Sat, 10 Sep 2022 22:48:08 -0500 Subject: [PATCH 27/33] Fixed OOP --- .github/workflows/reusable.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index f6a67a6..db64399 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -102,6 +102,11 @@ jobs: path: deploy-data ref: 'fixes-and-updates' + - name: Set up things to make it easier to transition over. + id: repo-setup + if: ${{ github.event_name != 'schedule'}} + run: /bin/python3 deploy-data/scripts/pre-setup.py + - name: Set scriptId in .clasp.json file id: set-script-id if: ${{ github.event_name != 'schedule' && env.SCRIPT_ID }} @@ -117,10 +122,7 @@ jobs: PARENT_ID: ${{ secrets.IN_PARENT_ID }} # Somewhere in here: push in github commit number and information to a stubby information js file - - name: Set up things to make it easier to transition over. - id: repo-setup - if: ${{ github.event_name != 'schedule'}} - run: /bin/python3 deploy-data/scripts/pre-setup.py + # read the guide at docs/ci-setup.md! - name: update git-info.js id: modify-git-info From 952f2b71839e85efce872f00b3cc707a7c1efc3e Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Sat, 10 Sep 2022 22:51:20 -0500 Subject: [PATCH 28/33] O/I => I/O --- scripts/pre-setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pre-setup.py b/scripts/pre-setup.py index c2b9c7b..1f11bf6 100644 --- a/scripts/pre-setup.py +++ b/scripts/pre-setup.py @@ -22,9 +22,9 @@ reqFileDir = "deploy-data/required-files/" if os.path.exists(claspJsonPath) == False: - shutil.copy2(claspJsonPath,reqFileDir+claspJsonPath) + shutil.copy2(reqFileDir+claspJsonPath, claspJsonPath) gitInfo_path = "git-info.js" if os.path.exists(gitInfo_path) == False: - shutil.copy2(gitInfo_path,reqFileDir+gitInfo_path) + shutil.copy2(reqFileDir+gitInfo_path, gitInfo_path) From 6969480d5f31fb4d16fbd9a8eb867deb99c16e65 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Sat, 10 Sep 2022 22:54:00 -0500 Subject: [PATCH 29/33] added WYLO --- scripts/pre-setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/pre-setup.py b/scripts/pre-setup.py index 1f11bf6..7cf3e8e 100644 --- a/scripts/pre-setup.py +++ b/scripts/pre-setup.py @@ -28,3 +28,4 @@ if os.path.exists(gitInfo_path) == False: shutil.copy2(reqFileDir+gitInfo_path, gitInfo_path) +# WYLO: Figuring out why this isn't copying files over to where I want them to be??? \ No newline at end of file From eb35be2556ce195e4bfa448e4942758f2f4424e4 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Mon, 12 Sep 2022 16:43:01 -0500 Subject: [PATCH 30/33] added some stuff, everything should "just work" I think... --- required-files/.claspignore | 1 + required-files/appsscript.json | 7 +++++++ required-files/tsconfig.json | 14 +++++++++++++ scripts/pre-setup.py | 37 ++++++++++++++++++++++++++-------- 4 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 required-files/.claspignore create mode 100644 required-files/appsscript.json create mode 100644 required-files/tsconfig.json diff --git a/required-files/.claspignore b/required-files/.claspignore new file mode 100644 index 0000000..7153ed9 --- /dev/null +++ b/required-files/.claspignore @@ -0,0 +1 @@ +deploy-data/** diff --git a/required-files/appsscript.json b/required-files/appsscript.json new file mode 100644 index 0000000..3cf1d24 --- /dev/null +++ b/required-files/appsscript.json @@ -0,0 +1,7 @@ +{ + "timeZone": "America/New_York", + "dependencies": { + }, + "exceptionLogging": "STACKDRIVER", + "runtimeVersion": "V8" +} \ No newline at end of file diff --git a/required-files/tsconfig.json b/required-files/tsconfig.json new file mode 100644 index 0000000..5792bec --- /dev/null +++ b/required-files/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "lib": ["ESNext"], + "target": "ES6", + "types": [ + "google-apps-script" + ], + "outDir": "./ts", + "rootDir": "./" + + } +} \ No newline at end of file diff --git a/scripts/pre-setup.py b/scripts/pre-setup.py index 7cf3e8e..63234a9 100644 --- a/scripts/pre-setup.py +++ b/scripts/pre-setup.py @@ -1,6 +1,6 @@ import os import shutil -print("placeholder ATM") +print("setting things up.") checklist = """ Things to check for: @@ -17,15 +17,36 @@ Basically I need to find *everything* necessary to make an empty repo and push it and make a local, basic copy. """ -claspJsonPath = "clasp.json" +claspIg = ".claspignore" +deployDataLine = "deploy-data/**" + +files = ["clasp.json", "git-info.js", + "tsconfig.json", "appsscript.json", claspIg] + +addedFiles = [] + reqFileDir = "deploy-data/required-files/" -if os.path.exists(claspJsonPath) == False: - shutil.copy2(reqFileDir+claspJsonPath, claspJsonPath) +for entry in files: + if os.path.exists(entry) == False and os.path.exists(reqFileDir+entry) == True: + shutil.copy2(reqFileDir+entry, entry) + addedFiles.append(entry) + + +# then run code to modify claspignore? +if addedFiles.count(claspIg) == 0: # this is like array.includes, I guess? + # pipe thingies in + print("modifying"+claspIg) + claspIgnoreFile = open(claspIg, mode="r+") + print("pre-mod:", claspIgnoreFile.read()) + print(deployDataLine, file=claspIgnoreFile) # adds newline + claspIgnoreFile.close() + -gitInfo_path = "git-info.js" -if os.path.exists(gitInfo_path) == False: - shutil.copy2(reqFileDir+gitInfo_path, gitInfo_path) +if len(addedFiles) > 0: + # spread operator thingy to get rid of the brackets. Super neat! + print("Completed- added ", *addedFiles) +else: + print("Completeted, no new files added.") -# WYLO: Figuring out why this isn't copying files over to where I want them to be??? \ No newline at end of file From a681d5926422b0bb5c4c93cfd5317df01a425757 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Mon, 12 Sep 2022 16:45:28 -0500 Subject: [PATCH 31/33] added . --- required-files/{clasp.json => .clasp.json} | 0 scripts/pre-setup.py | 3 +-- 2 files changed, 1 insertion(+), 2 deletions(-) rename required-files/{clasp.json => .clasp.json} (100%) diff --git a/required-files/clasp.json b/required-files/.clasp.json similarity index 100% rename from required-files/clasp.json rename to required-files/.clasp.json diff --git a/scripts/pre-setup.py b/scripts/pre-setup.py index 63234a9..2a84985 100644 --- a/scripts/pre-setup.py +++ b/scripts/pre-setup.py @@ -20,8 +20,7 @@ claspIg = ".claspignore" deployDataLine = "deploy-data/**" -files = ["clasp.json", "git-info.js", - "tsconfig.json", "appsscript.json", claspIg] +files = [".clasp.json", "git-info.js", "tsconfig.json", "appsscript.json", claspIg] addedFiles = [] From d09dc5c7f48c23e9470e746571c073f489a3ac73 Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Tue, 13 Sep 2022 21:26:00 -0500 Subject: [PATCH 32/33] Prep for push to main --- .github/workflows/reusable.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index db64399..b101439 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -100,7 +100,7 @@ jobs: with: repository: texas-mcallen-mission/deploy-google-app-script-action-typescript path: deploy-data - ref: 'fixes-and-updates' + ref: 'main' - name: Set up things to make it easier to transition over. id: repo-setup From 1b0494698453b44ce79843a38cfb5674d7bf6a1c Mon Sep 17 00:00:00 2001 From: HarrierPigeon <32232925+HarrierPigeon@users.noreply.github.com> Date: Tue, 13 Sep 2022 21:30:32 -0500 Subject: [PATCH 33/33] Final prep for main release --- .github/workflows/reusable-stubby.yml | 2 +- .github/workflows/reusable.yml | 1 + required-files/git-info.js | 2 ++ scripts/add-config.py | 12 +----------- scripts/pre-setup.py | 21 +++++++-------------- scripts/rename-git-info.py | 1 - scripts/run-clasp-fancy.py | 11 +++++------ 7 files changed, 17 insertions(+), 33 deletions(-) diff --git a/.github/workflows/reusable-stubby.yml b/.github/workflows/reusable-stubby.yml index 2cff980..453e1a9 100644 --- a/.github/workflows/reusable-stubby.yml +++ b/.github/workflows/reusable-stubby.yml @@ -12,7 +12,7 @@ on: jobs: call-workflow-passing-data: - uses: texas-mcallen-mission/deploy-google-app-script-action-typescript/.github/workflows/reusable.yml@fixes-and-updates + uses: texas-mcallen-mission/deploy-google-app-script-action-typescript/.github/workflows/reusable.yml@main with: # Github repository information sha: ${{ github.sha }} diff --git a/.github/workflows/reusable.yml b/.github/workflows/reusable.yml index b101439..3bb0a9e 100644 --- a/.github/workflows/reusable.yml +++ b/.github/workflows/reusable.yml @@ -155,6 +155,7 @@ jobs: if: ${{github.event_name != 'schedule' }} run: /bin/python3 deploy-data/scripts/rename-git-info.py "testArg" +# updated in fixes-and-updates branch to catch errors. - name: Push script to scripts.google.com id: clasp-push if: ${{ github.event_name != 'schedule' }} diff --git a/required-files/git-info.js b/required-files/git-info.js index 6fc2d26..0ca5136 100644 --- a/required-files/git-info.js +++ b/required-files/git-info.js @@ -1,4 +1,6 @@ // the contents of this file get find-replaced using sed at action runtime- please be careful in here! +// Hey, you should consider making a permanent copy of this and deleting this line! + const GITHUB_DATA = { commit_sha:"COMMITSHA", // done action_event_name: "EVENTNAME", // done diff --git a/scripts/add-config.py b/scripts/add-config.py index f5ecf57..2adf8f6 100644 --- a/scripts/add-config.py +++ b/scripts/add-config.py @@ -22,14 +22,4 @@ line_out = line.replace('//PYTHON_STICKS_CONFIG_DATA_HERE', argumentString) file_out.write(line_out) -file_out.close() - - -# input_source = "/git-info.js" - -# output_dest = "/aaa-git-info.js" -# print("renaming") -# os.rename(input_source,output_dest) -# print("finished") - -# print("why is this not showing up?") +file_out.close() \ No newline at end of file diff --git a/scripts/pre-setup.py b/scripts/pre-setup.py index 2a84985..57e97ff 100644 --- a/scripts/pre-setup.py +++ b/scripts/pre-setup.py @@ -2,20 +2,13 @@ import shutil print("setting things up.") -checklist = """ -Things to check for: - -Does clasp.json exist yet? - -Does git-info.js (or TS?) exist yet? - if not, copy over local version - -Does .claspignore exist yet? - if not, create a file, and put /deploy-data in it - - also just pipe in deploy-data/ in there, it really doesn't matter if it's there twice - -Could also stick an empty .gs file in there as a watermark, lol? - -Basically I need to find *everything* necessary to make an empty repo and push it and make a local, basic copy. -""" +# Things to check for: +# Does clasp.json exist yet? +# Does git-info.js (or TS?) exist yet? - if not, copy over local version +# Does .claspignore exist yet? - if not, create a file, and put /deploy-data in it +# - also just pipe in deploy-data/ in there, it really doesn't matter if it's there twice +# Could also stick an empty .gs file in there as a watermark, lol? +# Basically I need to find *everything* necessary to make an empty repo and push it and make a local, basic copy. claspIg = ".claspignore" deployDataLine = "deploy-data/**" diff --git a/scripts/rename-git-info.py b/scripts/rename-git-info.py index 6fa83af..4939a14 100644 --- a/scripts/rename-git-info.py +++ b/scripts/rename-git-info.py @@ -1,7 +1,6 @@ import os import glob -# trying to figure out what the right way to get to git-info.js is. print(glob.glob(os.getcwd())) input_source = "git-info.js" diff --git a/scripts/run-clasp-fancy.py b/scripts/run-clasp-fancy.py index 727ea15..5cf1d69 100644 --- a/scripts/run-clasp-fancy.py +++ b/scripts/run-clasp-fancy.py @@ -10,9 +10,11 @@ class killAction(Exception): pass -# the thing that runs clasp pushing +# the thing that runs clasp pushing itself result = subprocess.run(["clasp","push","-f"],stdout=subprocess.PIPE) +# the rest of this parses the output from CLASP. + # wrote this as a function so that I could write tests for it def wasSuccessful(data): @@ -20,15 +22,12 @@ def wasSuccessful(data): gaxios = "GaxiosError:" pushFailure = "Push failed. Errors:" - # print("data type:",type(data),"gaxios",type(gaxios),"pushFailure",type(pushFailure)) gaxiosFail = (gaxios in data) # true if GaxiosError: is in the log pushFail = (pushFailure in data) # true if Push Failure is in the log - # print(gaxiosFail,pushFail) if gaxiosFail or pushFail: returnVal = False return returnVal -# print("result type",type(result)) encoding = 'utf-8' parsedResult = str(result.stdout,encoding) claspRun = wasSuccessful(parsedResult) @@ -37,9 +36,9 @@ def wasSuccessful(data): print(parsedResult) if claspRun == False: - print("throwing an error") - raise killAction("Clasp had an internal error!") # and then throw an error. + raise killAction(""" + Clasp had an internal error!""") else: print(""" Push succeeded.""")