From 60e104acd1710c04057d079cfa5ac9316762f580 Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Wed, 13 Jul 2011 22:41:09 +0100 Subject: merge bundler and bundle-exec plugins --- plugins/bundler/bundler.plugin.zsh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'plugins/bundler') diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index fb40e2cec..fcf3e85fc 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -1,3 +1,37 @@ alias be="bundle exec" alias bi="bundle install" alias bu="bundle update" + +# The following is based on https://github.com/gma/bundler-exec + +bundled_commands=(cap capify cucumber heroku rackup rails rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) + +## Functions + +_bundler-installed() { + which bundle > /dev/null 2>&1 +} + +_within-bundled-project() { + local check_dir=$PWD + while [ "$(dirname $check_dir)" != "/" ]; do + [ -f "$check_dir/Gemfile" ] && return + check_dir="$(dirname $check_dir)" + done + false +} + +_run-with-bundler() { + local command="$1" + shift + if _bundler-installed && _within-bundled-project; then + bundle exec $command "$@" + else + $command "$@" + fi +} + +## Main program +for cmd in $bundled_commands; do + alias $cmd="_run-with-bundler $cmd" +done -- cgit v1.2.3-70-g09d2 From ba5fa3abc8ccf1f05e48c9b201282792c956c337 Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Wed, 13 Jul 2011 22:41:36 +0100 Subject: alias bundle list --- plugins/bundler/bundler.plugin.zsh | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins/bundler') diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index fcf3e85fc..c91dc9ab9 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -1,5 +1,6 @@ alias be="bundle exec" alias bi="bundle install" +alias bl="bundle list" alias bu="bundle update" # The following is based on https://github.com/gma/bundler-exec -- cgit v1.2.3-70-g09d2 From 913cf5325264960d4c1dfe678a2adadeaecdbf6a Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Thu, 14 Jul 2011 17:34:18 +0100 Subject: refactor _run-with-bundler --- plugins/bundler/bundler.plugin.zsh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'plugins/bundler') diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index c91dc9ab9..e98bb4b46 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -23,12 +23,10 @@ _within-bundled-project() { } _run-with-bundler() { - local command="$1" - shift if _bundler-installed && _within-bundled-project; then - bundle exec $command "$@" + bundle exec $@ else - $command "$@" + $@ fi } -- cgit v1.2.3-70-g09d2 From 6bf468f92c9302f84d3b21358202c3a956cad02b Mon Sep 17 00:00:00 2001 From: Shane Emmons Date: Mon, 25 Jul 2011 08:02:25 -0700 Subject: add alias for `bundle package` to the bundler plugin --- plugins/bundler/bundler.plugin.zsh | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins/bundler') diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index e98bb4b46..f005700ff 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -2,6 +2,7 @@ alias be="bundle exec" alias bi="bundle install" alias bl="bundle list" alias bu="bundle update" +alias bp="bundle package" # The following is based on https://github.com/gma/bundler-exec -- cgit v1.2.3-70-g09d2 From 11fcdb844d67492080befd8dcd1f995deb26b8ee Mon Sep 17 00:00:00 2001 From: Ches Martin Date: Sat, 13 Aug 2011 04:53:23 +0700 Subject: Add guard to bundler plugin's wrapped commands --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/bundler') diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index f005700ff..a6c116407 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -6,7 +6,7 @@ alias bp="bundle package" # The following is based on https://github.com/gma/bundler-exec -bundled_commands=(cap capify cucumber heroku rackup rails rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) +bundled_commands=(cap capify cucumber guard heroku rackup rails rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) ## Functions -- cgit v1.2.3-70-g09d2