Sha256: 28f1d8673eb94207765c6cde5e0aea49b10465ed64e00dc8bfe32f83fb0b662b

Contents?: true

Size: 586 Bytes

Versions: 7

Compression:

Stored size: 586 Bytes

Contents

module Spork::GemHelpers
  extend self

  def latest_specs
    Gem::Specification.inject({}) do |h, spec|
      h[spec.name] = spec if h[spec.name].nil? || (spec.version > h[spec.name].version)
      h
    end.values
  end

  def find_files_using_latest_spec(pattern)
    case
    when defined?(Bundler)
      Gem.find_files(pattern)
    when Gem.respond_to?(:find_files)
      latest_specs.map {  |spec| spec.matches_for_glob(pattern) }.flatten
    else
      STDERR.puts "No mechanism available to scan for other gems implementing Spork extensions."
      return []
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spork-1.0.0rc4 lib/spork/gem_helpers.rb
spork-1.0.0rc4-x86-mswin32 lib/spork/gem_helpers.rb
spork-1.0.0rc4-x86-mingw32 lib/spork/gem_helpers.rb
spork-1.0.0rc3 lib/spork/gem_helpers.rb
spork-1.0.0rc2 lib/spork/gem_helpers.rb
spork-1.0.0rc2-x86-mswin32 lib/spork/gem_helpers.rb
spork-1.0.0rc2-x86-mingw32 lib/spork/gem_helpers.rb