diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-11-11 15:05:59 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-11-11 17:24:08 +0900 |
commit | 28611be6ee84ba8eb19e667a70ae129833b98b8b (patch) | |
tree | d6556c2f06de009ebe7aa19564372f6251ad36e0 /spec/bundler/support/artifice/compact_index_precompiled_before.rb | |
parent | de159c5a855dd53bfd9ce284c9099306724560a7 (diff) |
Merge RubyGems/Bundler master from ee2f8398324af4bc1b95f7565ce2fda98126e026v3_2_0_preview3
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6715
Diffstat (limited to 'spec/bundler/support/artifice/compact_index_precompiled_before.rb')
-rw-r--r-- | spec/bundler/support/artifice/compact_index_precompiled_before.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/bundler/support/artifice/compact_index_precompiled_before.rb b/spec/bundler/support/artifice/compact_index_precompiled_before.rb new file mode 100644 index 0000000000..9f310e653b --- /dev/null +++ b/spec/bundler/support/artifice/compact_index_precompiled_before.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require_relative "compact_index" + +Artifice.deactivate + +class CompactIndexPrecompiledBefore < CompactIndexAPI + get "/info/:name" do + etag_response do + gem = gems.find {|g| g.name == params[:name] } + move_ruby_variant_to_the_end(CompactIndex.info(gem ? gem.versions : [])) + end + end + + private + + def move_ruby_variant_to_the_end(response) + lines = response.split("\n") + ruby = lines.find {|line| /\A\d+\.\d+\.\d* \|/.match(line) } + lines.delete(ruby) + lines.push(ruby).join("\n") + end +end + +Artifice.activate_with(CompactIndexPrecompiledBefore) |