rubygems-update 3.3.19 → 3.3.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/bin/update_rubygems +1 -1
  4. data/bundler/CHANGELOG.md +26 -0
  5. data/bundler/lib/bundler/build_metadata.rb +2 -2
  6. data/bundler/lib/bundler/cli/install.rb +5 -2
  7. data/bundler/lib/bundler/cli/outdated.rb +12 -3
  8. data/bundler/lib/bundler/cli/platform.rb +1 -1
  9. data/bundler/lib/bundler/cli.rb +5 -3
  10. data/bundler/lib/bundler/definition.rb +61 -11
  11. data/bundler/lib/bundler/fetcher.rb +6 -6
  12. data/bundler/lib/bundler/gem_helpers.rb +7 -1
  13. data/bundler/lib/bundler/installer/standalone.rb +1 -1
  14. data/bundler/lib/bundler/installer.rb +8 -1
  15. data/bundler/lib/bundler/lazy_specification.rb +21 -21
  16. data/bundler/lib/bundler/man/bundle-cache.1 +6 -0
  17. data/bundler/lib/bundler/man/bundle-cache.1.ronn +7 -0
  18. data/bundler/lib/bundler/man/bundle-config.1 +2 -2
  19. data/bundler/lib/bundler/man/bundle-config.1.ronn +3 -3
  20. data/bundler/lib/bundler/man/bundle-install.1 +4 -0
  21. data/bundler/lib/bundler/man/bundle-install.1.ronn +6 -0
  22. data/bundler/lib/bundler/man/bundle-platform.1 +15 -5
  23. data/bundler/lib/bundler/man/bundle-platform.1.ronn +14 -7
  24. data/bundler/lib/bundler/man/bundle.1 +3 -6
  25. data/bundler/lib/bundler/man/bundle.1.ronn +3 -4
  26. data/bundler/lib/bundler/resolver.rb +2 -1
  27. data/bundler/lib/bundler/ruby_dsl.rb +1 -1
  28. data/bundler/lib/bundler/ruby_version.rb +5 -5
  29. data/bundler/lib/bundler/rubygems_ext.rb +13 -0
  30. data/bundler/lib/bundler/source/metadata.rb +1 -1
  31. data/bundler/lib/bundler/source_list.rb +4 -0
  32. data/bundler/lib/bundler/spec_set.rb +15 -28
  33. data/bundler/lib/bundler/version.rb +1 -1
  34. data/lib/rubygems/available_set.rb +3 -3
  35. data/lib/rubygems/basic_specification.rb +2 -2
  36. data/lib/rubygems/command.rb +6 -6
  37. data/lib/rubygems/commands/cert_command.rb +1 -1
  38. data/lib/rubygems/commands/cleanup_command.rb +1 -1
  39. data/lib/rubygems/commands/contents_command.rb +1 -1
  40. data/lib/rubygems/commands/dependency_command.rb +4 -4
  41. data/lib/rubygems/commands/fetch_command.rb +2 -2
  42. data/lib/rubygems/commands/generate_index_command.rb +2 -2
  43. data/lib/rubygems/commands/install_command.rb +7 -7
  44. data/lib/rubygems/commands/pristine_command.rb +5 -5
  45. data/lib/rubygems/commands/setup_command.rb +4 -4
  46. data/lib/rubygems/commands/sources_command.rb +3 -3
  47. data/lib/rubygems/commands/specification_command.rb +2 -2
  48. data/lib/rubygems/commands/uninstall_command.rb +4 -4
  49. data/lib/rubygems/commands/update_command.rb +5 -5
  50. data/lib/rubygems/commands/which_command.rb +1 -1
  51. data/lib/rubygems/config_file.rb +7 -7
  52. data/lib/rubygems/core_ext/kernel_warn.rb +1 -1
  53. data/lib/rubygems/defaults.rb +1 -1
  54. data/lib/rubygems/dependency.rb +5 -5
  55. data/lib/rubygems/dependency_installer.rb +5 -5
  56. data/lib/rubygems/dependency_list.rb +4 -4
  57. data/lib/rubygems/doctor.rb +4 -4
  58. data/lib/rubygems/exceptions.rb +1 -1
  59. data/lib/rubygems/ext/ext_conf_builder.rb +2 -2
  60. data/lib/rubygems/gemcutter_utilities.rb +1 -1
  61. data/lib/rubygems/indexer.rb +3 -3
  62. data/lib/rubygems/installer.rb +5 -13
  63. data/lib/rubygems/name_tuple.rb +3 -3
  64. data/lib/rubygems/package/tar_header.rb +17 -17
  65. data/lib/rubygems/package/tar_writer.rb +1 -1
  66. data/lib/rubygems/package.rb +19 -8
  67. data/lib/rubygems/platform.rb +15 -15
  68. data/lib/rubygems/query_utils.rb +6 -6
  69. data/lib/rubygems/remote_fetcher.rb +3 -3
  70. data/lib/rubygems/request/connection_pools.rb +2 -2
  71. data/lib/rubygems/request/http_pool.rb +1 -1
  72. data/lib/rubygems/request.rb +1 -1
  73. data/lib/rubygems/request_set/gem_dependency_api.rb +3 -3
  74. data/lib/rubygems/request_set/lockfile/parser.rb +12 -12
  75. data/lib/rubygems/request_set/lockfile/tokenizer.rb +2 -2
  76. data/lib/rubygems/request_set.rb +3 -3
  77. data/lib/rubygems/requirement.rb +1 -1
  78. data/lib/rubygems/resolver/api_specification.rb +4 -4
  79. data/lib/rubygems/resolver/best_set.rb +3 -3
  80. data/lib/rubygems/resolver/conflict.rb +3 -3
  81. data/lib/rubygems/resolver/git_specification.rb +3 -3
  82. data/lib/rubygems/resolver/index_specification.rb +3 -2
  83. data/lib/rubygems/resolver/installed_specification.rb +2 -2
  84. data/lib/rubygems/resolver/installer_set.rb +7 -12
  85. data/lib/rubygems/resolver/lock_set.rb +1 -1
  86. data/lib/rubygems/resolver/lock_specification.rb +1 -1
  87. data/lib/rubygems/resolver/vendor_specification.rb +3 -3
  88. data/lib/rubygems/resolver.rb +4 -4
  89. data/lib/rubygems/security/policy.rb +6 -6
  90. data/lib/rubygems/security/signer.rb +1 -1
  91. data/lib/rubygems/security.rb +1 -1
  92. data/lib/rubygems/source/git.rb +4 -4
  93. data/lib/rubygems/source.rb +1 -1
  94. data/lib/rubygems/spec_fetcher.rb +1 -1
  95. data/lib/rubygems/specification.rb +26 -24
  96. data/lib/rubygems/specification_policy.rb +4 -4
  97. data/lib/rubygems/uninstaller.rb +4 -4
  98. data/lib/rubygems/user_interaction.rb +2 -2
  99. data/lib/rubygems/version.rb +12 -4
  100. data/lib/rubygems.rb +8 -8
  101. data/rubygems-update.gemspec +1 -1
  102. data/setup.rb +1 -1
  103. data/test/rubygems/helper.rb +5 -5
  104. data/test/rubygems/test_gem_config_file.rb +17 -5
  105. data/test/rubygems/test_gem_dependency_installer.rb +2 -2
  106. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +4 -4
  107. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -1
  108. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +1 -1
  109. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +4 -4
  110. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
  111. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +1 -1
  112. data/test/rubygems/test_gem_installer.rb +6 -3
  113. data/test/rubygems/test_gem_package.rb +22 -0
  114. data/test/rubygems/test_gem_package_tar_reader.rb +1 -1
  115. data/test/rubygems/test_gem_requirement.rb +9 -3
  116. data/test/rubygems/test_gem_resolver_index_specification.rb +1 -1
  117. data/test/rubygems/test_gem_resolver_installer_set.rb +44 -0
  118. data/test/rubygems/test_gem_specification.rb +11 -2
  119. data/test/rubygems/test_gem_version.rb +9 -2
  120. data/test/rubygems/test_require.rb +1 -1
  121. data/test/rubygems/utilities.rb +4 -4
  122. metadata +3 -3
@@ -7,36 +7,43 @@ bundle-platform(1) -- Displays platform compatibility information
7
7
 
8
8
  ## DESCRIPTION
9
9
 
10
- `platform` will display information from your Gemfile, Gemfile.lock, and Ruby
10
+ `platform` displays information from your Gemfile, Gemfile.lock, and Ruby
11
11
  VM about your platform.
12
12
 
13
13
  For instance, using this Gemfile(5):
14
14
 
15
15
  source "https://rubygems.org"
16
16
 
17
- ruby "1.9.3"
17
+ ruby "3.1.2"
18
18
 
19
19
  gem "rack"
20
20
 
21
- If you run `bundle platform` on Ruby 1.9.3, it will display the following output:
21
+ If you run `bundle platform` on Ruby 3.1.2, it displays the following output:
22
22
 
23
23
  Your platform is: x86_64-linux
24
24
 
25
25
  Your app has gems that work on these platforms:
26
+ * arm64-darwin-21
26
27
  * ruby
28
+ * x64-mingw-ucrt
29
+ * x86_64-linux
27
30
 
28
31
  Your Gemfile specifies a Ruby version requirement:
29
- * ruby 1.9.3
32
+ * ruby 3.1.2
30
33
 
31
34
  Your current platform satisfies the Ruby version requirement.
