summaryrefslogtreecommitdiff
path: root/lib/rubygems
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems')
-rw-r--r--lib/rubygems/basic_specification.rb16
-rw-r--r--lib/rubygems/bundler_version_finder.rb6
-rw-r--r--lib/rubygems/command.rb8
-rw-r--r--lib/rubygems/commands/cleanup_command.rb12
-rw-r--r--lib/rubygems/commands/pristine_command.rb24
-rw-r--r--lib/rubygems/commands/push_command.rb16
-rw-r--r--lib/rubygems/commands/rdoc_command.rb12
-rw-r--r--lib/rubygems/commands/setup_command.rb16
-rw-r--r--lib/rubygems/commands/specification_command.rb8
-rw-r--r--lib/rubygems/commands/update_command.rb8
-rw-r--r--lib/rubygems/config_file.rb8
-rw-r--r--lib/rubygems/doctor.rb10
-rw-r--r--lib/rubygems/gem_runner.rb10
-rw-r--r--lib/rubygems/install_update_options.rb8
-rw-r--r--lib/rubygems/package.rb20
-rw-r--r--lib/rubygems/platform.rb84
-rw-r--r--lib/rubygems/query_utils.rb12
-rw-r--r--lib/rubygems/remote_fetcher.rb8
-rw-r--r--lib/rubygems/request_set/lockfile.rb8
-rw-r--r--lib/rubygems/source.rb12
-rw-r--r--lib/rubygems/source_list.rb14
-rw-r--r--lib/rubygems/spec_fetcher.rb50
-rw-r--r--lib/rubygems/specification.rb90
-rw-r--r--lib/rubygems/specification_policy.rb32
-rw-r--r--lib/rubygems/stub_specification.rb30
-rw-r--r--lib/rubygems/uninstaller.rb14
-rw-r--r--lib/rubygems/user_interaction.rb24
-rw-r--r--lib/rubygems/version.rb12
28 files changed, 286 insertions, 286 deletions
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
index 665b87fc0e..b3b63b51aa 100644
--- a/lib/rubygems/basic_specification.rb
+++ b/lib/rubygems/basic_specification.rb
@@ -289,14 +289,14 @@ class Gem::BasicSpecification
def lib_dirs_glob
dirs = if self.raw_require_paths
- if self.raw_require_paths.size > 1
- "{#{self.raw_require_paths.join(',')}}"
- else
- self.raw_require_paths.first
- end
- else
- "lib" # default value for require_paths for bundler/inline
- end
+ if self.raw_require_paths.size > 1
+ "{#{self.raw_require_paths.join(',')}}"
+ else
+ self.raw_require_paths.first
+ end
+ else
+ "lib" # default value for require_paths for bundler/inline
+ end
"#{self.full_gem_path}/#{dirs}".dup.tap(&Gem::UNTAINT)
end
diff --git a/lib/rubygems/bundler_version_finder.rb b/lib/rubygems/bundler_version_finder.rb
index 14179aebf3..f6fad0bd83 100644
--- a/lib/rubygems/bundler_version_finder.rb
+++ b/lib/rubygems/bundler_version_finder.rb
@@ -65,9 +65,9 @@ module Gem::BundlerVersionFinder
return unless gemfile
lockfile = case gemfile
- when "gems.rb" then "gems.locked"
- else "#{gemfile}.lock"
- end.dup.tap(&Gem::UNTAINT)
+ when "gems.rb" then "gems.locked"
+ else "#{gemfile}.lock"
+ end.dup.tap(&Gem::UNTAINT)
return unless File.file?(lockfile)
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb
index abdaa8e7c6..f74cb419f9 100644
--- a/lib/rubygems/command.rb
+++ b/lib/rubygems/command.rb
@@ -398,10 +398,10 @@ class Gem::Command
version_to_expire = deprecation["rg_version_to_expire"]
deprecate_option_msg = if version_to_expire
- "The \"#{option}\" option has been deprecated and will be removed in Rubygems #{version_to_expire}."
- else
- "The \"#{option}\" option has been deprecated and will be removed in future versions of Rubygems."
- end
+ "The \"#{option}\" option has been deprecated and will be removed in Rubygems #{version_to_expire}."
+ else
+ "The \"#{option}\" option has been deprecated and will be removed in future versions of Rubygems."
+ end
extra_msg = deprecation["extra_msg"]
diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb
index c965085880..dc181e4de0 100644
--- a/lib/rubygems/commands/cleanup_command.rb
+++ b/lib/rubygems/commands/cleanup_command.rb
@@ -117,12 +117,12 @@ If no gems are named all gems in GEM_HOME are cleaned.
def get_candidate_gems
@candidate_gems = unless options[:args].empty?
- options[:args].map do |gem_name|
- Gem::Specification.find_all_by_name gem_name
- end.flatten
- else
- Gem::Specification.to_a
- end
+ options[:args].map do |gem_name|
+ Gem::Specification.find_all_by_name gem_name
+ end.flatten
+ else
+ Gem::Specification.to_a
+ end
end
def get_gems_to_cleanup
diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb
index 13979b0a59..3cf496ba5b 100644
--- a/lib/rubygems/commands/pristine_command.rb
+++ b/lib/rubygems/commands/pristine_command.rb
@@ -98,20 +98,20 @@ extensions will be restored.
def execute
specs = if options[:all]
- Gem::Specification.map
+ Gem::Specification.map
- # `--extensions` must be explicitly given to pristine only gems
- # with extensions.
- elsif options[:extensions_set] and
+ # `--extensions` must be explicitly given to pristine only gems
+ # with extensions.
+ elsif options[:extensions_set] and
options[:extensions] and options[:args].empty?
- Gem::Specification.select do |spec|
- spec.extensions and not spec.extensions.empty?
- end
- else
- get_all_gem_names.sort.map do |gem_name|
- Gem::Specification.find_all_by_name(gem_name, options[:version]).reverse
- end.flatten
- end
+ Gem::Specification.select do |spec|
+ spec.extensions and not spec.extensions.empty?
+ end
+ else
+ get_all_gem_names.sort.map do |gem_name|
+ Gem::Specification.find_all_by_name(gem_name, options[:version]).reverse
+ end.flatten
+ end
specs = specs.select{|spec| RUBY_ENGINE == spec.platform || Gem::Platform.local === spec.platform || spec.platform == Gem::Platform::RUBY }
diff --git a/lib/rubygems/commands/push_command.rb b/lib/rubygems/commands/push_command.rb
index 1864b4b095..4d0d5a9f4b 100644
--- a/lib/rubygems/commands/push_command.rb
+++ b/lib/rubygems/commands/push_command.rb
@@ -52,14 +52,14 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo
default_gem_server, push_host = get_hosts_for(gem_name)
@host = if @user_defined_host
- options[:host]
- elsif default_gem_server
- default_gem_server
- elsif push_host
- push_host
- else
- options[:host]
- end
+ options[:host]
+ elsif default_gem_server
+ default_gem_server
+ elsif push_host
+ push_host
+ else
+ options[:host]
+ end
sign_in @host, scope: get_push_scope
diff --git a/lib/rubygems/commands/rdoc_command.rb b/lib/rubygems/commands/rdoc_command.rb
index 305c80ccfe..7c5d6212f5 100644
--- a/lib/rubygems/commands/rdoc_command.rb
+++ b/lib/rubygems/commands/rdoc_command.rb
@@ -61,12 +61,12 @@ Use --overwrite to force rebuilding of documentation.
def execute
specs = if options[:all]
- Gem::Specification.to_a
- else
- get_all_gem_names.map do |name|
- Gem::Specification.find_by_name name, options[:version]
- end.flatten.uniq
- end
+ Gem::Specification.to_a
+ else
+ get_all_gem_names.map do |name|
+ Gem::Specification.find_by_name name, options[:version]
+ end.flatten.uniq
+ end
if specs.empty?
alert_error 'No matching gems found'
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index 0601dccb07..01714f0342 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -54,10 +54,10 @@ class Gem::Commands::SetupCommand < Gem::Command
'List the documentation types you wish to',
'generate. For example: rdoc,ri' do |value, options|
options[:document] = case value
- when nil then %w[rdoc ri]
- when false then []
- else value
- end
+ when nil then %w[rdoc ri]
+ when false then []
+ else value
+ end
end
add_option '--[no-]rdoc',
@@ -666,10 +666,10 @@ abort "#{deprecation_message}"
def target_bin_path(bin_dir, bin_file)
bin_file_formatted = if options[:format_executable]
- Gem.default_exec_format % bin_file
- else
- bin_file
- end
+ Gem.default_exec_format % bin_file
+ else
+ bin_file
+ end
File.join bin_dir, bin_file_formatted
end
diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb
index 473b6e7b19..6f24787962 100644
--- a/lib/rubygems/commands/specification_command.rb
+++ b/lib/rubygems/commands/specification_command.rb
@@ -140,10 +140,10 @@ Specific fields in the specification can be extracted in YAML format:
s = s.send field if field
say case options[:format]
- when :ruby then s.to_ruby
- when :marshal then Marshal.dump s
- else s.to_yaml
- end
+ when :ruby then s.to_ruby
+ when :marshal then Marshal.dump s
+ else s.to_yaml
+ end
say "\n"
end
diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb
index 99208e5cb2..ecaf717871 100644
--- a/lib/rubygems/commands/update_command.rb
+++ b/lib/rubygems/commands/update_command.rb
@@ -233,10 +233,10 @@ command to remove old versions.
up_ver = gems_to_update.first.version
target = if update_latest
- up_ver
- else
- version
- end
+ up_ver
+ else
+ version
+ end
return target, requirement
end
diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb
index 60c1d50ba9..5dd2bfe88d 100644
--- a/lib/rubygems/config_file.rb
+++ b/lib/rubygems/config_file.rb
@@ -281,10 +281,10 @@ if you believe they were disclosed to a third party.
check_credentials_permissions
@api_keys = if File.exist? credentials_path
- load_file(credentials_path)
- else
- @hash
- end
+ load_file(credentials_path)
+ else
+ @hash
+ end
if @api_keys.key? :rubygems_api_key
@rubygems_api_key = @api_keys[:rubygems_api_key]
diff --git a/lib/rubygems/doctor.rb b/lib/rubygems/doctor.rb
index 41bcda9804..d14c64a166 100644
--- a/lib/rubygems/doctor.rb
+++ b/lib/rubygems/doctor.rb
@@ -117,11 +117,11 @@ class Gem::Doctor
type = File.directory?(child) ? 'directory' : 'file'
action = if @dry_run
- 'Extra'
- else
- FileUtils.rm_r(child)
- 'Removed'
- end
+ 'Extra'
+ else
+ FileUtils.rm_r(child)
+ 'Removed'
+ end
say "#{action} #{type} #{sub_directory}/#{File.basename(child)}"
end
diff --git a/lib/rubygems/gem_runner.rb b/lib/rubygems/gem_runner.rb
index 55b5a7d067..89b23b26aa 100644
--- a/lib/rubygems/gem_runner.rb
+++ b/lib/rubygems/gem_runner.rb
@@ -42,11 +42,11 @@ class Gem::GemRunner
cmd.command_names.each do |command_name|
config_args = Gem.configuration[command_name]
config_args = case config_args
- when String
- config_args.split ' '
- else
- Array(config_args)
- end
+ when String
+ config_args.split ' '
+ else
+ Array(config_args)
+ end
Gem::Command.add_specific_extra_args command_name, config_args
end
diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb
index 2203b17f8e..454104435d 100644
--- a/lib/rubygems/install_update_options.rb
+++ b/lib/rubygems/install_update_options.rb
@@ -35,10 +35,10 @@ module Gem::InstallUpdateOptions
'List the documentation types you wish to',
'generate. For example: rdoc,ri') do |value, options|
options[:document] = case value
- when nil then %w[ri]
- when false then []
- else value
- end
+ when nil then %w[ri]
+ when false then []
+ else value
+ end
end
add_option(:"Install/Update", '--build-root DIR',
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 94705914af..58d021d99a 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -146,12 +146,12 @@ class Gem::Package
def self.new(gem, security_policy = nil)
gem = if gem.is_a?(Gem::Package::Source)
- gem
- elsif gem.respond_to? :read
- Gem::Package::IOSource.new gem
- else
- Gem::Package::FileSource.new gem
- end
+ gem
+ elsif gem.respond_to? :read
+ Gem::Package::IOSource.new gem
+ else
+ Gem::Package::FileSource.new gem
+ end
return super unless Gem::Package == self
return super unless gem.present?
@@ -353,10 +353,10 @@ EOM
def digest(entry) # :nodoc:
algorithms = if @checksums
- @checksums.keys
- else
- [Gem::Security::DIGEST_NAME].compact
- end
+ @checksums.keys
+ else
+ [Gem::Security::DIGEST_NAME].compact
+ end
algorithms.each do |algorithm|
digester = Gem::Security.create_digest(algorithm)
diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb
index a5e65f9243..f48f4bdc76 100644
--- a/lib/rubygems/platform.rb
+++ b/lib/rubygems/platform.rb
@@ -78,9 +78,9 @@ class Gem::Platform
cpu = arch.shift
@cpu = case cpu
- when /i\d86/ then 'x86'
- else cpu
- end
+ when /i\d86/ then 'x86'
+ else cpu
+ end
if arch.length == 2 and arch.last =~ /^\d+(\.\d+)?$/ # for command-line
@os, @version = arch
@@ -91,32 +91,32 @@ class Gem::Platform
@cpu, os = nil, cpu if os.nil? # legacy jruby
@os, @version = case os
- when /aix(\d+)?/ then [ 'aix', $1 ]
- when /cygwin/ then [ 'cygwin', nil ]
- when /darwin(\d+)?/ then [ 'darwin', $1 ]
- when /^macruby$/ then [ 'macruby', nil ]
- when /freebsd(\d+)?/ then [ 'freebsd', $1 ]
- when /hpux(\d+)?/ then [ 'hpux', $1 ]
- when /^java$/, /^jruby$/ then [ 'java', nil ]
- when /^java([\d.]*)/ then [ 'java', $1 ]
- when /^dalvik(\d+)?$/ then [ 'dalvik', $1 ]
- when /^dotnet$/ then [ 'dotnet', nil ]
- when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ]
- when /linux-?((?!gnu)\w+)?/ then [ 'linux', $1 ]
- when /mingw32/ then [ 'mingw32', nil ]
- when /mingw-?(\w+)?/ then [ 'mingw', $1 ]
- when /(mswin\d+)(\_(\d+))?/ then
- os, version = $1, $3
- @cpu = 'x86' if @cpu.nil? and os =~ /32$/
- [os, version]
- when /netbsdelf/ then [ 'netbsdelf', nil ]
- when /openbsd(\d+\.\d+)?/ then [ 'openbsd', $1 ]
- when /bitrig(\d+\.\d+)?/ then [ 'bitrig', $1 ]
- when /solaris(\d+\.\d+)?/ then [ 'solaris', $1 ]
- # test
- when /^(\w+_platform)(\d+)?/ then [ $1, $2 ]
- else [ 'unknown', nil ]
- end
+ when /aix(\d+)?/ then [ 'aix', $1 ]
+ when /cygwin/ then [ 'cygwin', nil ]
+ when /darwin(\d+)?/ then [ 'darwin', $1 ]
+ when /^macruby$/ then [ 'macruby', nil ]
+ when /freebsd(\d+)?/ then [ 'freebsd', $1 ]
+ when /hpux(\d+)?/ then [ 'hpux', $1 ]
+ when /^java$/, /^jruby$/ then [ 'java', nil ]
+ when /^java([\d.]*)/ then [ 'java', $1 ]
+ when /^dalvik(\d+)?$/ then [ 'dalvik', $1 ]
+ when /^dotnet$/ then [ 'dotnet', nil ]
+ when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ]
+ when /linux-?((?!gnu)\w+)?/ then [ 'linux', $1 ]
+ when /mingw32/ then [ 'mingw32', nil ]
+ when /mingw-?(\w+)?/ then [ 'mingw', $1 ]
+ when /(mswin\d+)(\_(\d+))?/ then
+ os, version = $1, $3
+ @cpu = 'x86' if @cpu.nil? and os =~ /32$/
+ [os, version]
+ when /netbsdelf/ then [ 'netbsdelf', nil ]
+ when /openbsd(\d+\.\d+)?/ then [ 'openbsd', $1 ]
+ when /bitrig(\d+\.\d+)?/ then [ 'bitrig', $1 ]
+ when /solaris(\d+\.\d+)?/ then [ 'solaris', $1 ]
+ # test
+ when /^(\w+_platform)(\d+)?/ then [ $1, $2 ]
+ else [ 'unknown', nil ]
+ end
when Gem::Platform then
@cpu = arch.cpu
@os = arch.os
@@ -180,19 +180,19 @@ class Gem::Platform
when String then
# This data is from http://gems.rubyforge.org/gems/yaml on 19 Aug 2007
other = case other
- when /^i686-darwin(\d)/ then ['x86', 'darwin', $1 ]
- when /^i\d86-linux/ then ['x86', 'linux', nil ]
- when 'java', 'jruby' then [nil, 'java', nil ]
- when /^dalvik(\d+)?$/ then [nil, 'dalvik', $1 ]
- when /dotnet(\-(\d+\.\d+))?/ then ['universal','dotnet', $2 ]
- when /mswin32(\_(\d+))?/ then ['x86', 'mswin32', $2 ]
- when /mswin64(\_(\d+))?/ then ['x64', 'mswin64', $2 ]
- when 'powerpc-darwin' then ['powerpc', 'darwin', nil ]
- when /powerpc-darwin(\d)/ then ['powerpc', 'darwin', $1 ]
- when /sparc-solaris2.8/ then ['sparc', 'solaris', '2.8' ]
- when /universal-darwin(\d)/ then ['universal', 'darwin', $1 ]
- else other
- end
+ when /^i686-darwin(\d)/ then ['x86', 'darwin', $1 ]
+ when /^i\d86-linux/ then ['x86', 'linux', nil ]
+ when 'java', 'jruby' then [nil, 'java', nil ]
+ when /^dalvik(\d+)?$/ then [nil, 'dalvik', $1 ]
+ when /dotnet(\-(\d+\.\d+))?/ then ['universal','dotnet', $2 ]
+ when /mswin32(\_(\d+))?/ then ['x86', 'mswin32', $2 ]
+ when /mswin64(\_(\d+))?/ then ['x64', 'mswin64', $2 ]
+ when 'powerpc-darwin' then ['powerpc', 'darwin', nil ]
+ when /powerpc-darwin(\d)/ then ['powerpc', 'darwin', $1 ]
+ when /sparc-solaris2.8/ then ['sparc', 'solaris', '2.8' ]
+ when /universal-darwin(\d)/ then ['universal', 'darwin', $1 ]
+ else other
+ end
other = Gem::Platform.new other
else
diff --git a/lib/rubygems/query_utils.rb b/lib/rubygems/query_utils.rb
index 0acd5bf9c8..4b2df4ea0a 100644
--- a/lib/rubygems/query_utils.rb
+++ b/lib/rubygems/query_utils.rb
@@ -150,12 +150,12 @@ module Gem::QueryUtils
fetcher = Gem::SpecFetcher.fetcher
spec_tuples = if name.respond_to?(:source) && name.source.empty?
- fetcher.detect(specs_type) { true }
- else
- fetcher.detect(specs_type) do |name_tuple|
- name === name_tuple.name
- end
- end
+ fetcher.detect(specs_type) { true }
+ else
+ fetcher.detect(specs_type) do |name_tuple|
+ name === name_tuple.name
+ end
+ end
output_query_results(spec_tuples)
end
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index bd8165e3c7..b8f9f90cee 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -172,10 +172,10 @@ class Gem::RemoteFetcher
when nil then # TODO test for local overriding cache
source_path = if Gem.win_platform? && source_uri.scheme &&
!source_uri.path.include?(':')
- "#{source_uri.scheme}:#{source_uri.path}"
- else
- source_uri.path
- end
+ "#{source_uri.scheme}:#{source_uri.path}"
+ else
+ source_uri.path
+ end
source_path = Gem::UriFormatter.new(source_path).unescape
diff --git a/lib/rubygems/request_set/lockfile.rb b/lib/rubygems/request_set/lockfile.rb
index bec29ef1b9..684d3fc7fe 100644
--- a/lib/rubygems/request_set/lockfile.rb
+++ b/lib/rubygems/request_set/lockfile.rb
@@ -56,10 +56,10 @@ class Gem::RequestSet::Lockfile
deps[name] = if [Gem::Resolver::VendorSpecification,
Gem::Resolver::GitSpecification].include? spec.class
- Gem::Requirement.source_set
- else
- requirement
- end
+ Gem::Requirement.source_set
+ else
+ requirement
+ end
end
deps
diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb
index f03e09872c..85c300a8f8 100644
--- a/lib/rubygems/source.rb
+++ b/lib/rubygems/source.rb
@@ -81,12 +81,12 @@ class Gem::Source
return Gem::Resolver::IndexSet.new self if 'file' == uri.scheme
fetch_uri = if uri.host == "rubygems.org"
- index_uri = uri.dup
- index_uri.host = "index.rubygems.org"
- index_uri
- else
- uri
- end
+ index_uri = uri.dup
+ index_uri.host = "index.rubygems.org"
+ index_uri
+ else
+ uri
+ end
bundler_api_uri = enforce_trailing_slash(fetch_uri)
diff --git a/lib/rubygems/source_list.rb b/lib/rubygems/source_list.rb
index 13b25b63dc..16e90e1ef7 100644
--- a/lib/rubygems/source_list.rb
+++ b/lib/rubygems/source_list.rb
@@ -51,13 +51,13 @@ class Gem::SourceList
require "uri"
src = case obj
- when URI
- Gem::Source.new(obj)
- when Gem::Source
- obj
- else
- Gem::Source.new(URI.parse(obj))
- end
+ when URI
+ Gem::Source.new(obj)
+ when Gem::Source
+ obj
+ else
+ Gem::Source.new(URI.parse(obj))
+ end
@sources << src unless @sources.include?(src)
src
diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb
index b97bd49692..15bfbb6f8d 100644
--- a/lib/rubygems/spec_fetcher.rb
+++ b/lib/rubygems/spec_fetcher.rb
@@ -191,10 +191,10 @@ class Gem::SpecFetcher
end
matches = if matches.empty? && type != :prerelease
- suggest_gems_from_name gem_name, :prerelease
- else
- matches.uniq.sort_by {|name, dist| dist }
- end
+ suggest_gems_from_name gem_name, :prerelease
+ else
+ matches.uniq.sort_by {|name, dist| dist }
+ end
matches.map {|name, dist| name }.uniq.first(num_results)
end
@@ -216,27 +216,27 @@ class Gem::SpecFetcher
@sources.each_source do |source|
begin
names = case type
- when :latest
- tuples_for source, :latest
- when :released
- tuples_for source, :released
- when :complete
- names =
- tuples_for(source, :prerelease, true) +
- tuples_for(source, :released)
-
- names.sort
- when :abs_latest
- names =
- tuples_for(source, :prerelease, true) +
- tuples_for(source, :latest)
-
- names.sort
- when :prerelease
- tuples_for(source, :prerelease)
- else
- raise Gem::Exception, "Unknown type - :#{type}"
- end
+ when :latest
+ tuples_for source, :latest
+ when :released
+ tuples_for source, :released
+ when :complete
+ names =
+ tuples_for(source, :prerelease, true) +
+ tuples_for(source, :released)
+
+ names.sort
+ when :abs_latest
+ names =
+ tuples_for(source, :prerelease, true) +
+ tuples_for(source, :latest)
+
+ names.sort
+ when :prerelease
+ tuples_for(source, :prerelease)
+ else
+ raise Gem::Exception, "Unknown type - :#{type}"
+ end
rescue Gem::RemoteFetcher::FetchError => e
errors << Gem::SourceFetchProblem.new(source, e)
else
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index fe3dc431c8..f572257525 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -162,15 +162,15 @@ class Gem::Specification < Gem::BasicSpecification
@@default_value.each do |k,v|
INITIALIZE_CODE_FOR_DEFAULTS[k] = case v
- when [], {}, true, false, nil, Numeric, Symbol
- v.inspect
- when String
- v.dump
- when Numeric
- "default_value(:#{k})"
- else
- "default_value(:#{k}).dup"
- end
+ when [], {}, true, false, nil, Numeric, Symbol
+ v.inspect
+ when String
+ v.dump
+ when Numeric
+ "default_value(:#{k})"
+ else
+ "default_value(:#{k}).dup"
+ end
end
@@attributes = @@default_value.keys.sort_by {|s| s.to_s }
@@ -1268,12 +1268,12 @@ class Gem::Specification < Gem::BasicSpecification
current_version = CURRENT_SPECIFICATION_VERSION
field_count = if spec.specification_version > current_version
- spec.instance_variable_set :@specification_version,
- current_version
- MARSHAL_FIELDS[current_version]
- else
- MARSHAL_FIELDS[spec.specification_version]
- end
+ spec.instance_variable_set :@specification_version,
+ current_version
+ MARSHAL_FIELDS[current_version]
+ else
+ MARSHAL_FIELDS[spec.specification_version]
+ end
if array.size < field_count
raise TypeError, "invalid Gem::Specification format #{array.inspect}"
@@ -1473,10 +1473,10 @@ class Gem::Specification < Gem::BasicSpecification
def add_dependency_with_type(dependency, type, requirements)
requirements = if requirements.empty?
- Gem::Requirement.default
- else
- requirements.flatten
- end
+ Gem::Requirement.default
+ else
+ requirements.flatten
+ end
unless dependency.respond_to?(:name) &&
dependency.respond_to?(:requirement)
@@ -1684,18 +1684,18 @@ class Gem::Specification < Gem::BasicSpecification
# This is the cleanest, most-readable, faster-than-using-Date
# way to do it.
@date = case date
- when String then
- if DateTimeFormat =~ date
- Time.utc($1.to_i, $2.to_i, $3.to_i)
- else
- raise(Gem::InvalidSpecificationException,
- "invalid date format in specification: #{date.inspect}")
- end
- when Time, DateLike then
- Time.utc(date.year, date.month, date.day)
- else
- TODAY
- end
+ when String then
+ if DateTimeFormat =~ date
+ Time.utc($1.to_i, $2.to_i, $3.to_i)
+ else
+ raise(Gem::InvalidSpecificationException,
+ "invalid date format in specification: #{date.inspect}")
+ end
+ when Time, DateLike then
+ Time.utc(date.year, date.month, date.day)
+ else
+ TODAY
+ end
end
##
@@ -1801,13 +1801,13 @@ class Gem::Specification < Gem::BasicSpecification
coder.add 'name', @name
coder.add 'version', @version
platform = case @original_platform
- when nil, '' then
- 'ruby'
- when String then
- @original_platform
- else
- @original_platform.to_s
- end
+ when nil, '' then
+ 'ruby'
+ when String then
+ @original_platform
+ else
+ @original_platform.to_s
+ end
coder.add 'platform', platform
attributes = @@attributes.map(&:to_s) - %w[name version platform]
@@ -2024,10 +2024,10 @@ class Gem::Specification < Gem::BasicSpecification
def base_dir
return Gem.dir unless loaded_from
@base_dir ||= if default_gem?
- File.dirname File.dirname File.dirname loaded_from
- else
- File.dirname File.dirname loaded_from
- end
+ File.dirname File.dirname File.dirname loaded_from
+ else
+ File.dirname File.dirname loaded_from
+ end
end
##
@@ -2654,9 +2654,9 @@ class Gem::Specification < Gem::BasicSpecification
default = self.default_value attribute
value = case default
- when Time, Numeric, Symbol, true, false, nil then default
- else default.dup
- end
+ when Time, Numeric, Symbol, true, false, nil then default
+ else default.dup
+ end
instance_variable_set "@#{attribute}", value
end
diff --git a/lib/rubygems/specification_policy.rb b/lib/rubygems/specification_policy.rb
index 73bd31970c..002b3c20c4 100644
--- a/lib/rubygems/specification_policy.rb
+++ b/lib/rubygems/specification_policy.rb
@@ -199,17 +199,17 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
base = segments.first 2
recommendation = if (op == '>' || op == '>=') && segments == [0]
- " use a bounded requirement, such as '~> x.y'"
- else
- bugfix = if op == '>'
- ", '> #{dep_version}'"
- elsif op == '>=' and base != segments
- ", '>= #{dep_version}'"
- end
-
- " if #{dep.name} is semantically versioned, use:\n" \
- " add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join '.'}'#{bugfix}"
- end
+ " use a bounded requirement, such as '~> x.y'"
+ else
+ bugfix = if op == '>'
+ ", '> #{dep_version}'"
+ elsif op == '>=' and base != segments
+ ", '>= #{dep_version}'"
+ end
+
+ " if #{dep.name} is semantically versioned, use:\n" \
+ " add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join '.'}'#{bugfix}"
+ end
warning_messages << ["open-ended dependency on #{dep} is not recommended", recommendation].join("\n") + "\n"
end
@@ -332,11 +332,11 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
def validate_array_attribute(field)
val = @specification.send(field)
klass = case field
- when :dependencies then
- Gem::Dependency
- else
- String
- end
+ when :dependencies then
+ Gem::Dependency
+ else
+ String
+ end
unless Array === val and val.all? {|x| x.kind_of?(klass) }
error "#{field} must be an Array of #{klass}"
diff --git a/lib/rubygems/stub_specification.rb b/lib/rubygems/stub_specification.rb
index ac7fc6109a..1f2dbbc2e2 100644
--- a/lib/rubygems/stub_specification.rb
+++ b/lib/rubygems/stub_specification.rb
@@ -36,18 +36,18 @@ class Gem::StubSpecification < Gem::BasicSpecification
parts = data[PREFIX.length..-1].split(" ".freeze, 4)
@name = parts[0].freeze
@version = if Gem::Version.correct?(parts[1])
- Gem::Version.new(parts[1])
- else
- Gem::Version.new(0)
- end
+ Gem::Version.new(parts[1])
+ else
+ Gem::Version.new(0)
+ end
@platform = Gem::Platform.new parts[2]
@extensions = extensions
@full_name = if platform == Gem::Platform::RUBY
- "#{name}-#{version}"
- else
- "#{name}-#{version}-#{platform}"
- end
+ "#{name}-#{version}"
+ else
+ "#{name}-#{version}-#{platform}"
+ end
path_list = parts.last
@require_paths = REQUIRE_PATH_LIST[path_list] || path_list.split("\0".freeze).map! do |x|
@@ -116,10 +116,10 @@ class Gem::StubSpecification < Gem::BasicSpecification
stubline = file.readline.chomp
if stubline.start_with?(PREFIX)
extensions = if /\A#{PREFIX}/ =~ file.readline.chomp
- $'.split "\0"
- else
- StubLine::NO_EXTENSIONS
- end
+ $'.split "\0"
+ else
+ StubLine::NO_EXTENSIONS
+ end
@data = StubLine.new stubline, extensions
end
@@ -185,9 +185,9 @@ class Gem::StubSpecification < Gem::BasicSpecification
def to_spec
@spec ||= if @data
- loaded = Gem.loaded_specs[name]
- loaded if loaded && loaded.version == version
- end
+ loaded = Gem.loaded_specs[name]
+ loaded if loaded && loaded.version == version
+ end
@spec ||= Gem::Specification.load(loaded_from)
end
diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb
index 11fb611329..a36c5cbe2b 100644
--- a/lib/rubygems/uninstaller.rb
+++ b/lib/rubygems/uninstaller.rb
@@ -200,13 +200,13 @@ class Gem::Uninstaller
executables = executables.map {|exec| formatted_program_filename exec }
remove = if @force_executables.nil?
- ask_yes_no("Remove executables:\n" +
- "\t#{executables.join ', '}\n\n" +
- "in addition to the gem?",
- true)
- else
- @force_executables
- end
+ ask_yes_no("Remove executables:\n" +
+ "\t#{executables.join ', '}\n\n" +
+ "in addition to the gem?",
+ true)
+ else
+ @force_executables
+ end
if remove
bin_dir = @bin_dir || Gem.bindir(spec.base_dir)
diff --git a/lib/rubygems/user_interaction.rb b/lib/rubygems/user_interaction.rb
index 0ab44fbf6c..e632f418a9 100644
--- a/lib/rubygems/user_interaction.rb
+++ b/lib/rubygems/user_interaction.rb
@@ -258,23 +258,23 @@ class Gem::StreamUI
end
default_answer = case default
- when nil
- 'yn'
- when true
- 'Yn'
- else
- 'yN'
- end
+ when nil
+ 'yn'
+ when true
+ 'Yn'
+ else
+ 'yN'
+ end
result = nil
while result.nil? do
result = case ask "#{question} [#{default_answer}]"
- when /^y/i then true
- when /^n/i then false
- when /^$/ then default
- else nil
- end
+ when /^y/i then true
+ when /^n/i then false
+ when /^$/ then default
+ else nil
+ end
end
return result
diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb
index 9a26f721d6..d8aeb6f278 100644
--- a/lib/rubygems/version.rb
+++ b/lib/rubygems/version.rb
@@ -310,12 +310,12 @@ class Gem::Version
def release
@@release[self] ||= if prerelease?
- segments = self.segments
- segments.pop while segments.any? {|s| String === s }
- self.class.new segments.join('.')
- else
- self
- end
+ segments = self.segments
+ segments.pop while segments.any? {|s| String === s }
+ self.class.new segments.join('.')
+ else
+ self
+ end
end
def segments # :nodoc: