Module: Gemstash::GemSource::DependencyCaching
- Included in:
- PrivateSource, UpstreamSource
- Defined in:
- lib/gemstash/gem_source/dependency_caching.rb
Overview
Module for caching dependencies in a GemSource.
Constant Summary collapse
- API_REQUEST_LIMIT =
200
Instance Method Summary collapse
Instance Method Details
#serve_dependencies ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/gemstash/gem_source/dependency_caching.rb', line 7 def serve_dependencies gems = gems_from_params if gems.length > API_REQUEST_LIMIT halt 422, "Too many gems (use --full-index instead)" end content_type "application/octet-stream" Marshal.dump dependencies.fetch(gems) end |
#serve_dependencies_json ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/gemstash/gem_source/dependency_caching.rb', line 18 def serve_dependencies_json gems = gems_from_params if gems.length > API_REQUEST_LIMIT halt 422, { "error" => "Too many gems (use --full-index instead)", "code" => 422 }.to_json end content_type "application/json;charset=UTF-8" dependencies.fetch(gems).to_json end |