Files
snpr/lib/tasks/update_snpedia_marshall_array.rake
Helge Rausch 906eef5403 Update gems (#338)
* Passwords now need to be 8 characters long (new default in authlogic).
* To login to the Sidekiq web interface, log in to opensnp.org, if you
  have the `admin` flag set, you will find it at the usual place.
* I finally found out why Rubocop didn't complain about the frozen string literal pragma missing and added all of them.
* Rubocop complained about keyword arguments, which is only relevant for Rails 5, so I disabled the cop.
* I removed the `inherit_from: .rubocop_todo.yml` from `.rubocop.yml`, so Hound does complain about **all** the issues. I also added a few tasks for running Rubocop.
2017-01-04 15:30:22 +01:00

24 lines
652 B
Ruby

# frozen_string_literal: true
require 'media_wiki'
namespace :snpedia do
desc "update snpedia array"
task :download => :environment do
file = Rails::root.join('marshalled_snpedia_array')
old = Marshal.load(File.open(file))
puts "There are #{old.length} SNPs in the old array"
mw = MediaWiki::Gateway.new("http://bots.snpedia.com/api.php")
puts 'Downloading all SNPs'
new = mw.category_members('Category:Is_a_snp')
new.map! { |x| x.downcase }
puts "There are #{new.length} SNPs in the new array, dumping now"
File.open(file, 'wb') do |f|
f.write Marshal.dump(new)
end
puts "Done!"
end
end