From e115b4c5af234558e062a1ccd9c0db8d91402a60 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Tue, 21 Jun 2011 09:20:40 -0500 Subject: [PATCH 01/19] Move auto-complete code over to available -> enabled style This continues the move toward the ability to turn things off with everything turned on by default. --- bash_it.sh | 8 +++++++- completion/{ => available}/brew.completion.bash | 0 completion/{ => available}/git.completion.bash | 0 completion/{ => available}/git_flow.completion.bash | 0 completion/{ => available}/rake.completion.bash | 0 completion/{ => available}/ssh.completion.bash | 0 completion/{ => available}/todo.completion.bash | 0 7 files changed, 7 insertions(+), 1 deletion(-) rename completion/{ => available}/brew.completion.bash (100%) rename completion/{ => available}/git.completion.bash (100%) rename completion/{ => available}/git_flow.completion.bash (100%) rename completion/{ => available}/rake.completion.bash (100%) rename completion/{ => available}/ssh.completion.bash (100%) rename completion/{ => available}/todo.completion.bash (100%) diff --git a/bash_it.sh b/bash_it.sh index b52ff97f..68f3884d 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -17,8 +17,14 @@ do source $config_file done +# TODO: reduce the repetition here by combining these three into a loop # Tab Completion -COMPLETION="${BASH}/completion/*.bash" +if [ ! -d "${BASH}/completion/enabled" ] +then + mkdir "${BASH}/completion/enabled" + ln -s ${BASH}/completion/available/* "${BASH}/completion/enabled" +fi +COMPLETION="${BASH}/completion/enabled/*.bash" for config_file in $COMPLETION do source $config_file diff --git a/completion/brew.completion.bash b/completion/available/brew.completion.bash similarity index 100% rename from completion/brew.completion.bash rename to completion/available/brew.completion.bash diff --git a/completion/git.completion.bash b/completion/available/git.completion.bash similarity index 100% rename from completion/git.completion.bash rename to completion/available/git.completion.bash diff --git a/completion/git_flow.completion.bash b/completion/available/git_flow.completion.bash similarity index 100% rename from completion/git_flow.completion.bash rename to completion/available/git_flow.completion.bash diff --git a/completion/rake.completion.bash b/completion/available/rake.completion.bash similarity index 100% rename from completion/rake.completion.bash rename to completion/available/rake.completion.bash diff --git a/completion/ssh.completion.bash b/completion/available/ssh.completion.bash similarity index 100% rename from completion/ssh.completion.bash rename to completion/available/ssh.completion.bash diff --git a/completion/todo.completion.bash b/completion/available/todo.completion.bash similarity index 100% rename from completion/todo.completion.bash rename to completion/available/todo.completion.bash From 1f0594b7d1e3fb948f53e76ade95e17f729b8804 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Tue, 21 Jun 2011 09:22:24 -0500 Subject: [PATCH 02/19] update to ignore all "enabled" files --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 33e5fca9..32e62dec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -aliases/enabled -plugins/enabled +*/enabled/* .DS_Store custom/*.bash !custom/example.bash From d7cfa8b394dcd652e6b1656e22d69ac235d104b0 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Tue, 21 Jun 2011 09:31:26 -0500 Subject: [PATCH 03/19] Switch to single loop now that all directory use the same pattern Simple refactoring -- now there's no need to source each one independently. --- bash_it.sh | 47 +++++++++++++---------------------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index 68f3884d..a030069e 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -17,43 +17,22 @@ do source $config_file done -# TODO: reduce the repetition here by combining these three into a loop -# Tab Completion -if [ ! -d "${BASH}/completion/enabled" ] -then - mkdir "${BASH}/completion/enabled" - ln -s ${BASH}/completion/available/* "${BASH}/completion/enabled" -fi -COMPLETION="${BASH}/completion/enabled/*.bash" -for config_file in $COMPLETION +# Load enabled aliases, completion, plugins +for file_type in "aliases" "completion" "plugins" do - source $config_file -done - -# Plugins -if [ ! -d "${BASH}/plugins/enabled" ] -then - mkdir "${BASH}/plugins/enabled" - ln -s ${BASH}/plugins/available/* "${BASH}/plugins/enabled" -fi -PLUGINS="${BASH}/plugins/enabled/*.bash" -for config_file in $PLUGINS -do - source $config_file -done - -# Aliases -if [ ! -d "${BASH}/aliases/enabled" ] -then - mkdir "${BASH}/aliases/enabled" - ln -s ${BASH}/aliases/available/* "${BASH}/aliases/enabled" -fi -FUNCTIONS="${BASH}/aliases/enabled/*.bash" -for config_file in $FUNCTIONS -do - source $config_file + if [ ! -d "${BASH}/${file_type}/enabled" ] + then + mkdir "${BASH}/${file_type}/enabled" + ln -s ${BASH}/${file_type}/available/* "${BASH}/${file_type}/enabled" + fi + FILES="${BASH}/${file_type}/enabled/*.bash" + for config_file in $FILES + do + source $config_file + done done +# Load any custom aliases that the user has added if [ -e "${BASH}/aliases/custom.aliases.bash" ] then source "${BASH}/aliases/custom.aliases.bash" From b36d86ddff8f83c691e761d1f9a9789ca8d52fbd Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 11:36:11 -0500 Subject: [PATCH 04/19] Add minimal-git theme Just like the minimal theme, but with git info --- themes/minimal-git/minimal-git.theme.bash | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 themes/minimal-git/minimal-git.theme.bash diff --git a/themes/minimal-git/minimal-git.theme.bash b/themes/minimal-git/minimal-git.theme.bash new file mode 100644 index 00000000..1862f7ff --- /dev/null +++ b/themes/minimal-git/minimal-git.theme.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +SCM_THEME_PROMPT_PREFIX="${cyan}(${green}" +SCM_THEME_PROMPT_SUFFIX="${cyan})" +SCM_THEME_PROMPT_DIRTY=" ${red}✗" +SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" + +PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} " From 989de733309ef79308b3806268ad35467f7ee9b8 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 12:06:30 -0500 Subject: [PATCH 05/19] No more bold --- themes/minimal-git/minimal-git.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/minimal-git/minimal-git.theme.bash b/themes/minimal-git/minimal-git.theme.bash index 1862f7ff..b4c34627 100644 --- a/themes/minimal-git/minimal-git.theme.bash +++ b/themes/minimal-git/minimal-git.theme.bash @@ -3,6 +3,6 @@ SCM_THEME_PROMPT_PREFIX="${cyan}(${green}" SCM_THEME_PROMPT_SUFFIX="${cyan})" SCM_THEME_PROMPT_DIRTY=" ${red}✗" -SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" +SCM_THEME_PROMPT_CLEAN=" ${green}✓" PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} " From 4e14eefca83e7386e02aa1013b11353583c5a134 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 12:08:36 -0500 Subject: [PATCH 06/19] Works now --- themes/minimal-git/minimal-git.theme.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/themes/minimal-git/minimal-git.theme.bash b/themes/minimal-git/minimal-git.theme.bash index b4c34627..76cb24d5 100644 --- a/themes/minimal-git/minimal-git.theme.bash +++ b/themes/minimal-git/minimal-git.theme.bash @@ -5,4 +5,8 @@ SCM_THEME_PROMPT_SUFFIX="${cyan})" SCM_THEME_PROMPT_DIRTY=" ${red}✗" SCM_THEME_PROMPT_CLEAN=" ${green}✓" -PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} " +prompt() { + PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} " +} + +PROMPT_COMMAND=prompt From 5af99be158656bbcb5f4d56fb799e3313837bb53 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 17:45:13 -0500 Subject: [PATCH 07/19] Get rid of old jekyll aliases --- aliases/available/jekyll.aliases.bash | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 aliases/available/jekyll.aliases.bash diff --git a/aliases/available/jekyll.aliases.bash b/aliases/available/jekyll.aliases.bash deleted file mode 100644 index e52c0351..00000000 --- a/aliases/available/jekyll.aliases.bash +++ /dev/null @@ -1,20 +0,0 @@ -# Open the root of your site in your vim or builtin cd to it - -if [[ $EDITOR = "vim" ]] -then - alias newentry="builtin cd $JEKYLL_LOCAL_ROOT && $EDITOR ." -else - alias newentry="builtin cd $JEKYLL_LOCAL_ROOT" -fi - -# Build and locally serve the site - -alias testsite="builtin cd $JEKYLL_LOCAL_ROOT && jekyll --server --auto" - -# Build but don't locally serve the site - -alias buildsite="builtin cd $JEKYLL_LOCAL_ROOT && rm -rf _site/ && jekyll" - -# Rsync the site to the remote server - -alias deploysite="builtin cd $JEKYLL_LOCAL_ROOT && rsync -rz _site/ $JEKYLL_REMOTE_ROOT" From 10ac7731703eaeecc9b4fb3d7e601569cbe5c980 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 17:45:37 -0500 Subject: [PATCH 08/19] Get rid of old, unneeded jekyll config stuff --- template/bash_profile.template.bash | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index 30ab0fc1..95f481e9 100644 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -26,18 +26,6 @@ export NGINX_PATH='/opt/nginx' # Don't check mail when opening terminal. unset MAILCHECK -# Change this to the path of your local jekyll root to use the jekyll aliases - -export JEKYLL_LOCAL_ROOT="$HOME/Sites/jekyllsite" - -# And change this to the remote server and root - -export JEKYLL_REMOTE_ROOT="user@server:/path/to/jekyll/root" - -# And, for the last of the jekyll variables, this is the formatting you use, eg: markdown, -# textile, etc. Basically whatever you use as the extension for posts, without the preceding dot - -export JEKYLL_FORMATTING="markdown" # Change this to your console based IRC client of choice. From 56b83c76cbc1b8d257103982563a6690e36068a0 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 17:45:55 -0500 Subject: [PATCH 09/19] Add new jekyll config stuff --- template/jekyllconfig.template.bash | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 template/jekyllconfig.template.bash diff --git a/template/jekyllconfig.template.bash b/template/jekyllconfig.template.bash new file mode 100644 index 00000000..e4705181 --- /dev/null +++ b/template/jekyllconfig.template.bash @@ -0,0 +1,17 @@ +# This is a space-delimited list of your Jekyll project paths + +SITES="$HOME/sites/project_1 $HOME/sites/project_2" + +# This is another space-delimited list. +# This one is of the remote user@host:path location of your jekyll site +# NOTE: The locations of these must correspond to the locations +# of the sites in the first list +# For instance, the host for the first Jekyll site +# must be first in this list, the second second, etc. + +REMOTES="user@host_1:path user@host_2:path" + +# list of markup syntaxes to use for the sites, +# Same rules as above. Can be HTML, textile, or markdown + +MARKUPS="markdown textile" From 9ad7964c861504d9ef030dd11742d5dc00e4320a Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 17:49:19 -0500 Subject: [PATCH 10/19] Add support for multiple Jekyll sites --- bash_it.sh | 7 + plugins/available/jekyll.plugins.bash | 448 +++++++++++++++++--------- 2 files changed, 300 insertions(+), 155 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index a030069e..7734c10c 100644 --- a/bash_it.sh +++ b/bash_it.sh @@ -56,6 +56,13 @@ PREVIEW="less" [ -s /usr/bin/gloobus-preview ] && PREVIEW="gloobus-preview" [ -s /Applications/Preview.app ] && PREVIEW="/Applications/Preview.app" +# Load all the Jekyll stuff + +if [ -e $HOME/.jekyllconfig ] +then + . $HOME/.jekyllconfig +fi + # # Custom Help diff --git a/plugins/available/jekyll.plugins.bash b/plugins/available/jekyll.plugins.bash index aebe69bc..8efdd11f 100644 --- a/plugins/available/jekyll.plugins.bash +++ b/plugins/available/jekyll.plugins.bash @@ -1,208 +1,346 @@ #!/bin/bash editpost() { - builtin cd "$JEKYLL_LOCAL_ROOT/_posts" + unset SITE + if [ -z "$1" ] + then + echo "Error: no site specified." + echo "The site is the name of the directory your project is in." + return 1 + fi - COUNTER=1 - NUMBER="$RANDOM" - TMPFILE="/tmp/editpost-$NUMBER" + for site in ${SITES[@]} + do + if [ "$(basename $site)" = "$1" ] + then + SITE=$site + break + fi + done - for POST in * - do - DATE=`echo $POST | grep -oE "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}"` - TITLE=`cat $POST | grep -oE "title: (.+)"` - TITLE=`echo $TITLE | sed 's/title: //'` - echo "$COUNTER) $DATE $TITLE" >> "$TMPFILE" - POSTS[$COUNTER]=$POST - COUNTER=`expr $COUNTER + 1` - done - less $TMPFILE - read -p "Number of post to edit: " POST_TO_EDIT - if [ -z "$EDITOR" ] - then - nano "${POSTS[$POST_TO_EDIT]}" - else - "$EDITOR" "${POSTS[$POST_TO_EDIT]}" - fi + if [ -z "$SITE" ] + then + echo "No such site." + return 1 + fi + + builtin cd "$SITE/_posts" + + COUNTER=1 + NUMBER="$RANDOM" + TMPFILE="/tmp/editpost-$NUMBER" + + for POST in * + do + DATE=`echo $POST | grep -oE "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}"` + TITLE=`cat $POST | grep -oE "title: (.+)"` + TITLE=`echo $TITLE | sed 's/title: //'` + echo "$COUNTER) $DATE $TITLE" >> "$TMPFILE" + POSTS[$COUNTER]=$POST + COUNTER=`expr $COUNTER + 1` + done + less $TMPFILE + read -p "Number of post to edit: " POST_TO_EDIT + if [ -z "$EDITOR" ] + then + nano "${POSTS[$POST_TO_EDIT]}" + else + "$EDITOR" "${POSTS[$POST_TO_EDIT]}" + fi } newpost() { + unset SITE + if [ -z "$1" ] + then + echo "Error: no site specified." + echo "The site is the name of the directory your project is in." + return 1 + fi - # 'builtin cd' into the local jekyll root + if [ -z "$SITE" ] + then + echo "No such site." + return 1 + fi - builtin cd "$JEKYLL_LOCAL_ROOT/_posts" + loc=0 - # Get the date for the new post's filename + for site in ${SITES[@]} + do + if [ "$(basename $site)" = "$1" ] + then + SITE=$site + JEKYLL_FORMATTING=${MARKUPS[$loc]} + break + fi + loc=$(($loc+1)) + done - FNAME_DATE=$(date "+%Y-%m-%d") + # 'builtin cd' into the local jekyll root - # If the user is using markdown formatting, let them choose what type of post they want. Sort of like Tumblr. + builtin cd "$SITE/_posts" - OPTIONS="Text Quote Image Audio Video Link" - - if [ $JEKYLL_FORMATTING = "markdown" -o $JEKYLL_FORMATTING = "textile" ] - then - select OPTION in $OPTIONS - do - if [[ $OPTION = "Text" ]] - then - POST_TYPE="Text" - break - fi + # Get the date for the new post's filename - if [[ $OPTION = "Quote" ]] - then - POST_TYPE="Quote" - break - fi - - if [[ $OPTION = "Image" ]] - then - POST_TYPE="Image" - break - fi + FNAME_DATE=$(date "+%Y-%m-%d") - if [[ $OPTION = "Audio" ]] - then - POST_TYPE="Audio" - break - fi + # If the user is using markdown or textile formatting, let them choose what type of post they want. Sort of like Tumblr. - if [[ $OPTION = "Video" ]] - then - POST_TYPE="Video" - break - fi + OPTIONS="Text Quote Image Audio Video Link" - if [[ $OPTION = "Link" ]] - then - POST_TYPE="Link" - break - fi - done - fi + if [ $JEKYLL_FORMATTING = "markdown" -o $JEKYLL_FORMATTING = "textile" ] + then + select OPTION in $OPTIONS + do + if [[ $OPTION = "Text" ]] + then + POST_TYPE="Text" + break + fi - # Get the title for the new post + if [[ $OPTION = "Quote" ]] + then + POST_TYPE="Quote" + break + fi - read -p "Enter title of the new post: " POST_TITLE + if [[ $OPTION = "Image" ]] + then + POST_TYPE="Image" + break + fi - # Convert the spaces in the title to hyphens for use in the filename + if [[ $OPTION = "Audio" ]] + then + POST_TYPE="Audio" + break + fi - FNAME_POST_TITLE=`echo $POST_TITLE | tr ' ' "-"` + if [[ $OPTION = "Video" ]] + then + POST_TYPE="Video" + break + fi - # Now, put it all together for the full filename + if [[ $OPTION = "Link" ]] + then + POST_TYPE="Link" + break + fi + done + fi - FNAME="$FNAME_DATE-$FNAME_POST_TITLE.$JEKYLL_FORMATTING" + # Get the title for the new post - # And, finally, create the actual post file. But we're not done yet... + read -p "Enter title of the new post: " POST_TITLE - touch "$FNAME" + # Convert the spaces in the title to hyphens for use in the filename - # Write a little stuff to the file for the YAML Front Matter + FNAME_POST_TITLE=`echo $POST_TITLE | tr ' ' "-"` - echo "---" >> $FNAME + # Now, put it all together for the full filename - # Now we have to get the date, again. But this time for in the header (YAML Front Matter) of - # the file + FNAME="$FNAME_DATE-$FNAME_POST_TITLE.$JEKYLL_FORMATTING" - YAML_DATE=$(date "+%B %d %Y %X") + # And, finally, create the actual post file. But we're not done yet... - # Echo the YAML Formatted date to the post file + touch "$FNAME" - echo "date: $YAML_DATE" >> $FNAME + # Write a little stuff to the file for the YAML Front Matter - # Echo the original post title to the YAML Front Matter header + echo "---" >> $FNAME - echo "title: $POST_TITLE" >> $FNAME + # Now we have to get the date, again. But this time for in the header (YAML Front Matter) of + # the file - # And, now, echo the "post" layout to the YAML Front Matter header + YAML_DATE=$(date "+%B %d %Y %X") - echo "layout: post" >> $FNAME + # Echo the YAML Formatted date to the post file - # Close the YAML Front Matter Header + echo "date: $YAML_DATE" >> $FNAME - echo "---" >> $FNAME - echo >> $FNAME + # Echo the original post title to the YAML Front Matter header - # Generate template text based on the post type + echo "title: $POST_TITLE" >> $FNAME - if [[ $JEKYLL_FORMATTING = "markdown" ]] - then - if [[ $POST_TYPE = "Text" ]] - then - true - fi + # And, now, echo the "post" layout to the YAML Front Matter header - if [[ $POST_TYPE = "Quote" ]] - then - echo "> Quote" >> $FNAME - echo >> $FNAME - echo "— Author" >> $FNAME - fi + echo "layout: post" >> $FNAME - if [[ $POST_TYPE = "Image" ]] - then - echo "![Alternate Text](/path/to/image/or/url)" >> $FNAME - fi + # Close the YAML Front Matter Header - if [[ $POST_TYPE = "Audio" ]] - then - echo "" >> $FNAME - fi + echo "---" >> $FNAME + echo >> $FNAME - if [[ $POST_TYPE = "Video" ]] - then - echo "" >> $FNAME - fi - - if [[ $POST_TYPE = "Link" ]] - then - echo "[link][1]" >> $FNAME - echo >> $FNAME - echo "> Quote" >> $FNAME - echo >> $FNAME - echo "[1]: url" >> $FNAME - fi - fi + # Generate template text based on the post type - if [[ $JEKYLL_FORMATTING = "textile" ]] - then - if [[ $POST_TYPE = "Text" ]] - then - true - fi + if [[ $JEKYLL_FORMATTING = "markdown" ]] + then + if [[ $POST_TYPE = "Text" ]] + then + true + fi - if [[ $POST_TYPE = "Quote" ]] - then - echo "bq. Quote" >> $FNAME - echo >> $FNAME - echo "— Author" >> $FNAME - fi + if [[ $POST_TYPE = "Quote" ]] + then + echo "> Quote" >> $FNAME + echo >> $FNAME + echo "— Author" >> $FNAME + fi - if [[ $POST_TYPE = "Image" ]] - then - echo "!url(alt text)" >> $FNAME - fi + if [[ $POST_TYPE = "Image" ]] + then + echo "![Alternate Text](/path/to/image/or/url)" >> $FNAME + fi - if [[ $POST_TYPE = "Audio" ]] - then - echo "" >> $FNAME - fi + if [[ $POST_TYPE = "Audio" ]] + then + echo "" >> $FNAME + fi - if [[ $POST_TYPE = "Video" ]] - then - echo "" >> $FNAME - fi + if [[ $POST_TYPE = "Video" ]] + then + echo "" >> $FNAME + fi - if [[ $POST_TYPE = "Link" ]] - then - echo "\"Site\":url" >> $FNAME - echo >> $FNAME - echo "bq. Quote" >> $FNAME - fi - fi + if [[ $POST_TYPE = "Link" ]] + then + echo "[link][1]" >> $FNAME + echo >> $FNAME + echo "> Quote" >> $FNAME + echo >> $FNAME + echo "[1]: url" >> $FNAME + fi + fi - # Open the file in your favorite editor + if [[ $JEKYLL_FORMATTING = "textile" ]] + then + if [[ $POST_TYPE = "Text" ]] + then + true + fi - "$EDITOR" $FNAME + if [[ $POST_TYPE = "Quote" ]] + then + echo "bq. Quote" >> $FNAME + echo >> $FNAME + echo "— Author" >> $FNAME + fi + + if [[ $POST_TYPE = "Image" ]] + then + echo "!url(alt text)" >> $FNAME + fi + + if [[ $POST_TYPE = "Audio" ]] + then + echo "" >> $FNAME + fi + + if [[ $POST_TYPE = "Video" ]] + then + echo "" >> $FNAME + fi + + if [[ $POST_TYPE = "Link" ]] + then + echo "\"Site\":url" >> $FNAME + echo >> $FNAME + echo "bq. Quote" >> $FNAME + fi + fi + + # Open the file in your favorite editor + + "$EDITOR" $FNAME +} + +function testsite() { + unset SITE + if [ -z "$1" ] + then + echo "Error: no site specified." + echo "The site is the name of the directory your project is in." + return 1 + fi + + for site in ${SITES[@]} + do + if [ "$(basename $site)" = "$1" ] + then + SITE=$site + break + fi + done + + if [ -z "$SITE" ] + then + echo "No such site." + return 1 + fi + + builtin cd $SITE + jekyll --server --auto +} + +function buildsite() { + unset SITE + if [ -z "$1" ] + then + echo "Error: no site specified." + echo "The site is the name of the directory your project is in." + return 1 + fi + + for site in ${SITES[@]} + do + if [ "$(basename $site)" = "$1" ] + then + SITE=$site + break + fi + done + + if [ -z "$SITE" ] + then + echo "No such site." + return 1 + fi + + builtin cd $SITE + rm -rf _site + jekyll --no-server +} + +function deploysite() { + unset SITE + if [ -z "$1" ] + then + echo "Error: no site specified." + echo "The site is the name of the directory your project is in." + return 1 + fi + + loc=0 + + for site in ${SITES[@]} + do + if [ "$(basename $site)" = "$1" ] + then + SITE=$site + REMOTE=${REMOTES[$loc]} + break + fi + loc=$(($loc+1)) + done + + if [ -z "$SITE" ] + then + echo "No such site." + return 1 + fi + + builtin cd $SITE + rsync -rz $REMOTE } From 4ac4049a7595e1d694e7283dba7714e5aff14569 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Fri, 24 Jun 2011 17:50:02 -0500 Subject: [PATCH 11/19] Add note for configuring Jekyll support --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index c8412c92..5af3056e 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,14 @@ Check a clone of this repo. You can view what a sample `~/.bash_profile` looks l cp ~/.bash_profile ~/.bash_profile_original cp /template/bash_profile.template.bash ~/.bash_profile +To configure Jekyll support for bash it, move the +jekyllconfig.template.bash to your home directory: + + cp /template/jekyllconfig.template.bash ~/.jekyllconfig + +Be sure to edit this file to your needed specifications. Please note +that this file is *not* required. Only use it if you plan on using the +jekyll plugins. ## Help Screens From 6e8733ea98d09ca5d87f07a9e4a1b696b2a6fe0e Mon Sep 17 00:00:00 2001 From: Jeff Carouth Date: Sat, 25 Jun 2011 10:05:25 -0500 Subject: [PATCH 12/19] Adding multiple SCM support to doubletime theme. The doubletime theme improves the SCM status prompt for git. However, it accomplishes this at the expense of other SCM systems. This delegates prompt to the default bash-it prompt function when the SCM is not git. --- themes/doubletime/doubletime.theme.bash | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index 1237f80f..e16ba66c 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -17,11 +17,12 @@ fi doubletime_scm_prompt() { CHAR=$(scm_char) - if [ $CHAR = $SCM_NONE_CHAR ] - then + if [ $CHAR = $SCM_NONE_CHAR ]; then return - else + elif [ $CHAR = $SCM_GIT_CHAR ]; then echo "$(git_prompt_status)" + else + echo "[$(scm_prompt_info)]" fi } From ff0859d28966035e310277ef3e8701b1fe119d80 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sat, 25 Jun 2011 11:50:56 -0500 Subject: [PATCH 13/19] Move minimal-git theme into minimal theme --- themes/minimal/minimal.theme.bash | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/themes/minimal/minimal.theme.bash b/themes/minimal/minimal.theme.bash index 8de4a6c7..76cb24d5 100644 --- a/themes/minimal/minimal.theme.bash +++ b/themes/minimal/minimal.theme.bash @@ -1,7 +1,12 @@ -prompt_setter() { - PS1="${cyan}\W${normal} " +#!/usr/bin/env bash + +SCM_THEME_PROMPT_PREFIX="${cyan}(${green}" +SCM_THEME_PROMPT_SUFFIX="${cyan})" +SCM_THEME_PROMPT_DIRTY=" ${red}✗" +SCM_THEME_PROMPT_CLEAN=" ${green}✓" + +prompt() { + PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} " } -PROMPT_COMMAND=prompt_setter - -export PS3=">> " +PROMPT_COMMAND=prompt From 052da726df55cf7019b08f897d3d3dc1371d2d85 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sat, 25 Jun 2011 11:52:50 -0500 Subject: [PATCH 14/19] Get rid of old minimal-git theme --- themes/minimal-git/minimal-git.theme.bash | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 themes/minimal-git/minimal-git.theme.bash diff --git a/themes/minimal-git/minimal-git.theme.bash b/themes/minimal-git/minimal-git.theme.bash deleted file mode 100644 index 76cb24d5..00000000 --- a/themes/minimal-git/minimal-git.theme.bash +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -SCM_THEME_PROMPT_PREFIX="${cyan}(${green}" -SCM_THEME_PROMPT_SUFFIX="${cyan})" -SCM_THEME_PROMPT_DIRTY=" ${red}✗" -SCM_THEME_PROMPT_CLEAN=" ${green}✓" - -prompt() { - PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} " -} - -PROMPT_COMMAND=prompt From 93df02f19389151f9bc5f0420024605289081f63 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sun, 26 Jun 2011 09:30:16 -0500 Subject: [PATCH 15/19] Fix irregular usage of bash it vs. bash-it --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5af3056e..e5c7aae2 100644 --- a/README.md +++ b/README.md @@ -42,13 +42,13 @@ and anything in the custom directory will be ignored with the exception of `cust ## Themes -There are a few bash-it themes, but I'm hoping the community will jump in and create their own custom prompts and share their creations with everyone else by submitting a pull request to me (revans). +There are a few bash it themes, but I'm hoping the community will jump in and create their own custom prompts and share their creations with everyone else by submitting a pull request to me (revans). ## Help out -I think all of us have our own custom scripts that we have added over time and so following in the footsteps of oh-my-zsh, bash-it was created as a framework for those who choose to use bash as their shell. As a community, I'm excited to see what everyone else has in their custom toolbox and am hoping that they'll share it with everyone by submitting a pull request to bash-it. +I think all of us have our own custom scripts that we have added over time and so following in the footsteps of oh-my-zsh, bash it was created as a framework for those who choose to use bash as their shell. As a community, I'm excited to see what everyone else has in their custom toolbox and am hoping that they'll share it with everyone by submitting a pull request to bash it. -So, if you have contributions to bash-it, please send me a pull request and I'll take a look at it and commit it to the repo as long as it looks good. If you do change an existing command, please give an explanation as to why. That will help a lot when I merge your changes in. Thanks, and happing bashing! +So, if you have contributions to bash it, please send me a pull request and I'll take a look at it and commit it to the repo as long as it looks good. If you do change an existing command, please give an explanation as to why. That will help a lot when I merge your changes in. Thanks, and happing bashing! ## Contributors From e1eb0114ed1d152d3c32dec8d8a8167817c93ed0 Mon Sep 17 00:00:00 2001 From: Adrian Rego Date: Mon, 27 Jun 2011 20:00:27 -0400 Subject: [PATCH 16/19] relieving headaches with a tylenol theme --- themes/tylenol/tylenol.theme.bash | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 themes/tylenol/tylenol.theme.bash diff --git a/themes/tylenol/tylenol.theme.bash b/themes/tylenol/tylenol.theme.bash new file mode 100644 index 00000000..c915f561 --- /dev/null +++ b/themes/tylenol/tylenol.theme.bash @@ -0,0 +1,20 @@ +#!/bin/bash +# +# Based on 'bobby' theme with the addition of virtualenv_prompt +# + +SCM_THEME_PROMPT_DIRTY=" ${red}✗" +SCM_THEME_PROMPT_CLEAN=" ${green}✓" +SCM_THEME_PROMPT_PREFIX=" ${yellow}|${reset_color}" +SCM_THEME_PROMPT_SUFFIX="${yellow}|" + +RVM_THEME_PROMPT_PREFIX="|" +RVM_THEME_PROMPT_SUFFIX="|" +VIRTUALENV_THEME_PROMPT_PREFIX='|' +VIRTUALENV_THEME_PROMPT_SUFFIX='|' + +function prompt_command() { + PS1="\n${green}$(virtualenv_prompt)${red}$(rvm_version_prompt) ${reset_color}\h ${orange}in ${reset_color}\w\n${yellow}$(scm_char)$(scm_prompt_info) ${yellow}→${white} " +} + +PROMPT_COMMAND=prompt_command; From d82d8fbbe8fe0ab67781136177684d34b79d71ca Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Tue, 28 Jun 2011 00:22:43 -0500 Subject: [PATCH 17/19] Add install script --- install.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 00000000..3fc647b4 --- /dev/null +++ b/install.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +cp $HOME/.bash_profile $HOME/.bash_profile.bak + +echo "Your original .bash_profile has been backed up to .bash_profile.bak" + +cp $HOME/.bash_it/template/bash_profile.template.bash $HOME/.bash_profile + +echo "Copied the template .bash_profile into ~/.bash_profile, edit this file to customize bash-it" + +while true +do + read -p "Do you use Jekyll? (If you don't know what Jekyll is, answer 'n') [Y/N] " RESP + + case $RESP + in + [yY]) + cp $HOME/.bash_it/template/jekyllconfig.template.bash $HOME/.jekyllconfig + echo "Copied the template .jekyllconfig into your home directory. Edit this file to customize bash-it for using the Jekyll plugins" + break + ;; + [nN]) + break + ;; + *) + echo "Please enter Y or N" + esac +done From b7c4b36ed247a90636200c4e9610e0a1032d85b9 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Tue, 28 Jun 2011 00:22:51 -0500 Subject: [PATCH 18/19] Add instructions for installing with the installation script --- README.md | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index e5c7aae2..89f3d0d0 100644 --- a/README.md +++ b/README.md @@ -6,21 +6,17 @@ Includes some autocompletion tools, theming support, aliases, custom functions, ## Install -Check a clone of this repo. You can view what a sample `~/.bash_profile` looks like in `template/bash_profile.template.bash`. If you wanted to use that template, make sure to make a backup of your current `~/.bash_profile` file. +Check a clone of this repo: git clone http://github.com/revans/bash-it.git bash_it - cp ~/.bash_profile ~/.bash_profile_original - cp /template/bash_profile.template.bash ~/.bash_profile +Then run the `install.sh` file, it will backup your `~/.bash_profile` +file and move the template one into it's place (the template file is at +`~/.bash_it/template/bash_profile.template.bash`). It will also prompt +you asking if you use [Jekyll](https://github.com/mojombo/jekyll). This +is to set up the `.jekyllconfig` file, the file that stores the +information needed to use the Jekyll plugin supplied with bash it. -To configure Jekyll support for bash it, move the -jekyllconfig.template.bash to your home directory: - - cp /template/jekyllconfig.template.bash ~/.jekyllconfig - -Be sure to edit this file to your needed specifications. Please note -that this file is *not* required. Only use it if you plan on using the -jekyll plugins. ## Help Screens From ed8332d8d4161ff7ffeaa21f2bfe678466f0caa3 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Tue, 28 Jun 2011 00:25:26 -0500 Subject: [PATCH 19/19] Add clarification to README --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 89f3d0d0..933b333c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,10 @@ Check a clone of this repo: Then run the `install.sh` file, it will backup your `~/.bash_profile` file and move the template one into it's place (the template file is at -`~/.bash_it/template/bash_profile.template.bash`). It will also prompt +`~/.bash_it/template/bash_profile.template.bash`). Be sure to edit this +template file in order to customize bash-it. + +The install script will also prompt you asking if you use [Jekyll](https://github.com/mojombo/jekyll). This is to set up the `.jekyllconfig` file, the file that stores the information needed to use the Jekyll plugin supplied with bash it.