Commit 2c533939 authored by Aral Balkan's avatar Aral Balkan

Updated commands to use the latest terminology (spotlight, clouds).

parent 382e7e6f
Pipeline #597 skipped
......@@ -4,10 +4,10 @@
#
# Better command: save
#
# Usage: better/save <trackers/sites/whitelist>/<domain> <message>
# Usage: better/save <trackers/spotlight/clouds>/<domain> <message>
#
# e.g., better/save trackers/google.com "Added a block rule."
# better/save sites/newdoma.in "Fixed a typo"
# better/save spotlight/somedoma.in "Fixed a typo"
# etc.
#
# Saves the your latest changes to the remote Git repository.
......@@ -38,7 +38,7 @@
showUsage(){
echo "\nUsage:\n"
echo " better/save <trackers/sites/whitelist>/<domain> <message>\n"
echo " better/save <trackers/spotlight/clouds>/<domain> <message>\n"
echo "The save command commits your latest changes using the passed message"
echo "and pushes them to the remote branch.\n"
exit 0
......@@ -245,7 +245,7 @@ processOtherArgumentsHook(){
#
processGenericHook(){ tooFewArgumentsError "domain and commit message are missing"; }
processCategoryHook(){
echo "\nError: Please specify a domain in the form: trackers/<domain> or sites/<domain> or whitelist/<domain>."
echo "\nError: Please specify a domain in the form: trackers/<domain> or spotlight/<domain> or clouds/<domain>."
showUsage
}
......
......@@ -57,7 +57,7 @@ jsonProperty(){
showUsage(){
echo "\nUsage:\n"
echo " better/status [<trackers/sites/whitelist>/<domain>]\n"
echo " better/stat [<trackers/spotlight|sites/clouds>/<domain>]\n"
echo "Provides you with general project status or specific status on domain, if specified.\n"
exit 0
}
......@@ -67,8 +67,15 @@ createGlobals(){
contentDirectory=~/better.fyi/content
draftsDirectory=~/better.fyi/drafts
contentRepositoryID=106
categoryCapitalised="$(tr '[:lower:]' '[:upper:]' <<< ${category:0:1})${category:1}"
issueTitle="${categoryCapitalised}: ${domain}"
# Special case: spotlight category is populated from domains in drafts/sites; handle the mapping.
targetCategory=$category
if [ targetCategory = 'sites' ]; then
targetCategory='spotlight'
fi
targetCategoryCapitalised="$(tr '[:lower:]' '[:upper:]' <<< ${targetCategory:0:1})${targetCategory:1}"
issueTitle="${targetCategoryCapitalised}: ${domain}"
}
......@@ -163,9 +170,21 @@ loginStatus(){
checkLocalExistence(){
local domainWithCategory="${category}/${domain}"
local domainInContent="${contentDirectory}/${domainWithCategory}"
# Special case: spotlight category is populated from domains in drafts/sites; handle the mapping.
if [ $category = 'sites' ]; then
domainInContent="${contentDirectory}/spotlight/${domain}"
fi
local domainInDrafts="${draftsDirectory}/${domainWithCategory}"
# Special case: spotlight category is populated from domains in drafts/sites; handle the mapping.
if [ $category = 'spotlight' ]; then
domainInDrafts="${contentDirectory}/sites/${domain}"
fi
if [ -d "${domainInContent}" ]; then
echo " ✓ Found in content: ${domainInContent}"
else
......@@ -203,7 +222,10 @@ ensurePersonIsLoggedIn(){
checkIfIssueExists(){
#
# Get all open issues in the content repository, filter by title, and search for our title.
#
issue=$(curl --silent -H "PRIVATE-TOKEN: ${privateToken}" https://source.ind.ie/api/v3/projects/$contentRepositoryID/issues\?state\=opened\&labels\=$category | $private/lib/jq --arg title "$issueTitle" --raw-output '.[] | select(.title == $title)')
if [ -n "$issue" ]; then
......
......@@ -7,7 +7,7 @@
# Usage: better/submit <trackers/sites/whitelist>/<domain>
#
# e.g., better/submit trackers/google.com
# better/submit sites/newdoma.in
# better/submit clouds/newdoma.in
# etc.
#
# Submits your latest saved changes to the remote Git repository for a
......@@ -36,7 +36,7 @@
showUsage(){
echo "\nUsage:\n"
echo " better/submit <trackers/sites/whitelist>/<domain> [\"merge message\"] : submit domain for merging\n"
echo " better/submit <trackers/spotlight/clouds>/<domain> [\"merge message\"] : submit domain for merging\n"
echo "Submits your latest saved changes to the remote Git repository and opens a merge request, optionally using the passed merge message.\n"
exit 0
}
......
......@@ -25,4 +25,4 @@ test(){
if [ "$#" -eq 1 ] && [ "$1" == "--help" ]; then
showUsageInstructionsHook
exit 0
fi
fi
......@@ -31,7 +31,7 @@
showUsage(){
echo "\nUsage:\n"
echo " better/update <trackers/sites/whitelist>/<domain> : update domain\n"
echo " better/update <trackers/spotlight/clouds>/<domain> : update domain\n"
echo "Updates your local copy of <domain> with the latest changes of others (if any) from the remote repository.\n"
exit 0
}
......@@ -236,7 +236,7 @@ processGenericHook(){
}
processCategoryHook(){
echo "\nError: Please specify a domain in the form: trackers/<domain> or sites/<domain> or whitelist/<domain>."
echo "\nError: Please specify a domain in the form: trackers/<domain> or spotlight/<domain> or clouds/<domain>."
showUsage
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment