From 39bf502561ec31646ebc4887f1b7e4aba90ca32d Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Mon, 4 Nov 2024 17:24:49 +0100 Subject: [PATCH] Fix `gemcutter:import:process` It creates a `Pusher` with the first argument being a user but it expects an API key. Similarly, the api key/user must be present in the database for validations. --- lib/tasks/gemcutter.rake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/tasks/gemcutter.rake b/lib/tasks/gemcutter.rake index c2e0c61935c..d836a75616c 100644 --- a/lib/tasks/gemcutter.rake +++ b/lib/tasks/gemcutter.rake @@ -13,10 +13,13 @@ namespace :gemcutter do desc "Bring the gems through the gemcutter process" task :process, %i[gems_cache_path] => :environment do |_task, args| gems = Dir[File.join(args[:gems_cache_path] || "#{Gem.path.first}/cache", "*.gem")].reverse + api_key = ApiKey.first + raise("Importing gems requires a user with an API key. Run `bin/rails db:seed` to do so.") if api_key.nil? + puts "Processing #{gems.size} gems..." gems.each do |path| puts "Processing #{path}" - cutter = Pusher.new(User.new, File.open(path)) + cutter = Pusher.new(api_key, File.open(path)) cutter.process puts cutter.message unless cutter.code == 200