Sha256: 95637d5e49601f8c0fdd97f3fdabf85bb41d52bbbc55ac26b13816f271c56ce9

Contents?: true

Size: 602 Bytes

Versions: 2

Compression:

Stored size: 602 Bytes

Contents

require 'yaml'

namespace :nvd do 
  desc 'Execute NVD migrations'
  task :migrate => :environment do
    db_connect
    ActiveRecord::Migrator.migrate(File.join FIDIUS::CveDb::GEM_BASE, 'db', 'migrate')
  end
  
  desc "Drop NVD database"
  task :drop do
    #db_connect
    raise NotImplementedError
    
  end
end

def db_connect
  db_config = YAML.load_file(File.join(Rails.root.to_s, 'config', 'database.yml'))
    if db_config["cve_db"]
      ActiveRecord::Base::establish_connection db_config["cve_db"]
    else
      puts "No configuration found for cve_db in config/database.yml!"
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fidius-cvedb-0.0.8 lib/tasks/nvd_migrate.rake
fidius-cvedb-0.0.7 lib/tasks/nvd_migrate.rake