Class: RuboCop::Schema::Repo

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/rubocop/schema/repo.rb

Constant Summary collapse

TAGS_PER_PAGE =

GitHub public APIs have a rate limit of 60/hour when making unauthenticated requests. 100 items per page is the maximum allowed, which we’ll use to keep the number of requests to a minimum.

100
TAGS_URL_TEMPLATE =
-"https://api.github.com/repos/rubocop/%s/tags?page=%d&per_page=#{TAGS_PER_PAGE}"

Instance Method Summary collapse

Methods included from Helpers

#boolean, #deep_dup, #deep_merge, #http_get, #strip_html, #template, templates

Constructor Details

#initialize(dir, loader, &event_handler) ⇒ Repo

Returns a new instance of Repo.



18
19
20
21
22
23
# File 'lib/rubocop/schema/repo.rb', line 18

def initialize(dir, loader, &event_handler)
  @dir           = Pathname(dir)
  @loader        = loader
  @event_handler = event_handler
  @dir.mkpath
end

Instance Method Details

#buildObject



25
26
27
28
# File 'lib/rubocop/schema/repo.rb', line 25

def build
  ExtensionSpec::KNOWN_GEMS.each &method(:build_for_gem)
  Event.dispatch message: "Repo updated: #{@dir}", &@event_handler
end