This repository was archived by the owner on Jun 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8c4d295
Showing
10 changed files
with
265 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
disable=SC1091 | ||
disable=SC2155 | ||
disable=SC1090 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# glue-store | ||
|
||
My personal store for [glue](https://github.com/eankeen/glue) | ||
|
||
The contents of each folder is copied to the `auto` subdirectory for any project you manage with `glue` | ||
|
||
## Usage | ||
|
||
Glue doesn't have a distribution channel yet, so invoke it in a | ||
cloned repository directory | ||
|
||
```sh | ||
# Example ($PWD is eankeen/glue-example) | ||
../glue/glue.sh sync && ../glue/glue.sh cmd NodeJS_Server.build | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# shellcheck shell=sh | ||
|
||
# note 1 | ||
# the variables GLUE_ACTIONS_DIR | ||
# GLUE_COMMANDS_DIR, and GLUE_CONFIG_DIR, | ||
# will all be incorrect when sourcing this file. I don't | ||
# change them because I don't use them on the first pass | ||
# of any of the bootstrap files | ||
|
||
# shellcheck disable=SC2016 | ||
printf "%s" ' | ||
if [[ $GLUE_IS_AUTO == yes ]]; then | ||
if [ -f "$GLUE_ACTIONS_DIR"/../util/bootstrap.sh ]; then | ||
source "$GLUE_ACTIONS_DIR"/../util/bootstrap.sh | ||
else | ||
# see note 1 | ||
[[ -f $GLUE_ACTIONS_DIR/util/bootstrap.sh ]] && source "$GLUE_ACTIONS_DIR/util/bootstrap.sh" | ||
fi | ||
else | ||
if [[ -f $GLUE_ACTIONS_DIR/util/bootstrap.sh ]]; then | ||
source "$GLUE_ACTIONS_DIR/util/bootstrap.sh" | ||
else | ||
# see note 1 | ||
[[ -f $GLUE_ACTIONS_DIR/auto/util/bootstrap.sh ]] && source "$GLUE_ACTIONS_DIR/auto/util/bootstrap.sh" | ||
fi | ||
fi | ||
' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# shellcheck shell=sh | ||
|
||
eval "$GLUE_ACTIONS_BOOTSTRAP" | ||
bootstrap | ||
|
||
# glue requireConfigs(prettier.config.js) | ||
|
||
prettierConfig="$(util_get_config "prettier.config.js")" | ||
ln -sfT "$prettierConfig" "$GLUE_CONFIGS_DIR/prettier.config.js" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# shellcheck shell=bash | ||
|
||
bootstrap() { | ||
shopt -q nullglob | ||
local shoptExitStatus="$?" | ||
shopt -s nullglob | ||
|
||
# paths of all the files to source | ||
local -a filesToSource=() | ||
|
||
local utilDirAuto | ||
if [[ $GLUE_IS_AUTO = yes ]]; then | ||
utilDirAuto="$GLUE_ACTIONS_DIR/util" | ||
else | ||
utilDirAuto="$GLUE_ACTIONS_DIR/auto/util" | ||
fi | ||
|
||
local utilDirOverride | ||
if [[ $GLUE_IS_AUTO = yes ]]; then | ||
utilDirOverride="$GLUE_ACTIONS_DIR/../util" | ||
else | ||
utilDirOverride="$GLUE_ACTIONS_DIR/util" | ||
fi | ||
|
||
# Add file in 'util' to filesToSource, ensuring priority of 'override' scripts | ||
|
||
local file possibleFileBasename | ||
for file in "$utilDirOverride"/*?.sh; do | ||
echo "added: $file" | ||
filesToSource+=("$file") | ||
done | ||
|
||
for possibleFile in "$utilDirAuto"/*?.sh; do | ||
possibleFileBasename="${possibleFile##*/}" | ||
|
||
if [[ $possibleFileBasename == 'bootstrap.sh' ]]; then | ||
continue | ||
fi | ||
|
||
# loop over exiting files that we're going to source | ||
# and ensure 'possibleFile' is not already there | ||
local alreadyThere=no | ||
for file in "${filesToSource[@]}"; do | ||
fileBasename="${file##*/}" | ||
|
||
# if the file is not included (which means it's not | ||
# already covered by 'override'), add it | ||
if [[ $fileBasename == "$possibleFileBasename" ]]; then | ||
alreadyThere=yes | ||
fi | ||
done | ||
|
||
if [[ $alreadyThere == no ]]; then | ||
filesToSource+=("$possibleFile") | ||
fi | ||
done | ||
|
||
(( shoptExitStatus != 0 )) && shopt -u nullglob | ||
|
||
for file in "${filesToSource[@]}"; do | ||
source "$file" | ||
done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# shellcheck shell=sh | ||
|
||
# note 1 | ||
# the variables GLUE_ACTIONS_DIR | ||
# GLUE_COMMANDS_DIR, and GLUE_CONFIG_DIR, | ||
# will all be incorrect when sourcing this file. I don't | ||
# change them because I don't use them on the first pass | ||
# of any of the bootstrap files | ||
|
||
# shellcheck disable=SC2016 | ||
printf "%s" ' | ||
if [[ $GLUE_IS_AUTO == yes ]]; then | ||
if [ -f "$GLUE_COMMANDS_DIR"/../util/bootstrap.sh ]; then | ||
source "$GLUE_COMMANDS_DIR"/../util/bootstrap.sh | ||
else | ||
# see note 1 | ||
[[ -f $GLUE_COMMANDS_DIR/util/bootstrap.sh ]] && source "$GLUE_COMMANDS_DIR/util/bootstrap.sh" | ||
fi | ||
else | ||
if [[ -f $GLUE_COMMANDS_DIR/util/bootstrap.sh ]]; then | ||
source "$GLUE_COMMANDS_DIR/util/bootstrap.sh" | ||
else | ||
# see note 1 | ||
[[ -f $GLUE_COMMANDS_DIR/auto/util/bootstrap.sh ]] && source "$GLUE_COMMANDS_DIR/auto/util/bootstrap.sh" | ||
fi | ||
fi | ||
' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
eval "$GLUE_COMMANDS_BOOTSTRAP" | ||
bootstrap | ||
|
||
# glue requireActions(do-npm-build) | ||
|
||
log_info "Content" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# shellcheck shell=bash | ||
|
||
bootstrap() { | ||
shopt -q nullglob | ||
local shoptExitStatus="$?" | ||
shopt -s nullglob | ||
|
||
# paths of all the files to source | ||
local -a filesToSource=() | ||
|
||
local utilDirAuto | ||
if [[ $GLUE_IS_AUTO = yes ]]; then | ||
utilDirAuto="$GLUE_COMMANDS_DIR/util" | ||
else | ||
utilDirAuto="$GLUE_COMMANDS_DIR/auto/util" | ||
fi | ||
|
||
local utilDirOverride | ||
if [[ $GLUE_IS_AUTO = yes ]]; then | ||
utilDirOverride="$GLUE_COMMANDS_DIR/../util" | ||
else | ||
utilDirOverride="$GLUE_COMMANDS_DIR/util" | ||
fi | ||
|
||
# Add file in 'util' to filesToSource, ensuring priority of 'override' scripts | ||
|
||
local file possibleFileBasename | ||
for file in "$utilDirOverride"/*?.sh; do | ||
echo "added: $file" | ||
filesToSource+=("$file") | ||
done | ||
|
||
for possibleFile in "$utilDirAuto"/*?.sh; do | ||
possibleFileBasename="${possibleFile##*/}" | ||
|
||
if [[ $possibleFileBasename == 'bootstrap.sh' ]]; then | ||
continue | ||
fi | ||
|
||
# loop over exiting files that we're going to source | ||
# and ensure 'possibleFile' is not already there | ||
local alreadyThere=no | ||
for file in "${filesToSource[@]}"; do | ||
fileBasename="${file##*/}" | ||
|
||
# if the file is not included (which means it's not | ||
# already covered by 'override'), add it | ||
if [[ $fileBasename == "$possibleFileBasename" ]]; then | ||
alreadyThere=yes | ||
fi | ||
done | ||
|
||
if [[ $alreadyThere == no ]]; then | ||
filesToSource+=("$possibleFile") | ||
fi | ||
done | ||
|
||
(( shoptExitStatus != 0 )) && shopt -u nullglob | ||
|
||
for file in "${filesToSource[@]}"; do | ||
source "$file" | ||
done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# shellcheck shell=sh | ||
|
||
trap sigint INT | ||
sigint() { | ||
die 'Received SIGINT' | ||
} | ||
|
||
die() { | ||
log_error "${*-'die: '}. Exiting" | ||
exit 1 | ||
} | ||
|
||
log_info() { | ||
printf "\033[0;34m%s\033[0m\n" "Info: $*" | ||
} | ||
|
||
log_warn() { | ||
printf "\033[1;33m%s\033[0m\n" "Warn: $*" >&2 | ||
} | ||
|
||
log_error() { | ||
printf "\033[0;31m%s\033[0m\n" "Error: $*" >&2 | ||
} | ||
|
||
util_get_working_dir() { | ||
while [ ! -f "glue.sh" ] && [ "$PWD" != / ]; do | ||
cd .. | ||
done | ||
|
||
if [ "$PWD" = / ]; then | ||
die 'No glue config file found in current or parent paths' | ||
fi | ||
|
||
printf "%s" "$PWD" | ||
} | ||
|
||
util_get_config() { | ||
configFile="$1" | ||
|
||
# if an override exists (above the 'auto' directory), use that | ||
if [ -f "$(dirname "$configDir")/$configFile" ]; then | ||
printf "%s" "$configDir/$configFile" | ||
elif [ -f "$configDir/$configFile" ]; then | ||
printf "%s" "$configDir/$configFile" | ||
else | ||
die 'No config file found. This is an issue with the glue store' | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |