ruby/spec/bundler/support/artifice/endpoint_mirror_source.rb
2022-12-15 19:06:40 +09:00

17 lines
384 B
Ruby

# frozen_string_literal: true
require_relative "helpers/endpoint"
class EndpointMirrorSource < Endpoint
get "/gems/:id" do
if request.env["HTTP_X_GEMFILE_SOURCE"] == "https://server.example.org/"
File.binread("#{gem_repo1}/gems/#{params[:id]}")
else
halt 500
end
end
end
require_relative "helpers/artifice"
Artifice.activate_with(EndpointMirrorSource)