Sha256: 15082b6ab229bde9dec429894cba4ec47c9a7796222163d77c1a485f0becddb9

Contents?: true

Size: 506 Bytes

Versions: 1

Compression:

Stored size: 506 Bytes

Contents

class AdvisoriesFixture
  attr_reader :dir

  def initialize
    @dir = File.join(Dir.tmpdir, 'advisory_db')
    FileUtils.makedirs @dir
  end

  def clean_up
    FileUtils.rmtree @dir
  end

  def save_advisory(ad)
    gem_path = File.join(@dir, 'gems', ad.gem)
    FileUtils.makedirs gem_path
    last_fn = Dir[File.join(gem_path, '*yml')].last || '000.yml'
    next_fn = "#{File.basename(last_fn, '.yml').next}.yml"
    File.open(File.join(gem_path, next_fn), 'wb') { |f| f.print ad.to_yaml }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bundler-advise-1.0.1 spec/fixture/advisories_fixture.rb