Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Fix rake release not prompting for OTP code
Browse files Browse the repository at this point in the history
Co-authored-by: Colby Swandale <[email protected]>
Co-authored-by: Kevin Deisz <[email protected]>
  • Loading branch information
3 people committed Jun 11, 2019
1 parent f694fe7 commit 1b2bbc7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/bundler/gem_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def rubygem_push(path)
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)
sh_with_input(gem_command)
Bundler.ui.confirm "Pushed #{name} #{version} to #{gem_push_host}"
end

Expand Down Expand Up @@ -180,6 +180,13 @@ def name
gemspec.name
end

def sh_with_input(cmd)
Bundler.ui.debug(cmd)
SharedHelpers.chdir(base) do
abort unless Kernel.system(*cmd)
end
end

def sh(cmd, &block)
out, status = sh_with_status(cmd, &block)
unless status.success?
Expand Down
8 changes: 7 additions & 1 deletion spec/bundler/gem_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ def mock_build_message(name, version)

Rake.application["release"].invoke
end

it "uses Kernel.system" do
expect(Kernel).to receive(:system).with("gem", "push", app_gem_path.to_s, "--host", "http://example.org").and_return(true)

Rake.application["release"].invoke
end
end

it "even if tag already exists" do
Expand All @@ -255,7 +261,7 @@ def mock_build_message(name, version)
before(:each) do
Rake.application = Rake::Application.new
subject.install
allow(subject).to receive(:sh)
allow(subject).to receive(:sh_with_input)
end

after(:each) do
Expand Down

0 comments on commit 1b2bbc7

Please sign in to comment.