Sha256: 9fde4537852f7d1de43b3b8d786244c031fe0638fd0ff56f52c0d6b2330ddc3f

Contents?: true

Size: 610 Bytes

Versions: 5

Compression:

Stored size: 610 Bytes

Contents

require 'bundler/lockfile_parser'

module Bundler::Advise
  class GemAdviser
    def initialize(advisories: Advisories.new, dir: Dir.pwd)
      @advisories = advisories
      @dir = dir
      scan_lockfile
    end

    def scan_lockfile
      lockfile = nil
      Dir.chdir(@dir) do
        lockfile = Bundler::LockfileParser.new(Bundler.read_file('Gemfile.lock'))
      end
      lockfile.specs.map do |spec|
        @advisories.gem_advisories_for(spec.name).select do |ad|
          ad.is_affected?(spec.version).tap { |res| ad.send(:gem_spec=, spec) if res }
        end
      end.flatten
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bundler-advise-1.1.4 lib/bundler/advise/gem_adviser.rb
bundler-advise-1.1.3 lib/bundler/advise/gem_adviser.rb
bundler-advise-1.1.2 lib/bundler/advise/gem_adviser.rb
bundler-advise-1.1.1 lib/bundler/advise/gem_adviser.rb
bundler-advise-1.1.0 lib/bundler/advise/gem_adviser.rb