Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions lib/bundler/gem_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,25 @@ def install_gem(built_gem_path = nil, local = false)
protected

def rubygem_push(path)
gem_command = %W[gem push #{path}]
gem_command << "--key" << gem_key if gem_key
gem_command << "--host" << allowed_push_host if allowed_push_host
args = ["gem", "push", path]
args += ["--key", gem_key] if gem_key
args += ["--host", allowed_push_host] if allowed_push_host

unless allowed_push_host || Bundler.user_home.join(".gem/credentials").file?
raise "Your rubygems.org credentials aren't set. Run `gem push` to set them."
end
sh(gem_command)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good if we could fix this problem in the sh method rather then just have the release task do its own output/input.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to push this into sh, I just wasn't sure if you would want to switch all of these functions over to that. Not sure of any other implications it may have.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@colby-swandale @kddeisz I had a look at this PR and the related one (#7108), and I tend to think that @kddeisz's approach is better. The fix in #7108 changes all the methods using the sh helper to print all of there stdout and stderr to the screen. That's quite verbose, specially in the case of rake build. We might still want to change that and print all those messages to the screen everytime, but for the shake of fixing this particular issue, I would only modify this specific method, which is also the only case where we should actually expect input from the user, I think.

What about extracting a sh_with_input method with the modified logic, and use it only here, for now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gosh yeah sorry this has languished for a while. I can take a look at this again later this week.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, let's wait for @colby-swandale's input first so that you don't do unnecessary work.


Bundler.ui.debug(args.join(" "))
SharedHelpers.chdir(base) do
IO.popen(args, :in => :in) do |io|
Thread.new { puts io.gets until io.eof? }.join
io.close
end
end

code = $?.exitstatus
exit code unless code.zero?

Bundler.ui.confirm "Pushed #{name} #{version} to #{gem_push_host}"
end

Expand Down