Class: Gemstash::GemSource::RubygemsSource

Inherits:
UpstreamSource show all
Defined in:
lib/gemstash/gem_source/upstream_source.rb

Overview

GemSource for rubygems.org (specifically when defined by using the default upstream).

Constant Summary

Constants included from DependencyCaching

DependencyCaching::API_REQUEST_LIMIT

Constants included from Logging

Logging::LEVELS

Class Method Summary collapse

Methods inherited from UpstreamSource

rack_env_rewriter, #serve_gem, #serve_marshal

Methods included from DependencyCaching

#serve_dependencies, #serve_dependencies_json

Methods inherited from RedirectSource

capture_user_agent, rack_env_rewriter, #serve_actual_gem, #serve_add_gem, #serve_add_spec_json, #serve_dependencies, #serve_dependencies_json, #serve_gem, #serve_info, #serve_latest_specs, #serve_marshal, #serve_names, #serve_prerelease_specs, #serve_remove_spec_json, #serve_root, #serve_specs, #serve_unyank, #serve_versions, #serve_yank

Methods inherited from Base

#initialize

Methods included from Logging

#log, #log_error, logger, reset, setup_logger

Constructor Details

This class inherits a constructor from Gemstash::GemSource::Base

Class Method Details

.matches?(env) ⇒ Boolean

Returns:

  • (Boolean)


198
199
200
201
202
203
204
205
206
207
# File 'lib/gemstash/gem_source/upstream_source.rb', line 198

def self.matches?(env)
  if env["HTTP_X_GEMFILE_SOURCE"].to_s.empty?
    env["gemstash.upstream"] = env["gemstash.env"].config[:rubygems_url]
  else
    env["gemstash.upstream"] = env["HTTP_X_GEMFILE_SOURCE"]
  end
  capture_user_agent(env)

  true
end