diff --git a/lib/rvm.zsh b/lib/rvm.zsh index 597be1b3..cb870a9b 100644 --- a/lib/rvm.zsh +++ b/lib/rvm.zsh @@ -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)" } - - diff --git a/plugins/cap/cap.plugin.zsh b/plugins/cap/cap.plugin.zsh index 8336182d..d22d1040 100644 --- a/plugins/cap/cap.plugin.zsh +++ b/plugins/cap/cap.plugin.zsh @@ -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 diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh new file mode 100644 index 00000000..c9b762d0 --- /dev/null +++ b/plugins/composer/composer.plugin.zsh @@ -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' \ No newline at end of file diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh new file mode 100644 index 00000000..636e4619 --- /dev/null +++ b/plugins/jira/jira.plugin.zsh @@ -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' diff --git a/plugins/nanoc/_nanoc b/plugins/nanoc/_nanoc new file mode 100644 index 00000000..fde07c3f --- /dev/null +++ b/plugins/nanoc/_nanoc @@ -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 site’s CSS' + 'validate-html:validate the site’s 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 diff --git a/plugins/nanoc/nanoc.plugin.zsh b/plugins/nanoc/nanoc.plugin.zsh new file mode 100644 index 00000000..5a506461 --- /dev/null +++ b/plugins/nanoc/nanoc.plugin.zsh @@ -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' diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh index 64426684..22340129 100644 --- a/plugins/symfony2/symfony2.plugin.zsh +++ b/plugins/symfony2/symfony2.plugin.zsh @@ -10,4 +10,8 @@ _symfony2 () { fi } -compdef _symfony2 app/console \ No newline at end of file +compdef _symfony2 app/console + +#Alias +alias sf2='php app/console' +alias sf2clear='php app/console cache:clear' \ No newline at end of file diff --git a/plugins/urltools/urltools.plugin.zsh b/plugins/urltools/urltools.plugin.zsh new file mode 100644 index 00000000..0d29314d --- /dev/null +++ b/plugins/urltools/urltools.plugin.zsh @@ -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])"' \ No newline at end of file diff --git a/plugins/zeus/README.md b/plugins/zeus/README.md new file mode 100644 index 00000000..4409943f --- /dev/null +++ b/plugins/zeus/README.md @@ -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` diff --git a/plugins/zeus/zeus.plugin.zsh b/plugins/zeus/zeus.plugin.zsh new file mode 100644 index 00000000..2fc7e1eb --- /dev/null +++ b/plugins/zeus/zeus.plugin.zsh @@ -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'