aboutsummaryrefslogtreecommitdiffstats
path: root/spec/bundler/support/artifice/endpoint_extra.rb
blob: ed4e87e65f495e92994e0702b0932cb434cad44d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true
require File.expand_path("../endpoint", __FILE__)

Artifice.deactivate

class EndpointExtra < Endpoint
  get "/extra/api/v1/dependencies" do
    halt 404
  end

  get "/extra/specs.4.8.gz" do
    File.read("#{gem_repo2}/specs.4.8.gz")
  end

  get "/extra/prerelease_specs.4.8.gz" do
    File.read("#{gem_repo2}/prerelease_specs.4.8.gz")
  end

  get "/extra/quick/Marshal.4.8/:id" do
    redirect "/extra/fetch/actual/gem/#{params[:id]}"
  end

  get "/extra/fetch/actual/gem/:id" do
    File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
  end

  get "/extra/gems/:id" do
    File.read("#{gem_repo2}/gems/#{params[:id]}")
  end
end

Artifice.activate_with(EndpointExtra)