summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-08 22:41:03 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-08 22:41:03 +0000
commit7083cebeaea83096128fc5ccb5f60bfbe5bcc939 (patch)
treefb25c12a6cc01a1a8de5221d64da632418e194a3 /lib/rubygems/commands
parentfa343a796fd256fc9098db7fdddf226fe5cbd181 (diff)
* lib/rubygems: Update to RubyGems 2.0.4. See
https://github.com/rubygems/rubygems/blob/2.0/History.txt for changes git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/commands')
-rw-r--r--lib/rubygems/commands/help_command.rb10
-rw-r--r--lib/rubygems/commands/list_command.rb10
-rw-r--r--lib/rubygems/commands/owner_command.rb2
-rw-r--r--lib/rubygems/commands/pristine_command.rb9
-rw-r--r--lib/rubygems/commands/push_command.rb3
-rw-r--r--lib/rubygems/commands/search_command.rb20
-rw-r--r--lib/rubygems/commands/setup_command.rb58
-rw-r--r--lib/rubygems/commands/specification_command.rb2
-rw-r--r--lib/rubygems/commands/update_command.rb2
9 files changed, 75 insertions, 41 deletions
diff --git a/lib/rubygems/commands/help_command.rb b/lib/rubygems/commands/help_command.rb
index 8e3d97edd3..7f1fb486e0 100644
--- a/lib/rubygems/commands/help_command.rb
+++ b/lib/rubygems/commands/help_command.rb
@@ -113,7 +113,15 @@ platform.
format = "#{' ' * margin_width}%-#{desc_width}s%s"
command_manager.command_names.each do |cmd_name|
- summary = command_manager[cmd_name].summary
+ command = command_manager[cmd_name]
+
+ summary =
+ if command then
+ command.summary
+ else
+ "[No command found for #{cmd_name}, bug?]"
+ end
+
summary = wrap(summary, summary_width).split "\n"
out << sprintf(format, cmd_name, summary.shift)
until summary.empty? do
diff --git a/lib/rubygems/commands/list_command.rb b/lib/rubygems/commands/list_command.rb
index d9b7a9535e..f3e5da9551 100644
--- a/lib/rubygems/commands/list_command.rb
+++ b/lib/rubygems/commands/list_command.rb
@@ -7,9 +7,8 @@ require 'rubygems/commands/query_command'
class Gem::Commands::ListCommand < Gem::Commands::QueryCommand
- def initialize(name = 'list',
- summary = 'Display gems whose name starts with STRING')
- super name, summary
+ def initialize
+ super 'list', 'Display gems whose name starts with STRING'
remove_option('--name-matches')
end
@@ -27,9 +26,8 @@ class Gem::Commands::ListCommand < Gem::Commands::QueryCommand
end
def execute
- name = get_one_optional_argument || ''
- options[:name] = /^#{name}/i
-
+ string = get_one_optional_argument || ''
+ options[:name] = /^#{string}/i
super
end
diff --git a/lib/rubygems/commands/owner_command.rb b/lib/rubygems/commands/owner_command.rb
index 92674132e8..11e6e026fd 100644
--- a/lib/rubygems/commands/owner_command.rb
+++ b/lib/rubygems/commands/owner_command.rb
@@ -73,7 +73,7 @@ class Gem::Commands::OwnerCommand < Gem::Command
request.add_field "Authorization", api_key
end
- with_response response
+ with_response response, "Removing #{owner}"
rescue
# ignore
end
diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb
index f7eb9014ea..f22fe11769 100644
--- a/lib/rubygems/commands/pristine_command.rb
+++ b/lib/rubygems/commands/pristine_command.rb
@@ -10,7 +10,8 @@ class Gem::Commands::PristineCommand < Gem::Command
def initialize
super 'pristine',
'Restores installed gems to pristine condition from files located in the gem cache',
- :version => Gem::Requirement.default, :extensions => true,
+ :version => Gem::Requirement.default,
+ :extensions => true,
:all => false
add_option('--all',
@@ -37,7 +38,7 @@ class Gem::Commands::PristineCommand < Gem::Command
end
def defaults_str # :nodoc:
- "--all --extensions"
+ '--extensions'
end
def description # :nodoc:
@@ -52,8 +53,8 @@ for the gem are regenerated.
If the cached gem cannot be found, you will need to use `gem install` to
revert the gem.
-If --no-extensions is provided pristine will not attempt to restore gems with
-extensions.
+If --no-extensions is provided pristine will not attempt to restore gems
+with extensions.
EOF
end
diff --git a/lib/rubygems/commands/push_command.rb b/lib/rubygems/commands/push_command.rb
index 2df00b0457..fccad206fa 100644
--- a/lib/rubygems/commands/push_command.rb
+++ b/lib/rubygems/commands/push_command.rb
@@ -20,7 +20,8 @@ class Gem::Commands::PushCommand < Gem::Command
end
def initialize
- super 'push', description
+ super 'push', description, :host => self.host
+
add_proxy_option
add_key_option
diff --git a/lib/rubygems/commands/search_command.rb b/lib/rubygems/commands/search_command.rb
index 92d4b3672e..7810c85b36 100644
--- a/lib/rubygems/commands/search_command.rb
+++ b/lib/rubygems/commands/search_command.rb
@@ -1,17 +1,31 @@
require 'rubygems/command'
-require 'rubygems/commands/list_command'
+require 'rubygems/commands/query_command'
-class Gem::Commands::SearchCommand < Gem::Commands::ListCommand
+class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand
def initialize
super 'search', 'Display all gems whose name contains STRING'
- @defaults[:domain] = :remote
+ remove_option '--name-matches'
+ end
+
+ def arguments # :nodoc:
+ "STRING fragment of gem name to search for"
end
def defaults_str # :nodoc:
"--remote --no-details"
end
+ def usage # :nodoc:
+ "#{program_name} [STRING]"
+ end
+
+ def execute
+ string = get_one_optional_argument
+ options[:name] = /#{string}/i
+ super
+ end
+
end
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index 1cdc9f4c57..face77fae9 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -159,29 +159,7 @@ By default, this RubyGems will install gem as:
options[:previous_version] = Gem::Version.new(options[:previous_version])
- release_notes = File.join Dir.pwd, 'History.txt'
-
- release_notes = if File.exist? release_notes then
- history = File.read release_notes
- history = history.sub(/^# coding:.*?^=/m, '')
-
- 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 { |x| Gem::Version.new(x) }
-
- history_string = ""
-
- until versions.length == 0 or versions.shift < options[:previous_version]
- history_string += version_lines.shift + text.shift
- end
-
- history_string
- else
- "Oh-no! Unable to find release notes!"
- end
-
- say release_notes
+ show_release_notes
say
say "-" * 78
@@ -458,6 +436,40 @@ abort "#{deprecation_message}"
end
end
+ def show_release_notes
+ release_notes = File.join Dir.pwd, 'History.txt'
+
+ release_notes =
+ if File.exist? release_notes then
+ history = File.read release_notes
+
+ history.force_encoding Encoding::UTF_8 if
+ Object.const_defined? :Encoding
+
+ history = history.sub(/^# coding:.*?^=/m, '')
+
+ 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 or
+ 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 'rubygems/uninstaller'
diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb
index 63da5fef0f..b40dfd5f3c 100644
--- a/lib/rubygems/commands/specification_command.rb
+++ b/lib/rubygems/commands/specification_command.rb
@@ -28,7 +28,7 @@ class Gem::Commands::SpecificationCommand < Gem::Command
options[:format] = :ruby
end
- add_option('--yaml', 'Output RUBY format') do |value, options|
+ add_option('--yaml', 'Output YAML format') do |value, options|
options[:format] = :yaml
end
diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb
index 66aef49b4d..a31de0071a 100644
--- a/lib/rubygems/commands/update_command.rb
+++ b/lib/rubygems/commands/update_command.rb
@@ -94,7 +94,7 @@ class Gem::Commands::UpdateCommand < Gem::Command
say "Updating #{name}"
begin
- @installer.install name, version
+ @installer.install name, Gem::Requirement.new(version)
success = true
rescue Gem::InstallError => e
alert_error "Error installing #{name}:\n\t#{e.message}"