Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Better
Better
Commits
e07d9b06
Commit
e07d9b06
authored
Jul 05, 2016
by
Aral Balkan
Browse files
Remove spotlight section from commands
Progress towards
#46
parent
be43f73d
Changes
7
Hide whitespace changes
Inline
Side-by-side
better/edit
View file @
e07d9b06
...
...
@@ -7,7 +7,6 @@
# Usage: better/edit [drafts/]<trackers/sites>/<domain>
#
# e.g., better/edit trackers/google.com
# better/edit spotlight/newdoma.in
# better/edit drafts/sites/newdoma.in
# etc.
#
...
...
@@ -75,7 +74,7 @@ jsonProperty(){
showUsage
(){
echo
"
\n
Usage:
\n
"
echo
" better/edit (<trackers/s
potlight
>|<drafts/sites>|<drafts/trackers>)/<domain> : edit domain
\n
"
echo
" better/edit (<trackers/s
ites
>|<drafts/sites>|<drafts/trackers>)/<domain> : edit domain
\n
"
echo
"The edit command handles necessary copying from drafts, repository actions,"
echo
"and issue tracking prerequisites before opening the requested domain’s entry in your editor.
\n
"
exit
0
...
...
@@ -130,7 +129,7 @@ ensureIssueExists(){
echo
" · Ensuring an issue exists for:
${
issueTitle
}
"
# 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
\=
$
targetC
ategory
|
$private
/lib/jq
--arg
title
"
$issueTitle
"
--raw-output
'.[] | select(.title == $title)'
)
issue
=
$(
curl
--silent
-H
"PRIVATE-TOKEN:
${
privateToken
}
"
https://source.ind.ie/api/v3/projects/
$contentRepositoryID
/issues
\?
state
\=
opened
\&
labels
\=
$
c
ategory
|
$private
/lib/jq
--arg
title
"
$issueTitle
"
--raw-output
'.[] | select(.title == $title)'
)
if
[
-z
"
$issue
"
]
;
then
# Issue does not exist.
...
...
@@ -147,7 +146,7 @@ ensureIssueExists(){
#
createIssue
(){
echo
" · Issue does not exist. Creating issue: ‘
${
issueTitle
}
’"
issue
=
$(
curl
--silent
-X
POST
--header
"PRIVATE-TOKEN:
${
privateToken
}
"
https://source.ind.ie/api/v3/projects/
$contentRepositoryID
/issues
--data-urlencode
"title=
${
issueTitle
}
"
--data-urlencode
"labels=
$
targetC
ategory
"
)
issue
=
$(
curl
--silent
-X
POST
--header
"PRIVATE-TOKEN:
${
privateToken
}
"
https://source.ind.ie/api/v3/projects/
$contentRepositoryID
/issues
--data-urlencode
"title=
${
issueTitle
}
"
--data-urlencode
"labels=
$
c
ategory
"
)
saveIssueIDs
}
...
...
@@ -271,21 +270,21 @@ createBranch(){
#
# Check if the directory already exists in content and, if it doesn’t, copy the draft.
#
local
targetFile
=
~/better.fyi/content/
$
targetC
ategory
/
$domain
local
targetFile
=
~/better.fyi/content/
$
c
ategory
/
$domain
if
[
-d
$targetFile
]
;
then
echo
" · Content already exists at
${
targetFile
}
, not copying."
else
#
# Copy, add, commit, and push the newly-added draft and the branch itself to the live repository.
#
echo
" · Copying
${
domain
}
from drafts/
${
category
}
to content/
${
targetC
ategory
}
in
${
branchName
}
."
cp
-R
~/better.fyi/drafts/
$category
/
$domain
~/better.fyi/content/
$
targetC
ategory
/
echo
" · Copying
${
domain
}
from drafts/
${
category
}
to content/
${
c
ategory
}
in
${
branchName
}
."
cp
-R
~/better.fyi/drafts/
$category
/
$domain
~/better.fyi/content/
$
c
ategory
/
echo
" · Adding changes to git."
runIn
$contentDirectory
"git add --all"
echo
" · Committing changes to git."
runIn
$contentDirectory
"git commit -am
\"
Added
${
domain
}
draft to
${
targetC
ategory
}
. Progress towards #
${
issueIID
}
.
\"
"
runIn
$contentDirectory
"git commit -am
\"
Added
${
domain
}
draft to
${
c
ategory
}
. Progress towards #
${
issueIID
}
.
\"
"
fi
echo
" · Pushing the newly-created branch to the repository at https://source.ind.ie/better/content"
...
...
@@ -299,7 +298,7 @@ openInSystemBrowser(){
#
# TODO: May require a delay for the rebuild to complete.
echo
" · Opening the page preview in the system default browser."
open
"http://localhost:3000/
${
targetC
ategory
}
/
${
domain
}
"
open
"http://localhost:3000/
${
c
ategory
}
/
${
domain
}
"
}
...
...
@@ -308,15 +307,15 @@ openInEditor(){
# Open the new draft in an editor if possible.
#
pathToDomainMarkdownFile
=
"~/better.fyi/content/
${
targetC
ategory
}
/
${
domain
}
/index.md"
pathToDomainMarkdownFile
=
"~/better.fyi/content/
${
c
ategory
}
/
${
domain
}
/index.md"
if
!
[
-z
$EDITOR
]
;
then
# Open in the system default editor.
echo
" · Opening the entry for
${
domain
}
(
${
targetC
ategory
}
) in your default editor."
echo
" · Opening the entry for
${
domain
}
(
${
c
ategory
}
) in your default editor."
eval
$EDITOR
$pathToDomainMarkdownFile
elif
hash
node 2>/dev/null
;
then
# Open in sublime text.
echo
" · Opening the entry for
${
domain
}
(
${
targetC
ategory
}
) in Sublime Text."
echo
" · Opening the entry for
${
domain
}
(
${
c
ategory
}
) in Sublime Text."
subl
$pathToDomainMarkdownFile
else
# Could not open an editor. Tell the person where they can find the new draft.
...
...
@@ -329,14 +328,8 @@ createGlobals(){
contentDirectory
=
~/better.fyi/content
contentRepositoryID
=
106
# Draft sites are copied into the spotlight category in content.
targetCategory
=
$category
if
[
$category
=
'sites'
]
;
then
targetCategory
=
'spotlight'
fi
targetCategoryCapitalised
=
"
$(
tr
'[:lower:]'
'[:upper:]'
<<<
${
targetCategory
:0:1
}
)
${
targetCategory
:1
}
"
issueTitle
=
"
${
targetCategoryCapitalised
}
:
${
domain
}
"
categoryCapitalised
=
"
$(
tr
'[:lower:]'
'[:upper:]'
<<<
${
category
:0:1
}
)
${
category
:1
}
"
issueTitle
=
"
${
categoryCapitalised
}
:
${
domain
}
"
}
...
...
better/help
View file @
e07d9b06
...
...
@@ -21,7 +21,7 @@ echo """
=====================
dev: start development environment (Better Builder and servers)
edit: edit a
domain
edit: edit a
site or tracker entry
help: display this help
log-in: sign into source.ind.ie
log-out: sign out of source.ind.ie
...
...
better/save
View file @
e07d9b06
...
...
@@ -4,10 +4,10 @@
#
# Better command: save
#
# Usage: better/save <trackers/s
potlight
>/<domain> <message>
# Usage: better/save <trackers/s
ites
>/<domain> <message>
#
# e.g., better/save trackers/google.com "Added a block rule."
# better/save s
potlight
/somedoma.in "Fixed a typo"
# better/save s
ites
/somedoma.in "Fixed a typo"
# etc.
#
# Saves the your latest changes to the remote Git repository.
...
...
@@ -38,7 +38,7 @@
showUsage
(){
echo
"
\n
Usage:
\n
"
echo
" better/save <trackers/s
potlight
>/<domain> <message>
\n
"
echo
" better/save <trackers/s
ites
>/<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
"
\n
Error: Please specify a domain in the form: trackers/<domain> or s
potlight
/<domain>."
echo
"
\n
Error: Please specify a domain in the form: trackers/<domain> or s
ites
/<domain>."
showUsage
}
...
...
better/stat
View file @
e07d9b06
...
...
@@ -57,7 +57,7 @@ jsonProperty(){
showUsage
(){
echo
"
\n
Usage:
\n
"
echo
" better/stat [<trackers/
spotlight|
sites>/<domain>]
\n
"
echo
" better/stat [<trackers/sites>/<domain>]
\n
"
echo
"Provides you with general project status or specific status on domain, if specified.
\n
"
exit
0
}
...
...
@@ -82,14 +82,8 @@ createGlobals(){
draftsDirectory
=
~/better.fyi/drafts
contentRepositoryID
=
106
# 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
}
"
categoryCapitalised
=
"
$(
tr
'[:lower:]'
'[:upper:]'
<<<
${
category
:0:1
}
)
${
category
:1
}
"
issueTitle
=
"
${
categoryCapitalised
}
:
${
domain
}
"
}
...
...
@@ -184,21 +178,9 @@ 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
...
...
@@ -399,7 +381,7 @@ processGenericHook(){
}
processCategoryHook
(){
echo
"
\n
Error: Please specify a domain in the form: trackers/<domain> or s
potlight
/<domain>."
echo
"
\n
Error: Please specify a domain in the form: trackers/<domain> or s
ites
/<domain>."
showUsage
}
...
...
better/submit
View file @
e07d9b06
...
...
@@ -4,7 +4,7 @@
#
# Better command: submit
#
# Usage: better/submit <trackers/s
potlight
>/<domain>
# Usage: better/submit <trackers/s
ites
>/<domain>
#
# e.g., better/submit trackers/google.com
# etc.
...
...
@@ -35,7 +35,7 @@
showUsage
(){
echo
"
\n
Usage:
\n
"
echo
" better/submit <trackers/s
potlight
>/<domain> [
\"
merge message
\"
] : submit domain for merging
\n
"
echo
" better/submit <trackers/s
ites
>/<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
}
...
...
@@ -293,7 +293,7 @@ processOtherArgumentsHook(){
#
processGenericHook
(){
tooFewArgumentsError
"domain and merge message are missing"
;
}
processCategoryHook
(){
echo
"
\n
Error: Please specify a domain in the form: trackers/<domain> or s
potlight
/<domain>."
echo
"
\n
Error: Please specify a domain in the form: trackers/<domain> or s
ites
/<domain>."
showUsage
}
...
...
better/test
deleted
100755 → 0
View file @
be43f73d
#!/bin/sh
#
# Runs command in requested directory and restores the working directory at the end.
# Usage: run <directory> "<command>"
#
runIn
(){
pushd
$1
>
/dev/null
eval
$2
popd
>
/dev/null
}
test
(){
echo
">>
$@
"
echo
">> $#"
}
# main(){
# }
# main
if
[
"$#"
-eq
1
]
&&
[
"
$1
"
==
"--help"
]
;
then
showUsageInstructionsHook
exit
0
fi
better/update
View file @
e07d9b06
...
...
@@ -4,10 +4,10 @@
#
# Better command: update
#
# Usage: better/update <trackers/s
potlight
>/<domain>
# Usage: better/update <trackers/s
ites
>/<domain>
#
# e.g., better/update trackers/google.com
# better/update s
potlight
/newdoma.in
# better/update s
ites
/newdoma.in
# etc.
#
# Updates your local copy of <domain> with the latest changes of others
...
...
@@ -31,7 +31,7 @@
showUsage
(){
echo
"
\n
Usage:
\n
"
echo
" better/update <trackers/s
potlight
>/<domain> : update domain
\n
"
echo
" better/update <trackers/s
ites
>/<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
"
\n
Error: Please specify a domain in the form: trackers/<domain> or s
potlight
/<domain>."
echo
"
\n
Error: Please specify a domain in the form: trackers/<domain> or s
ites
/<domain>."
showUsage
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment