1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rubygems: update to 1.3.6.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-02-22 02:52:35 +00:00
parent 65544f575b
commit b551e8c8b3
119 changed files with 2735 additions and 2613 deletions

View file

@ -160,8 +160,8 @@ class Gem::Command
end
##
# Get the single gem name from the command line. Fail if there is no gem
# name or if there is more than one gem name given.
# Get a single gem name from the command line. Fail if there is no gem name
# or if there is more than one gem name given.
def get_one_gem_name
args = options[:args]
@ -248,11 +248,12 @@ class Gem::Command
# Invoke the command with the given list of arguments.
def invoke(*args)
handle_options(args)
if options[:help]
handle_options args
if options[:help] then
show_help
elsif @when_invoked
@when_invoked.call(options)
elsif @when_invoked then
@when_invoked.call options
else
execute
end
@ -362,37 +363,39 @@ class Gem::Command
def create_option_parser
@parser = OptionParser.new
@parser.separator("")
@parser.separator nil
regular_options = @option_groups.delete :options
configure_options "", regular_options
@option_groups.sort_by { |n,_| n.to_s }.each do |group_name, option_list|
@parser.separator nil
configure_options group_name, option_list
end
@parser.separator nil
configure_options "Common", Gem::Command.common_options
@parser.separator("")
unless arguments.empty?
@parser.separator(" Arguments:")
@parser.separator nil
@parser.separator " Arguments:"
arguments.split(/\n/).each do |arg_desc|
@parser.separator(" #{arg_desc}")
@parser.separator " #{arg_desc}"
end
@parser.separator("")
end
@parser.separator(" Summary:")
@parser.separator nil
@parser.separator " Summary:"
wrap(@summary, 80 - 4).split("\n").each do |line|
@parser.separator(" #{line.strip}")
@parser.separator " #{line.strip}"
end
if description then
formatted = description.split("\n\n").map do |chunk|
wrap(chunk, 80 - 4)
end.join("\n")
wrap chunk, 80 - 4
end.join "\n"
@parser.separator ""
@parser.separator nil
@parser.separator " Description:"
formatted.split("\n").each do |line|
@parser.separator " #{line.rstrip}"
@ -400,10 +403,10 @@ class Gem::Command
end
unless defaults_str.empty?
@parser.separator("")
@parser.separator(" Defaults:")
@parser.separator nil
@parser.separator " Defaults:"
defaults_str.split(/\n/).each do |line|
@parser.separator(" #{line}")
@parser.separator " #{line}"
end
end
end
@ -471,33 +474,33 @@ class Gem::Command
# :stopdoc:
HELP = %{
RubyGems is a sophisticated package manager for Ruby. This is a
basic help message containing pointers to more information.
HELP = <<-HELP
RubyGems is a sophisticated package manager for Ruby. This is a
basic help message containing pointers to more information.
Usage:
gem -h/--help
gem -v/--version
gem command [arguments...] [options...]
Usage:
gem -h/--help
gem -v/--version
gem command [arguments...] [options...]
Examples:
gem install rake
gem list --local
gem build package.gemspec
gem help install
Examples:
gem install rake
gem list --local
gem build package.gemspec
gem help install
Further help:
gem help commands list all 'gem' commands
gem help examples show some examples of usage
gem help platforms show information about platforms
gem help <COMMAND> show help on COMMAND
(e.g. 'gem help install')
gem server present a web page at
http://localhost:8808/
with info about installed gems
Further information:
http://rubygems.rubyforge.org
}.gsub(/^ /, '')
Further help:
gem help commands list all 'gem' commands
gem help examples show some examples of usage
gem help platforms show information about platforms
gem help <COMMAND> show help on COMMAND
(e.g. 'gem help install')
gem server present a web page at
http://localhost:8808/
with info about installed gems
Further information:
http://rubygems.rubyforge.org
HELP
# :startdoc: