Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Guerki 2014-07-29 09:27:58 +02:00
commit 65ce765043
14 changed files with 164 additions and 25 deletions

View File

@ -54,11 +54,19 @@ git_remote_status() {
# Checks if there are commits ahead from remote # Checks if there are commits ahead from remote
function git_prompt_ahead() { function git_prompt_ahead() {
if $(echo "$(command git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
echo "$ZSH_THEME_GIT_PROMPT_AHEAD" echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
fi fi
} }
# Gets the number of commits ahead from remote
function git_commits_ahead() {
if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ')
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
fi
}
# Formats prompt string for current git commit short SHA # Formats prompt string for current git commit short SHA
function git_prompt_short_sha() { function git_prompt_short_sha() {
SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"

View File

@ -1 +1,2 @@
alias brews='brew list -1' alias brews='brew list -1'
alias bubu="brew update && brew upgrade && brew cleanup"

49
plugins/bundler/README.md Normal file
View File

@ -0,0 +1,49 @@
# Bundler
- adds completion for basic bundler commands
- adds short aliases for common bundler commands
- `be` aliased to `bundle exec`
- `bl` aliased to `bundle list`
- `bp` aliased to `bundle package`
- `bo` aliased to `bundle open`
- `bu` aliased to `bundle update`
- `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`)
- adds a wrapper for common gems:
- looks for a binstub under `./bin/` and executes it (if present)
- calls `bundle exec <gem executable>` otherwise
For a full list of *common gems* being wrapped by default please look at the `bundler.plugin.zsh` file.
## Configuration
Please use the exact name of the executable and not the gem name.
### Add additional gems to be wrapped
Add this before the plugin-list in your `.zshrc`:
```sh
BUNDLED_COMMANDS=(rubocop)
plugins=(... bundler ...)
```
This will add the wrapper for the `rubocop` gem (i.e. the executable).
### Exclude gems from being wrapped
Add this before the plugin-list in your `.zshrc`:
```sh
UNBUNDLED_COMMANDS=(foreman spin)
plugins=(... bundler ...)
```
This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped.
## Excluded gems
These gems should not be called with `bundle exec`. Please see the Issues on GitHub for clarification.
`berks`
`foreman`
`mailcatcher`
`rails`
`ruby`
`spin`

View File

@ -18,11 +18,13 @@ case $state in
"check[Determine whether the requirements for your application are installed]" \ "check[Determine whether the requirements for your application are installed]" \
"list[Show all of the gems in the current bundle]" \ "list[Show all of the gems in the current bundle]" \
"show[Show the source location of a particular gem in the bundle]" \ "show[Show the source location of a particular gem in the bundle]" \
"outdated[Show all of the outdated gems in the current bundle]" \
"console[Start an IRB session in the context of the current bundle]" \ "console[Start an IRB session in the context of the current bundle]" \
"open[Open an installed gem in the editor]" \ "open[Open an installed gem in the editor]" \
"viz[Generate a visual representation of your dependencies]" \ "viz[Generate a visual representation of your dependencies]" \
"init[Generate a simple Gemfile, placed in the current directory]" \ "init[Generate a simple Gemfile, placed in the current directory]" \
"gem[Create a simple gem, suitable for development with bundler]" \ "gem[Create a simple gem, suitable for development with bundler]" \
"platform[Displays platform compatibility information]" \
"clean[Cleans up unused gems in your bundler directory]" \ "clean[Cleans up unused gems in your bundler directory]" \
"help[Describe available tasks or one specific task]" "help[Describe available tasks or one specific task]"
ret=0 ret=0
@ -39,11 +41,13 @@ case $state in
'check' \ 'check' \
'list' \ 'list' \
'show' \ 'show' \
'outdated' \
'console' \ 'console' \
'open' \ 'open' \
'viz' \ 'viz' \
'init' \ 'init' \
'gem' \ 'gem' \
'platform' \
'help' && ret=0 'help' && ret=0
;; ;;
install) install)
@ -71,6 +75,15 @@ case $state in
'(--verbose)--verbose[Enable verbose output mode]' '(--verbose)--verbose[Enable verbose output mode]'
ret=0 ret=0
;; ;;
outdated)
_arguments \
'(--pre)--pre[Check for newer pre-release gems]' \
'(--source)--source[Check against a specific source]' \
'(--local)--local[Do not attempt to fetch gems remotely and use the gem cache instead]' \
'(--no-color)--no-color[Disable colorization in output]' \
'(--verbose)--verbose[Enable verbose output mode]'
ret=0
;;
(open|show) (open|show)
_gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') ) _gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') )
if [[ $_gems != "" ]]; then if [[ $_gems != "" ]]; then