32
35
 
33
- `platform` will list all the platforms in your `Gemfile.lock` as well as the
34
- `ruby` directive if applicable from your Gemfile(5). It will also let you know
36
+ `platform` lists all the platforms in your `Gemfile.lock` as well as the
37
+ `ruby` directive if applicable from your Gemfile(5). It also lets you know
35
38
  if the `ruby` directive requirement has been met. If `ruby` directive doesn't
36
- match the running Ruby VM, it will tell you what part does not.
39
+ match the running Ruby VM, it tells you what part does not.
37
40
 
38
41
  ## OPTIONS
39
42
 
40
43
  * `--ruby`:
41
44
  It will display the ruby directive information, so you don't have to
42
45
  parse it from the Gemfile(5).
46
+
47
+ ## SEE ALSO
48
+
49
+ * [bundle-lock(1)](bundle-lock.1.ronn)
@@ -43,8 +43,8 @@ Install the gems specified by the \fBGemfile\fR or \fBGemfile\.lock\fR
43
43
  Update dependencies to their latest versions
44
44
  .
45
45
  .TP
46
- \fBbundle package(1)\fR \fIbundle\-package\.1\.html\fR
47
- Package the \.gem files required by your application into the \fBvendor/cache\fR directory
46
+ \fBbundle cache(1)\fR \fIbundle\-cache\.1\.html\fR
47
+ Package the \.gem files required by your application into the \fBvendor/cache\fR directory (aliases: \fBbundle package\fR, \fBbundle pack\fR)
48
48
  .
49
49
  .TP
50
50
  \fBbundle exec(1)\fR \fIbundle\-exec\.1\.html\fR
@@ -81,7 +81,7 @@ Show the source location of a particular gem in the bundle
81
81
  Show all of the outdated gems in the current bundle
82
82
  .
83
83
  .TP
84
- \fBbundle console(1)\fR
84
+ \fBbundle console(1)\fR (deprecated)
85
85
  Start an IRB session in the current bundle
86
86
  .
87
87
  .TP
@@ -127,9 +127,6 @@ When running a command that isn\'t listed in PRIMARY COMMANDS or UTILITIES, Bund
127
127
  These commands are obsolete and should no longer be used:
128
128
  .
129
129
  .IP "\(bu" 4
130
- \fBbundle cache(1)\fR
131
- .
132
- .IP "\(bu" 4
133
130
  \fBbundle inject(1)\fR
134
131
  .
135
132
  .IP "" 0
@@ -36,9 +36,9 @@ We divide `bundle` subcommands into primary commands and utilities:
36
36
  * [`bundle update(1)`](bundle-update.1.html):
37
37
  Update dependencies to their latest versions
38
38
 
39
- * [`bundle package(1)`](bundle-package.1.html):
39
+ * [`bundle cache(1)`](bundle-cache.1.html):
40
40
  Package the .gem files required by your application into the
41
- `vendor/cache` directory
41
+ `vendor/cache` directory (aliases: `bundle package`, `bundle pack`)
42
42
 
43
43
  * [`bundle exec(1)`](bundle-exec.1.html):
44
44
  Execute a script in the current bundle
@@ -67,7 +67,7 @@ We divide `bundle` subcommands into primary commands and utilities:
67
67
  * [`bundle outdated(1)`](bundle-outdated.1.html):
68
68
  Show all of the outdated gems in the current bundle
69
69
 
70
- * `bundle console(1)`:
70
+ * `bundle console(1)` (deprecated):
71
71
  Start an IRB session in the current bundle
72
72
 
73
73
  * [`bundle open(1)`](bundle-open.1.html):
@@ -107,5 +107,4 @@ and execute it, passing down any extra arguments to it.
107
107
 
108
108
  These commands are obsolete and should no longer be used:
109
109
 
110
- * `bundle cache(1)`
111
110
  * `bundle inject(1)`
@@ -28,10 +28,11 @@ module Bundler
28
28
  def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms, metadata_requirements)
29
29
  @source_requirements = source_requirements
30
30
  @metadata_requirements = metadata_requirements
31
+ @base = base
31
32
  @resolver = Molinillo::Resolver.new(self, self)
32
33
  @search_for = {}
33
34
  @base_dg = Molinillo::DependencyGraph.new
34
- @base = base.materialized_for_resolution do |ls|
35
+ base.each do |ls|
35
36
  dep = Dependency.new(ls.name, ls.version)
36
37
  @base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true)
37
38
  end
@@ -9,7 +9,7 @@ module Bundler
9
9
  raise GemfileError, "Please define :engine" if options[:engine_version] && options[:engine].nil?
10
10
 
11
11
  if options[:engine] == "ruby" && options[:engine_version] &&
12
- ruby_version != Array(options[:engine_version])
12
+ ruby_version != Array(options[:engine_version])
13
13
  raise GemfileEvalError, "ruby_version must match the :engine_version for MRI"
14
14
  end
15
15
  @ruby_version = RubyVersion.new(ruby_version, options[:patchlevel], options[:engine], options[:engine_version])
@@ -32,12 +32,12 @@ module Bundler
32
32
  @engine = engine && engine.to_s || "ruby"
33
33
  @engine_versions = (engine_version && Array(engine_version)) || @versions
34
34
  @engine_gem_version = Gem::Requirement.create(@engine_versions.first).requirements.first.last
35
- @patchlevel = patchlevel
35
+ @patchlevel = patchlevel || (@gem_version.prerelease? ? "-1" : nil)
36
36
  end
37
37
 
38
38
  def to_s(versions = self.versions)
39
39
  output = String.new("ruby #{versions_string(versions)}")
40
- output << "p#{patchlevel}" if patchlevel
40
+ output << "p#{patchlevel}" if patchlevel && patchlevel != "-1"
41
41
  output << " (#{engine} #{versions_string(engine_versions)})" unless engine == "ruby"
42
42
 
43
43
  output
@@ -46,7 +46,7 @@ module Bundler
46
46
  # @private
47
47
  PATTERN = /
48
48
  ruby\s
49
- ([\d.]+) # ruby version
49
+ (\d+\.\d+\.\d+(?:\.\S+)?) # ruby version
50
50
  (?:p(-?\d+))? # optional patchlevel
51
51
  (?:\s\((\S+)\s(.+)\))? # optional engine info
52
52
  /xo.freeze
@@ -103,8 +103,8 @@ module Bundler
103
103
 
104
104
  def self.system
105
105
  ruby_engine = RUBY_ENGINE.dup
106
- ruby_version = RUBY_VERSION.dup
107
- ruby_engine_version = RUBY_ENGINE_VERSION.dup
106
+ ruby_version = Gem.ruby_version.to_s
107
+ ruby_engine_version = RUBY_ENGINE == "ruby" ? ruby_version : RUBY_ENGINE_VERSION.dup
108
108
  patchlevel = RUBY_PATCHLEVEL.to_s
109
109
 
110
110
  @ruby_version ||= RubyVersion.new(ruby_version, patchlevel, ruby_engine, ruby_engine_version)
@@ -17,6 +17,15 @@ require "rubygems/source"
17
17
 
18
18
  require_relative "match_platform"
19
19
 
20
+ # Cherry-pick fixes to `Gem.ruby_version` to be useful for modern Bundler
21
+ # versions and ignore patchlevels
22
+ # (https://github.com/rubygems/rubygems/pull/5472,
23
+ # https://github.com/rubygems/rubygems/pull/5486). May be removed once RubyGems
24
+ # 3.3.12 support is dropped.
25
+ unless Gem.ruby_version.to_s == RUBY_VERSION || RUBY_PATCHLEVEL == -1
26
+ Gem.instance_variable_set(:@ruby_version, Gem::Version.new(RUBY_VERSION))
27
+ end
28
+
20
29
  module Gem
21
30
  class Specification
22
31
  include ::Bundler::MatchPlatform
@@ -146,6 +155,10 @@ module Gem
146
155
 
147
156
  alias_method :eql?, :==
148
157
 
158
+ def force_ruby_platform
159
+ false
160
+ end
161
+
149
162
  def encode_with(coder)
150
163
  to_yaml_properties.each do |ivar|
151
164
  coder[ivar.to_s.sub(/^@/, "")] = instance_variable_get(ivar)
@@ -5,7 +5,7 @@ module Bundler
5
5
  class Metadata < Source
6
6
  def specs
7
7
  @specs ||= Index.build do |idx|
8
- idx << Gem::Specification.new("Ruby\0", RubyVersion.system.gem_version)
8
+ idx << Gem::Specification.new("Ruby\0", Gem.ruby_version)
9
9
  idx << Gem::Specification.new("RubyGems\0", Gem::VERSION) do |s|
10
10
  s.required_rubygems_version = Gem::Requirement.default
11
11
  end
@@ -101,6 +101,10 @@ module Bundler
101
101
  source_list_for(source).find {|s| equivalent_source?(source, s) }
