lib/tap/support/gems.rb in bahuvrihi-tap-0.10.7 vs lib/tap/support/gems.rb in bahuvrihi-tap-0.10.8
- old
+ new
@@ -1,9 +1,12 @@
require 'rubygems'
module Tap
module Support
+
+ # Methods for working with {RubyGems}[http://www.rubygems.org/]
+ # and other gems frequently used by Tap.
module Gems
module_function
# Returns the gemspec for the specified gem. A gem version
# can be specified in the name, like 'gem >= 1.2'. The gem
@@ -21,9 +24,12 @@
# load the gem and get the spec
gem(name, version)
Gem.loaded_specs[name]
end
+ # Selects gem specs for which the block returns true. If
+ # latest is specified, only the latest version of each
+ # gem will be passed to the block.
def select_gems(latest=true)
index = latest ?
Gem.source_index.latest_specs :
Gem.source_index.gems.collect {|(name, spec)| spec }
\ No newline at end of file