Skip to content

Discover gems to adopt through API calls #8

Description

@benjaminoakes

Goals

  • Script finding repos
  • Gems gem to search for ruby gems that…
    • Are archived on GitHub (need to call GitHub API, either directly through REST/GraphQL or through a gem)
    • High download count
    • Last updated > x ago

Spike

Query for homepage URLs using Fabio Rehm (who we adopted rake-notes from)

ℹ️ I don't hold any of the names in this code closely. Feel free to change them as you like.

# query_gems.rb
class QueryGems
  def initialize(username:)
    @username = username
  end

  def results
    Gems.
      gems(@username).
      map { |gem| Gems.info(gem["name"])["homepage_uri"] }.
      sort
  end
end

Let's try using the default test framework for a bit and see how we like it:

# query_gems_test.rb
require "test_helper"

class QueryGemsTest < ActiveSupport::TestCase
  test "#gems" do
    query = QueryGems.new(username: "fgrehm")

    results = query.results

     assert_equal results, [
       "",
       "http://github.com/fgrehm/autotestforphp",
       "http://github.com/fgrehm/tiny-rails",
       "https://github.com/Helabs/jumpup-deis",
       "https://github.com/Helabs/jumpup-hipchat",
       "https://github.com/PetroFeed/actionpusher",
       "https://github.com/doximity/rsg",
       "https://github.com/fgrehm/bindler",
       "https://github.com/fgrehm/docker-provider",
       "https://github.com/fgrehm/letter_opener_web",
       "https://github.com/fgrehm/middleman-draft-articles",
       "https://github.com/fgrehm/rake-notes",
       "https://github.com/fgrehm/vagrant-boxen",
       "https://github.com/fgrehm/vagrant-cachier",
       "https://github.com/fgrehm/vagrant-global-status",
       "https://github.com/fgrehm/vagrant-lxc",
       "https://github.com/fgrehm/vagrant-notify",
       "https://github.com/fgrehm/vagrant-pristine",
       "https://github.com/fgrehm/ventriloquist",
       "https://github.com/fgrehm/vocker",
       "https://github.com/fgrehm/vundler",
     ]
  end
end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions