This commit is contained in:
Peter Tillemans 2012-10-12 09:34:21 +02:00
commit 55cc936d4e
10 changed files with 247 additions and 13 deletions

View file

@ -1,7 +1,5 @@
# get the name of the branch we are on
function rvm_prompt_info() {
ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) || return
echo "($ruby_version)"
[[ ! -z $ruby_version ]] && echo "($ruby_version)"
}

View file

@ -1,8 +1,30 @@
function _cap_does_task_list_need_generating () {
if [ ! -f .cap_tasks~ ]; then return 0;
stat -f%m . > /dev/null 2>&1
if [ "$?" = 0 ]; then
stat_cmd=(stat -f%m)
else
stat_cmd=(stat -L --format=%y)
fi
# Cache filename
_cap_show_undescribed_tasks=0
# Cache filename
_cap_task_cache_file='.cap_task_cache'
_cap_get_task_list () {
if [ ${_cap_show_undescribed_tasks} -eq 0 ]; then
cap -T | grep '^cap' | cut -d " " -f 2
else
accurate=$(stat -f%m .cap_tasks~)
changed=$(stat -f%m config/deploy.rb)
cap -vT | grep '^cap' | cut -d " " -f 2
fi
}
_cap_does_task_list_need_generating () {
if [ ! -f ${_cap_task_cache_file} ]; then return 0;
else
accurate=$($stat_cmd $_cap_task_cache_file)
changed=$($stat_cmd config/deploy.rb)
return $(expr $accurate '>=' $changed)
fi
}
@ -10,12 +32,10 @@ function _cap_does_task_list_need_generating () {
function _cap () {
if [ -f config/deploy.rb ]; then
if _cap_does_task_list_need_generating; then
echo "\nGenerating .cap_tasks~..." > /dev/stderr
cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D'
> .cap_tasks~
_cap_get_task_list > ${_cap_task_cache_file}
fi
compadd `cat .cap_tasks~`
compadd `cat ${_cap_task_cache_file}`
fi
}
compctl -K _cap cap
compdef _cap cap

View file

@ -0,0 +1,29 @@
# ------------------------------------------------------------------------------
# FILE: composer.plugin.zsh
# DESCRIPTION: oh-my-zsh composer plugin file.
# AUTHOR: Daniel Gomes (me@danielcsgomes.com)
# VERSION: 1.0.0
# ------------------------------------------------------------------------------
# Composer basic command completion
_composer_get_command_list () {
composer --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
}
_composer () {
if [ -f composer.json ]; then
compadd `_composer_get_command_list`
fi
}
compdef _composer composer
# Aliases
alias c='composer'
alias csu='composer self-update'
alias cu='composer update'
alias ci='composer install'
alias ccp='composer create-project'
# install composer in the current directory
alias cget='curl -s https://getcomposer.org/installer | php'

View file

@ -0,0 +1,22 @@
# To use: add a .jira-url file in the base of your project
# Setup: cd to/my/project
# echo "https://name.jira.com" >> .jira-url
# Usage: jira # opens a new issue
# jira ABC-123 # Opens an existing issue
open_jira_issue () {
if [ ! -f .jira-url ]; then
echo "There is no .jira-url file in the current directory..."
return 0;
else
jira_url=$(cat .jira-url);
if [ -z "$1" ]; then
echo "Opening new issue";
`open $jira_url/secure/CreateIssue!default.jspa`;
else
echo "Opening issue #$1";
`open $jira_url/issues/$1`;
fi
fi
}
alias jira='open_jira_issue'

44
plugins/nanoc/_nanoc Normal file
View file

@ -0,0 +1,44 @@
#compdef nanoc
#autoload
# nanoc zsh completion - based on the homebrew zsh completion
# requires the 'nanoc' gem to be installed
local -a _1st_arguments
_1st_arguments=(
'autocompile:start the autocompiler'
'compile:compile items of this site'
'create-item:create an item'
'create-layout:create a layout'
'create-site:create a site'
'deploy:deploy the compiled site'
'help:show help'
'prune:remove files not managed by nanoc from the output directory'
'show-data:show data in this site'
'show-plugins:show all available plugins'
'show-rules:describe the rules for each item'
'update:update the data stored by the data source to a newer version'
'validate-css:validate the sites CSS'
'validate-html:validate the sites HTML'
'validate-links:validate links in site'
'view:start the web server that serves static files'
'watch:start the watcher'
)
local expl
local -a pkgs installed_pkgs
_arguments \
'(--color)--color[enable color]' \
'(--debug)--debug[enable debugging]' \
'(--help)--help[show the help message and quit]' \
'(--no-color)--no-color[disable color]' \
'(--verbose)--verbose[make nanoc output more detailed]' \
'(--version)--version[show version information and quit]' \
'(--warn)--warn[enable warnings]' \
'*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "nanoc subcommand" _1st_arguments
return
fi

View file

@ -0,0 +1,9 @@
alias n='nanoc'
alias na='nanoc autocompile'
alias nco='nanoc compile'
alias nci='nanoc create_item'
alias ncl='nanoc create_layout'
alias ncs='nanoc create_site'
alias nd='nanoc deploy'
alias nv='nanoc view'
alias nw='nanoc watch'

View file

@ -10,4 +10,8 @@ _symfony2 () {
fi
}
compdef _symfony2 app/console
compdef _symfony2 app/console
#Alias
alias sf2='php app/console'
alias sf2clear='php app/console cache:clear'

View file

@ -0,0 +1,9 @@
# URL Tools
# Adds handy command line aliases useful for dealing with URLs
#
# Taken from:
# http://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'

41
plugins/zeus/README.md Normal file
View file

@ -0,0 +1,41 @@
## zeus
**Maintainer:** [b4mboo](https://github.com/b4mboo)
* `zi` aliases `zeus init`
* `zinit` aliases `zeus init`
* `zs` aliases `zeus start`
* `ztart` aliases `zeus start`
* `zc` aliases `zeus console`
* `zonsole` aliases `zeus console`
* `zsr` aliases `zeus server`
* `zerver` aliases `zeus server`
* `zr` aliases `zeus rake`
* `zake` aliases `zeus rake`
* `zg` aliases `zeus generate`
* `zenerate` aliases `zeus generate`
* `zrn` aliases `zeus runner`
* `zunner` aliases `zeus runner`
* `zcu` aliases `zeus cucumber`
* `zucumber` aliases `zeus cucumber`
* `zt` aliases `zeus test`
* `zest` aliases `zeus test`
* `zu` aliases `zeus test test/unit/*`
* `zunits` aliases `zeus test test/unit/*`
* `zf` aliases `zeus test test/functional/*`
* `zunctional` aliases `zeus test test/functional/*`
* `za` aliases `zeus test test/unit/*; zeus test test/functional/; zeus cucumber`
* `zall` aliases `zeus test test/unit/*; zeus test test/functional/; zeus cucumber`
* `zsw` aliases `rm .zeus.sock`
* `zweep` aliases `rm .zeus.sock`

View file

@ -0,0 +1,58 @@
# Some aliases for zeus. (See: https://github.com/burke/zeus)
# Zeus preloads your Rails environment and forks that process whenever
# needed. This effectively speeds up Rails' boot process to under 1 sec.
# Always use bundler.
# Rails depends on bundler, so we can be pretty sure, that there are no
# problems with this command. For all the other aliases I provided an
# alternative, in case people have conflicts with other plugins (e.g. suse).
alias zeus='bundle exec zeus'
# Init
alias zi='zeus init'
alias zinit='zeus init'
# Start
alias zs='zeus start'
alias ztart='zeus start'
# Console
alias zc='zeus console'
alias zonsole='zeus console'
# Server
alias zsr='zeus server'
alias zerver='zeus server'
# Rake
alias zr='zeus rake'
alias zake='zeus rake'
# Generate
alias zg='zeus generate'
alias zenerate='zeus generate'
# Runner
alias zrn='zeus runner'
alias zunner='zeus runner'
# Cucumber
alias zcu='zeus cucumber'
alias zucumber='zeus cucumber'
# Test
alias zt='zeus test'
alias zest='zeus test'
alias zu='zeus test test/unit/*'
alias zunits='zeus test test/unit/*'
alias zf='zeus test test/functional/*'
alias zunctional='zeus test test/functional/*'
alias za='zeus test test/unit/*; zeus test test/functional/; zeus cucumber'
alias zall='zeus test test/unit/*; zeus test test/functional/; zeus cucumber'
# Clean up crashed zeus instances.
alias zsw='rm .zeus.sock'
alias zweep='rm .zeus.sock'