summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/setup_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/commands/setup_command.rb')
-rw-r--r--lib/rubygems/commands/setup_command.rb78
1 files changed, 16 insertions, 62 deletions
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index 22b1371a1f..47e215c149 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -6,8 +6,8 @@ require 'rubygems/command'
# RubyGems checkout or tarball.
class Gem::Commands::SetupCommand < Gem::Command
- HISTORY_HEADER = /^===\s*[\d.a-zA-Z]+\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/.freeze
- VERSION_MATCHER = /^===\s*([\d.a-zA-Z]+)\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/.freeze
+ HISTORY_HEADER = /^#\s*[\d.a-zA-Z]+\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/.freeze
+ VERSION_MATCHER = /^#\s*([\d.a-zA-Z]+)\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/.freeze
ENV_PATHS = %w[/usr/bin/env /bin/env].freeze
@@ -167,19 +167,18 @@ By default, this RubyGems will install gem as:
extend MakeDirs
lib_dir, bin_dir = make_destination_dirs install_destdir
- man_dir = make_man_dir install_destdir
+ man_dir = generate_default_man_dir install_destdir
install_lib lib_dir
- install_man man_dir
-
install_executables bin_dir
remove_old_bin_files bin_dir
remove_old_lib_files lib_dir
- remove_old_man_files man_dir
+ # Can be removed one we drop support for bundler 2.2.3 (the last version installing man files to man_dir)
+ remove_old_man_files man_dir if man_dir && File.exist?(man_dir)
install_default_bundler_gem bin_dir
@@ -330,21 +329,6 @@ By default, this RubyGems will install gem as:
end
end
- def install_man(man_dir)
- mans = { 'Bundler' => 'bundler/man' }
- mans.each do |tool, path|
- say "Installing #{tool} manpages" if @verbose
-
- bundler_man1_files = bundler_man1_files_in(path)
- bundler_man5_files = bundler_man5_files_in(path)
-
- Dir.chdir path do
- install_file_list(bundler_man1_files, "#{man_dir}/man1")
- install_file_list(bundler_man5_files, "#{man_dir}/man5")
- end
- end
- end
-
def install_rdoc
gem_doc_dir = File.join Gem.dir, 'doc'
rubygems_name = "rubygems-#{Gem::VERSION}"
@@ -391,9 +375,7 @@ By default, this RubyGems will install gem as:
specs_dir = File.join(options[:destdir], specs_dir) unless Gem.win_platform?
mkdir_p specs_dir, :mode => 0755
- bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
- bundler_spec.files = Dir.chdir("bundler") { Dir["{*.md,{lib,exe,man}/**/*}"] }
- bundler_spec.executables -= %w[bundler bundle_ruby]
+ bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") }
# Remove bundler-*.gemspec in default specification directory.
Dir.entries(specs_dir).
@@ -455,19 +437,12 @@ By default, this RubyGems will install gem as:
return lib_dir, bin_dir
end
- def make_man_dir(install_destdir)
- man_dir = generate_default_man_dir(install_destdir)
-
- mkdir_p man_dir, :mode => 0755
-
- return man_dir
- end
-
def generate_default_man_dir(install_destdir)
prefix = options[:prefix]
if prefix.empty?
man_dir = RbConfig::CONFIG['mandir']
+ return unless man_dir
else
man_dir = File.join prefix, 'man'
end
@@ -518,20 +493,6 @@ By default, this RubyGems will install gem as:
end
end
- # for installation of bundler as default gems
- def bundler_man1_files_in(dir)
- Dir.chdir dir do
- Dir['bundle*.1']
- end
- end
-
- # for installation of bundler as default gems
- def bundler_man5_files_in(dir)
- Dir.chdir dir do
- Dir['gemfile.5']
- end
- end
-
def remove_old_bin_files(bin_dir)
old_bin_files = {
'gem_mirror' => 'gem mirror',
@@ -585,33 +546,26 @@ abort "#{deprecation_message}"
end
end
- def remove_old_man_files(man_dir)
- man_dirs = { man_dir => "bundler/man" }
- man_dirs.each do |old_man_dir, new_man_dir|
- man1_files = bundler_man1_files_in(new_man_dir)
-
- old_man1_dir = "#{old_man_dir}/man1"
- old_man1_files = bundler_man1_files_in(old_man1_dir)
- old_man1_files += Dir.chdir(old_man1_dir) { Dir["bundle*.1.{txt,ronn}"] }
+ def remove_old_man_files(old_man_dir)
+ old_man1_dir = "#{old_man_dir}/man1"
- man1_to_remove = old_man1_files - man1_files
+ if File.exist?(old_man1_dir)
+ man1_to_remove = Dir.chdir(old_man1_dir) { Dir["bundle*.1{,.txt,.ronn}"] }
remove_file_list(man1_to_remove, old_man1_dir)
+ end
- man5_files = bundler_man5_files_in(new_man_dir)
-
- old_man5_dir = "#{old_man_dir}/man5"
- old_man5_files = bundler_man5_files_in(old_man5_dir)
- old_man5_files += Dir.chdir(old_man5_dir) { Dir["gemfile.5.{txt,ronn}"] }
+ old_man5_dir = "#{old_man_dir}/man5"
- man5_to_remove = old_man5_files - man5_files
+ if File.exist?(old_man5_dir)
+ man5_to_remove = Dir.chdir(old_man5_dir) { Dir["gemfile.5{,.txt,.ronn}"] }
remove_file_list(man5_to_remove, old_man5_dir)
end
end
def show_release_notes
- release_notes = File.join Dir.pwd, 'History.txt'
+ release_notes = File.join Dir.pwd, 'CHANGELOG.md'
release_notes =
if File.exist? release_notes