Merge remote branch 'upstream/master'

pull/33/head
John Schulz 2010-11-23 13:05:38 -05:00
commit 61cb7a71dd
7 changed files with 209 additions and 13 deletions

View File

@ -1,27 +1,27 @@
# Open the root of your site in your vim or cd to it
# Open the root of your site in your vim or builtin cd to it
if [[ $EDITOR = "vim" ]]
then alias newentry="cd $JEKYLL_LOCAL_ROOT && $EDITOR ."
else alias newentry="cd $JEKYLL_LOCAL_ROOT"
then alias newentry="builtin cd $JEKYLL_LOCAL_ROOT && $EDITOR ."
else alias newentry="builtin cd $JEKYLL_LOCAL_ROOT"
fi
# Open the _posts/ directory for making a new blog post (seperate from above alias because not everyone uses jekyll for a blog)
# if [ $editor = "vim" ]
# then
# alias newpost="cd $jekyll_local_root/_posts && $editor ."
# alias newpost="builtin cd $jekyll_local_root/_posts && $editor ."
# else
# alias newpost="cd $jekyll_local_root"
# alias newpost="builtin cd $jekyll_local_root"
# fi
# Build and locally serve the site
alias testsite="cd $JEKYLL_LOCAL_ROOT && jekyll --server --auto"
alias testsite="builtin cd $JEKYLL_LOCAL_ROOT && jekyll --server --auto"
# Build but don't locally serve the site
alias buildsite="cd $JEKYLL_LOCAL_ROOT && rm -rf _site/ && jekyll"
alias buildsite="builtin cd $JEKYLL_LOCAL_ROOT && rm -rf _site/ && jekyll"
# Rsync the site to the remote server
alias deploysite="cd $JEKYLL_LOCAL_ROOT && rsync -rz _site/ $JEKYLL_REMOTE_ROOT"
alias deploysite="builtin cd $JEKYLL_LOCAL_ROOT && rsync -rz _site/ $JEKYLL_REMOTE_ROOT"

View File

@ -30,6 +30,10 @@ pri() {
ri -T "${1}" | open -f -a $PREVIEW
}
quiet() {
$* &> /dev/null &
}
banish-cookies() {
rm -r ~/.macromedia ~/.adobe
ln -s /dev/null ~/.adobe

View File

@ -18,3 +18,39 @@ function git_remove_missing_files() {
function local-ignore() {
echo "$1" >> .git/info/exclude
}
# get a quick overview for your git repo
function git_info() {
if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]; then
# print informations
echo "git repo overview"
echo "-----------------"
echo
# print all remotes and thier details
for remote in $(git remote show); do
echo $remote:
git remote show $remote
echo
done
# print status of working repo
echo "status:"
if [ -n "$(git status -s 2> /dev/null)" ]; then
git status -s
else
echo "working directory is clean"
fi
# print at least 5 last log entries
echo
echo "log:"
git log -5 --oneline
echo
else
echo "you're currently not in a git repository"
fi
}

View File

@ -1,13 +1,55 @@
#!/bin/bash
newpost() {
# 'cd' into the local jekyll root
# 'builtin cd' into the local jekyll root
cd "$JEKYLL_LOCAL_ROOT/_posts"
builtin cd "$JEKYLL_LOCAL_ROOT/_posts"
# Get the date for the new post's filename
FNAME_DATE=$(date "+%Y-%m-%d")
# If the user is using markdown formatting, let them choose what type of post they want. Sort of like Tumblr.
OPTIONS="Text Quote Image Audio Video"
if [ $JEKYLL_FORMATTING = "markdown" -o $JEKYLL_FORMATTING = "textile" ]
then
select OPTION in $OPTIONS
do
if [[ $OPTION = "Text" ]]
then
POST_TYPE="Text"
break
fi
if [[ $OPTION = "Quote" ]]
then
POST_TYPE="Quote"
break
fi
if [[ $OPTION = "Image" ]]
then
POST_TYPE="Image"
break
fi
if [[ $OPTION = "Audio" ]]
then
POST_TYPE="Audio"
break
fi
if [[ $OPTION = "Video" ]]
then
POST_TYPE="Video"
break
fi
done
fi
# Get the title for the new post
read -p "Enter title of the new post: " POST_TITLE
@ -50,6 +92,68 @@ newpost() {
echo "---" >> $FNAME
echo >> $FNAME
# Generate template text based on the post type
if [[ $JEKYLL_FORMATTING = "markdown" ]]
then
if [[ $POST_TYPE = "Text" ]]
then
true
fi
if [[ $POST_TYPE = "Quote" ]]
then
echo "> Quote" >> $FNAME
echo >> $FNAME
echo "— Author" >> $FNAME
fi
if [[ $POST_TYPE = "Image" ]]
then
echo "![Alternate Text](/path/to/image/or/url)" >> $FNAME
fi
if [[ $POST_TYPE = "Audio" ]]
then
echo "<html><audio src=\"/path/to/audio/file\" controls=\"controls\"></audio></html>" >> $FNAME
fi
if [[ $POST_TYPE = "Video" ]]
then
echo "<html><video src=\"/path/to/video\" controls=\"controls\"></video></html>" >> $FNAME
fi
fi
if [[ $JEKYLL_FORMATTING = "textile" ]]
then
if [[ $POST_TYPE = "Text" ]]
then
true
fi
if [[ $POST_TYPE = "Quote" ]]
then
echo "bq. Quote" >> $FNAME
echo >> $FNAME
echo "&mdash; Author" >> $FNAME
fi
if [[ $POST_TYPE = "Image" ]]
then
echo "!url(alt text)" >> $FNAME
fi
if [[ $POST_TYPE = "Audio" ]]
then
echo "<html><audio src=\"/path/to/audio/file\" controls=\"controls\"></audio></html>" >> $FNAME
fi
if [[ $POST_TYPE = "Video" ]]
then
echo "<html><video src=\"/path/to/video\" controls=\"controls\"></video></html>" >> $FNAME
fi
fi
# Open the file in your favorite editor
$EDITOR $FNAME

View File

@ -0,0 +1,50 @@
#!/bin/bash
_vagrant()
{
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
commands="box destroy halt help init package provision reload resume ssh ssh_config status suspend up version"
if [ $COMP_CWORD == 1 ]
then
COMPREPLY=($(compgen -W "${commands}" -- ${cur}))
return 0
fi
if [ $COMP_CWORD == 2 ]
then
case "$prev" in
"box")
box_commands="add help list remove repackage"
COMPREPLY=($(compgen -W "${box_commands}" -- ${cur}))
return 0
;;
"help")
COMPREPLY=($(compgen -W "${commands}" -- ${cur}))
return 0
;;
*)
;;
esac
fi
if [ $COMP_CWORD == 3 ]
then
action="${COMP_WORDS[COMP_CWORD-2]}"
if [ $action == 'box' ]
then
case "$prev" in
"remove"|"repackage")
local box_list=$(find $HOME/.vagrant/boxes/* -maxdepth 0 -type d -printf '%f ')
COMPREPLY=($(compgen -W "${box_list}" -- ${cur}))
return 0
;;
*)
;;
esac
fi
fi
}
complete -F _vagrant vagrant

View File

@ -50,7 +50,7 @@ function prompt_char {
}
function git_prompt_info {
if [[ -n $(git status -s 2> /dev/null) ]]; then
if [[ -n $(git status -s 2> /dev/null |grep -v ^# |grep -v "working directory clean") ]]; then
state=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY}
else
state=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN}

View File

@ -7,3 +7,5 @@ prompt_setter() {
}
PROMPT_COMMAND=prompt_setter
export PS3=">> "