The following Rake task takes the directory listing (_data/themes.yml and _data/plugins.yml clubbed into a single _data/entries.yml) and downloads each gem into their respective directory
# frozen_string_literal: true
require "rubygems"
require "rake"
require "open-uri"
require "safe_yaml"
task :default do
entries = SafeYAML.load_file("_data/entries.yml")
entries.each do |type, list|
FileUtils.mkdir_p("_data/#{type}")
list.each do |item|
begin
data = open("https://rubygems.org/api/v1/gems/#{item}.yaml").read
File.open("_data/#{type}/#{item}.yml", "wb") { |file| file.puts data }
rescue OpenURI::HTTPError
puts "#{item} does not seem to exist at rubygems.org"
next
end
end
end
end
The data files can then be used to define the front end..
We can then set up Travis to download these files at a set interval..
Thoughts?
The following Rake task takes the directory listing (
_data/themes.ymland_data/plugins.ymlclubbed into a single_data/entries.yml) and downloads each gem into their respective directoryThe data files can then be used to define the front end..
We can then set up Travis to download these files at a set interval..
Thoughts?