Added support for gem-open on gem plugin

This commit is contained in:
tinogomes 2011-05-12 08:24:50 -03:00
commit f750a5317a

View file

@ -7,6 +7,10 @@ _gem_installed() {
installed_gems=(`gem list --local --no-versions`) 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 local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'cert:Manage RubyGems certificates and signing settings' 'cert:Manage RubyGems certificates and signing settings'
@ -22,6 +26,7 @@ _1st_arguments=(
'list:Display gems whose name starts with STRING' 'list:Display gems whose name starts with STRING'
'lock:Generate a lockdown list of gems' 'lock:Generate a lockdown list of gems'
'mirror:Mirror a gem repository' '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' 'outdated:Display all gems that need updates'
'owner:Manage gem owners on RubyGems.org.' 'owner:Manage gem owners on RubyGems.org.'
'pristine:Restores installed gems to pristine condition from files located in the gem cache' 'pristine:Restores installed gems to pristine condition from files located in the gem cache'
@ -61,4 +66,7 @@ case "$words[1]" in
uninstall|update) uninstall|update)
_gem_installed _gem_installed
_wanted installed_gems expl 'installed gems' compadd -a installed_gems ;; _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 esac