Skip to content

Instantly share code, notes, and snippets.

@stanographer
Last active January 28, 2021 18:36
Show Gist options
  • Save stanographer/83d3decd95f25754c73df11be6fbe5ee to your computer and use it in GitHub Desktop.
Save stanographer/83d3decd95f25754c73df11be6fbe5ee to your computer and use it in GitHub Desktop.
#!/bin/bash
## **run `chmod +x ~/myFolder/clay_import_site.bash`.**
## grab uris.
printf "\n"
echo " Enter article URI including www."
printf "\n"
read uri
printf "\n"
## check that URI contains www.
if [[ "$uri" == *"www"* ]]; then
echo " URI valid."
printf "\n"
else
echo " Article URI invalid. Please retry."
exit
fi
echo " Enter NYMag site (nymag, vulture, etc.)"
printf "\n"
read site
printf "\n"
## remove everything after @ if applicable.
clean=${uri%@*}
echo $clean
import_command() {
printf "\n"
clay export $clean --layout | clay import --key $1 https://localhost.$site.com/
}
echo " Select a key: [l=local, q=qa, p=prod]."
printf "\n"
select lqp in "local" "qa" "prod"; do
case $lqp in
local ) import_command "LOCAL KEY"; break;;
qa ) import_command "QA KEY"; break;;
prod ) import_command "PROD KEY"; break;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment