summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2020-06-10 19:46:05 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-06-15 21:20:37 +0900
commit955f1837a180d8936f90ab6cf039ccb8f751be72 (patch)
tree0d48749501febfccefda3b1376511c421d4118e4 /lib
parentef481c120c55bf0351a586739f9b5d704f3f7a7d (diff)
Use space inside block braces everywhere
To make rubygems code style consistent with bundler.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3229
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems.rb14
-rw-r--r--lib/rubygems/available_set.rb8
-rw-r--r--lib/rubygems/basic_specification.rb6
-rw-r--r--lib/rubygems/bundler_version_finder.rb6
-rw-r--r--lib/rubygems/command.rb12
-rw-r--r--lib/rubygems/command_manager.rb6
-rw-r--r--lib/rubygems/commands/cert_command.rb2
-rw-r--r--lib/rubygems/commands/cleanup_command.rb6
-rw-r--r--lib/rubygems/commands/contents_command.rb2
-rw-r--r--lib/rubygems/commands/dependency_command.rb12
-rw-r--r--lib/rubygems/commands/fetch_command.rb4
-rw-r--r--lib/rubygems/commands/help_command.rb2
-rw-r--r--lib/rubygems/commands/lock_command.rb2
-rw-r--r--lib/rubygems/commands/setup_command.rb6
-rw-r--r--lib/rubygems/commands/specification_command.rb4
-rw-r--r--lib/rubygems/commands/stale_command.rb2
-rw-r--r--lib/rubygems/commands/uninstall_command.rb2
-rw-r--r--lib/rubygems/commands/unpack_command.rb2
-rw-r--r--lib/rubygems/commands/update_command.rb8
-rw-r--r--lib/rubygems/config_file.rb2
-rw-r--r--lib/rubygems/core_ext/kernel_require.rb2
-rw-r--r--lib/rubygems/dependency.rb4
-rw-r--r--lib/rubygems/dependency_list.rb14
-rw-r--r--lib/rubygems/doctor.rb4
-rw-r--r--lib/rubygems/exceptions.rb2
-rw-r--r--lib/rubygems/ext/ext_conf_builder.rb2
-rw-r--r--lib/rubygems/indexer.rb2
-rw-r--r--lib/rubygems/install_update_options.rb2
-rw-r--r--lib/rubygems/installer.rb4
-rw-r--r--lib/rubygems/local_remote_options.rb2
-rw-r--r--lib/rubygems/name_tuple.rb4
-rw-r--r--lib/rubygems/package.rb8
-rw-r--r--lib/rubygems/package/old.rb2
-rw-r--r--lib/rubygems/package/tar_header.rb2
-rw-r--r--lib/rubygems/package/tar_test_case.rb2
-rw-r--r--lib/rubygems/path_support.rb2
-rw-r--r--lib/rubygems/query_utils.rb16
-rw-r--r--lib/rubygems/remote_fetcher.rb6
-rw-r--r--lib/rubygems/request/connection_pools.rb2
-rw-r--r--lib/rubygems/request_set.rb10
-rw-r--r--lib/rubygems/request_set/gem_dependency_api.rb2
-rw-r--r--lib/rubygems/request_set/lockfile.rb16
-rw-r--r--lib/rubygems/request_set/lockfile/tokenizer.rb2
-rw-r--r--lib/rubygems/requirement.rb28
-rw-r--r--lib/rubygems/resolver.rb14
-rw-r--r--lib/rubygems/resolver/api_set.rb4
-rw-r--r--lib/rubygems/resolver/composed_set.rb6
-rw-r--r--lib/rubygems/resolver/conflict.rb2
-rw-r--r--lib/rubygems/resolver/index_set.rb2
-rw-r--r--lib/rubygems/resolver/installer_set.rb6
-rw-r--r--lib/rubygems/resolver/lock_set.rb2
-rw-r--r--lib/rubygems/security.rb2
-rw-r--r--lib/rubygems/security/signer.rb2
-rw-r--r--lib/rubygems/server.rb14
-rw-r--r--lib/rubygems/source/local.rb4
-rw-r--r--lib/rubygems/source_list.rb8
-rw-r--r--lib/rubygems/spec_fetcher.rb12
-rw-r--r--lib/rubygems/specification.rb80
-rw-r--r--lib/rubygems/specification_policy.rb14
-rw-r--r--lib/rubygems/test_case.rb16
-rw-r--r--lib/rubygems/test_utilities.rb2
-rw-r--r--lib/rubygems/uninstaller.rb12
-rw-r--r--lib/rubygems/user_interaction.rb2
-rw-r--r--lib/rubygems/validator.rb2
-rw-r--r--lib/rubygems/version.rb6
65 files changed, 230 insertions, 230 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index ca80326..5f0579b 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -504,7 +504,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
gem_specifications = @gemdeps ? Gem.loaded_specs.values : Gem::Specification.stubs
- files.concat gem_specifications.map { |spec|
+ files.concat gem_specifications.map {|spec|
spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}")
}.flatten
@@ -519,7 +519,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
glob_with_suffixes = "#{glob}#{Gem.suffix_pattern}"
$LOAD_PATH.map do |load_path|
Gem::Util.glob_files_in_dir(glob_with_suffixes, load_path)
- end.flatten.select { |file| File.file? file.tap(&Gem::UNTAINT) }
+ end.flatten.select {|file| File.file? file.tap(&Gem::UNTAINT) }
end
##
@@ -539,7 +539,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
files = find_files_from_load_path glob if check_load_path
- files.concat Gem::Specification.latest_specs(true).map { |spec|
+ files.concat Gem::Specification.latest_specs(true).map {|spec|
spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}")
}.flatten
@@ -1014,7 +1014,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
paths.flatten!
paths.compact!
hash = { "GEM_HOME" => home, "GEM_PATH" => paths.empty? ? home : paths.join(File::PATH_SEPARATOR) }
- hash.delete_if { |_, v| v.nil? }
+ hash.delete_if {|_, v| v.nil? }
self.paths = hash
end
@@ -1024,7 +1024,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
def self.win_platform?
if @@win_platform.nil?
ruby_platform = RbConfig::CONFIG['host_os']
- @@win_platform = !!WIN_PATTERNS.find { |r| ruby_platform =~ r }
+ @@win_platform = !!WIN_PATTERNS.find {|r| ruby_platform =~ r }
end
@@win_platform
@@ -1101,7 +1101,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
if path == "-"
Gem::Util.traverse_parents Dir.pwd do |directory|
- dep_file = GEM_DEP_FILES.find { |f| File.file?(f) }
+ dep_file = GEM_DEP_FILES.find {|f| File.file?(f) }
next unless dep_file
@@ -1212,7 +1212,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
#
def register_default_spec(spec)
- extended_require_paths = spec.require_paths.map {|f| f + "/"}
+ extended_require_paths = spec.require_paths.map {|f| f + "/" }
new_format = extended_require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } }
if new_format
diff --git a/lib/rubygems/available_set.rb b/lib/rubygems/available_set.rb
index 2e9d949..48bf6da 100644
--- a/lib/rubygems/available_set.rb
+++ b/lib/rubygems/available_set.rb
@@ -70,11 +70,11 @@ class Gem::AvailableSet
end
def all_specs
- @set.map { |t| t.spec }
+ @set.map {|t| t.spec }
end
def match_platform!
- @set.reject! { |t| !Gem::Platform.match(t.spec.platform) }
+ @set.reject! {|t| !Gem::Platform.match(t.spec.platform) }
@sorted = nil
self
end
@@ -91,7 +91,7 @@ class Gem::AvailableSet
end
def source_for(spec)
- f = @set.find { |t| t.spec == spec }
+ f = @set.find {|t| t.spec == spec }
f.source
end
@@ -160,7 +160,7 @@ class Gem::AvailableSet
end
def inject_into_list(dep_list)
- @set.each { |t| dep_list.add t.spec }
+ @set.each {|t| dep_list.add t.spec }
end
end
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
index 0e65f26..ce07cdc 100644
--- a/lib/rubygems/basic_specification.rb
+++ b/lib/rubygems/basic_specification.rb
@@ -276,7 +276,7 @@ class Gem::BasicSpecification
def matches_for_glob(glob) # TODO: rename?
glob = File.join(self.lib_dirs_glob, glob)
- Dir[glob].map { |f| f.tap(&Gem::UNTAINT) } # FIX our tests are broken, run w/ SAFE=1
+ Dir[glob].map {|f| f.tap(&Gem::UNTAINT) } # FIX our tests are broken, run w/ SAFE=1
end
##
@@ -335,12 +335,12 @@ class Gem::BasicSpecification
def have_file?(file, suffixes)
return true if raw_require_paths.any? do |path|
base = File.join(gems_dir, full_name, path.tap(&Gem::UNTAINT), file).tap(&Gem::UNTAINT)
- suffixes.any? { |suf| File.file? base + suf }
+ suffixes.any? {|suf| File.file? base + suf }
end
if have_extensions?
base = File.join extension_dir, file
- suffixes.any? { |suf| File.file? base + suf }
+ suffixes.any? {|suf| File.file? base + suf }
else
false
end
diff --git a/lib/rubygems/bundler_version_finder.rb b/lib/rubygems/bundler_version_finder.rb
index ea6698f..56ca14f 100644
--- a/lib/rubygems/bundler_version_finder.rb
+++ b/lib/rubygems/bundler_version_finder.rb
@@ -44,9 +44,9 @@ To install the missing version, run `gem install bundler:#{vr.first}`
def self.filter!(specs)
return unless bundler_version = self.bundler_version
- specs.reject! { |spec| spec.version.segments.first != bundler_version.segments.first }
+ specs.reject! {|spec| spec.version.segments.first != bundler_version.segments.first }
- exact_match_index = specs.find_index { |spec| spec.version == bundler_version }
+ exact_match_index = specs.find_index {|spec| spec.version == bundler_version }
return unless exact_match_index
specs.unshift(specs.delete_at(exact_match_index))
@@ -86,7 +86,7 @@ To install the missing version, run `gem install bundler:#{vr.first}`
unless gemfile
begin
Gem::Util.traverse_parents(Dir.pwd) do |directory|
- next unless gemfile = Gem::GEM_DEP_FILES.find { |f| File.file?(f.tap(&Gem::UNTAINT)) }
+ next unless gemfile = Gem::GEM_DEP_FILES.find {|f| File.file?(f.tap(&Gem::UNTAINT)) }
gemfile = File.join directory, gemfile
break
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb
index f08749b..cfbe34c 100644
--- a/lib/rubygems/command.rb
+++ b/lib/rubygems/command.rb
@@ -125,7 +125,7 @@ class Gem::Command
@program_name = "gem #{command}"
@defaults = defaults
@options = defaults.dup
- @option_groups = Hash.new { |h,k| h[k] = [] }
+ @option_groups = Hash.new {|h,k| h[k] = [] }
@deprecated_options = { command => {} }
@parser = nil
@when_invoked = nil
@@ -162,7 +162,7 @@ class Gem::Command
if errors and !errors.empty?
msg << ", here is why:\n"
- errors.each { |x| msg << " #{x.wordy}\n" }
+ errors.each {|x| msg << " #{x.wordy}\n" }
else
if required_by and gem != required_by
msg << " (required by #{required_by}) in any repository"
@@ -192,7 +192,7 @@ class Gem::Command
"Please specify at least one gem name (e.g. gem build GEMNAME)"
end
- args.select { |arg| arg !~ /^-/ }
+ args.select {|arg| arg !~ /^-/ }
end
##
@@ -364,7 +364,7 @@ class Gem::Command
def remove_option(name)
@option_groups.each do |_, option_list|
- option_list.reject! { |args, _| args.any? { |x| x.is_a?(String) && x =~ /^#{name}/ } }
+ option_list.reject! {|args, _| args.any? {|x| x.is_a?(String) && x =~ /^#{name}/ } }
end
end
@@ -417,7 +417,7 @@ class Gem::Command
def merge_options(new_options)
@options = @defaults.clone
- new_options.each { |k,v| @options[k] = v }
+ new_options.each {|k,v| @options[k] = v }
end
##
@@ -496,7 +496,7 @@ class Gem::Command
configure_options "", regular_options
- @option_groups.sort_by { |n,_| n.to_s }.each do |group_name, option_list|
+ @option_groups.sort_by {|n,_| n.to_s }.each do |group_name, option_list|
@parser.separator nil
configure_options group_name, option_list
end
diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb
index 03b859e..f18e777 100644
--- a/lib/rubygems/command_manager.rb
+++ b/lib/rubygems/command_manager.rb
@@ -138,7 +138,7 @@ class Gem::CommandManager
# Return a sorted list of all command names as strings.
def command_names
- @commands.keys.collect {|key| key.to_s}.sort
+ @commands.keys.collect {|key| key.to_s }.sort
end
##
@@ -203,9 +203,9 @@ class Gem::CommandManager
def find_command_possibilities(cmd_name)
len = cmd_name.length
- found = command_names.select { |name| cmd_name == name[0, len] }
+ found = command_names.select {|name| cmd_name == name[0, len] }
- exact = found.find { |name| name == cmd_name }
+ exact = found.find {|name| name == cmd_name }
exact ? [exact] : found
end
diff --git a/lib/rubygems/commands/cert_command.rb b/lib/rubygems/commands/cert_command.rb
index 72400f3..4ec600e 100644
--- a/lib/rubygems/commands/cert_command.rb
+++ b/lib/rubygems/commands/cert_command.rb
@@ -186,7 +186,7 @@ class Gem::Commands::CertCommand < Gem::Command
subject = certificate.subject.to_s
subject.downcase.index filter
end.sort_by do |certificate, _|
- certificate.subject.to_a.map { |name, data,| [name, data] }
+ certificate.subject.to_a.map {|name, data,| [name, data] }
end.each do |certificate, path|
yield certificate, path
end
diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb
index fedaec8..98cd203 100644
--- a/lib/rubygems/commands/cleanup_command.rb
+++ b/lib/rubygems/commands/cleanup_command.rb
@@ -69,7 +69,7 @@ If no gems are named all gems in GEM_HOME are cleaned.
until done do
clean_gems
- this_set = @gems_to_cleanup.map { |spec| spec.full_name }.sort
+ this_set = @gems_to_cleanup.map {|spec| spec.full_name }.sort
done = this_set.empty? || last_set == this_set
@@ -82,7 +82,7 @@ If no gems are named all gems in GEM_HOME are cleaned.
say "Clean up complete"
verbose do
- skipped = @default_gems.map { |spec| spec.full_name }
+ skipped = @default_gems.map {|spec| spec.full_name }
"Skipped default gems: #{skipped.join ', '}"
end
@@ -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 { |spec| deplist.add spec }
+ @gems_to_cleanup.each {|spec| deplist.add spec }
deps = deplist.strongly_connected_components.flatten
diff --git a/lib/rubygems/commands/contents_command.rb b/lib/rubygems/commands/contents_command.rb
index 2da8c49..d30b62d 100644
--- a/lib/rubygems/commands/contents_command.rb
+++ b/lib/rubygems/commands/contents_command.rb
@@ -175,7 +175,7 @@ prefix or only the files that are requireable.
if Gem.configuration.verbose
say "\nDirectories searched:"
- @spec_dirs.sort.each { |dir| say dir }
+ @spec_dirs.sort.each {|dir| say dir }
end
return nil
diff --git a/lib/rubygems/commands/dependency_command.rb b/lib/rubygems/commands/dependency_command.rb
index 00ab19b..bdb71ad 100644
--- a/lib/rubygems/commands/dependency_command.rb
+++ b/lib/rubygems/commands/dependency_command.rb
@@ -59,14 +59,14 @@ use with other commands.
ss, = fetcher.spec_for_dependency dependency
- ss.map { |spec, _| spec }
+ ss.map {|spec, _| spec }
end
def fetch_specs(name_pattern, dependency) # :nodoc:
specs = []
if local?
- specs.concat Gem::Specification.stubs.find_all { |spec|
+ specs.concat Gem::Specification.stubs.find_all {|spec|
name_pattern =~ spec.name and
dependency.requirement.satisfied_by? spec.version
}.map(&:to_spec)
@@ -92,7 +92,7 @@ use with other commands.
def display_pipe(specs) # :nodoc:
specs.each do |spec|
unless spec.dependencies.empty?
- spec.dependencies.sort_by { |dep| dep.name }.each do |dep|
+ spec.dependencies.sort_by {|dep| dep.name }.each do |dep|
say "#{dep.name} --version '#{dep.requirement}'"
end
end
@@ -156,7 +156,7 @@ use with other commands.
response = String.new
response << ' ' * level + "Gem #{spec.full_name}\n"
unless spec.dependencies.empty?
- spec.dependencies.sort_by { |dep| dep.name }.each do |dep|
+ spec.dependencies.sort_by {|dep| dep.name }.each do |dep|
response << ' ' * level + " #{dep}\n"
end
end
@@ -168,11 +168,11 @@ use with other commands.
ss, _ = fetcher.spec_for_dependency dependency
- ss.map { |s,o| s }
+ ss.map {|s,o| s }
end
def reverse_dependencies(specs) # :nodoc:
- reverse = Hash.new { |h, k| h[k] = [] }
+ reverse = Hash.new {|h, k| h[k] = [] }
return reverse unless options[:reverse_dependencies]
diff --git a/lib/rubygems/commands/fetch_command.rb b/lib/rubygems/commands/fetch_command.rb
index 66562d7..ab77a3b 100644
--- a/lib/rubygems/commands/fetch_command.rb
+++ b/lib/rubygems/commands/fetch_command.rb
@@ -57,11 +57,11 @@ then repackaging it.
Gem::SpecFetcher.fetcher.spec_for_dependency dep
if platform
- filtered = specs_and_sources.select { |s,| s.platform == platform }
+ filtered = specs_and_sources.select {|s,| s.platform == platform }
specs_and_sources = filtered unless filtered.empty?
end
- spec, source = specs_and_sources.max_by { |s,| s.version }
+ spec, source = specs_and_sources.max_by {|s,| s.version }
if spec.nil?
show_lookup_failure gem_name, version, errors, options[:domain]
diff --git a/lib/rubygems/commands/help_command.rb b/lib/rubygems/commands/help_command.rb
index 259e8b5..23df79f 100644
--- a/lib/rubygems/commands/help_command.rb
+++ b/lib/rubygems/commands/help_command.rb
@@ -324,7 +324,7 @@ platform.
margin_width = 4
- desc_width = @command_manager.command_names.map { |n| n.size }.max + 4
+ desc_width = @command_manager.command_names.map {|n| n.size }.max + 4
summary_width = 80 - margin_width - desc_width
wrap_indent = ' ' * (margin_width + desc_width)
diff --git a/lib/rubygems/commands/lock_command.rb b/lib/rubygems/commands/lock_command.rb
index ebb402a..ed1d548 100644
--- a/lib/rubygems/commands/lock_command.rb
+++ b/lib/rubygems/commands/lock_command.rb
@@ -104,7 +104,7 @@ lock it down to the exact version.
File.join path, "specifications", "#{gem_full_name}.gemspec"
end
- gemspecs.find { |path| File.exist? path }
+ gemspecs.find {|path| File.exist? path }
end
end
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index a82b6a4..55b8061 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -217,7 +217,7 @@ By default, this RubyGems will install gem as:
say
say "RubyGems installed the following executables:"
- say bin_file_names.map { |name| "\t#{name}\n" }
+ say bin_file_names.map {|name| "\t#{name}\n" }
say
unless bin_file_names.grep(/#{File::SEPARATOR}gem$/)
@@ -548,7 +548,7 @@ By default, this RubyGems will install gem as:
def bundler_template_files
Dir.chdir "bundler/lib" do
Dir.glob(File.join('bundler', 'templates', '**', '*'), File::FNM_DOTMATCH).
- select{|f| !File.directory?(f)}
+ select{|f| !File.directory?(f) }
end
end
@@ -556,7 +556,7 @@ By default, this RubyGems will install gem as:
def template_files_in(dir)
Dir.chdir dir do
Dir.glob(File.join('templates', '**', '*'), File::FNM_DOTMATCH).
- select{|f| !File.directory?(f)}
+ select{|f| !File.directory?(f) }
end
end
diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb
index 7326822..e19bfee 100644
--- a/lib/rubygems/commands/specification_command.rb
+++ b/lib/rubygems/commands/specification_command.rb
@@ -119,7 +119,7 @@ Specific fields in the specification can be extracted in YAML format:
dep.prerelease = options[:prerelease]
found, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dep
- specs.push(*found.map { |spec,| spec })
+ specs.push(*found.map {|spec,| spec })
end
if specs.empty?
@@ -128,7 +128,7 @@ Specific fields in the specification can be extracted in YAML format:
end
unless options[:all]
- specs = [specs.max_by { |s| s.version }]
+ specs = [specs.max_by {|s| s.version }]
end
specs.each do |s|
diff --git a/lib/rubygems/commands/stale_command.rb b/lib/rubygems/commands/stale_command.rb
index 89bafea..2fd4388 100644
--- a/lib/rubygems/commands/stale_command.rb
+++ b/lib/rubygems/commands/stale_command.rb
@@ -33,7 +33,7 @@ longer using.
end
end
- gem_to_atime.sort_by { |_, atime| atime }.each do |name, atime|
+ gem_to_atime.sort_by {|_, atime| atime }.each do |name, atime|
say "#{name} at #{atime.strftime '%c'}"
end
end
diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb
index c1a9dbb..2aac9e9 100644
--- a/lib/rubygems/commands/uninstall_command.rb
+++ b/lib/rubygems/commands/uninstall_command.rb
@@ -136,7 +136,7 @@ that is a dependency of an existing gem. You can use the
end
def uninstall_all
- specs = Gem::Specification.reject { |spec| spec.default_gem? }
+ specs = Gem::Specification.reject {|spec| spec.default_gem? }
specs.each do |spec|
options[:version] = spec.version
diff --git a/lib/rubygems/commands/unpack_command.rb b/lib/rubygems/commands/unpack_command.rb
index 09829d8..1091a55 100644
--- a/lib/rubygems/commands/unpack_command.rb
+++ b/lib/rubygems/commands/unpack_command.rb
@@ -157,7 +157,7 @@ command help for an example.
specs = dependency.matching_specs
- selected = specs.max_by { |s| s.version }
+ selected = specs.max_by {|s| s.version }
return Gem::RemoteFetcher.fetcher.download_to_cache(dependency) unless
selected
diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb
index 494b3ee..ca407ee 100644
--- a/lib/rubygems/commands/update_command.rb
+++ b/lib/rubygems/commands/update_command.rb
@@ -107,7 +107,7 @@ command to remove old versions.
updated = update_gems gems_to_update
- updated_names = updated.map { |spec| spec.name }
+ updated_names = updated.map {|spec| spec.name }
not_updated_names = options[:args].uniq - updated_names
if updated.empty?
@@ -126,7 +126,7 @@ command to remove old versions.
spec_tuples, errors = fetcher.search_for_dependency dependency
- error = errors.find { |e| e.respond_to? :exception }
+ error = errors.find {|e| e.respond_to? :exception }
raise error if error
@@ -231,7 +231,7 @@ command to remove old versions.
end
def update_gem(name, version = Gem::Requirement.default)
- return if @updated.any? { |spec| spec.name == name }
+ return if @updated.any? {|spec| spec.name == name }
update_options = options.dup
update_options[:prerelease] = version.prerelease?
@@ -292,7 +292,7 @@ command to remove old versions.
highest_installed_gems.each do |l_name, l_spec|
next if not gem_names.empty? and
- gem_names.none? { |name| name == l_spec.name }
+ gem_names.none? {|name| name == l_spec.name }
highest_remote_tup = highest_remote_name_tuple l_spec
highest_remote_ver = highest_remote_tup.version
diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb
index 393f947..9f1da9e 100644
--- a/lib/rubygems/config_file.rb
+++ b/lib/rubygems/config_file.rb
@@ -434,7 +434,7 @@ if you believe they were disclosed to a third party.
yaml_hash[:ssl_client_cert] =
@hash[:ssl_client_cert] if @hash.key? :ssl_client_cert
- keys = yaml_hash.keys.map { |key| key.to_s }
+ keys = yaml_hash.keys.map {|key| key.to_s }
keys << 'debug'
re = Regexp.union(*keys)
diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb
index faf9886..edf0466 100644
--- a/lib/rubygems/core_ext/kernel_require.rb
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -130,7 +130,7 @@ module Kernel
# Ok, now find a gem that has no conflicts, starting
# at the highest version.
- valid = found_specs.find { |s| !s.has_conflicts? }
+ valid = found_specs.find {|s| !s.has_conflicts? }
unless valid
le = Gem::LoadError.new "unable to find a version of '#{names.first}' to activate"
diff --git a/lib/rubygems/dependency.rb b/lib/rubygems/dependency.rb
index 0c58815..be0bf24 100644
--- a/lib/rubygems/dependency.rb
+++ b/lib/rubygems/dependency.rb
@@ -322,13 +322,13 @@ class Gem::Dependency
def to_spec
matches = self.to_specs.compact
- active = matches.find { |spec| spec.activated? }
+ active = matches.find {|spec| spec.activated? }
return active if active
return matches.first if prerelease?
# Move prereleases to the end of the list for >= 0 requirements
- pre, matches = matches.partition { |spec| spec.version.prerelease? }
+ pre, matches = matches.partition {|spec| spec.version.prerelease? }
matches += pre if requirement == Gem::Requirement.default
matches.first
diff --git a/lib/rubygems/dependency_list.rb b/lib/rubygems/dependency_list.rb
index db7a2f5..978d1be 100644
--- a/lib/rubygems/dependency_list.rb
+++ b/lib/rubygems/dependency_list.rb
@@ -101,11 +101,11 @@ class Gem::DependencyList
end
def find_name(full_name)
- @specs.find { |spec| spec.full_name == full_name }
+ @specs.find {|spec| spec.full_name == full_name }
end
def inspect # :nodoc:
- "%s %p>" % [super[0..-2], map { |s| s.full_name }]
+ "%s %p>" % [super[0..-2], map {|s| s.full_name }]
end
##
@@ -116,7 +116,7 @@ class Gem::DependencyList
end
def why_not_ok?(quick = false)
- unsatisfied = Hash.new { |h,k| h[k] = [] }
+ unsatisfied = Hash.new {|h,k| h[k] = [] }
each do |spec|
spec.runtime_dependencies.each do |dep|
inst = Gem::Specification.any? do |installed_spec|
@@ -124,7 +124,7 @@ class Gem::DependencyList
dep.requirement.satisfied_by? installed_spec.version
end
- unless inst or @specs.find { |s| s.satisfies_requirement? dep }
+ unless inst or @specs.find {|s| s.satisfies_requirement? dep }
unsatisfied[spec.name] << dep
return unsatisfied if quick
end
@@ -184,7 +184,7 @@ class Gem::DependencyList
# Removes the gemspec matching +full_name+ from the dependency list
def remove_by_name(full_name)
- @specs.delete_if { |spec| spec.full_name == full_name }
+ @specs.delete_if {|spec| spec.full_name == full_name }
end
##
@@ -192,7 +192,7 @@ class Gem::DependencyList
# gemspecs that have a dependency satisfied by the named gemspec.
def spec_predecessors
- result = Hash.new { |h,k| h[k] = [] }
+ result = Hash.new {|h,k| h[k] = [] }
specs = @specs.sort.reverse
@@ -238,7 +238,7 @@ class Gem::DependencyList
# +ignored+.
def active_count(specs, ignored)
- specs.count { |spec| ignored[spec.full_name].nil? }
+ specs.count {|spec| ignored[spec.full_name].nil? }
end
end
diff --git a/lib/rubygems/doctor.rb b/lib/rubygems/doctor.rb
index cb800f1..9ac577a 100644
--- a/lib/rubygems/doctor.rb
+++ b/lib/rubygems/doctor.rb
@@ -31,7 +31,7 @@ class Gem::Doctor
missing =
Gem::REPOSITORY_SUBDIRECTORIES.sort -
- REPOSITORY_EXTENSION_MAP.map { |(k,_)| k }.sort
+ REPOSITORY_EXTENSION_MAP.map {|(k,_)| k }.sort
raise "Update REPOSITORY_EXTENSION_MAP, missing: #{missing.join ', '}" unless
missing.empty?
@@ -53,7 +53,7 @@ class Gem::Doctor
# Specs installed in this gem repository
def installed_specs # :nodoc:
- @installed_specs ||= Gem::Specification.map { |s| s.full_name }
+ @installed_specs ||= Gem::Specification.map {|s| s.full_name }
end
##
diff --git a/lib/rubygems/exceptions.rb b/lib/rubygems/exceptions.rb
index ac1e8b4..903abe0 100644
--- a/lib/rubygems/exceptions.rb
+++ b/lib/rubygems/exceptions.rb
@@ -245,7 +245,7 @@ class Gem::UnsatisfiableDependencyError < Gem::DependencyError
def initialize(dep, platform_mismatch=nil)
if platform_mismatch and !platform_mismatch.empty?
- plats = platform_mismatch.map { |x| x.platform.to_s }.sort.uniq
+ plats = platform_mismatch.map {|x| x.platform.to_s }.sort.uniq
super "Unable to resolve dependency: No match for '#{dep}' on this platform. Found: #{plats.join(', ')}"
else
if dep.explicit?
diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb
index 1fe1ea8..1310f59 100644
--- a/lib/rubygems/ext/ext_conf_builder.rb
+++ b/lib/rubygems/ext/ext_conf_builder.rb
@@ -66,7 +66,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
if Gem.install_extension_in_lib and lib_dir
FileUtils.mkdir_p lib_dir
entries = Dir.entries(tmp_dest) - %w[. ..]
- entries = entries.map { |entry| File.join tmp_dest, entry }
+ entries = entries.map {|entry| File.join tmp_dest, entry }
FileUtils.cp_r entries, lib_dir, :remove_destination => true
end
diff --git a/lib/rubygems/indexer.rb b/lib/rubygems/indexer.rb
index 262836a..c99a6a8 100644
--- a/lib/rubygems/indexer.rb
+++ b/lib/rubygems/indexer.rb
@@ -365,7 +365,7 @@ class Gem::Indexer
end
specs = map_gems_to_specs updated_gems
- prerelease, released = specs.partition { |s| s.version.prerelease? }
+ prerelease, released = specs.partition {|s| s.version.prerelease? }
files = build_marshal_gemspecs specs
diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb
index 65c2f30..b46b53e 100644
--- a/lib/rubygems/install_update_options.rb
+++ b/lib/rubygems/install_update_options.rb
@@ -154,7 +154,7 @@ module Gem::InstallUpdateOptions
'Omit the named groups (comma separated)',
'when installing from a gem dependencies',
'file') do |v,o|
- options[:without_groups].concat v.map { |without| without.intern }
+ options[:without_groups].concat v.map {|without| without.intern }
end
add_option(:"Install/Update", '--default',
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 92e6126..54e7a59 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -410,7 +410,7 @@ class Gem::Installer
def installation_satisfies_dependency?(dependency)
return true if @options[:development] and dependency.type == :development
- return true if installed_specs.detect { |s| dependency.matches_spec? s }
+ return true if installed_specs.detect {|s| dependency.matches_spec? s }
return false if @only_install_dir
not dependency.matching_specs.empty?
end
@@ -584,7 +584,7 @@ class Gem::Installer
def shebang(bin_file_name)
ruby_name = RbConfig::CONFIG['ruby_install_name'] if @env_shebang
path = File.join gem_dir, spec.bindir, bin_file_name
- first_line = File.open(path, "rb") {|file| file.gets} || ""
+ first_line = File.open(path, "rb") {|file| file.gets } || ""
if first_line.start_with?("#!")
# Preserve extra words on shebang line, like "-w". Thanks RPA.
diff --git a/lib/rubygems/local_remote_options.rb b/lib/rubygems/local_remote_options.rb
index c940f50..2d0509e 100644
--- a/lib/rubygems/local_remote_options.rb
+++ b/lib/rubygems/local_remote_options.rb
@@ -26,7 +26,7 @@ module Gem::LocalRemoteOptions
valid_uri_schemes = ["http", "https", "file", "s3"]
unless valid_uri_schemes.include?(uri.scheme)
- msg = "Invalid uri scheme for #{value}\nPreface URLs with one of #{valid_uri_schemes.map{|s| "#{s}://"}}"
+ msg = "Invalid uri scheme for #{value}\nPreface URLs with one of #{valid_uri_schemes.map{|s| "#{s}://" }}"
raise ArgumentError, msg
end
diff --git a/lib/rubygems/name_tuple.rb b/lib/rubygems/name_tuple.rb
index dc1a1bb..9130282 100644
--- a/lib/rubygems/name_tuple.rb
+++ b/lib/rubygems/name_tuple.rb
@@ -26,7 +26,7 @@ class Gem::NameTuple
# NameTuple objects.
def self.from_list(list)
- list.map { |t| new(*t) }
+ list.map {|t| new(*t) }
end
##
@@ -34,7 +34,7 @@ class Gem::NameTuple
# [name, version, platform] tuples.
def self.to_basic(list)
- list.map { |t| t.to_a }
+ list.map {|t| t.to_a }
end
##
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 060c82d..271c236 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -198,7 +198,7 @@ class Gem::Package
@build_time = Gem.source_date_epoch
@checksums = {}
@contents = nil
- @digests = Hash.new { |h, algorithm| h[algorithm] = {} }
+ @digests = Hash.new {|h, algorithm| h[algorithm] = {} }
@files = nil
@security_policy = security_policy
@signatures = {}
@@ -219,7 +219,7 @@ class Gem::Package
def add_checksums(tar)
Gem.load_yaml
- checksums_by_algorithm = Hash.new { |h, algorithm| h[algorithm] = {} }
+ checksums_by_algorithm = Hash.new {|h, algorithm| h[algorithm] = {} }
@checksums.each do |name, digests|
digests.each do |algorithm, digest|
@@ -582,10 +582,10 @@ EOM
)
@spec.signing_key = nil
- @spec.cert_chain = @signer.cert_chain.map { |cert| cert.to_s }
+ @spec.cert_chain = @signer.cert_chain.map {|cert| cert.to_s }
else
@signer = Gem::Security::Signer.new nil, nil, passphrase
- @spec.cert_chain = @signer.cert_chain.map { |cert| cert.to_pem } if
+ @spec.cert_chain = @signer.cert_chain.map {|cert| cert.to_pem } if
@signer.cert_chain
end
end
diff --git a/lib/rubygems/package/old.rb b/lib/rubygems/package/old.rb
index f574b98..aeb6c99 100644
--- a/lib/rubygems/package/old.rb
+++ b/lib/rubygems/package/old.rb
@@ -42,7 +42,7 @@ class Gem::Package::Old < Gem::Package
read_until_dashes io # spec
header = file_list io
- @contents = header.map { |file| file['path'] }
+ @contents = header.map {|file| file['path'] }
end
end
diff --git a/lib/rubygems/package/tar_header.rb b/lib/rubygems/package/tar_header.rb
index 83a208b..de51df1 100644
--- a/lib/rubygems/package/tar_header.rb
+++ b/lib/rubygems/package/tar_header.rb
@@ -210,7 +210,7 @@ class Gem::Package::TarHeader
private
def calculate_checksum(header)
- header.unpack("C*").inject { |a, b| a + b }
+ header.unpack("C*").inject {|a, b| a + b }
end
def header(checksum = @checksum)
diff --git a/lib/rubygems/package/tar_test_case.rb b/lib/rubygems/package/tar_test_case.rb
index 75978c8..e4c408e 100644
--- a/lib/rubygems/package/tar_test_case.rb
+++ b/lib/rubygems/package/tar_test_case.rb
@@ -68,7 +68,7 @@ class Gem::Package::TarTestCase < Gem::TestCase
end
def calc_checksum(header)
- sum = header.unpack("C*").inject{|s,a| s + a}
+ sum = header.unpack("C*").inject{|s,a| s + a }
SP(Z(to_oct(sum, 6)))
end
diff --git a/lib/rubygems/path_support.rb b/lib/rubygems/path_support.rb
index 6a5d180..9e5a48d 100644
--- a/lib/rubygems/path_support.rb
+++ b/lib/rubygems/path_support.rb
@@ -68,7 +68,7 @@ class Gem::PathSupport
gem_path = default_path
end
- gem_path.map { |path| expand(path) }.uniq
+ gem_path.map {|path| expand(path) }.uniq
end
# Return the default Gem path
diff --git a/lib/rubygems/query_utils.rb b/lib/rubygems/query_utils.rb
index 3bc5ccf..4e9b6ef 100644
--- a/lib/rubygems/query_utils.rb
+++ b/lib/rubygems/query_utils.rb
@@ -75,7 +75,7 @@ is too hard to use.
terminate_interaction(check_installed_gems(gem_names)) if check_installed_gems?
- gem_names.each { |n| show_gems(n) }
+ gem_names.each {|n| show_gems(n) }
end
private
@@ -187,12 +187,12 @@ is too hard to use.
# Check if gem +name+ version +version+ is installed.
def installed?(name, req = Gem::Requirement.default)
- Gem::Specification.any? { |s| s.name =~ name and req =~ s.version }
+ Gem::Specification.any? {|s| s.name =~ name and req =~ s.version }
end
def output_query_results(spec_tuples)
output = []
- versions = Hash.new { |h,name| h[name] = [] }
+ versions = Hash.new {|h,name| h[name] = [] }
spec_tuples.each do |spec_tuple, source|
versions[spec_tuple.name] << [spec_tuple, source]
@@ -209,9 +209,9 @@ is too hard to use.
def output_versions(output, versions)
versions.each do |gem_name, matching_tuples|
- matching_tuples = matching_tuples.sort_by { |n,_| n.version }.reverse
+ matching_tuples = matching_tuples.sort_by {|n,_| n.version }.reverse
- platforms = Hash.new { |h,version| h[version] = [] }
+ platforms = Hash.new {|h,version| h[version] = [] }
matching_tuples.each do |n, _|
platforms[n.version] << n.platform if n.platform
@@ -254,7 +254,7 @@ is too hard to use.
list =
if platforms.empty? or options[:details]
- name_tuples.map { |n| n.version }.uniq
+ name_tuples.map {|n| n.version }.uniq
else
platforms.sort.reverse.map do |version, pls|
out = version.to_s
@@ -332,7 +332,7 @@ is too hard to use.
def spec_platforms(entry, platforms)
non_ruby = platforms.any? do |_, pls|
- pls.any? { |pl| pl != Gem::Platform::RUBY }
+ pls.any? {|pl| pl != Gem::Platform::RUBY }
end
return unless non_ruby
@@ -343,7 +343,7 @@ is too hard to use.
else
entry << " Platforms:\n"
- sorted_platforms = platforms.sort_by { |version,| version }
+ sorted_platforms = platforms.sort_by {|version,| version }
sorted_platforms.each do |version, pls|
label = " #{version}: "
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index da88ec4..58c14ae 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -106,7 +106,7 @@ class Gem::RemoteFetcher
return if found.empty?
- spec, source = found.max_by { |(s,_)| s.version }
+ spec, source = found.max_by {|(s,_)| s.version }
download spec, source.uri
end
@@ -212,7 +212,7 @@ class Gem::RemoteFetcher
def fetch_http(uri, last_modified = nil, head = false, depth = 0)
fetch_type = head ? Net::HTTP::Head : Net::HTTP::Get
response = request uri, fetch_type, last_modified do |req|
- headers.each { |k,v| req.add_field(k,v) }
+ headers.each {|k,v| req.add_field(k,v) }
end
case response
@@ -327,7 +327,7 @@ class Gem::RemoteFetcher
end
def close_all
- @pools.each_value {|pool| pool.close_all}
+ @pools.each_value {|pool| pool.close_all }
end
private
diff --git a/lib/rubygems/request/connection_pools.rb b/lib/rubygems/request/connection_pools.rb
index 9444239..1bd823a 100644
--- a/lib/rubygems/request/connection_pools.rb
+++ b/lib/rubygems/request/connection_pools.rb
@@ -31,7 +31,7 @@ class Gem::Request::ConnectionPools # :nodoc:
end
def close_all
- @pools.each_value {|pool| pool.close_all}
+ @pools.each_value {|pool| pool.close_all }
end
private
diff --git a/lib/rubygems/request_set.rb b/lib/rubygems/request_set.rb
index d6fb41f..15eb952 100644
--- a/lib/rubygems/request_set.rb
+++ b/lib/rubygems/request_set.rb
@@ -184,7 +184,7 @@ class Gem::RequestSet
if req.installed?
req.spec.spec.build_extensions
- if @always_install.none? { |spec| spec == req.spec.spec }
+ if @always_install.none? {|spec| spec == req.spec.spec }
yield req, nil if block_given?
next
end
@@ -269,7 +269,7 @@ class Gem::RequestSet
gem_home, ENV['GEM_HOME'] = ENV['GEM_HOME'], dir
existing = force ? [] : specs_in(dir)
- existing.delete_if { |s| @always_install.include? s }
+ existing.delete_if {|s| @always_install.include? s }
dir = File.expand_path dir
@@ -283,7 +283,7 @@ class Gem::RequestSet
sorted_requests.each do |request|
spec = request.spec
- if existing.find { |s| s.full_name == spec.full_name }
+ if existing.find {|s| s.full_name == spec.full_name }
yield request, nil if block_given?
next
end
@@ -386,7 +386,7 @@ class Gem::RequestSet
q.text 'sets:'
q.breakable
- q.pp @sets.map { |set| set.class }
+ q.pp @sets.map {|set| set.class }
end
end
@@ -440,7 +440,7 @@ class Gem::RequestSet
end
def specs
- @specs ||= @requests.map { |r| r.full_spec }
+ @specs ||= @requests.map {|r| r.full_spec }
end
def specs_in(dir)
diff --git a/lib/rubygems/request_set/gem_dependency_api.rb b/lib/rubygems/request_set/gem_dependency_api.rb
index ef3f302..07da092 100644
--- a/lib/rubygems/request_set/gem_dependency_api.rb
+++ b/lib/rubygems/request_set/gem_dependency_api.rb
@@ -206,7 +206,7 @@ class Gem::RequestSet::GemDependencyAPI
@git_set = @set.git_set
@git_sources = {}
@installing = false
- @requires = Hash.new { |h, name| h[name] = [] }
+ @requires = Hash.new {|h, name| h[name] = [] }
@vendor_set = @set.vendor_set
@source_set = @set.source_set
@gem_sources = {}
diff --git a/lib/rubygems/request_set/lockfile.rb b/lib/rubygems/request_set/lockfile.rb
index 5423f2c..5af49a4 100644
--- a/lib/rubygems/request_set/lockfile.rb
+++ b/lib/rubygems/request_set/lockfile.rb
@@ -89,7 +89,7 @@ class Gem::RequestSet::Lockfile
def add_DEPENDENCIES(out) # :nodoc:
out << "DEPENDENCIES"
- out.concat @dependencies.sort_by { |name,| name }.map { |name, requirement|
+ out.concat @dependencies.sort_by {|name,| name }.map {|name, requirement|
" #{name}#{requirement.for_lockfile}"
}
@@ -103,12 +103,12 @@ class Gem::RequestSet::Lockfile
request.spec.source.uri
end
- source_groups.sort_by { |group,| group.to_s }.map do |group, requests|
+ source_groups.sort_by {|group,| group.to_s }.map do |group, requests|
out << "GEM"
out << " remote: #{group}"
out << " specs:"
- requests.sort_by { |request| request.name }.each do |request|
+ requests.sort_by {|request| request.name }.each do |request|
next if request.spec.name == 'bundler'
platform = "-#{request.spec.platform}" unless
Gem::Platform::RUBY == request.spec.platform
@@ -140,10 +140,10 @@ class Gem::RequestSet::Lockfile
out << " revision: #{revision}"
out << " specs:"
- requests.sort_by { |request| request.name }.each do |request|
+ requests.sort_by {|request| request.name }.each do |request|
out << " #{request.name} (#{request.version})"
- dependencies = request.spec.dependencies.sort_by { |dep| dep.name }
+ dependencies = request.spec.dependencies.sort_by {|dep| dep.name }
dependencies.each do |dep|
out << " #{dep.name}#{dep.requirement.for_lockfile}"
end
@@ -185,9 +185,9 @@ class Gem::RequestSet::Lockfile
def add_PLATFORMS(out) # :nodoc:
out << "PLATFORMS"
- platforms = requests.map { |request| request.spec.platform }.uniq
+ platforms = requests.map {|request| request.spec.platform }.uniq
- platforms = platforms.sort_by { |platform| platform.to_s }
+ platforms = platforms.sort_by {|platform| platform.to_s }
platforms.each do |platform|
out << " #{platform}"
@@ -197,7 +197,7 @@ class Gem::RequestSet::Lockfile
end
def spec_groups
- requests.group_by { |request| request.spec.class }
+ requests.group_by {|request| request.spec.class }
end
##
diff --git a/lib/rubygems/request_set/lockfile/tokenizer.rb b/lib/rubygems/request_set/lockfile/tokenizer.rb
index 97396ec..2062334 100644
--- a/lib/rubygems/request_set/lockfile/tokenizer.rb
+++ b/lib/rubygems/request_set/lockfile/tokenizer.rb
@@ -23,7 +23,7 @@ class Gem::RequestSet::Lockfile::Tokenizer
end
def to_a
- @tokens.map { |token| [token.type, token.value, token.column, token.line] }
+ @tokens.map {|token| [token.type, token.value, token.column, token.line] }
end
def skip(type)
diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb
index 1e17fc2..d2c1254 100644
--- a/lib/rubygems/requirement.rb
+++ b/lib/rubygems/requirement.rb
@@ -12,18 +12,18 @@ require "rubygems/deprecate"
class Gem::Requirement
OPS = { #:nodoc:
- "=" => lambda { |v, r| v == r },
- "!=" => lambda { |v, r| v != r },
- ">" => lambda { |v, r| v > r },
- "<" => lambda { |v, r| v < r },
- ">=" => lambda { |v, r| v >= r },
- "<=" => lambda { |v, r| v <= r },
- "~>" => lambda { |v, r| v >= r && v.release < r.bump }
+ "=" => lambda {|v, r| v == r },
+ "!=" => lambda {|v, r| v != r },
+ ">" => lambda {|v, r| v > r },
+ "<" => lambda {|v, r| v < r },
+ ">=" => lambda {|v, r| v >= r },
+ "<=" => lambda {|v, r| v <= r },
+ "~>" => lambda {|v, r| v >= r && v.release < r.bump }
}.freeze
SOURCE_SET_REQUIREMENT = Struct.new(:for_lockfile).new "!" # :nodoc:
- quoted = OPS.keys.map { |k| Regexp.quote k }.join "|"
+ quoted = OPS.keys.map {|k| Regexp.quote k }.join "|"
PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*".freeze # :nodoc:
##
@@ -137,7 +137,7 @@ class Gem::Requirement
if requirements.empty?
@requirements = [DefaultRequirement]
else
- @requirements = requirements.map! { |r| self.class.parse r }
+ @requirements = requirements.map! {|r| self.class.parse r }
end
end
@@ -148,7 +148,7 @@ class Gem::Requirement
new = new.flatten
new.compact!
new.uniq!
- new = new.map { |r| self.class.parse r }
+ new = new.map {|r| self.class.parse r }
@requirements.concat new
end
@@ -188,7 +188,7 @@ class Gem::Requirement
end
def as_list # :nodoc:
- requirements.map { |op, version| "#{op} #{version}" }
+ requirements.map {|op, version| "#{op} #{version}" }
end
def hash # :nodoc:
@@ -233,7 +233,7 @@ class Gem::Requirement
# are prereleases
def prerelease?
- requirements.any? { |r| r.last.prerelease? }
+ requirements.any? {|r| r.last.prerelease? }
end
def pretty_print(q) # :nodoc:
@@ -249,7 +249,7 @@ class Gem::Requirement
raise ArgumentError, "Need a Gem::Version: #{version.inspect}" unless
Gem::Version === version
# #28965: syck has a bug with unquoted '=' YAML.loading as YAML::DefaultKey
- requirements.all? { |op, rv| (OPS[op] || OPS["="]).call version, rv }
+ requirements.all? {|op, rv| (OPS[op] || OPS["="]).call version, rv }
end
alias :=== :satisfied_by?
@@ -285,7 +285,7 @@ class Gem::Requirement
protected
def _tilde_requirements
- requirements.select { |r| r.first == "~>" }
+ requirements.select {|r| r.first == "~>" }
end
private
diff --git a/lib/rubygems/resolver.rb b/lib/rubygems/resolver.rb
index ea9687b..fd5cf3d 100644
--- a/lib/rubygems/resolver.rb
+++ b/lib/rubygems/resolver.rb
@@ -116,7 +116,7 @@ class Gem::Resolver
def explain(stage, *data) # :nodoc:
return unless DEBUG_RESOLVER
- d = data.map { |x| x.pretty_inspect }.join(", ")
+ d = data.map {|x| x.pretty_inspect }.join(", ")
$stderr.printf "%10s %s\n", stage.to_s.upcase, d
end
@@ -189,7 +189,7 @@ class Gem::Resolver
def resolve
locking_dg = Molinillo::DependencyGraph.new
- Molinillo::Resolver.new(self, self).resolve(@needed.map { |d| DependencyRequest.new d, nil }, locking_dg).tsort.map(&:payload).compact
+ Molinillo::Resolver.new(self, self).resolve(@needed.map {|d| DependencyRequest.new d, nil }, locking_dg).tsort.map(&:payload).compact
rescue Molinillo::VersionConflict => e
conflict = e.conflicts.values.first
raise Gem::DependencyResolutionError, Conflict.new(conflict.requirement_trees.first.first, conflict.existing, conflict.requirement)
@@ -206,7 +206,7 @@ class Gem::Resolver
if (skip_dep_gems = skip_gems[dependency.name]) && !skip_dep_gems.empty?
matching = all.select do |api_spec|
- skip_dep_gems.any? { |s| api_spec.version == s.version }
+ skip_dep_gems.any? {|s| api_spec.version == s.version }
end
all = matching unless matching.empty?
@@ -235,7 +235,7 @@ class Gem::Resolver
raise exc
end
- groups = Hash.new { |hash, key| hash[key] = [] }
+ groups = Hash.new {|hash, key| hash[key] = [] }
# create groups & sources in the same loop
sources = possibles.map do |spec|
@@ -248,9 +248,9 @@ class Gem::Resolver
sources.each do |source|
groups[source].
- sort_by { |spec| [spec.version, Gem::Platform.local =~ spec.platform ? 1 : 0] }.
- map { |spec| ActivationRequest.new spec, dependency }.
- each { |activation_request| activation_requests << activation_request }
+ sort_by {|spec| [spec.version, Gem::Platform.local =~ spec.platform ? 1 : 0] }.
+ map {|spec| ActivationRequest.new spec, dependency }.
+ each {|activation_request| activation_requests << activation_request }
end
activation_requests
diff --git a/lib/rubygems/resolver/api_set.rb b/lib/rubygems/resolver/api_set.rb
index 9b9eeb6..ca92bac 100644
--- a/lib/rubygems/resolver/api_set.rb
+++ b/lib/rubygems/resolver/api_set.rb
@@ -33,7 +33,7 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
@dep_uri = dep_uri
@uri = dep_uri + '../..'
- @data = Hash.new { |h,k| h[k] = [] }
+ @data = Hash.new {|h,k| h[k] = [] }
@source = Gem::Source.new @uri
@to_fetch = []
@@ -67,7 +67,7 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
def prefetch(reqs)
return unless @remote
- names = reqs.map { |r| r.dependency.name }
+ names = reqs.map {|r| r.dependency.name }
needed = names - @data.keys - @to_fetch
@to_fetch += needed
diff --git a/lib/rubygems/resolver/composed_set.rb b/lib/rubygems/resolver/composed_set.rb
index 4baac9c..094cb69 100644
--- a/lib/rubygems/resolver/composed_set.rb
+++ b/lib/rubygems/resolver/composed_set.rb
@@ -40,11 +40,11 @@ class Gem::Resolver::ComposedSet < Gem::Resolver::Set
def remote=(remote)
super
- @sets.each { |set| set.remote = remote }
+ @sets.each {|set| set.remote = remote }
end
def errors
- @errors + @sets.map { |set| set.errors }.flatten
+ @errors + @sets.map {|set| set.errors }.flatten
end
##
@@ -60,7 +60,7 @@ class Gem::Resolver::ComposedSet < Gem::Resolver::Set
# Prefetches +reqs+ in all sets.
def prefetch(reqs)
- @sets.each { |s| s.prefetch(reqs) }
+ @sets.each {|s| s.prefetch(reqs) }
end
end
diff --git a/lib/rubygems/resolver/conflict.rb b/lib/rubygems/resolver/conflict.rb
index 2b337db..4245b59 100644
--- a/lib/rubygems/resolver/conflict.rb
+++ b/lib/rubygems/resolver/conflict.rb
@@ -55,7 +55,7 @@ class Gem::Resolver::Conflict
activated = @activated.spec.full_name
dependency = @failed_dep.dependency
requirement = dependency.requirement
- alternates = dependency.matching_specs.map { |spec| spec.full_name }
+ alternates = dependency.matching_specs.map {|spec| spec.full_name }
unless alternates.empty?
matching = <<-MATCHING.chomp
diff --git a/lib/rubygems/resolver/index_set.rb b/lib/rubygems/resolver/index_set.rb
index e32e1fa..f1ecc7f 100644
--- a/lib/rubygems/resolver/index_set.rb
+++ b/lib/rubygems/resolver/index_set.rb
@@ -17,7 +17,7 @@ class Gem::Resolver::IndexSet < Gem::Resolver::Set
Gem::SpecFetcher.fetcher
end
- @all = Hash.new { |h,k| h[k] = [] }
+ @all = Hash.new {|h,k| h[k] = [] }
list, errors = @f.available_specs :complete
diff --git a/lib/rubygems/resolver/installer_set.rb b/lib/rubygems/resolver/installer_set.rb
index ba14ee9..dad6313 100644
--- a/lib/rubygems/resolver/installer_set.rb
+++ b/lib/rubygems/resolver/installer_set.rb
@@ -118,12 +118,12 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
dep = req.dependency
return res if @ignore_dependencies and
- @always_install.none? { |spec| dep.match? spec }
+ @always_install.none? {|spec| dep.match? spec }
name = dep.name
dep.matching_specs.each do |gemspec|
- next if @always_install.any? { |spec| spec.name == gemspec.name }
+ next if @always_install.any? {|spec| spec.name == gemspec.name }
res << Gem::Resolver::InstalledSpecification.new(self, gemspec)
end unless @ignore_installed
@@ -168,7 +168,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
end
def inspect # :nodoc:
- always_install = @always_install.map { |s| s.full_name }
+ always_install = @always_install.map {|s| s.full_name }
'#<%s domain: %s specs: %p always install: %p>' % [
self.class, @domain, @specs.keys, always_install,
diff --git a/lib/rubygems/resolver/lock_set.rb b/lib/rubygems/resolver/lock_set.rb
index 4134b4d..12807f3 100644
--- a/lib/rubygems/resolver/lock_set.rb
+++ b/lib/rubygems/resolver/lock_set.rb
@@ -75,7 +75,7 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
q.text 'specs:'
q.breakable
- q.pp @specs.map { |spec| spec.full_name }
+ q.pp @specs.map {|spec| spec.full_name }
end
end
diff --git a/lib/rubygems/security.rb b/lib/rubygems/security.rb
index 4529c08..8c86896 100644
--- a/lib/rubygems/security.rb
+++ b/lib/rubygems/security.rb
@@ -485,7 +485,7 @@ module Gem::Security
dcs = dcs.split '.'
- name = "CN=#{cn}/#{dcs.map { |dc| "DC=#{dc}" }.join '/'}"
+ name = "CN=#{cn}/#{dcs.map {|dc| "DC=#{dc}" }.join '/'}"
OpenSSL::X509::Name.parse name
end
diff --git a/lib/rubygems/security/signer.rb b/lib/rubygems/security/signer.rb
index cc1d109..cbfdc0e 100644
--- a/lib/rubygems/security/signer.rb
+++ b/lib/rubygems/security/signer.rb
@@ -106,7 +106,7 @@ class Gem::Security::Signer
# this value is preferred, otherwise the subject is used.
def extract_name(cert) # :nodoc:
- subject_alt_name = cert.extensions.find { |e| 'subjectAltName' == e.oid }
+ subject_alt_name = cert.extensions.find {|e| 'subjectAltName' == e.oid }
if subject_alt_name
/\Aemail:/ =~ subject_alt_name.value # rubocop:disable Performance/StartWith
diff --git a/lib/rubygems/server.rb b/lib/rubygems/server.rb
index b213085..caa36f5 100644
--- a/lib/rubygems/server.rb
+++ b/lib/rubygems/server.rb
@@ -442,8 +442,8 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
logger = WEBrick::Log.new nil, WEBrick::BasicLog::FATAL
@server = WEBrick::HTTPServer.new :DoNotListen => true, :Logger => logger
- @spec_dirs = @gem_dirs.map { |gem_dir| File.join gem_dir, 'specifications' }
- @spec_dirs.reject! { |spec_dir| !File.directory? spec_dir }
+ @spec_dirs = @gem_dirs.map {|gem_dir| File.join gem_dir, 'specifications' }
+ @spec_dirs.reject! {|spec_dir| !File.directory? spec_dir }
reset_gems
@@ -458,7 +458,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
def uri_encode(str)
str.gsub(URI::UNSAFE) do |match|
- match.each_byte.map { |c| sprintf('%%%02X', c.ord) }.join
+ match.each_byte.map {|c| sprintf('%%%02X', c.ord) }.join
end
end
@@ -615,11 +615,11 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
}
end
- deps = deps.sort_by { |dep| [dep["name"].downcase, dep["version"]] }
+ deps = deps.sort_by {|dep| [dep["name"].downcase, dep["version"]] }
deps.last["is_last"] = true unless deps.empty?
# executables
- executables = spec.executables.sort.collect { |exec| {"executable" => exec} }
+ executables = spec.executables.sort.collect {|exec| {"executable" => exec} }
executables = nil if executables.empty?
executables.last["is_last"] = true if executables
@@ -668,7 +668,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
"version" => Gem::VERSION,
}
- specs = specs.sort_by { |spec| [spec["name"].downcase, spec["version"]] }
+ specs = specs.sort_by {|spec| [spec["name"].downcase, spec["version"]] }
specs.last["is_last"] = true
# tag all specs with first_name_entry
@@ -869,7 +869,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
listeners = @server.listeners.map{|l| l.addr[2] }
# TODO: 0.0.0.0 == any, not localhost.
- host = listeners.any?{|l| l == '0.0.0.0'} ? 'localhost' : listeners.first
+ host = listeners.any?{|l| l == '0.0.0.0' } ? 'localhost' : listeners.first
say "Launching browser to http://#{host}:#{@port}"
diff --git a/lib/rubygems/source/local.rb b/lib/rubygems/source/local.rb
index 875e992..15700a0 100644
--- a/lib/rubygems/source/local.rb
+++ b/lib/rubygems/source/local.rb
@@ -61,7 +61,7 @@ class Gem::Source::Local < Gem::Source
when :latest
tup = pkg.spec.name_tuple
- cur = names.find { |x| x.name == tup.name }
+ cur = names.find {|x| x.name == tup.name }
if !cur
names << tup
elsif cur.version < tup.version
@@ -98,7 +98,7 @@ class Gem::Source::Local < Gem::Source
end
end
- found.max_by { |s| s.version }
+ found.max_by {|s| s.version }
end
def fetch_spec(name) # :nodoc:
diff --git a/lib/rubygems/source_list.rb b/lib/rubygems/source_list.rb
index b1d1f2c..2f27303 100644
--- a/lib/rubygems/source_list.rb
+++ b/lib/rubygems/source_list.rb
@@ -90,7 +90,7 @@ class Gem::SourceList
# Yields each source URI in the list.
def each
- @sources.each { |s| yield s.uri.to_s }
+ @sources.each {|s| yield s.uri.to_s }
end
##
@@ -115,7 +115,7 @@ class Gem::SourceList
# Returns an Array of source URI Strings.
def to_a
- @sources.map { |x| x.uri.to_s }
+ @sources.map {|x| x.uri.to_s }
end
alias_method :to_ary, :to_a
@@ -135,7 +135,7 @@ class Gem::SourceList
if other.kind_of? Gem::Source
@sources.include? other
else
- @sources.find { |x| x.uri.to_s == other.to_s }
+ @sources.find {|x| x.uri.to_s == other.to_s }
end
end
@@ -146,7 +146,7 @@ class Gem::SourceList
if source.kind_of? Gem::Source
@sources.delete source
else
- @sources.delete_if { |x| x.uri.to_s == source.to_s }
+ @sources.delete_if {|x| x.uri.to_s == source.to_s }
end
end
diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb
index 56ccaea..82b7bb4 100644
--- a/lib/rubygems/spec_fetcher.rb
+++ b/lib/rubygems/spec_fetcher.rb
@@ -92,8 +92,8 @@ class Gem::SpecFetcher
list.each do |source, specs|
if dependency.name.is_a?(String) && specs.respond_to?(:bsearch)
- start_index = (0 ... specs.length).bsearch{ |i| specs[i].name >= dependency.name }
- end_index = (0 ... specs.length).bsearch{ |i| specs[i].name > dependency.name }
+ start_index = (0 ... specs.length).bsearch{|i| specs[i].name >= dependency.name }
+ end_index = (0 ... specs.length).bsearch{|i| specs[i].name > dependency.name }
specs = specs[start_index ... end_index] if start_index && end_index
end
@@ -122,7 +122,7 @@ class Gem::SpecFetcher
end
end
- tuples = tuples.sort_by { |x| x[0] }
+ tuples = tuples.sort_by {|x| x[0] }
return [tuples, errors]
end
@@ -194,10 +194,10 @@ class Gem::SpecFetcher
matches = if matches.empty? && type != :prerelease
suggest_gems_from_name gem_name, :prerelease
else
- matches.uniq.sort_by { |name, dist| dist }
+ matches.uniq.sort_by {|name, dist| dist }
end
- matches.map { |name, dist| name }.uniq.first(num_results)
+ matches.map {|name, dist| name }.uniq.first(num_results)
end
##
@@ -254,7 +254,7 @@ class Gem::SpecFetcher
def tuples_for(source, type, gracefully_ignore=false) # :nodoc:
@caches[type][source.uri] ||=
- source.load_specs(type).sort_by { |tup| tup.name }
+ source.load_specs(type).sort_by {|tup| tup.name }
rescue Gem::RemoteFetcher::FetchError
raise unless gracefully_ignore
[]
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index cb70b96..fd9776d 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -180,8 +180,8 @@ class Gem::Specification < Gem::BasicSpecification
end
end
- @@attributes = @@default_value.keys.sort_by { |s| s.to_s }
- @@array_attributes = @@default_value.reject { |k,v| v != [] }.keys
+ @@attributes = @@default_value.keys.sort_by {|s| s.to_s }
+ @@array_attributes = @@default_value.reject {|k,v| v != [] }.keys
@@nil_attributes, @@non_nil_attributes = @@default_value.keys.partition do |k|
@@default_value[k].nil?
end
@@ -747,8 +747,8 @@ class Gem::Specification < Gem::BasicSpecification
# After a reset, make sure already loaded specs
# are still marked as activated.
specs = {}
- Gem.loaded_specs.each_value{|s| specs[s] = true}
- @@all.each{|s| s.activated = true if specs[s]}
+ Gem.loaded_specs.each_value{|s| specs[s] = true }
+ @@all.each{|s| s.activated = true if specs[s] }
end
@@all
end
@@ -768,7 +768,7 @@ class Gem::Specification < Gem::BasicSpecification
end
def self.gemspec_stubs_in(dir, pattern)
- Gem::Util.glob_files_in_dir(pattern, dir).map { |path| yield path }.select(&:valid?)
+ Gem::Util.glob_files_in_dir(pattern, dir).map {|path| yield path }.select(&:valid?)
end
private_class_method :gemspec_stubs_in
@@ -783,7 +783,7 @@ class Gem::Specification < Gem::BasicSpecification
dirs.flat_map do |dir|
base_dir = File.dirname dir
gems_dir = File.join base_dir, "gems"
- gemspec_stubs_in(dir, pattern) { |path| yield path, base_dir, gems_dir }
+ gemspec_stubs_in(dir, pattern) {|path| yield path, base_dir, gems_dir }
end
end
private_class_method :map_stubs
@@ -802,10 +802,10 @@ class Gem::Specification < Gem::BasicSpecification
@@stubs ||= begin
pattern = "*.gemspec"
stubs = installed_stubs(dirs, pattern) + default_stubs(pattern)
- stubs = stubs.uniq { |stub| stub.full_name }
+ stubs = stubs.uniq {|stub| stub.full_name }
_resort!(stubs)
- @@stubs_by_name = stubs.select { |s| Gem::Platform.match s.platform }.group_by(&:name)
+ @@stubs_by_name = stubs.select {|s| Gem::Platform.match s.platform }.group_by(&:name)
stubs
end
end
@@ -832,9 +832,9 @@ class Gem::Specification < Gem::BasicSpecification
@@stubs_by_name[name]
else
pattern = "#{name}-*.gemspec"
- stubs = installed_stubs(dirs, pattern).select { |s| Gem::Platform.match s.platform } + default_stubs(pattern)
- stubs = stubs.uniq { |stub| stub.full_name }.group_by(&:name)
- stubs.each_value { |v| _resort!(v) }
+ stubs = installed_stubs(dirs, pattern).select {|s| Gem::Platform.match s.platform } + default_stubs(pattern)
+ stubs = stubs.uniq {|stub| stub.full_name }.group_by(&:name)
+ stubs.each_value {|v| _resort!(v) }
@@stubs_by_name.merge! stubs
@@stubs_by_name[name] ||= EMPTY
@@ -928,7 +928,7 @@ class Gem::Specification < Gem::BasicSpecification
def self.dirs=(dirs)
self.reset
- @@dirs = Array(dirs).map { |dir| File.join dir, "specifications" }
+ @@dirs = Array(dirs).map {|dir| File.join dir, "specifications" }
end
extend Enumerable
@@ -1012,9 +1012,9 @@ class Gem::Specification < Gem::BasicSpecification
def self.find_in_unresolved(path)
# TODO: do we need these?? Kill it
- specs = unresolved_deps.values.map { |dep| dep.to_specs }.flatten
+ specs = unresolved_deps.values.map {|dep| dep.to_specs }.flatten
- specs.find_all { |spec| spec.contains_requirable_file? path }
+ specs.find_all {|spec| spec.contains_requirable_file? path }
end
##
@@ -1022,7 +1022,7 @@ class Gem::Specification < Gem::BasicSpecification
# specs that contain the file matching +path+.
def self.find_in_unresolved_tree(path)
- specs = unresolved_deps.values.map { |dep| dep.to_specs }.flatten
+ specs = unresolved_deps.values.map {|dep| dep.to_specs }.flatten
specs.each do |spec|
spec.traverse do |from_spec, dep, to_spec, trail|
@@ -1077,11 +1077,11 @@ class Gem::Specification < Gem::BasicSpecification
# Return the latest installed spec for gem +name+.
def self.latest_spec_for(name)
- latest_specs(true).find { |installed_spec| installed_spec.name == name }
+ latest_specs(true).find {|installed_spec| installed_spec.name == name }
end
def self._latest_specs(specs, prerelease = false) # :nodoc:
- result = Hash.new { |h,k| h[k] = {} }
+ result = Hash.new {|h,k| h[k] = {} }
native = {}
specs.reverse_each do |spec|
@@ -1094,7 +1094,7 @@ class Gem::Specification < Gem::BasicSpecification
result.map(&:last).map(&:values).flatten.reject do |spec|
minimum = native[spec.name]
minimum && spec.version < minimum
- end.sort_by{ |tup| tup.name }
+ end.sort_by{|tup| tup.name }
end
##
@@ -1168,7 +1168,7 @@ class Gem::Specification < Gem::BasicSpecification
# version as well.
def self.outdated
- outdated_and_latest_version.map { |local, _| local.name }
+ outdated_and_latest_version.map {|local, _| local.name }
end
##
@@ -1189,7 +1189,7 @@ class Gem::Specification < Gem::BasicSpecification
Gem::Dependency.new local_spec.name, ">= #{local_spec.version}"
remotes, = fetcher.search_for_dependency dependency
- remotes = remotes.map { |n, _| n.version }
+ remotes = remotes.map {|n, _| n.version }
latest_remote = remotes.sort.last
@@ -1220,7 +1220,7 @@ class Gem::Specification < Gem::BasicSpecification
def self.reset
@@dirs = nil
- Gem.pre_reset_hooks.each { |hook| hook.call }
+ Gem.pre_reset_hooks.each {|hook| hook.call }
@@all = nil
@@stubs = nil
@@stubs_by_name = {}
@@ -1237,19 +1237,19 @@ class Gem::Specification < Gem::BasicSpecification
versions = find_all_by_name(dep.name)
unless versions.empty?
warn " Available/installed versions of this gem:"
- versions.each { |s| warn " - #{s.version}" }
+ versions.each {|s| warn " - #{s.version}" }
end
end
warn "#{w}: Clearing out unresolved specs. Try 'gem cleanup <gem>'"
warn "Please report a bug if this causes problems."
unresolved.clear
end
- Gem.post_reset_hooks.each { |hook| hook.call }
+ Gem.post_reset_hooks.each {|hook| hook.call }
end
# DOC: This method needs documented or nodoc'd
def self.unresolved_deps
- @unresolved_deps ||= Hash.new { |h, n| h[n] = Gem::Dependency.new n }
+ @unresolved_deps ||= Hash.new {|h, n| h[n] = Gem::Dependency.new n }
end
##
@@ -1280,7 +1280,7 @@ class Gem::Specification < Gem::BasicSpecification
# Cleanup any YAML::PrivateType. They only show up for an old bug
# where nil => null, so just convert them to nil based on the type.
- array.map! { |e| e.kind_of?(YAML::PrivateType) ? nil : e }
+ array.map! {|e| e.kind_of?(YAML::PrivateType) ? nil : e }
spec.instance_variable_set :@rubygems_version, array[0]
# spec version
@@ -1433,7 +1433,7 @@ class Gem::Specification < Gem::BasicSpecification
self.summary = sanitize_string(summary)
self.description = sanitize_string(description)
self.post_install_message = sanitize_string(post_install_message)
- self.authors = authors.collect { |a| sanitize_string(a) }
+ self.authors = authors.collect {|a| sanitize_string(a) }
end
##
@@ -1456,7 +1456,7 @@ class Gem::Specification < Gem::BasicSpecification
return nil if executables.nil?
if @bindir
- Array(executables).map { |e| File.join(@bindir, e) }
+ Array(executables).map {|e| File.join(@bindir, e) }
else
executables
end
@@ -1538,7 +1538,7 @@ class Gem::Specification < Gem::BasicSpecification
def build_args
if File.exist? build_info_file
build_info = File.readlines build_info_file
- build_info = build_info.map { |x| x.strip }
+ build_info = build_info.map {|x| x.strip }
build_info.delete ""
build_info
else
@@ -1630,7 +1630,7 @@ class Gem::Specification < Gem::BasicSpecification
def conficts_when_loaded_with?(list_of_specs) # :nodoc:
result = list_of_specs.any? do |spec|
- spec.dependencies.any? { |dep| dep.runtime? && (dep.name == name) && !satisfies_requirement?(dep) }
+ spec.dependencies.any? {|dep| dep.runtime? && (dep.name == name) && !satisfies_requirement?(dep) }
end
result
end
@@ -1765,7 +1765,7 @@ class Gem::Specification < Gem::BasicSpecification
# Returns all specs that matches this spec's runtime dependencies.
def dependent_specs
- runtime_dependencies.map { |dep| dep.to_specs }.flatten
+ runtime_dependencies.map {|dep| dep.to_specs }.flatten
end
##
@@ -1779,7 +1779,7 @@ class Gem::Specification < Gem::BasicSpecification
# List of dependencies that are used for development
def development_dependencies
- dependencies.select { |d| d.type == :development }
+ dependencies.select {|d| d.type == :development }
end
##
@@ -2283,9 +2283,9 @@ class Gem::Specification < Gem::BasicSpecification
def ruby_code(obj)
case obj
when String then obj.dump + ".freeze"
- when Array then '[' + obj.map { |x| ruby_code x }.join(", ") + ']'
+ when Array then '[' + obj.map {|x| ruby_code x }.join(", ") + ']'
when Hash then
- seg = obj.keys.sort.map { |k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
+ seg = obj.keys.sort.map {|k| "#{k.to_s.dump} => #{obj[k].to_s.dump}" }
"{ #{seg.join(', ')} }"
when Gem::Version then obj.to_s.dump
when DateLike then obj.strftime('%Y-%m-%d').dump
@@ -2313,7 +2313,7 @@ class Gem::Specification < Gem::BasicSpecification
# True if this gem has the same attributes as +other+.
def same_attributes?(spec)
- @@attributes.all? { |name, default| self.send(name) == spec.send(name) }
+ @@attributes.all? {|name, default| self.send(name) == spec.send(name) }
end
private :same_attributes?
@@ -2555,7 +2555,7 @@ class Gem::Specification < Gem::BasicSpecification
unless result == :next
spec_name = dep_spec.name
dep_spec.traverse(trail, visited, &block) unless
- trail.any? { |s| s.name == spec_name }
+ trail.any? {|s| s.name == spec_name }
end
end
end
@@ -2580,11 +2580,11 @@ class Gem::Specification < Gem::BasicSpecification
end
def keep_only_files_and_directories
- @executables.delete_if { |x| File.directory?(File.join(@bindir, x)) }
- @extensions.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
- @extra_rdoc_files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
- @files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
- @test_files.delete_if { |x| File.directory?(x) && !File.symlink?(x) }
+ @executables.delete_if {|x| File.directory?(File.join(@bindir, x)) }
+ @extensions.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
+ @extra_rdoc_files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
+ @files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
+ @test_files.delete_if {|x| File.directory?(x) && !File.symlink?(x) }
end
def validate_metadata
diff --git a/lib/rubygems/specification_policy.rb b/lib/rubygems/specification_policy.rb
index 3a3dba9..b93ff89 100644
--- a/lib/rubygems/specification_policy.rb
+++ b/lib/rubygems/specification_policy.rb
@@ -154,7 +154,7 @@ class Gem::SpecificationPolicy
def validate_duplicate_dependencies # :nodoc:
# NOTE: see REFACTOR note in Gem::Dependency about types - this might be brittle
- seen = Gem::Dependency::TYPES.inject({}) { |types, type| types.merge({ type => {}}) }
+ seen = Gem::Dependency::TYPES.inject({}) {|types, type| types.merge({ type => {}}) }
error_messages = []
@specification.dependencies.each do |dep|
@@ -215,7 +215,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
end
end
if warning_messages.any?
- warning_messages.each { |warning_message| warning warning_message }
+ warning_messages.each {|warning_message| warning warning_message }
end
end
@@ -292,7 +292,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
def validate_non_files
return unless packaging
- non_files = @specification.files.reject {|x| File.file?(x) || File.symlink?(x)}
+ non_files = @specification.files.reject {|x| File.file?(x) || File.symlink?(x) }
unless non_files.empty?
error "[\"#{non_files.join "\", \""}\"] are not files"
@@ -338,7 +338,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
String
end
- unless Array === val and val.all? {|x| x.kind_of?(klass)}
+ unless Array === val and val.all? {|x| x.kind_of?(klass) }
error "#{field} must be an Array of #{klass}"
end
end
@@ -369,7 +369,7 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
license value '#{license}' is invalid. Use a license identifier from
http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard license.
WARNING
- message += "Did you mean #{suggestions.map { |s| "'#{s}'"}.join(', ')}?\n" unless suggestions.nil?
+ message += "Did you mean #{suggestions.map {|s| "'#{s}'" }.join(', ')}?\n" unless suggestions.nil?
warning(message)
end
end
@@ -433,7 +433,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
validate_shebang_line_in(executable)
end
- @specification.files.select { |f| File.symlink?(f) }.each do |file|
+ @specification.files.select {|f| File.symlink?(f) }.each do |file|
warning "#{file} is a symlink, which is not supported on all platforms"
end
end
@@ -461,7 +461,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li
builder = Gem::Ext::Builder.new(@specification)
rake_extension = @specification.extensions.any? {|s| builder.builder_for(s) == Gem::Ext::RakeBuilder }
- rake_dependency = @specification.dependencies.any? {|d| d.name == 'rake'}
+ rake_dependency = @specification.dependencies.any? {|d| d.name == 'rake' }
warning <<-WARNING if rake_extension && !rake_dependency
You have specified rake based extension, but rake is not added as dependency. It is recommended to add rake as a dependency in gemspec since there's no guarantee rake will be already installed.
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 7f5f1a8..7cc1b9a 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -269,7 +269,7 @@ class Gem::TestCase < Minitest::Test
end
end
- assert scan_make_command_lines(output).any? { |line|
+ assert scan_make_command_lines(output).any? {|line|
make = parse_make_command_line(line)
if make[:targets].include?(target)
@@ -425,9 +425,9 @@ class Gem::TestCase < Minitest::Test
$LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH
if @orig_LOADED_FEATURES
if @orig_LOAD_PATH
- paths = @orig_LOAD_PATH.map {|path| File.join(File.expand_path(path), "/")}
+ paths = @orig_LOAD_PATH.map {|path| File.join(File.expand_path(path), "/") }
($LOADED_FEATURES - @orig_LOADED_FEATURES).each do |feat|
- unless paths.any? {|path| feat.start_with?(path)}
+ unless paths.any? {|path| feat.start_with?(path) }
$LOADED_FEATURES.delete(feat)
end
end
@@ -791,7 +791,7 @@ class Gem::TestCase < Minitest::Test
ensure
prefix = File.dirname(__FILE__) + "/"
new_features = ($LOADED_FEATURES - old_loaded_features)
- old_loaded_features.concat(new_features.select {|f| f.rindex(prefix, 0)})
+ old_loaded_features.concat(new_features.select {|f| f.rindex(prefix, 0) })
$LOADED_FEATURES.replace old_loaded_features
end
@@ -1014,7 +1014,7 @@ Also, a list:
spec_fetcher = Gem::SpecFetcher.fetcher
- prerelease, all = all_specs.partition { |spec| spec.version.prerelease? }
+ prerelease, all = all_specs.partition {|spec| spec.version.prerelease? }
latest = Gem::Specification._latest_specs all_specs
spec_fetcher.specs[@uri] = []
@@ -1036,7 +1036,7 @@ Also, a list:
unless Gem::RemoteFetcher === @fetcher
v = Gem.marshal_version
- specs = all.map { |spec| spec.name_tuple }
+ specs = all.map {|spec| spec.name_tuple }
s_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic specs
latest_specs = latest.map do |spec|
@@ -1045,7 +1045,7 @@ Also, a list:
l_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic latest_specs
- prerelease_specs = prerelease.map { |spec| spec.name_tuple }
+ prerelease_specs = prerelease.map {|spec| spec.name_tuple }
p_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic prerelease_specs
@fetcher.data["#{@gem_repo}specs.#{v}.gz"] = s_zip
@@ -1441,7 +1441,7 @@ Also, a list:
# Finds all gems matching +dep+ in this set.
def find_all(dep)
- @specs.find_all { |s| dep.match? s, @prerelease }
+ @specs.find_all {|s| dep.match? s, @prerelease }
end
##
diff --git a/lib/rubygems/test_utilities.rb b/lib/rubygems/test_utilities.rb
index 0ad167b..81b34f3 100644
--- a/lib/rubygems/test_utilities.rb
+++ b/lib/rubygems/test_utilities.rb
@@ -76,7 +76,7 @@ class Gem::FakeFetcher
def cache_update_path(uri, path = nil, update = true)
if data = fetch_path(uri)
- open(path, 'wb') { |io| io.write data } if path and update
+ open(path, 'wb') {|io| io.write data } if path and update
data
else
Gem.read_binary(path) if path
diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb
index 69893df..2552fc7 100644
--- a/lib/rubygems/uninstaller.rb
+++ b/lib/rubygems/uninstaller.rb
@@ -114,10 +114,10 @@ class Gem::Uninstaller
if list.empty?
return unless other_repo_specs.any?
- other_repos = other_repo_specs.map { |spec| spec.base_dir }.uniq
+ other_repos = other_repo_specs.map {|spec| spec.base_dir }.uniq
message = ["#{@gem} is not installed in GEM_HOME, try:"]
- message.concat other_repos.map { |repo|
+ message.concat other_repos.map {|repo|
"\tgem uninstall -i #{repo} #{@gem}"
}
@@ -126,7 +126,7 @@ class Gem::Uninstaller
remove_all list
elsif list.size > 1
- gem_names = list.map { |gem| gem.full_name }
+ gem_names = list.map {|gem| gem.full_name }
gem_names << "All versions"
say
@@ -197,7 +197,7 @@ class Gem::Uninstaller
return if executables.empty?
- executables = executables.map { |exec| formatted_program_filename exec }
+ executables = executables.map {|exec| formatted_program_filename exec }
remove = if @force_executables.nil?
ask_yes_no("Remove executables:\n" +
@@ -232,7 +232,7 @@ class Gem::Uninstaller
# NOTE: removes uninstalled gems from +list+.
def remove_all(list)
- list.each { |spec| uninstall_gem spec }
+ list.each {|spec| uninstall_gem spec }
end
##
@@ -339,7 +339,7 @@ class Gem::Uninstaller
end
spec.dependent_gems(@check_dev).each do |dep_spec, dep, satlist|
- unless siblings.any? { |s| s.satisfies_requirement? dep }
+ unless siblings.any? {|s| s.satisfies_requirement? dep }
msg << "#{dep_spec.name}-#{dep_spec.version} depends on #{dep}"
end
end
diff --git a/lib/rubygems/user_interaction.rb b/lib/rubygems/user_interaction.rb
index f5bdd84..616659e 100644
--- a/lib/rubygems/user_interaction.rb
+++ b/lib/rubygems/user_interaction.rb
@@ -323,7 +323,7 @@ class Gem::StreamUI
def _gets_noecho
require_io_console
- @ins.noecho {@ins.gets}
+ @ins.noecho { @ins.gets }
end
##
diff --git a/lib/rubygems/validator.rb b/lib/rubygems/validator.rb
index 7ed0a1f..b53dff7 100644
--- a/lib/rubygems/validator.rb
+++ b/lib/rubygems/validator.rb
@@ -60,7 +60,7 @@ class Gem::Validator
# TODO needs further cleanup
def alien(gems=[])
- errors = Hash.new { |h,k| h[k] = {} }
+ errors = Hash.new {|h,k| h[k] = {} }
Gem::Specification.each do |spec|
next unless gems.include? spec.name unless gems.empty?
diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb
index d216647..5c48a02 100644
--- a/lib/rubygems/version.rb
+++ b/lib/rubygems/version.rb
@@ -231,7 +231,7 @@ class Gem::Version
def bump
@@bump[self] ||= begin
segments = self.segments
- segments.pop while segments.any? { |s| String === s }
+ segments.pop while segments.any? {|s| String === s }
segments.pop if segments.size > 1
segments[-1] = segments[-1].succ
@@ -310,7 +310,7 @@ class Gem::Version
def release
@@release[self] ||= if prerelease?
segments = self.segments
- segments.pop while segments.any? { |s| String === s }
+ segments.pop while segments.any? {|s| String === s }
self.class.new segments.join('.')
else
self
@@ -327,7 +327,7 @@ class Gem::Version
def approximate_recommendation
segments = self.segments
- segments.pop while segments.any? { |s| String === s }
+ segments.pop while segments.any? {|s| String === s }
segments.pop while segments.size > 2
segments.push 0 while segments.size < 2