summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-06-11 11:45:09 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-06-11 13:09:41 +0200
commit1b2bbc73642c100749831f30d8a2f0e674c2f944 (patch)
tree1dfa66b6b83d5bebe05690577e801a633abcd29e
parentf694fe7f67970b1ccfaf56778a242419f66adc3c (diff)
downloadbundler-deivid/allow_otp.tar.gz
Fix `rake release` not prompting for OTP codedeivid/allow_otp
Co-authored-by: Colby Swandale <me@colby.fyi> Co-authored-by: Kevin Deisz <kevin.deisz@gmail.com>
-rw-r--r--lib/bundler/gem_helper.rb9
-rw-r--r--spec/bundler/gem_helper_spec.rb8
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index 33f1d51592..68f5e636ff 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -106,7 +106,7 @@ module Bundler
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
@@ -180,6 +180,13 @@ module Bundler
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?
diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb
index 1452e20967..1ef57c1d00 100644
--- a/spec/bundler/gem_helper_spec.rb
+++ b/spec/bundler/gem_helper_spec.rb
@@ -233,6 +233,12 @@ RSpec.describe Bundler::GemHelper do
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
@@ -255,7 +261,7 @@ RSpec.describe Bundler::GemHelper do
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