class Bundler::Audit::Database
and CVE number.
Represents the directory of advisories, grouped by gem name
def self.path
-
(String)
-
def self.path if File.directory?(USER_PATH) t1 = Dir.chdir(USER_PATH) { Time.parse(`git log --date=iso8601 --pretty="%cd" -1`).utc } t2 = VENDORED_TIMESTAMP if t1 >= t2 then USER_PATH else VENDORED_PATH end else VENDORED_PATH end end
def self.update!(options={})
- Since: - 0.3.0
Other tags:
- Note: -
Raises:
-
(ArgumentError)
-
Returns:
-
(Boolean, nil)
-
Options Hash:
(**options)
-
:quiet
(Boolean
) --
Parameters:
-
options
(Hash
) --
def self.update!(options={}) unless (options.keys - [:quiet]).empty? raise(ArgumentError,"Invalid option(s)") end if File.directory?(USER_PATH) if File.directory?(File.join(USER_PATH, ".git")) Dir.chdir(USER_PATH) do command = %w(git pull --no-rebase) command << '--quiet' if options[:quiet] command << 'origin' << 'master' system *command end end else command = %w(git clone) command << '--quiet' if options[:quiet] command << URL << USER_PATH system *command end end
def advisories(&block)
-
(Enumerator)
-
Other tags:
- Yieldparam: advisory -
Other tags:
- Yield: -
def advisories(&block) return enum_for(__method__) unless block_given? each_advisory_path do |path| yield Advisory.load(path) end end
def advisories_for(name)
-
(Enumerator)
-
Other tags:
- Yieldparam: advisory -
Other tags:
- Yield: -
Parameters:
-
name
(String
) --
def advisories_for(name) return enum_for(__method__,name) unless block_given? each_advisory_path_for(name) do |path| yield Advisory.load(path) end end
def check_gem(gem)
-
(Enumerator)
-
Other tags:
- Yieldparam: advisory -
Other tags:
- Yield: -
Parameters:
-
gem
(Gem::Specification
) --
def check_gem(gem) return enum_for(__method__,gem) unless block_given? advisories_for(gem.name) do |advisory| if advisory.vulnerable?(gem.version) yield advisory end end end
def each_advisory_path(&block)
- Yieldparam: path -
Other tags:
- Yield: -
def each_advisory_path(&block) Dir.glob(File.join(@path,'gems','*','*.yml'),&block) end
def each_advisory_path_for(name,&block)
- Yieldparam: path -
Other tags:
- Yield: -
Parameters:
-
name
(String
) --
def each_advisory_path_for(name,&block) Dir.glob(File.join(@path,'gems',name,'*.yml'),&block) end
def initialize(path=self.class.path)
-
(ArgumentError)
-
Parameters:
-
path
(String
) --
def initialize(path=self.class.path) unless File.directory?(path) raise(ArgumentError,"#{path.dump} is not a directory") end @path = path end
def inspect
-
(String)
-
def inspect "#<#{self.class}:#{self}>" end
def size
-
(Integer)
-
def size each_advisory_path.count end
def to_s
-
(String)
-
def to_s @path end