View File

@ -5,15 +5,49 @@ alias bo="bundle open"
alias bu="bundle update" alias bu="bundle update"
alias bi="bundle_install" alias bi="bundle_install"
# The following is based on https://github.com/gma/bundler-exec bundled_commands=(
annotate
bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard irb jekyll kitchen knife middleman nanoc puma rackup rainbows rake rspec ruby shotgun spec spin spork spring strainer tailor taps thin thor unicorn unicorn_rails) cap
capify
cucumber
foodcritic
guard
irb
jekyll
kitchen
knife
middleman
nanoc
pry
puma
rackup
rainbows
rake
rspec
shotgun
sidekiq
spec
spork
spring
strainer
tailor
taps
thin
thor
unicorn
unicorn_rails
)
# Remove $UNBUNDLED_COMMANDS from the bundled_commands list # Remove $UNBUNDLED_COMMANDS from the bundled_commands list
for cmd in $UNBUNDLED_COMMANDS; do for cmd in $UNBUNDLED_COMMANDS; do
bundled_commands=(${bundled_commands#$cmd}); bundled_commands=(${bundled_commands#$cmd});
done done
# Add $BUNDLED_COMMANDS to the bundled_commands list
for cmd in $BUNDLED_COMMANDS; do
bundled_commands+=($cmd);
done
## Functions ## Functions
bundle_install() { bundle_install() {
@ -48,9 +82,17 @@ _within-bundled-project() {
false false
} }
_binstubbed() {
[ -f "./bin/${1}" ]
}
_run-with-bundler() { _run-with-bundler() {
if _bundler-installed && _within-bundled-project; then if _bundler-installed && _within-bundled-project; then
if _binstubbed $1; then
./bin/$@
else
bundle exec $@ bundle exec $@
fi
else else
$@ $@
fi fi
@ -66,4 +108,3 @@ for cmd in $bundled_commands; do
compdef _$cmd bundled_$cmd=$cmd compdef _$cmd bundled_$cmd=$cmd
fi fi
done done

View File

@ -29,15 +29,23 @@ open_jira_issue () {
return 0 return 0
fi fi
if [ -f .jira-prefix ]; then
jira_prefix=$(cat .jira-prefix)
elif [ -f ~/.jira-prefix ]; then
jira_prefix=$(cat ~/.jira-prefix)
else
jira_prefix=""
fi
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "Opening new issue" echo "Opening new issue"
$open_cmd "$jira_url/secure/CreateIssue!default.jspa" $open_cmd "$jira_url/secure/CreateIssue!default.jspa"
else else
echo "Opening issue #$1" echo "Opening issue #$1"
if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then
$open_cmd "$jira_url/issues/$1" $open_cmd "$jira_url/issues/$jira_prefix$1"
else else
$open_cmd "$jira_url/browse/$1" $open_cmd "$jira_url/browse/$jira_prefix$1"
fi fi
fi fi
} }

View File

@ -129,6 +129,8 @@ function listMavenCompletions {
tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy
# tomcat7 # tomcat7
tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy
# spring-boot
spring-boot:run spring-boot:repackage
# exec # exec
exec:exec exec:java exec:exec exec:java
# versions # versions

View File

@ -174,12 +174,16 @@ function itunes() {
next|previous) next|previous)
opt="$opt track" opt="$opt track"
;; ;;
vol)
opt="set sound volume to $1" #$1 Due to the shift
;;
""|-h|--help) ""|-h|--help)
echo "Usage: itunes <option>" echo "Usage: itunes <option>"
echo "option:" echo "option:"
echo "\tlaunch|play|pause|stop|rewind|resume|quit" echo "\tlaunch|play|pause|stop|rewind|resume|quit"
echo "\tmute|unmute\tcontrol volume set" echo "\tmute|unmute\tcontrol volume set"
echo "\tnext|previous\tplay next or previous track" echo "\tnext|previous\tplay next or previous track"
echo "\tvol\tSet the volume, takes an argument from 0 to 100"
echo "\thelp\tshow this message and exit" echo "\thelp\tshow this message and exit"
return 0 return 0
;; ;;
@ -190,4 +194,3 @@ function itunes() {
esac esac
osascript -e "tell application \"iTunes\" to $opt" osascript -e "tell application \"iTunes\" to $opt"
} }

View File

