summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/setup_command.rb
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/commands/setup_command.rb145
1 files changed, 104 insertions, 41 deletions
@@ -5,14 +5,22 @@ require 'rubygems/command'
# RubyGems checkout or tarball.
class Gem::Commands::SetupCommand < Gem::Command
def initialize
require 'tmpdir'
super 'setup', 'Install RubyGems',
- :format_executable => true, :rdoc => true, :ri => true,
:site_or_vendor => :sitelibdir,
- :destdir => '', :prefix => ''
add_option '--prefix=PREFIX',
'Prefix path for installing RubyGems',
@@ -37,14 +45,37 @@ class Gem::Commands::SetupCommand < Gem::Command
options[:format_executable] = value
end
add_option '--[no-]rdoc',
'Generate RDoc documentation for RubyGems' do |value, options|
- options[:rdoc] = value
end
add_option '--[no-]ri',
'Generate RI documentation for RubyGems' do |value, options|
- options[:ri] = value
end
end
@@ -58,7 +89,7 @@ class Gem::Commands::SetupCommand < Gem::Command
end
def defaults_str # :nodoc:
- "--format-executable --rdoc --ri"
end
def description # :nodoc:
@@ -110,7 +141,7 @@ By default, this RubyGems will install gem as:
uninstall_old_gemcutter
- install_rdoc
say
if @verbose then
@@ -118,14 +149,30 @@ By default, this RubyGems will install gem as:
say
end
release_notes = File.join Dir.pwd, 'History.txt'
release_notes = if File.exist? release_notes then
- open release_notes do |io|
- text = io.gets '==='
- text << io.gets('===')
- text[0...-3].sub(/^# coding:.*?^=/m, '')
end
else
"Oh-no! Unable to find release notes!"
end
@@ -145,6 +192,31 @@ By default, this RubyGems will install gem as:
say "to remove it by hand."
say
end
end
def install_executables(bin_dir)
@@ -165,7 +237,7 @@ By default, this RubyGems will install gem as:
end
dest_file = File.join bin_dir, bin_file_formatted
- bin_tmp_file = File.join Dir.tmpdir, bin_file
begin
bin = File.readlines bin_file
@@ -209,10 +281,7 @@ TEXT
say "Installing RubyGems" if @verbose
Dir.chdir 'lib' do
- lib_files = Dir[File.join('**', '*rb')]
-
- # Be sure to include our SSL ca bundles
- lib_files += Dir[File.join('**', '*pem')]
lib_files.each do |lib_file|
dest_file = File.join lib_dir, lib_file
@@ -229,6 +298,12 @@ TEXT
rubygems_name = "rubygems-#{Gem::VERSION}"
rubygems_doc_dir = File.join gem_doc_dir, rubygems_name
if File.writable? gem_doc_dir and
(not File.exist? rubygems_doc_dir or
File.writable? rubygems_doc_dir) then
@@ -237,21 +312,26 @@ TEXT
rm_rf dir
end
- if options[:ri] then
- ri_dir = File.join rubygems_doc_dir, 'ri'
- say "Installing #{rubygems_name} ri into #{ri_dir}" if @verbose
- run_rdoc '--ri', '--op', ri_dir
- end
- if options[:rdoc] then
- rdoc_dir = File.join rubygems_doc_dir, 'rdoc'
- say "Installing #{rubygems_name} rdoc into #{rdoc_dir}" if @verbose
- run_rdoc '--op', rdoc_dir
end
elsif @verbose then
say "Skipping RDoc generation, #{gem_doc_dir} not writable"
say "Set the GEM_HOME environment variable if you want RDoc generated"
end
end
def make_destination_dirs(install_destdir)
@@ -331,23 +411,6 @@ abort "#{deprecation_message}"
end
end
- def run_rdoc(*args)
- begin
- gem 'rdoc'
- rescue Gem::LoadError
- end
-
- require 'rdoc/rdoc'
-
- args << '--main' << 'README.rdoc' << '--quiet'
- args << '.'
- args << 'README.rdoc' << 'UPGRADING.rdoc'
- args << 'LICENSE.txt' << 'MIT.txt' << 'History.txt'
-
- r = RDoc::RDoc.new
- r.document args
- end
-
def uninstall_old_gemcutter
require 'rubygems/uninstaller'