diff options
Diffstat (limited to 'lib/rubygems/commands/setup_command.rb')
-rw-r--r-- | lib/rubygems/commands/setup_command.rb | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index 37abe3b2ec..7992818863 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*$/ - VERSION_MATCHER = /^===\s*([\d.a-zA-Z]+)\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/ + 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 @@ -62,7 +62,7 @@ class Gem::Commands::SetupCommand < Gem::Command add_option '--[no-]rdoc', 'Generate RDoc documentation for RubyGems' do |value, options| - if value then + if value options[:document] << 'rdoc' else options[:document].delete 'rdoc' @@ -73,7 +73,7 @@ class Gem::Commands::SetupCommand < Gem::Command add_option '--[no-]ri', 'Generate RI documentation for RubyGems' do |value, options| - if value then + if value options[:document] << 'ri' else options[:document].delete 'ri' @@ -99,7 +99,7 @@ class Gem::Commands::SetupCommand < Gem::Command def check_ruby_version required_version = Gem::Requirement.new '>= 1.8.7' - unless required_version.satisfied_by? Gem.ruby_version then + unless required_version.satisfied_by? Gem.ruby_version alert_error "Expected Ruby version #{required_version}, is #{Gem.ruby_version}" terminate_interaction 1 end @@ -139,7 +139,7 @@ By default, this RubyGems will install gem as: install_destdir = options[:destdir] - unless install_destdir.empty? then + unless install_destdir.empty? ENV['GEM_HOME'] ||= File.join(install_destdir, Gem.default_dir.gsub(/^[a-zA-Z]:/, '')) end @@ -147,7 +147,7 @@ By default, this RubyGems will install gem as: check_ruby_version require 'fileutils' - if Gem.configuration.really_verbose then + if Gem.configuration.really_verbose extend FileUtils::Verbose else extend FileUtils @@ -180,7 +180,7 @@ By default, this RubyGems will install gem as: documentation_success = install_rdoc say - if @verbose then + if @verbose say "-" * 78 say end @@ -201,14 +201,14 @@ By default, this RubyGems will install gem as: say @bin_file_names.map { |name| "\t#{name}\n" } say - unless @bin_file_names.grep(/#{File::SEPARATOR}gem$/) then + unless @bin_file_names.grep(/#{File::SEPARATOR}gem$/) say "If `gem` was installed by a previous RubyGems installation, you may need" say "to remove it by hand." say end if documentation_success - if options[:document].include? 'rdoc' then + if options[:document].include? 'rdoc' say "Rdoc documentation was installed. You may now invoke:" say " gem server" say "and then peruse beautifully formatted documentation for your gems" @@ -219,7 +219,7 @@ By default, this RubyGems will install gem as: say end - if options[:document].include? 'ri' then + if options[:document].include? 'ri' say "Ruby Interactive (ri) documentation was installed. ri is kind of like man " say "pages for Ruby libraries. You may access it like this:" say " ri Classname" @@ -250,7 +250,7 @@ By default, this RubyGems will install gem as: bin_files -= %w[update_rubygems bundler bundle_ruby] bin_files.each do |bin_file| - bin_file_formatted = if options[:format_executable] then + bin_file_formatted = if options[:format_executable] Gem.default_exec_format % bin_file else bin_file @@ -308,7 +308,7 @@ By default, this RubyGems will install gem as: end end - def install_file file, dest_dir + def install_file(file, dest_dir) dest_file = File.join dest_dir, file dest_dir = File.dirname dest_file unless File.directory? dest_dir @@ -354,7 +354,7 @@ By default, this RubyGems will install gem as: if File.writable? gem_doc_dir and (not File.exist? rubygems_doc_dir or - File.writable? rubygems_doc_dir) then + File.writable? rubygems_doc_dir) say "Removing old RubyGems RDoc and ri" if @verbose Dir[File.join(Gem.dir, 'doc', 'rubygems-[0-9]*')].each do |dir| rm_rf dir @@ -374,7 +374,7 @@ By default, this RubyGems will install gem as: rdoc.generate return true - elsif @verbose then + elsif @verbose say "Skipping RDoc generation, #{gem_doc_dir} not writable" say "Set the GEM_HOME environment variable if you want RDoc generated" end @@ -456,7 +456,7 @@ By default, this RubyGems will install gem as: prefix = options[:prefix] site_or_vendor = options[:site_or_vendor] - if prefix.empty? then + if prefix.empty? lib_dir = RbConfig::CONFIG[site_or_vendor] bin_dir = RbConfig::CONFIG['bindir'] else @@ -467,7 +467,7 @@ By default, this RubyGems will install gem as: # just in case Apple and RubyGems don't get this patched up proper. (prefix == RbConfig::CONFIG['libdir'] or # this one is important - prefix == File.join(RbConfig::CONFIG['libdir'], 'ruby')) then + prefix == File.join(RbConfig::CONFIG['libdir'], 'ruby')) lib_dir = RbConfig::CONFIG[site_or_vendor] bin_dir = RbConfig::CONFIG['bindir'] else @@ -476,7 +476,7 @@ By default, this RubyGems will install gem as: end end - unless install_destdir.empty? then + unless install_destdir.empty? lib_dir = File.join install_destdir, lib_dir.gsub(/^[a-zA-Z]:/, '') bin_dir = File.join install_destdir, bin_dir.gsub(/^[a-zA-Z]:/, '') end @@ -484,13 +484,13 @@ By default, this RubyGems will install gem as: [lib_dir, bin_dir] end - def pem_files_in dir + def pem_files_in(dir) Dir.chdir dir do Dir[File.join('**', '*pem')] end end - def rb_files_in dir + def rb_files_in(dir) Dir.chdir dir do Dir[File.join('**', '*rb')] end @@ -505,7 +505,7 @@ By default, this RubyGems will install gem as: end # for cleanup old bundler files - def template_files_in dir + def template_files_in(dir) Dir.chdir dir do (Dir[File.join('templates', '**', '{*,.*}')]). select{|f| !File.directory?(f)} @@ -544,7 +544,7 @@ abort "#{deprecation_message}" end end - def remove_old_lib_files lib_dir + def remove_old_lib_files(lib_dir) lib_dirs = { File.join(lib_dir, 'rubygems') => 'lib/rubygems' } lib_dirs[File.join(lib_dir, 'bundler')] = 'bundler/lib/bundler' if Gem::USE_BUNDLER_FOR_GEMDEPS lib_dirs.each do |old_lib_dir, new_lib_dir| @@ -575,7 +575,7 @@ abort "#{deprecation_message}" release_notes = File.join Dir.pwd, 'History.txt' release_notes = - if File.exist? release_notes then + if File.exist? release_notes history = File.read release_notes history.force_encoding Encoding::UTF_8 |