Skip to content

Instantly share code, notes, and snippets.

@bernerdschaefer
Created May 9, 2011 15:19
Show Gist options
  • Save bernerdschaefer/962715 to your computer and use it in GitHub Desktop.
Save bernerdschaefer/962715 to your computer and use it in GitHub Desktop.
some bash helpers for working with padrino projects
alias rake="time rake"
# Run `padrino rake` when inside a padrino project,
# otherwise run the normal rake command.
function rake () {
if [[ -f ".components" ]]; then
padrino rake $*
else
ruby -S rake $*
fi
}
# Shortcut for padrino
pd () {
padrino $*
}
# Autocomplete `pd`
_pd () {
local cur projects
eval 'COMPREPLY=()'
cur=${COMP_WORDS[COMP_CWORD]}
commands=$(\padrino | grep '^ padrino' | awk '{print $2;}')
if [ $COMP_CWORD -eq 1 ]; then
eval 'COMPREPLY=( $(compgen -o filenames -W "$commands" $cur) )'
fi
return 0
}
complete -F _pd pd
@nesquena
Copy link

nesquena commented May 9, 2011

Nice shortcuts. I have a similar set, thanks for sharing these.

@DAddYE
Copy link

DAddYE commented May 10, 2011

Thanks! I think there is a problem with rake because seems unable to pass args to the rake try: rake -T

@bernerdschaefer
Copy link
Author

@DAddYE Silly me. It's fixed now!

@DAddYE
Copy link

DAddYE commented May 10, 2011

Thanks man!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment