Skip to content

Commit

Permalink
modify spec searching to not fail hard and to work across multiple ru…
Browse files Browse the repository at this point in the history
…bygems versions
  • Loading branch information
cldwalker committed Aug 15, 2011
1 parent 4b27b40 commit 899f56d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/boson/libraries/gem_library.rb
Expand Up @@ -10,7 +10,10 @@ module Boson
class GemLibrary < Library
#:stopdoc:
def self.is_a_gem?(name)
Object.const_defined?(:Gem) && Gem::Specification.find_by_name(name).is_a?(Gem::Specification)
return false unless defined? Gem
Gem::VERSION >= '1.8.0' ?
Gem::Specification.find_all_by_name(name)[0].is_a?(Gem::Specification) :
Gem.searcher.find(name).is_a?(Gem::Specification)
end

handles {|source| is_a_gem?(source.to_s) }
Expand All @@ -24,4 +27,4 @@ def load_source_and_set_module
end
#:startdoc:
end
end
end

0 comments on commit 899f56d

Please sign in to comment.