Skip to content

Instantly share code, notes, and snippets.

@itsthatguy
Created March 8, 2012 02:58
Show Gist options
  • Save itsthatguy/1998267 to your computer and use it in GitHub Desktop.
Save itsthatguy/1998267 to your computer and use it in GitHub Desktop.
Bootslap
BSTITLE="\033[0;33m"
BSCODE="\033[1;33m"
BSCLEAN="\033[0m"
BOOTSLAP=''
function decorate {
local base=$1
local feature=$2
local undecorated="${base}_without_${feature}"
local decorated="${base}_with_${feature}"
# Define $undecorated with $base's body
eval "$(echo 'function' $undecorated; declare -f $base | tail -n +2)"
# Define $base with $decorated's body
eval "$(echo 'function' $base; declare -f $decorated | tail -n +2)"
}
function cd_with_bootslap () {
cd_without_bootslap "$@" && bootslap
}
decorate cd bootslap
function bs () {
if [ -f "$BOOTSLAP/.bootslap" ]; then
echo -en "\n${BSTITLE}Bootslap: ${BOOTSLAP}\n----------"
perl -e "print '-' x ${#BOOTSLAP}"
echo -e ${BSCODE}
cat "$BOOTSLAP/.bootslap";
echo -e "${BSCLEAN}";
else
echo -e "${BSTITLE}Bootslap: ${BSCODE}Nothing to Bootslap!${BSCLEAN}";
fi
}
function bootslap () {
PD="$(pwd -L)/"
if [[ "${PD}" != "${BOOTSLAP}" ]] && [ -f ".bootslap" ]; then
BOOTSLAP="${PD}"
bs
elif [[ "${PD:0:${#BOOTSLAP}}" != "${BOOTSLAP}" ]]; then
BOOTSLAP=''
fi
}
I should live in your project directory just like this, enter anything here.
Commands:
bs # This will echo the bootslap file for your project, from any directory within the project.
Running the server:
Lein repl
(dev-server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment