WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Use Travis CI to download Rubygems data for listed gems #42

@ashmaroli

Description

@ashmaroli

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions