Class: Topaz::List
- Inherits:
-
Object
- Object
- Topaz::List
- Defined in:
- lib/topaz.rb
Class Method Summary collapse
-
.list(type = :local) ⇒ Object
Returns an array of RubyGems.
Class Method Details
.list(type = :local) ⇒ Object
Returns an array of RubyGems. Set the ‘type` parameter to `:local`, `:remote`, or `:both` to have local or remote gems listed, respectively.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/topaz.rb', line 83 def list(type = :local) type = case type when :local '-l' when :remote '-r' when :both '-b' end if type == '-l' gems = Gem::cache.search '' list = [] gems.each do |g| list << [g.name, g.version.to_s] end list else `gem list #{type}`.scan(/^(\w+) \(([\d\.]+)/) end end |