@ -1,6 +1,8 @@
# Aliases to stop, start and restart Postgres # Aliases to control Postgres
# Paths noted below are for Postgress installed via Homebrew on OSX # Paths noted below are for Postgres installed via Homebrew on OSX
alias startpost='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start' alias startpost='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'
alias stoppost='pg_ctl -D /usr/local/var/postgres stop -s -m fast' alias stoppost='pg_ctl -D /usr/local/var/postgres stop -s -m fast'
alias restartpost='stoppost && sleep 1 && startpost' alias restartpost='stoppost && sleep 1 && startpost'
alias reloadpost='pg_ctl reload -D /usr/local/var/postgres -s'
alias statuspost='pg_ctl status -D /usr/local/var/postgres -s'

View File

@ -6,6 +6,7 @@ alias gemsets='rvm gemset list'
local ruby18='ruby-1.8.7' local ruby18='ruby-1.8.7'
local ruby19='ruby-1.9.3' local ruby19='ruby-1.9.3'
local ruby20='ruby-2.0.0' local ruby20='ruby-2.0.0'
local ruby21='ruby-2.1.1'
function rb18 { function rb18 {
if [ -z "$1" ]; then if [ -z "$1" ]; then
@ -40,6 +41,17 @@ function rb20 {
_rb20() {compadd `ls -1 $rvm_path/gems | grep "^$ruby20@" | sed -e "s/^$ruby20@//" | awk '{print $1}'`} _rb20() {compadd `ls -1 $rvm_path/gems | grep "^$ruby20@" | sed -e "s/^$ruby20@//" | awk '{print $1}'`}
compdef _rb20 rb20 compdef _rb20 rb20
function rb21 {
if [ -z "$1" ]; then
rvm use "$ruby21"
else
rvm use "$ruby21@$1"
fi
}
_rb21() {compadd `ls -1 $rvm_path/gems | grep "^$ruby21@" | sed -e "s/^$ruby21@//" | awk '{print $1}'`}
compdef _rb21 rb21
function rvm-update { function rvm-update {
rvm get head rvm get head
} }

View File

@ -1,22 +1,23 @@
# Symfony2 basic command completion # Symfony2 basic command completion
_symfony2_get_command_list () { _symfony2_get_command_list () {
php app/console --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }' php $(find . -maxdepth 2 -mindepth 1 -name 'console') --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
} }
_symfony2 () { _symfony2 () {
if [ -f app/console ]; then if [ -f $(find . -maxdepth 2 -mindepth 1 -name 'console') ]; then
compadd `_symfony2_get_command_list` compadd `_symfony2_get_command_list`
fi fi
} }
compdef _symfony2 app/console compdef _symfony2 $(find . -maxdepth 2 -mindepth 1 -name 'console')
compdef _symfony2 sf compdef _symfony2 sf
#Alias #Alias
alias sf='php app/console' alias sf='php $(find . -maxdepth 2 -mindepth 1 -name 'console') '
alias sfcl='php app/console cache:clear' alias sfcl='php $(find . -maxdepth 2 -mindepth 1 -name 'console') cache:clear'
alias sfroute='php app/console router:debug' alias sfcw='php $(find . -maxdepth 2 -mindepth 1 -name 'console') cache:warmup'
alias sfcontainer='php app/console container:debug' alias sfroute='php $(find . -maxdepth 2 -mindepth 1 -name 'console') router:debug'
alias sfgb='php app/console generate:bundle' alias sfcontainer='php $(find . -maxdepth 2 -mindepth 1 -name 'console') container:debug'
alias sfgb='php $(find . -maxdepth 2 -mindepth 1 -name 'console') generate:bundle'

View File

@ -58,7 +58,7 @@ wd_warp()
#wd_print_msg $BLUE "Warping..." #wd_print_msg $BLUE "Warping..."
cd ${points[$1]} cd ${points[$1]}
else else
wd_print_msg $RED "Unkown warp point '$1'" wd_print_msg $RED "Unknown warp point '$1'"
fi fi
} }

View File

@ -1,4 +1,4 @@
PROMPT='%{$fg[green]%} %% ' PROMPT='%(?,%{$fg[green]%},%{$fg[red]%}) %% '
# RPS1='%{$fg[blue]%}%~%{$reset_color%} ' # RPS1='%{$fg[blue]%}%~%{$reset_color%} '
RPS1='%{$fg[white]%}%2~$(git_prompt_info) %{$fg_bold[blue]%}%m%{$reset_color%}' RPS1='%{$fg[white]%}%2~$(git_prompt_info) %{$fg_bold[blue]%}%m%{$reset_color%}'
@ -6,4 +6,3 @@ ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}("
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ⚡%{$fg[yellow]%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ⚡%{$fg[yellow]%}"