102
102
  end
103
103
 
104
+ def get_with_fallback(source)
105
+ get(source) || default_source
106
+ end
107
+
104
108
  def lock_sources
105
109
  lock_other_sources + lock_rubygems_sources
106
110
  end
@@ -13,14 +13,16 @@ module Bundler
13
13
 
14
14
  def for(dependencies, check = false, platforms = [nil])
15
15
  handled = ["bundler"].product(platforms).map {|k| [k, true] }.to_h
16
- deps = dependencies.product(platforms).map {|dep, platform| [dep.name, platform && dep.force_ruby_platform ? Gem::Platform::RUBY : platform] }
16
+ deps = dependencies.product(platforms)
17
17
  specs = []
18
18
 
19
19
  loop do
20
20
  break unless dep = deps.shift
21
- next if handled.key?(dep)
22
21
 
23
- handled[dep] = true
22
+ key = [dep[0].name, dep[1]]
23
+ next if handled.key?(key)
24
+
25
+ handled[key] = true
24
26
 
25
27
  specs_for_dep = specs_for_dependency(*dep)
26
28
  if specs_for_dep.any?
@@ -28,17 +30,13 @@ module Bundler
28
30
 
29
31
  specs_for_dep.first.dependencies.each do |d|
30
32
  next if d.type == :development
31
- deps << [d.name, dep[1]]
33
+ deps << [d, dep[1]]
32
34
  end
33
35
  elsif check
34
- specs << IncompleteSpecification.new(*dep)
36
+ specs << IncompleteSpecification.new(*key)
35
37
  end
36
38
  end
37
39
 
38
- if spec = lookup["bundler"].first
39
- specs << spec
40
- end
41
-
42
40
  specs
43
41
  end
44
42
 
@@ -66,13 +64,8 @@ module Bundler
66
64
  end
67
65
 
68
66
  def materialize(deps)
69
- materialized = self.for(deps, true).uniq
67
+ materialized = self.for(deps, true)
70
68
 
71
- materialized.map! do |s|
72
- next s unless s.is_a?(LazySpecification)
73
- s.source.local!
74
- s.materialize_for_installation || s
75
- end
76
69
  SpecSet.new(materialized)
77
70
  end
78
71
 
@@ -82,7 +75,6 @@ module Bundler
82
75
  def materialized_for_all_platforms
83
76
  @specs.map do |s|
84
77
  next s unless s.is_a?(LazySpecification)
85
- s.source.local!
86
78
  s.source.remote!
87
79
  spec = s.materialize_for_installation
88
80
  raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
@@ -90,13 +82,8 @@ module Bundler
90
82
  end
91
83
  end
92
84
 
93
- def materialized_for_resolution
94
- materialized = @specs.map do |s|
95
- spec = s.materialize_for_resolution
96
- yield spec if spec
97
- spec
98
- end.compact
99
- SpecSet.new(materialized)
85
+ def incomplete_ruby_specs?(deps)
86
+ self.class.new(self.for(deps, true, [Gem::Platform::RUBY])).incomplete_specs.any?
100
87
  end
101
88
 
102
89
  def missing_specs
@@ -181,13 +168,13 @@ module Bundler
181
168
  @specs.sort_by(&:name).each {|s| yield s }
182
169
  end
183
170
 
184
- def specs_for_dependency(name, platform)
185
- specs_for_name = lookup[name]
171
+ def specs_for_dependency(dep, platform)
172
+ specs_for_name = lookup[dep.name]
186
173
  if platform.nil?
