From 00a2c8160250820257175a5a1109c5d6d886d18f Mon Sep 17 00:00:00 2001 From: tinogomes Date: Thu, 12 May 2011 08:24:50 -0300 Subject: [PATCH] Added support for gem-open on gem plugin --- plugins/gem/_gem | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/gem/_gem b/plugins/gem/_gem index 83cba40d1..8ba88d440 100644 --- a/plugins/gem/_gem +++ b/plugins/gem/_gem @@ -7,6 +7,10 @@ _gem_installed() { installed_gems=(`gem list --local --no-versions`) } +_gem_installed_for_open() { + installed_gems=(`ruby -rubygems -e 'puts Dir["{#{Gem::SourceIndex.installed_spec_directories.join(",")}}/*.gemspec"].collect {|s| File.basename(s).gsub(/\.gemspec$/, "")}'`) +} + local -a _1st_arguments _1st_arguments=( 'cert:Manage RubyGems certificates and signing settings' @@ -22,6 +26,7 @@ _1st_arguments=( 'list:Display gems whose name starts with STRING' 'lock:Generate a lockdown list of gems' 'mirror:Mirror a gem repository' + 'open:Open a gem into your favorite editor (install gem-open before: "[sudo] gem install gem-open")' 'outdated:Display all gems that need updates' 'owner:Manage gem owners on RubyGems.org.' 'pristine:Restores installed gems to pristine condition from files located in the gem cache' @@ -61,4 +66,7 @@ case "$words[1]" in uninstall|update) _gem_installed _wanted installed_gems expl 'installed gems' compadd -a installed_gems ;; + open) + _gem_installed_for_open + _wanted installed_gems expl 'installed gems' compadd -a installed_gems ;; esac