End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Gem::Commands::SetupCommand#show_release_notes
show_release_notes
lib/rubygems/commands/setup_command.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/rubygems/commands/setup_command.rb, line 544
def show_release_notes
release_notes = File.join Dir.pwd, "CHANGELOG.md"
release_notes =
if File.exist? release_notes
history = File.read release_notes
history.force_encoding Encoding::UTF_8
text = history.split(HISTORY_HEADER)
text.shift # correct an off-by-one generated by split
version_lines = history.scan(HISTORY_HEADER)
versions = history.scan(VERSION_MATCHER).flatten.map do |x|
Gem::Version.new(x)
end
history_string = ""
until versions.length == 0 ||
versions.shift <= options[:previous_version] do
history_string += version_lines.shift + text.shift
end
history_string
else
"Oh-no! Unable to find release notes!"
end
say release_notes
end
def uninstall_old_gemcutter
require_relative "../uninstaller"
ui = Gem::Uninstaller.new("gemcutter", :all => true, :ignore => true,
:version => "< 0.4")
ui.uninstall
rescue Gem::InstallError
end
def regenerate_binstubs(bindir)
require_relative "pristine_command"
say "Regenerating binstubs"
args = %w[--all --only-executables --silent]
args << "--bindir=#{bindir}"
if options[:env_shebang]
args << "--env-shebang"
end
command = Gem::Commands::PristineCommand.new
command.invoke(*args)
end
def regenerate_plugins(bindir)
require_relative "pristine_command"
say "Regenerating plugins"
args = %w[--all --only-plugins --silent]
args << "--bindir=#{bindir}"
args << "--install-dir=#{default_dir}"
command = Gem::Commands::PristineCommand.new
command.invoke(*args)
end
private
def default_dir
prefix = options[:prefix]
if prefix.empty?
dir = Gem.default_dir
else
dir = prefix
end
prepend_destdir_if_present(dir)
end
def prepend_destdir_if_present(path)
destdir = options[:destdir]
return path if destdir.empty?
File.join(options[:destdir], path.gsub(/^[a-zA-Z]:/, ""))
end
def install_file_list(files, dest_dir)
files.each do |file|
install_file file, dest_dir
end
end
def install_file(file, dest_dir)
dest_file = File.join dest_dir, file
dest_dir = File.dirname dest_file
unless File.directory? dest_dir
mkdir_p dest_dir, :mode => 0755
end
install file, dest_file, :mode => options[:data_mode] || 0644
end
def remove_file_list(files, dir)
Dir.chdir dir do
files.each do |file|
FileUtils.rm_f file
warn "unable to remove old file #{file} please remove it by hand" if
File.exist? file
end
end
end
def target_bin_path(bin_dir, bin_file)
bin_file_formatted = if options[:format_executable]
Gem.default_exec_format % bin_file
else
bin_file
end
File.join bin_dir, bin_file_formatted
end
def bin_file_names
@bin_file_names ||= []
end
end
No documentation available
See also
#shebang
#target_bin_path
#remove_old_man_files
#uninstall_old_gemcutter
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0