Module: Spork::GemHelpers
Defined Under Namespace
Classes: GemPath
Instance Method Summary collapse
Instance Method Details
#latest_load_paths ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/spork/gem_helpers.rb', line 19 def latest_load_paths case when defined?(Bundler) $LOAD_PATH.map { |p| File.(p) }.uniq when Gem.respond_to?(:path) Dir["{#{Gem.path.join(',')}}" + "/gems/*"].inject({}) do |h,f| gem_path = GemPath.new(f) if h[gem_path.name] h[gem_path.name] = gem_path if gem_path > h[gem_path.name] else h[gem_path.name] = gem_path end h end.values.map { |gem_path| File.("lib", gem_path.path) }.sort.uniq else STDERR.puts "No mechanism available to scan for other gems implementing spork hooks. " [] end end |