summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/commands')
-rw-r--r--lib/rubygems/commands/build_command.rb1
-rw-r--r--lib/rubygems/commands/cleanup_command.rb14
-rw-r--r--lib/rubygems/commands/contents_command.rb6
-rw-r--r--lib/rubygems/commands/dependency_command.rb5
-rw-r--r--lib/rubygems/commands/info_command.rb2
-rw-r--r--lib/rubygems/commands/install_command.rb7
-rw-r--r--lib/rubygems/commands/lock_command.rb4
-rw-r--r--lib/rubygems/commands/mirror_command.rb1
-rw-r--r--lib/rubygems/commands/open_command.rb3
-rw-r--r--lib/rubygems/commands/outdated_command.rb1
-rw-r--r--lib/rubygems/commands/owner_command.rb3
-rw-r--r--lib/rubygems/commands/pristine_command.rb1
-rw-r--r--lib/rubygems/commands/push_command.rb2
-rw-r--r--lib/rubygems/commands/query_command.rb8
-rw-r--r--lib/rubygems/commands/rdoc_command.rb1
-rw-r--r--lib/rubygems/commands/setup_command.rb1
-rw-r--r--lib/rubygems/commands/signin_command.rb1
-rw-r--r--lib/rubygems/commands/specification_command.rb1
-rw-r--r--lib/rubygems/commands/stale_command.rb2
-rw-r--r--lib/rubygems/commands/uninstall_command.rb1
-rw-r--r--lib/rubygems/commands/update_command.rb2
-rw-r--r--lib/rubygems/commands/which_command.rb1
-rw-r--r--lib/rubygems/commands/yank_command.rb1
23 files changed, 47 insertions, 22 deletions
diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb
index 761b80ee94..9d318e6e8b 100644
--- a/lib/rubygems/commands/build_command.rb
+++ b/lib/rubygems/commands/build_command.rb
@@ -96,4 +96,5 @@ Gems can be saved to a specified filename with the output option:
terminate_interaction 1
end
end
+
end
diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb
index aeb4d82fae..fedaec8448 100644
--- a/lib/rubygems/commands/cleanup_command.rb
+++ b/lib/rubygems/commands/cleanup_command.rb
@@ -99,7 +99,7 @@ If no gems are named all gems in GEM_HOME are cleaned.
@full = Gem::DependencyList.from_specs
deplist = Gem::DependencyList.new
- @gems_to_cleanup.each do |spec| deplist.add spec end
+ @gems_to_cleanup.each { |spec| deplist.add spec }
deps = deplist.strongly_connected_components.flatten
@@ -121,19 +121,19 @@ If no gems are named all gems in GEM_HOME are cleaned.
end
def get_gems_to_cleanup
- gems_to_cleanup = @candidate_gems.select { |spec|
+ gems_to_cleanup = @candidate_gems.select do |spec|
@primary_gems[spec.name].version != spec.version
- }
+ end
- default_gems, gems_to_cleanup = gems_to_cleanup.partition { |spec|
+ default_gems, gems_to_cleanup = gems_to_cleanup.partition do |spec|
spec.default_gem?
- }
+ end
uninstall_from = options[:user_install] ? Gem.user_dir : @original_home
- gems_to_cleanup = gems_to_cleanup.select { |spec|
+ gems_to_cleanup = gems_to_cleanup.select do |spec|
spec.base_dir == uninstall_from
- }
+ end
@default_gems += default_gems
@default_gems.uniq!
diff --git a/lib/rubygems/commands/contents_command.rb b/lib/rubygems/commands/contents_command.rb
index 6da89a136e..26d6828fe6 100644
--- a/lib/rubygems/commands/contents_command.rb
+++ b/lib/rubygems/commands/contents_command.rb
@@ -14,7 +14,7 @@ class Gem::Commands::ContentsCommand < Gem::Command
add_version_option
- add_option( '--all',
+ add_option('--all',
"Contents for all gems") do |all, options|
options[:all] = all
end
@@ -29,12 +29,12 @@ class Gem::Commands::ContentsCommand < Gem::Command
options[:lib_only] = lib_only
end
- add_option( '--[no-]prefix',
+ add_option('--[no-]prefix',
"Don't include installed path prefix") do |prefix, options|
options[:prefix] = prefix
end
- add_option( '--[no-]show-install-dir',
+ add_option('--[no-]show-install-dir',
'Show only the gem install dir') do |show, options|
options[:show_install_dir] = show
end
diff --git a/lib/rubygems/commands/dependency_command.rb b/lib/rubygems/commands/dependency_command.rb
index 9e88b04ea5..8e198ac93a 100644
--- a/lib/rubygems/commands/dependency_command.rb
+++ b/lib/rubygems/commands/dependency_command.rb
@@ -80,9 +80,9 @@ use with other commands.
end
def gem_dependency(pattern, version, prerelease) # :nodoc:
- dependency = Gem::Deprecate.skip_during {
+ dependency = Gem::Deprecate.skip_during do
Gem::Dependency.new pattern, version
- }
+ end
dependency.prerelease = prerelease
@@ -215,4 +215,5 @@ use with other commands.
/\A#{Regexp.union(*args)}/
end
end
+
end
diff --git a/lib/rubygems/commands/info_command.rb b/lib/rubygems/commands/info_command.rb
index 8d9611a957..6a737b178b 100644
--- a/lib/rubygems/commands/info_command.rb
+++ b/lib/rubygems/commands/info_command.rb
@@ -4,6 +4,7 @@ require 'rubygems/command'
require 'rubygems/commands/query_command'
class Gem::Commands::InfoCommand < Gem::Commands::QueryCommand
+
def initialize
super "info", "Show information for the given gem"
@@ -30,4 +31,5 @@ class Gem::Commands::InfoCommand < Gem::Commands::QueryCommand
def defaults_str
"--local"
end
+
end
diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb
index 776b58651f..82631b1ffd 100644
--- a/lib/rubygems/commands/install_command.rb
+++ b/lib/rubygems/commands/install_command.rb
@@ -201,10 +201,13 @@ You can use `i` command instead of `install`.
request_set = inst.resolve_dependencies name, req
if options[:explain]
- puts "Gems to install:"
+ say "Gems to install:"
request_set.sorted_requests.each do |s|
- puts " #{s.full_name}"
+ # shows platform specific gems if used
+ say (plat = s.spec.platform) == Gem::Platform::RUBY ?
+ " #{s.full_name}" :
+ " #{s.full_name}-#{plat}"
end
return
diff --git a/lib/rubygems/commands/lock_command.rb b/lib/rubygems/commands/lock_command.rb
index 7f02e9feda..ebb402a8bd 100644
--- a/lib/rubygems/commands/lock_command.rb
+++ b/lib/rubygems/commands/lock_command.rb
@@ -100,9 +100,9 @@ lock it down to the exact version.
end
def spec_path(gem_full_name)
- gemspecs = Gem.path.map { |path|
+ gemspecs = Gem.path.map do |path|
File.join path, "specifications", "#{gem_full_name}.gemspec"
- }
+ end
gemspecs.find { |path| File.exist? path }
end
diff --git a/lib/rubygems/commands/mirror_command.rb b/lib/rubygems/commands/mirror_command.rb
index 801c9c8927..4e2a41fa33 100644
--- a/lib/rubygems/commands/mirror_command.rb
+++ b/lib/rubygems/commands/mirror_command.rb
@@ -3,6 +3,7 @@ require 'rubygems/command'
unless defined? Gem::Commands::MirrorCommand
class Gem::Commands::MirrorCommand < Gem::Command
+
def initialize
super('mirror', 'Mirror all gem files (requires rubygems-mirror)')
begin
diff --git a/lib/rubygems/commands/open_command.rb b/lib/rubygems/commands/open_command.rb
index 2794fe05e6..8eaeb64ba9 100644
--- a/lib/rubygems/commands/open_command.rb
+++ b/lib/rubygems/commands/open_command.rb
@@ -17,7 +17,7 @@ class Gem::Commands::OpenCommand < Gem::Command
end
add_option('-v', '--version VERSION', String,
"Opens specific gem version") do |version|
- options[:version] = version
+ options[:version] = version
end
end
@@ -84,4 +84,5 @@ class Gem::Commands::OpenCommand < Gem::Command
say "Unable to find gem '#{name}'"
end
+
end
diff --git a/lib/rubygems/commands/outdated_command.rb b/lib/rubygems/commands/outdated_command.rb
index 70f6c02801..035eaffcbc 100644
--- a/lib/rubygems/commands/outdated_command.rb
+++ b/lib/rubygems/commands/outdated_command.rb
@@ -30,4 +30,5 @@ update the gems with the update or install commands.
say "#{spec.name} (#{spec.version} < #{remote_version})"
end
end
+
end
diff --git a/lib/rubygems/commands/owner_command.rb b/lib/rubygems/commands/owner_command.rb
index 799f31704a..9fcabaa9f8 100644
--- a/lib/rubygems/commands/owner_command.rb
+++ b/lib/rubygems/commands/owner_command.rb
@@ -4,6 +4,7 @@ require 'rubygems/local_remote_options'
require 'rubygems/gemcutter_utilities'
class Gem::Commands::OwnerCommand < Gem::Command
+
include Gem::LocalRemoteOptions
include Gem::GemcutterUtilities
@@ -60,6 +61,8 @@ permission to.
end
def show_owners(name)
+ Gem.load_yaml
+
response = rubygems_api_request :get, "api/v1/gems/#{name}/owners.yaml" do |request|
request.add_field "Authorization", api_key
end
diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb
index 41decde856..1d0eb61700 100644
--- a/lib/rubygems/commands/pristine_command.rb
+++ b/lib/rubygems/commands/pristine_command.rb
@@ -183,4 +183,5 @@ extensions will be restored.
say "Restored #{spec.full_name}"
end
end
+
end
diff --git a/lib/rubygems/commands/push_command.rb b/lib/rubygems/commands/push_command.rb
index 55ee3ae73f..7fd1119ff9 100644
--- a/lib/rubygems/commands/push_command.rb
+++ b/lib/rubygems/commands/push_command.rb
@@ -5,6 +5,7 @@ require 'rubygems/gemcutter_utilities'
require 'rubygems/package'
class Gem::Commands::PushCommand < Gem::Command
+
include Gem::LocalRemoteOptions
include Gem::GemcutterUtilities
@@ -145,4 +146,5 @@ You can upgrade or downgrade to the latest release version with:
gem_metadata["allowed_push_host"]
]
end
+
end
diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb
index d947d588ef..5a42d45249 100644
--- a/lib/rubygems/commands/query_command.rb
+++ b/lib/rubygems/commands/query_command.rb
@@ -39,7 +39,7 @@ class Gem::Commands::QueryCommand < Gem::Command
options[:details] = value
end
- add_option( '--[no-]versions',
+ add_option('--[no-]versions',
'Display only gem names') do |value, options|
options[:versions] = value
options[:details] = false unless value
@@ -56,7 +56,7 @@ class Gem::Commands::QueryCommand < Gem::Command
options[:exact] = value
end
- add_option( '--[no-]prerelease',
+ add_option('--[no-]prerelease',
'Display prerelease versions') do |value, options|
options[:prerelease] = value
end
@@ -141,9 +141,9 @@ is too hard to use.
display_header 'LOCAL'
- specs = Gem::Specification.find_all { |s|
+ specs = Gem::Specification.find_all do |s|
s.name =~ name and req =~ s.version
- }
+ end
spec_tuples = specs.map do |spec|
[spec.name_tuple, spec]
diff --git a/lib/rubygems/commands/rdoc_command.rb b/lib/rubygems/commands/rdoc_command.rb
index 5f8b72eb7a..ff9e1ffcfa 100644
--- a/lib/rubygems/commands/rdoc_command.rb
+++ b/lib/rubygems/commands/rdoc_command.rb
@@ -5,6 +5,7 @@ require 'rubygems/rdoc'
require 'fileutils'
class Gem::Commands::RdocCommand < Gem::Command
+
include Gem::VersionOption
def initialize
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index c9c00b5be4..975eca593d 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -6,6 +6,7 @@ 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
diff --git a/lib/rubygems/commands/signin_command.rb b/lib/rubygems/commands/signin_command.rb
index 0d527fc339..7c4b5ceb69 100644
--- a/lib/rubygems/commands/signin_command.rb
+++ b/lib/rubygems/commands/signin_command.rb
@@ -3,6 +3,7 @@ require 'rubygems/command'
require 'rubygems/gemcutter_utilities'
class Gem::Commands::SigninCommand < Gem::Command
+
include Gem::GemcutterUtilities
def initialize
diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb
index 56b9371686..7326822ad7 100644
--- a/lib/rubygems/commands/specification_command.rb
+++ b/lib/rubygems/commands/specification_command.rb
@@ -143,4 +143,5 @@ Specific fields in the specification can be extracted in YAML format:
say "\n"
end
end
+
end
diff --git a/lib/rubygems/commands/stale_command.rb b/lib/rubygems/commands/stale_command.rb
index 0524ee1e2b..89bafeae98 100644
--- a/lib/rubygems/commands/stale_command.rb
+++ b/lib/rubygems/commands/stale_command.rb
@@ -2,6 +2,7 @@
require 'rubygems/command'
class Gem::Commands::StaleCommand < Gem::Command
+
def initialize
super('stale', 'List gems along with access times')
end
@@ -36,4 +37,5 @@ longer using.
say "#{name} at #{atime.strftime '%c'}"
end
end
+
end
diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb
index 9de0ea722b..698ff4b555 100644
--- a/lib/rubygems/commands/uninstall_command.rb
+++ b/lib/rubygems/commands/uninstall_command.rb
@@ -185,4 +185,5 @@ that is a dependency of an existing gem. You can use the
def uninstall(gem_name)
Gem::Uninstaller.new(gem_name, options).uninstall
end
+
end
diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb
index 9ab3b80e96..c44dcf0bd8 100644
--- a/lib/rubygems/commands/update_command.rb
+++ b/lib/rubygems/commands/update_command.rb
@@ -194,7 +194,7 @@ command to remove old versions.
}
gems_to_update = which_to_update hig, options[:args], :system
- _, up_ver = gems_to_update.first
+ _, up_ver = gems_to_update.first
target = if update_latest
up_ver
diff --git a/lib/rubygems/commands/which_command.rb b/lib/rubygems/commands/which_command.rb
index 5c51ed72dd..334bde2622 100644
--- a/lib/rubygems/commands/which_command.rb
+++ b/lib/rubygems/commands/which_command.rb
@@ -2,6 +2,7 @@
require 'rubygems/command'
class Gem::Commands::WhichCommand < Gem::Command
+
def initialize
super 'which', 'Find the location of a library file you can require',
:search_gems_first => false, :show_all => false
diff --git a/lib/rubygems/commands/yank_command.rb b/lib/rubygems/commands/yank_command.rb
index d13b674b48..be675fa460 100644
--- a/lib/rubygems/commands/yank_command.rb
+++ b/lib/rubygems/commands/yank_command.rb
@@ -5,6 +5,7 @@ require 'rubygems/version_option'
require 'rubygems/gemcutter_utilities'
class Gem::Commands::YankCommand < Gem::Command
+
include Gem::LocalRemoteOptions
include Gem::VersionOption
include Gem::GemcutterUtilities