From 480ca2205846426c04fa46fb37e1f7246bba2b88 Mon Sep 17 00:00:00 2001 From: Helge Rausch Date: Mon, 16 Jun 2014 16:11:59 +0200 Subject: Make bundler plugin run binstubbed cmd if existing --- plugins/bundler/bundler.plugin.zsh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'plugins/bundler') diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 3338d78be..fc20f91b3 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -47,9 +47,17 @@ _within-bundled-project() { false } +_binstubbed() { + [ -f "./bin/${1}" ] +} + _run-with-bundler() { if _bundler-installed && _within-bundled-project; then - bundle exec $@ + if _binstubbed $1; then + bundle exec "./bin/$@" + else + bundle exec $@ + fi else $@ fi -- cgit v1.2.3-70-g09d2 From d29c53cb101d6949f9d2c341e511533046568b86 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Wed, 2 Jul 2014 12:22:33 +0200 Subject: split bundler-commands into seperate lines This makes adding, deleting and merging a lot easier. --- plugins/bundler/bundler.plugin.zsh | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'plugins/bundler') diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index fbdbc0244..12f516f14 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -5,9 +5,39 @@ alias bo="bundle open" alias bu="bundle update" alias bi="bundle_install" -# The following is based on https://github.com/gma/bundler-exec - -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) +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 + strainer + tailor + taps + thin + thor + unicorn + unicorn_rails +) # Remove $UNBUNDLED_COMMANDS from the bundled_commands list for cmd in $UNBUNDLED_COMMANDS; do @@ -74,4 +104,3 @@ for cmd in $bundled_commands; do compdef _$cmd bundled_$cmd=$cmd fi done - -- cgit v1.2.3-70-g09d2 From c4eec0b1349168a0c23819d153401ce7e802260c Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Wed, 2 Jul 2014 20:35:49 +0200 Subject: add sidekiq to bundler-commands closes #2779 --- 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 12f516f14..57fb20bea 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -27,6 +27,7 @@ bundled_commands=( rspec ruby shotgun + sidekiq spec spin spork -- cgit v1.2.3-70-g09d2 From a22e0256a35e6e3378f253090029abfaf917a81c Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Wed, 2 Jul 2014 20:36:16 +0200 Subject: remove foreman from bundler-commands closes #1825 --- plugins/bundler/bundler.plugin.zsh | 1 - 1 file changed, 1 deletion(-) (limited to 'plugins/bundler') diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 57fb20bea..0c981c924 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -12,7 +12,6 @@ bundled_commands=( capify cucumber foodcritic - foreman guard irb jekyll -- cgit v1.2.3-70-g09d2 From f5e69c6cab20f1ac6dbb67f0cd7b49d079e0a76c Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Wed, 2 Jul 2014 20:36:33 +0200 Subject: remove spin from bundler-commands closes #1817 --- plugins/bundler/bundler.plugin.zsh | 1 - 1 file changed, 1 deletion(-) (limited to 'plugins/bundler') diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 0c981c924..22f59db4f 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -28,7 +28,6 @@ bundled_commands=( shotgun sidekiq spec - spin spork strainer tailor -- cgit v1.2.3-70-g09d2 From fdbfd410907c30c28184a339323fd5703cbd2309 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Fri, 4 Jul 2014 14:29:16 +0200 Subject: remove ruby from bundler-commands related to #1587 closes #2200 closes #2561 --- plugins/bundler/bundler.plugin.zsh | 1 - 1 file changed, 1 deletion(-) (limited to 'plugins/bundler') diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 22f59db4f..cd54ad6fa 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -24,7 +24,6 @@ bundled_commands=( rainbows rake rspec - ruby shotgun sidekiq spec -- cgit v1.2.3-70-g09d2 From f8ea9270ebcb012aee8e0691e5ab2fc700e56492 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Fri, 4 Jul 2014 14:33:24 +0200 Subject: remove berkshelf from bundler-commands fixes #2076 --- plugins/bundler/bundler.plugin.zsh | 1 - 1 file changed, 1 deletion(-) (limited to 'plugins/bundler') diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index cd54ad6fa..fd65ad568 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -7,7 +7,6 @@ alias bi="bundle_install" bundled_commands=( annotate - berks cap capify cucumber -- cgit v1.2.3-70-g09d2 From 20c84eaafc0bddc8584902898c245dbe1a7b0f8f Mon Sep 17 00:00:00 2001 From: toooooooby Date: Wed, 15 May 2013 02:15:13 +0900 Subject: Add 'outdated' and 'platform' completions to bundler plugin --- plugins/bundler/_bundler | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'plugins/bundler') diff --git a/plugins/bundler/_bundler b/plugins/bundler/_bundler index 2ec3a5f9c..ba647ab80 100644 --- a/plugins/bundler/_bundler +++ b/plugins/bundler/_bundler @@ -18,11 +18,13 @@ case $state in "check[Determine whether the requirements for your application are installed]" \ "list[Show all of the gems in the current 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]" \ "open[Open an installed gem in the editor]" \ "viz[Generate a visual representation of your dependencies]" \ "init[Generate a simple Gemfile, placed in the current directory]" \ "gem[Create a simple gem, suitable for development with bundler]" \ + "platform[Displays platform compatibility information]" \ "clean[Cleans up unused gems in your bundler directory]" \ "help[Describe available tasks or one specific task]" ret=0 @@ -39,11 +41,13 @@ case $state in 'check' \ 'list' \ 'show' \ + 'outdated' \ 'console' \ 'open' \ 'viz' \ 'init' \ 'gem' \ + 'platform' \ 'help' && ret=0 ;; install) @@ -71,6 +75,15 @@ case $state in '(--verbose)--verbose[Enable verbose output mode]' 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) _gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') ) if [[ $_gems != "" ]]; then -- cgit v1.2.3-70-g09d2 From cfc98d3f8c234b48d34961ce18274ad365ebb97b Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Fri, 4 Jul 2014 14:56:44 +0200 Subject: remove double bundle exec --- 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 fd65ad568..254e0a364 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -82,7 +82,7 @@ _binstubbed() { _run-with-bundler() { if _bundler-installed && _within-bundled-project; then if _binstubbed $1; then - bundle exec "./bin/$@" + ./bin/$@ else bundle exec $@ fi -- cgit v1.2.3-70-g09d2 From 11f0d273b5849275909d5fcf37e4771e0449f897 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Fri, 4 Jul 2014 15:16:29 +0200 Subject: add spring to bundler-commands --- 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 254e0a364..fe098d854 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -27,6 +27,7 @@ bundled_commands=( sidekiq spec spork + spring strainer tailor taps -- cgit v1.2.3-70-g09d2 From b007fee187bb111c13c0c95b39763b28dc3f8ca0 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Fri, 4 Jul 2014 15:17:02 +0200 Subject: add pry to bundler-commands --- 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 fe098d854..4f9eea922 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -18,6 +18,7 @@ bundled_commands=( knife middleman nanoc + pry puma rackup rainbows -- cgit v1.2.3-70-g09d2 From 34bc91e79d8cbb7b889402746770f1671d9b5872 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Mon, 7 Jul 2014 14:23:37 +0200 Subject: added Bundler readme file --- plugins/bundler/README.md | 49 ++++++++++++++++++++++++++++++++++++++ plugins/bundler/bundler.plugin.zsh | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 plugins/bundler/README.md (limited to 'plugins/bundler') diff --git a/plugins/bundler/README.md b/plugins/bundler/README.md new file mode 100644 index 000000000..56f0c7176 --- /dev/null +++ b/plugins/bundler/README.md @@ -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=` (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 ` 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` diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 4f9eea922..9c920aa1f 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -100,6 +100,6 @@ for cmd in $bundled_commands; do alias $cmd=bundled_$cmd if which _$cmd > /dev/null 2>&1; then - compdef _$cmd bundled_$cmd=$cmd + compdef _$cmd bundled_$cmd=$cmd fi done -- cgit v1.2.3-70-g09d2 From 4b997429b3785aefa929732d7dbf431e7884bc4d Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Mon, 7 Jul 2014 20:07:02 +0200 Subject: add BUNDLED_COMMANDS functionality to bundler plugin --- plugins/bundler/bundler.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'plugins/bundler') diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 9c920aa1f..617dcde71 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -43,6 +43,11 @@ for cmd in $UNBUNDLED_COMMANDS; do bundled_commands=(${bundled_commands#$cmd}); done +# Add $BUNDLED_COMMANDS to the bundled_commands list +for cmd in $BUNDLED_COMMANDS; do + bundled_commands+=($cmd); +done + ## Functions bundle_install() { -- cgit v1.2.3-70-g09d2