From bd2f8876851c20f82507b65e49fb6f7cbfcde29f Mon Sep 17 00:00:00 2001 From: jimchamp <28732543+jimchamp@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:53:29 -0700 Subject: [PATCH] Add script for applying the `offline-mode` to the current branch (#9951) * Add script for applying the `offline-mode` branch to the current branch * Add `--reverse` flag --- scripts/apply_offline_mode.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 scripts/apply_offline_mode.sh diff --git a/scripts/apply_offline_mode.sh b/scripts/apply_offline_mode.sh new file mode 100755 index 00000000000..c13cfa785ca --- /dev/null +++ b/scripts/apply_offline_mode.sh @@ -0,0 +1,25 @@ +#!/bin/bash +##### +# This script applies the changes from the `offline-mode` branch in the `internetarchive/openlibrary` repo. +# These changes will mock or otherwise prevent API calls to Internet Archive, resulting in a better +# developer experience when IA is down. +##### + +reverse='' + +# Parse command-line arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --reverse) + reverse='--reverse' + shift + ;; + *) + # Handle other arguments or show usage + echo "Unknown option: $1" + exit 1 + ;; + esac +done + +curl "https://github.com/internetarchive/openlibrary/compare/master...offline-mode.patch" | git apply $reverse