-
-
Notifications
You must be signed in to change notification settings - Fork 986
Open
Labels
Description
Trying to import gems locally is throwing an error:
NoMethodError: undefined method `owner' for an instance of User (NoMethodError)
/Users/bradly/code/archive/rubygems.org/app/models/pusher.rb:11:in `initialize'
/Users/bradly/code/archive/rubygems.org/lib/tasks/gemcutter.rake:21:in `new'
In the rake take we pass a new user instance to the Pusher initializer:
rubygems.org/lib/tasks/gemcutter.rake
Line 21 in d5ec157
| cutter = Pusher.new(User.new, File.open(path)) |
But in the Pusher class we are expecting an api_key and calling owner on it.
rubygems.org/app/models/pusher.rb
Lines 9 to 11 in d5ec157
| def initialize(api_key, body, request: nil) | |
| @api_key = api_key | |
| @owner = api_key.owner |
Steps to Reproduce
- bundle exec rake "gemcutter:import:process[$gem_install_path]"
Expected Behavior
Gems should be imported
Current Behavior
Error calling .owner on a User instance
Possible Solution
Change the rake task to pass an api key instance instead of a user instance
The following worked but felt a little sketchy. Is there a better solution?
api_key = ApiKey.first
api_key.owner ||= User.new
cutter = Pusher.new(ApiKey.first, File.open(path))Environment
RubyGems version: latest code frommaster
Reactions are currently unavailable