Sha256: 7081a20cc5ebfaf6f2a6be77fc141653afbc0524378e1036503a008d49d32e9a

Contents?: true

Size: 563 Bytes

Versions: 4

Compression:

Stored size: 563 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)
        end
      end.flatten
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bundler-advise-1.0.3 lib/bundler/advise/gem_adviser.rb
bundler-advise-1.0.2 lib/bundler/advise/gem_adviser.rb
bundler-advise-1.0.1 lib/bundler/advise/gem_adviser.rb
bundler-advise-1.0.0 lib/bundler/advise/gem_adviser.rb