summaryrefslogtreecommitdiff
path: root/lib/bundler/gem_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/gem_helper.rb')
-rw-r--r--lib/bundler/gem_helper.rb17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index 9af8501525..d535d54f9b 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -21,7 +21,7 @@ module Bundler
def gemspec(&block)
gemspec = instance.gemspec
- block.call(gemspec) if block
+ block&.call(gemspec)
gemspec
end
end
@@ -107,9 +107,9 @@ module Bundler
SharedHelpers.filesystem_access(File.join(base, "checksums")) {|p| FileUtils.mkdir_p(p) }
file_name = "#{File.basename(built_gem_path)}.sha512"
require "digest/sha2"
- checksum = Digest::SHA512.new.hexdigest(built_gem_path.to_s)
+ checksum = ::Digest::SHA512.file(built_gem_path).hexdigest
target = File.join(base, "checksums", file_name)
- File.write(target, checksum)
+ File.write(target, checksum + "\n")
Bundler.ui.confirm "#{name} #{version} checksum written to checksums/#{file_name}."
end
@@ -129,8 +129,8 @@ module Bundler
def git_push(remote = nil)
remote ||= default_remote
- sh(%W[git push #{remote} refs/heads/#{current_branch}])
- sh(%W[git push #{remote} refs/tags/#{version_tag}])
+ sh("git push #{remote} refs/heads/#{current_branch}".shellsplit)
+ sh("git push #{remote} refs/tags/#{version_tag}".shellsplit)
Bundler.ui.confirm "Pushed git commits and release tag."
end
@@ -152,8 +152,7 @@ module Bundler
def gem_push_host
env_rubygems_host = ENV["RUBYGEMS_HOST"]
- env_rubygems_host = nil if
- env_rubygems_host && env_rubygems_host.empty?
+ env_rubygems_host = nil if env_rubygems_host&.empty?
allowed_push_host || env_rubygems_host || "rubygems.org"
end
@@ -216,9 +215,9 @@ module Bundler
def sh_with_status(cmd, &block)
Bundler.ui.debug(cmd)
SharedHelpers.chdir(base) do
- outbuf = IO.popen(cmd, :err => [:child, :out], &:read)
+ outbuf = IO.popen(cmd, err: [:child, :out], &:read)
status = $?
- block.call(outbuf) if status.success? && block
+ block&.call(outbuf) if status.success?
[outbuf, status]
end
end