187
- GemHelpers.select_best_platform_match(specs_for_name.select {|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
174
+ matching_specs = specs_for_name.map {|s| s.materialize_for_installation if Gem::Platform.match_spec?(s) }.compact
175
+ GemHelpers.sort_best_platform_match(matching_specs, Bundler.local_platform)
188
176
  else
189
- specs_for_name_and_platform = GemHelpers.select_best_platform_match(specs_for_name, platform)
190
- specs_for_name_and_platform.any? ? specs_for_name_and_platform : specs_for_name
177
+ GemHelpers.select_best_platform_match(specs_for_name, dep.force_ruby_platform ? Gem::Platform::RUBY : platform)
191
178
  end
192
179
  end
193
180
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.3.19".freeze
4
+ VERSION = "2.3.20".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -26,7 +26,7 @@ class Gem::AvailableSet
26
26
  s = o.set
27
27
  when Array
28
28
  s = o.map do |sp,so|
29
- if !sp.kind_of?(Gem::Specification) or !so.kind_of?(Gem::Source)
29
+ if !sp.kind_of?(Gem::Specification) || !so.kind_of?(Gem::Source)
30
30
  raise TypeError, "Array must be in [[spec, source], ...] form"
31
31
  end
32
32
 
@@ -149,8 +149,8 @@ class Gem::AvailableSet
149
149
  @set.reject! do |t|
150
150
  # already locally installed
151
151
  Gem::Specification.any? do |installed_spec|
152
- dep.name == installed_spec.name and
153
- dep.requirement.satisfied_by? installed_spec.version
152
+ dep.name == installed_spec.name &&
153
+ dep.requirement.satisfied_by?(installed_spec.version)
154
154
  end
155
155
  end
156
156
 
@@ -77,7 +77,7 @@ class Gem::BasicSpecification
77
77
 
78
78
  if Gem::Platform::RUBY == platform || Gem::Platform.local === platform
79
79
  warn "Ignoring #{full_name} because its extensions are not built. " +
80
- "Try: gem pristine #{name} --version #{version}"
80
+ "Try: gem pristine #{name} --version #{version}"
81
81
  end
82
82
 
83
83
  return false
@@ -131,7 +131,7 @@ class Gem::BasicSpecification
131
131
  # default Ruby platform.
132
132
 
133
133
  def full_name
134
- if platform == Gem::Platform::RUBY or platform.nil?
134
+ if platform == Gem::Platform::RUBY || platform.nil?
135
135
  "#{name}-#{version}".dup.tap(&Gem::UNTAINT)
136
136
  else
137
137
  "#{name}-#{version}-#{platform}".dup.tap(&Gem::UNTAINT)
@@ -159,11 +159,11 @@ class Gem::Command
159
159
  gem = "'#{gem_name}' (#{version})"
160
160
  msg = String.new "Could not find a valid gem #{gem}"
161
161
 
162
- if errors and !errors.empty?
162
+ if errors && !errors.empty?
163
163
  msg << ", here is why:\n"
164
164
  errors.each {|x| msg << " #{x.wordy}\n" }
165
165
  else
166
- if required_by and gem != required_by
166
+ if required_by && gem != required_by
167
167
  msg << " (required by #{required_by}) in any repository"
168
168
  else
169
169
  msg << " in any repository"
@@ -186,7 +186,7 @@ class Gem::Command
186
186
  def get_all_gem_names
187
187
  args = options[:args]
188
188
 
189
- if args.nil? or args.empty?
189
+ if args.nil? || args.empty?
190
190
  raise Gem::CommandLineError,
191
191
  "Please specify at least one gem name (e.g. gem build GEMNAME)"
192
192
  end
@@ -216,7 +216,7 @@ class Gem::Command
216
216
  def get_one_gem_name
217
217
  args = options[:args]
218
218
 
219
- if args.nil? or args.empty?
219
+ if args.nil? || args.empty?
220
220
  raise Gem::CommandLineError,
221
221
  "Please specify a gem name on the command line (e.g. gem build GEMNAME)"
222
222
  end
@@ -554,7 +554,7 @@ class Gem::Command
554
554
  end
555
555
 
556
556
  def configure_options(header, option_list)
557
- return if option_list.nil? or option_list.empty?
557
+ return if option_list.nil? || option_list.empty?
558
558
 
559
559
  header = header.to_s.empty? ? "" : "#{header} "
560
560
  @parser.separator " #{header}Options:"
@@ -586,7 +586,7 @@ class Gem::Command
586
586
  add_common_option("-V", "--[no-]verbose",
587
587
  "Set the verbose level of output") do |value, options|
588
588
  # Set us to "really verbose" so the progress meter works
589
- if Gem.configuration.verbose and value
589
+ if Gem.configuration.verbose && value
590
590
  Gem.configuration.verbose = 1
591
591
  else
592
592
  Gem.configuration.verbose = value
@@ -152,7 +152,7 @@ class Gem::Commands::CertCommand < Gem::Command
152
152
 
153
153
  def build_cert(email, key) # :nodoc:
154
154
  expiration_length_days = options[:expiration_length_days] ||
155
- Gem.configuration.cert_expiration_length_days
155
+ Gem.configuration.cert_expiration_length_days
156
156
 
157
157
  cert = Gem::Security.create_cert_email(
158
158
  email,
@@ -149,7 +149,7 @@ If no gems are named all gems in GEM_HOME are cleaned.
149
149
  @primary_gems = {}
150
150
 
151
151
  Gem::Specification.each do |spec|
152
- if @primary_gems[spec.name].nil? or
152
+ if @primary_gems[spec.name].nil? ||
153
153
  @primary_gems[spec.name].version < spec.version
154
154
  @primary_gems[spec.name] = spec
155
155
  end
@@ -77,7 +77,7 @@ prefix or only the files that are requireable.
77
77
  gem_contents name
78
78
  end
79
79
 
80
- terminate_interaction 1 unless found or names.length > 1
80
+ terminate_interaction 1 unless found || names.length > 1
81
81
  end
82
82
  end
83
83
 
@@ -77,7 +77,7 @@ use with other commands.
77
77
  name_matches = name_pattern ? name_pattern =~ spec.name : true
78
78
  version_matches = requirement.satisfied_by?(spec.version)
79
79
 
80
- name_matches and version_matches
80
+ name_matches && version_matches
81
81
  }.map(&:to_spec)
82
82
  end
83
83
 
@@ -133,7 +133,7 @@ use with other commands.
133
133
  end
134
134
 
135
135
  def ensure_local_only_reverse_dependencies # :nodoc:
136
- if options[:reverse_dependencies] and remote? and not local?
136
+ if options[:reverse_dependencies] && remote? && !local?
137
137
  alert_error "Only reverse dependencies for local gems are supported."
138
138
  terminate_interaction 1
139
139
  end
@@ -182,7 +182,7 @@ use with other commands.
182
182
  sp.dependencies.each do |dep|
183
183
  dep = Gem::Dependency.new(*dep) unless Gem::Dependency === dep
184
184
 
185
- if spec.name == dep.name and
185
+ if spec.name == dep.name &&
186
186
  dep.requirement.satisfied_by?(spec.version)
187
187
  result << [sp.full_name, dep]
188
188
  end
@@ -197,7 +197,7 @@ use with other commands.
197
197
  def name_pattern(args)
198
198
  return if args.empty?
199
199
 
200
- if args.length == 1 and args.first =~ /\A(.*)(i)?\z/m
200
+ if args.length == 1 && args.first =~ /\A(.*)(i)?\z/m
201
201
  flags = $2 ? Regexp::IGNORECASE : nil
202
202
  Regexp.new $1, flags
203
203
  else
@@ -52,8 +52,8 @@ then repackaging it.
52
52
  end
53
53
 
54
54
  def check_version # :nodoc:
55
- if options[:version] != Gem::Requirement.default and
56
- get_all_gem_names.size > 1
55
+ if options[:version] != Gem::Requirement.default &&
56
+ get_all_gem_names.size > 1
57
57
  alert_error "Can't use --version with multiple gems. You can specify multiple gems with" \
58
58
  " version requirements using `gem fetch 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'`"
59
59
  terminate_interaction 1
@@ -68,8 +68,8 @@ Marshal::MINOR_VERSION constants. It is used to ensure compatibility.
68
68
  # This is always true because it's the only way now.
69
69
  options[:build_modern] = true
70
70
 
71
- if not File.exist?(options[:directory]) or
72
- not File.directory?(options[:directory])
71
+ if !File.exist?(options[:directory]) ||
72
+ !File.directory?(options[:directory])
73
73
  alert_error "unknown directory name #{options[:directory]}."
74
74
  terminate_interaction 1
75
75
  else
@@ -46,8 +46,8 @@ class Gem::Commands::InstallCommand < Gem::Command
46
46
 
47
47
  def defaults_str # :nodoc:
48
48
  "--both --version '#{Gem::Requirement.default}' --no-force\n" +
49
- "--install-dir #{Gem.dir} --lock\n" +
50
- install_update_defaults_str
49
+ "--install-dir #{Gem.dir} --lock\n" +
50
+ install_update_defaults_str
51
51
  end
52
52
 
53
53
  def description # :nodoc:
@@ -134,15 +134,15 @@ You can use `i` command instead of `install`.
134
134
  end
135
135
 
136
136
  def check_install_dir # :nodoc:
137
- if options[:install_dir] and options[:user_install]
137
+ if options[:install_dir] && options[:user_install]
138
138
  alert_error "Use --install-dir or --user-install but not both"
139
139
  terminate_interaction 1
140
140
  end
141
141
  end
142
142
 
143
143
  def check_version # :nodoc:
144
- if options[:version] != Gem::Requirement.default and
145
- get_all_gem_names.size > 1
144
+ if options[:version] != Gem::Requirement.default &&
145
+ get_all_gem_names.size > 1
146
146
  alert_error "Can't use --version with multiple gems. You can specify multiple gems with" \
147
147
  " version requirements using `gem install 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'`"
148
148
  terminate_interaction 1
@@ -191,8 +191,8 @@ You can use `i` command instead of `install`.
191
191
  end
192
192
 
193
193
  def install_gem(name, version) # :nodoc:
194
- return if options[:conservative] and
195
- not Gem::Dependency.new(name, version).matching_specs.empty?
194
+ return if options[:conservative] &&
195
+ !Gem::Dependency.new(name, version).matching_specs.empty?
196
196
 
197
197
  req = Gem::Requirement.create(version)
198
198
 
@@ -102,10 +102,10 @@ extensions will be restored.
102
102
 
103
103
  # `--extensions` must be explicitly given to pristine only gems
104
104
  # with extensions.
105
- elsif options[:extensions_set] and
106
- options[:extensions] and options[:args].empty?
105
+ elsif options[:extensions_set] &&
106
+ options[:extensions] && options[:args].empty?
107
107
  Gem::Specification.select do |spec|
108
- spec.extensions and not spec.extensions.empty?
108
+ spec.extensions && !spec.extensions.empty?
109
109
  end
110
110
  else
111
111
  get_all_gem_names.sort.map do |gem_name|
@@ -135,14 +135,14 @@ extensions will be restored.
135
135
  end
136
136
  end
137
137
 
138
- unless spec.extensions.empty? or options[:extensions] or options[:only_executables] or options[:only_plugins]
138
+ unless spec.extensions.empty? || options[:extensions] || options[:only_executables] || options[:only_plugins]
139
139
  say "Skipped #{spec.full_name}, it needs to compile an extension"
140
140
  next
141
141
  end
142
142
 
143
143
  gem = spec.cache_file
144
144
 
145
- unless File.exist? gem or options[:only_executables] or options[:only_plugins]
145
+ unless File.exist?(gem) || options[:only_executables] || options[:only_plugins]
146
146
  require_relative "../remote_fetcher"
147
147
 
148
148
  say "Cached gem for #{spec.full_name} not found, attempting to fetch..."
@@ -329,9 +329,9 @@ By default, this RubyGems will install gem as:
329
329
  # ignore
330
330
  end
331
331
 
332
- if File.writable? gem_doc_dir and
333
- (not File.exist? rubygems_doc_dir or
334
- File.writable? rubygems_doc_dir)
332
+ if File.writable?(gem_doc_dir) &&
333
+ (!File.exist?(rubygems_doc_dir) ||
334
+ File.writable?(rubygems_doc_dir))
335
335
  say "Removing old RubyGems RDoc and ri" if @verbose
336
336
  Dir[File.join(Gem.dir, "doc", "rubygems-[0-9]*")].each do |dir|
337
337
  rm_rf dir
@@ -559,7 +559,7 @@ abort "#{deprecation_message}"
559
559
 
560
560
  history_string = ""
561
561
 
562
- until versions.length == 0 or
562
+ until versions.length == 0 ||
563
563
  versions.shift <= options[:previous_version] do
564
564
  history_string += version_lines.shift + text.shift
565
565
  end
@@ -82,7 +82,7 @@ Do you want to add this source?
82
82
  def check_rubygems_https(source_uri) # :nodoc:
83
83
  uri = URI source_uri
84
84
 
85
- if uri.scheme and uri.scheme.downcase == "http" and
85
+ if uri.scheme && uri.scheme.downcase == "http" &&
86
86
  uri.host.downcase == "rubygems.org"
87
87
  question = <<-QUESTION.chomp
88
88
  https://rubygems.org is recommended for security over #{uri}
@@ -215,9 +215,9 @@ To remove a source use the --remove argument:
215
215
  def remove_cache_file(desc, path) # :nodoc:
216
216
  FileUtils.rm_rf path
217
217
 
218
- if not File.exist?(path)
218
+ if !File.exist?(path)
219
219
  say "*** Removed #{desc} source cache ***"
220
- elsif not File.writable?(path)
220
+ elsif !File.writable?(path)
221
221
  say "*** Unable to remove #{desc} source cache (write protected) ***"
222
222
  else
223
223
  say "*** Unable to remove #{desc} source cache ***"
@@ -88,7 +88,7 @@ Specific fields in the specification can be extracted in YAML format:
88
88
  raise Gem::CommandLineError, "Unsupported version type: '#{v}'"
89
89
  end
90
90
 
91
- if !req.none? and options[:all]
91
+ if !req.none? && options[:all]
92
92
  alert_error "Specify --all or -v, not both"
93
93
  terminate_interaction 1
94
94
  end
@@ -102,7 +102,7 @@ Specific fields in the specification can be extracted in YAML format:
102
102
  field = get_one_optional_argument
103
103
 
104
104
  raise Gem::CommandLineError, "--ruby and FIELD are mutually exclusive" if
105
- field and options[:format] == :ruby
105
+ field && options[:format] == :ruby
106
106
 
107
107
  if local?
108
108
  if File.exist? gem