rubygems-update 3.3.2 → 3.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +68 -0
  3. data/bundler/CHANGELOG.md +44 -0
  4. data/bundler/lib/bundler/build_metadata.rb +2 -2
  5. data/bundler/lib/bundler/cli/doctor.rb +9 -1
  6. data/bundler/lib/bundler/cli/gem.rb +11 -1
  7. data/bundler/lib/bundler/cli/install.rb +0 -3
  8. data/bundler/lib/bundler/cli/platform.rb +1 -1
  9. data/bundler/lib/bundler/cli/update.rb +6 -2
  10. data/bundler/lib/bundler/cli.rb +3 -10
  11. data/bundler/lib/bundler/compact_index_client/cache.rb +0 -9
  12. data/bundler/lib/bundler/compact_index_client.rb +0 -6
  13. data/bundler/lib/bundler/definition.rb +2 -9
  14. data/bundler/lib/bundler/endpoint_specification.rb +21 -3
  15. data/bundler/lib/bundler/env.rb +1 -1
  16. data/bundler/lib/bundler/fetcher/compact_index.rb +0 -10
  17. data/bundler/lib/bundler/fetcher/index.rb +0 -26
  18. data/bundler/lib/bundler/fetcher.rb +4 -9
  19. data/bundler/lib/bundler/gem_helper.rb +2 -2
  20. data/bundler/lib/bundler/lazy_specification.rb +2 -2
  21. data/bundler/lib/bundler/lockfile_generator.rb +1 -1
  22. data/bundler/lib/bundler/remote_specification.rb +7 -0
  23. data/bundler/lib/bundler/resolver/spec_group.rb +1 -1
  24. data/bundler/lib/bundler/resolver.rb +7 -12
  25. data/bundler/lib/bundler/ruby_version.rb +1 -1
  26. data/bundler/lib/bundler/self_manager.rb +106 -14
  27. data/bundler/lib/bundler/settings.rb +1 -0
  28. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  29. data/bundler/lib/bundler/templates/newgem/standard.yml.tt +1 -0
  30. data/bundler/lib/bundler/templates/newgem/test/minitest/test_newgem.rb.tt +1 -1
  31. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -4
  32. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  33. data/bundler/lib/bundler/version.rb +1 -1
  34. data/lib/rubygems/basic_specification.rb +8 -8
  35. data/lib/rubygems/bundler_version_finder.rb +3 -3
  36. data/lib/rubygems/command.rb +4 -4
  37. data/lib/rubygems/commands/cleanup_command.rb +6 -6
  38. data/lib/rubygems/commands/dependency_command.rb +20 -30
  39. data/lib/rubygems/commands/fetch_command.rb +27 -8
  40. data/lib/rubygems/commands/list_command.rb +1 -1
  41. data/lib/rubygems/commands/pristine_command.rb +12 -12
  42. data/lib/rubygems/commands/push_command.rb +8 -8
  43. data/lib/rubygems/commands/query_command.rb +1 -1
  44. data/lib/rubygems/commands/rdoc_command.rb +6 -6
  45. data/lib/rubygems/commands/search_command.rb +1 -1
  46. data/lib/rubygems/commands/setup_command.rb +8 -8
  47. data/lib/rubygems/commands/specification_command.rb +4 -4
  48. data/lib/rubygems/commands/update_command.rb +11 -8
  49. data/lib/rubygems/config_file.rb +4 -4
  50. data/lib/rubygems/doctor.rb +5 -5
  51. data/lib/rubygems/gem_runner.rb +5 -5
  52. data/lib/rubygems/install_update_options.rb +4 -4
  53. data/lib/rubygems/installer.rb +51 -12
  54. data/lib/rubygems/package/old.rb +1 -1
  55. data/lib/rubygems/package.rb +11 -11
  56. data/lib/rubygems/platform.rb +42 -42
  57. data/lib/rubygems/psych_additions.rb +1 -1
  58. data/lib/rubygems/query_utils.rb +16 -18
  59. data/lib/rubygems/remote_fetcher.rb +4 -4
  60. data/lib/rubygems/request_set/lockfile.rb +4 -4
  61. data/lib/rubygems/resolver/installer_set.rb +9 -9
  62. data/lib/rubygems/safe_yaml.rb +8 -8
  63. data/lib/rubygems/security.rb +1 -1
  64. data/lib/rubygems/source.rb +6 -6
  65. data/lib/rubygems/source_list.rb +7 -7
  66. data/lib/rubygems/spec_fetcher.rb +25 -25
  67. data/lib/rubygems/specification.rb +50 -51
  68. data/lib/rubygems/specification_policy.rb +16 -16
  69. data/lib/rubygems/stub_specification.rb +16 -19
  70. data/lib/rubygems/uninstaller.rb +7 -7
  71. data/lib/rubygems/user_interaction.rb +12 -12
  72. data/lib/rubygems/version.rb +9 -7
  73. data/lib/rubygems.rb +18 -17
  74. data/rubygems-update.gemspec +1 -1
  75. data/test/rubygems/helper.rb +10 -10
  76. data/test/rubygems/test_gem.rb +2 -0
  77. data/test/rubygems/test_gem_command_manager.rb +1 -1
  78. data/test/rubygems/test_gem_commands_fetch_command.rb +97 -0
  79. data/test/rubygems/test_gem_commands_install_command.rb +16 -0
  80. data/test/rubygems/test_gem_commands_update_command.rb +59 -0
  81. data/test/rubygems/test_gem_installer.rb +170 -58
  82. data/test/rubygems/test_gem_package.rb +2 -2
  83. data/test/rubygems/test_gem_stream_ui.rb +1 -1
  84. data/test/rubygems/test_gem_stub_specification.rb +0 -16
  85. data/test/rubygems/test_gem_version.rb +4 -0
  86. data/test/rubygems/utilities.rb +4 -4
  87. metadata +3 -3
@@ -9,7 +9,7 @@ module Bundler
9
9
  def restart_with_locked_bundler_if_needed
10
10
  return unless needs_switching? && installed?
11
11
 
12
- restart_with_locked_bundler
12
+ restart_with(lockfile_version)
13
13
  end
14
14
 
15
15
  def install_locked_bundler_and_restart_with_it_if_needed
@@ -19,23 +19,48 @@ module Bundler
19
19
  "Bundler #{current_version} is running, but your lockfile was generated with #{lockfile_version}. " \
20
20
  "Installing Bundler #{lockfile_version} and restarting using that version."
21
21
 
22
- install_and_restart_with_locked_bundler
22
+ install_and_restart_with(lockfile_version)
23
+ end
24
+
25
+ def update_bundler_and_restart_with_it_if_needed(target)
26
+ return unless autoswitching_applies?
27
+
28
+ spec = resolve_update_version_from(target)
29
+ return unless spec
30
+
31
+ version = spec.version
32
+
33
+ Bundler.ui.info "Updating bundler to #{version}."
34
+
35
+ install(spec)
36
+
37
+ restart_with(version)
23
38
  end
24
39
 
25
40
  private
26
41
 
27
- def install_and_restart_with_locked_bundler
28
- bundler_dep = Gem::Dependency.new("bundler", lockfile_version)
42
+ def install_and_restart_with(version)
43
+ requirement = Gem::Requirement.new(version)
44
+ spec = find_latest_matching_spec(requirement)
29
45
 
30
- Gem.install(bundler_dep)
46
+ if spec.nil?
47
+ Bundler.ui.warn "Your lockfile is locked to a version of bundler (#{lockfile_version}) that doesn't exist at https://rubygems.org/. Going on using #{current_version}"
48
+ return
49
+ end
50
+
51
+ install(spec)
31
52
  rescue StandardError => e
32
53
  Bundler.ui.trace e
33
54
  Bundler.ui.warn "There was an error installing the locked bundler version (#{lockfile_version}), rerun with the `--verbose` flag for more details. Going on using bundler #{current_version}."
34
55
  else
35
- restart_with_locked_bundler
56
+ restart_with(version)
57
+ end
58
+
59
+ def install(spec)
60
+ spec.source.install(spec)
36
61
  end
37
62
 
38
- def restart_with_locked_bundler
63
+ def restart_with(version)
39
64
  configured_gem_home = ENV["GEM_HOME"]
40
65
  configured_gem_path = ENV["GEM_PATH"]
41
66
 
@@ -44,33 +69,100 @@ module Bundler
44
69
 
45
70
  Bundler.with_original_env do
46
71
  Kernel.exec(
47
- { "GEM_HOME" => configured_gem_home, "GEM_PATH" => configured_gem_path, "BUNDLER_VERSION" => lockfile_version },
72
+ { "GEM_HOME" => configured_gem_home, "GEM_PATH" => configured_gem_path, "BUNDLER_VERSION" => version.to_s },
48
73
  *cmd
49
74
  )
50
75
  end
51
76
  end
52
77
 
53
78
  def needs_switching?
79
+ autoswitching_applies? &&
80
+ released?(lockfile_version) &&
81
+ !running?(lockfile_version) &&
82
+ !updating?
83
+ end
84
+
85
+ def autoswitching_applies?
54
86
  ENV["BUNDLER_VERSION"].nil? &&
55
87
  Bundler.rubygems.supports_bundler_trampolining? &&
56
88
  SharedHelpers.in_bundle? &&
57
- lockfile_version &&
58
- !lockfile_version.end_with?(".dev") &&
59
- lockfile_version != current_version
89
+ lockfile_version
90
+ end
91
+
92
+ def resolve_update_version_from(target)
93
+ requirement = Gem::Requirement.new(target)
94
+ update_candidate = find_latest_matching_spec(requirement)
95
+
96
+ if update_candidate.nil?
97
+ raise InvalidOption, "The `bundle update --bundler` target version (#{target}) does not exist"
98
+ end
99
+
100
+ resolved_version = update_candidate.version
101
+ needs_update = requirement.specific? ? !running?(resolved_version) : running_older_than?(resolved_version)
102
+
103
+ return unless needs_update
104
+
105
+ update_candidate
106
+ end
107
+
108
+ def local_specs
109
+ @local_specs ||= Bundler::Source::Rubygems.new("allow_local" => true).specs.select {|spec| spec.name == "bundler" }
110
+ end
111
+
112
+ def remote_specs
113
+ @remote_specs ||= begin
114
+ source = Bundler::Source::Rubygems.new("remotes" => "https://rubygems.org")
115
+ source.remote!
116
+ source.add_dependency_names("bundler")
117
+ source.specs
118
+ end
119
+ end
120
+
121
+ def find_latest_matching_spec(requirement)
122
+ local_result = find_latest_matching_spec_from_collection(local_specs, requirement)
123
+ return local_result if local_result && requirement.specific?
124
+
125
+ remote_result = find_latest_matching_spec_from_collection(remote_specs, requirement)
126
+ return remote_result if local_result.nil?
127
+
128
+ [local_result, remote_result].max
129
+ end
130
+
131
+ def find_latest_matching_spec_from_collection(specs, requirement)
132
+ specs.sort.reverse_each.find {|spec| requirement.satisfied_by?(spec.version) }
133
+ end
134
+
135
+ def running?(version)
136
+ version == current_version
137
+ end
138
+
139
+ def running_older_than?(version)
140
+ current_version < version
141
+ end
142
+
143
+ def released?(version)
144
+ !version.to_s.end_with?(".dev")
145
+ end
146
+
147
+ def updating?
148
+ "update".start_with?(ARGV.first || " ") && ARGV[1..-1].any? {|a| a.start_with?("--bundler") }
60
149
  end
61
150
 
62
151
  def installed?
63
152
  Bundler.configure
64
153
 
65
- Bundler.rubygems.find_bundler(lockfile_version)
154
+ Bundler.rubygems.find_bundler(lockfile_version.to_s)
66
155
  end
67
156
 
68
157
  def current_version
69
- @current_version ||= Bundler::VERSION
158
+ @current_version ||= Gem::Version.new(Bundler::VERSION)
70
159
  end
71
160
 
72
161
  def lockfile_version
73
- @lockfile_version ||= Bundler::LockfileParser.bundled_with
162
+ return @lockfile_version if defined?(@lockfile_version)
163
+
164
+ parsed_version = Bundler::LockfileParser.bundled_with
165
+ @lockfile_version = parsed_version ? Gem::Version.new(parsed_version) : nil
74
166
  end
75
167
  end
76
168
  end
@@ -219,6 +219,7 @@ module Bundler
219
219
  def path
220
220
  configs.each do |_level, settings|
221
221
  path = value_for("path", settings)
222
+ path = "vendor/bundle" if value_for("deployment", settings) && path.nil?
222
223
  path_system = value_for("path.system", settings)
223
224
  disabled_shared_gems = value_for("disable_shared_gems", settings)
224
225
  next if path.nil? && path_system.nil? && disabled_shared_gems.nil?
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
27
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
28
28
  `git ls-files -z`.split("\x0").reject do |f|
29
- (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
29
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
30
30
  end
31
31
  end
32
32
  spec.bindir = "exe"
@@ -1,2 +1,3 @@
1
1
  # For available configuration options, see:
2
2
  # https://github.com/testdouble/standard
3
+ ruby_version: <%= ::Gem::Version.new(config[:required_ruby_version]).segments[0..1].join(".") %>
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "test_helper"
4
4
 
5
- class Test<%= config[:constant_name] %> < Minitest::Test
5
+ class <%= config[:minitest_constant_name] %> < Minitest::Test
6
6
  def test_that_it_has_a_version_number
7
7
  refute_nil ::<%= config[:constant_name] %>::VERSION
8
8
  end
@@ -107,10 +107,7 @@ class Bundler::Thor
107
107
  #
108
108
  def replace!(regexp, string, force)
109
109
  content = File.read(destination)
110
- before, after = content.split(regexp, 2)
111
- snippet = (behavior == :after ? after : before).to_s
112
-
113
- if force || !snippet.include?(replacement)
110
+ if force || !content.include?(replacement)
114
111
  success = content.gsub!(regexp, string)
115
112
 
116
113
  File.open(destination, "wb") { |file| file.write(content) } unless pretend?
@@ -1,3 +1,3 @@
1
1
  class Bundler::Thor
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.3.2".freeze
4
+ VERSION = "2.3.6".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -289,14 +289,14 @@ class Gem::BasicSpecification
289
289
 
290
290
  def lib_dirs_glob
291
291
  dirs = if self.raw_require_paths
292
- if self.raw_require_paths.size > 1
293
- "{#{self.raw_require_paths.join(',')}}"
294
- else
295
- self.raw_require_paths.first
296
- end
297
- else
298
- "lib" # default value for require_paths for bundler/inline
299
- end
292
+ if self.raw_require_paths.size > 1
293
+ "{#{self.raw_require_paths.join(',')}}"
294
+ else
295
+ self.raw_require_paths.first
296
+ end
297
+ else
298
+ "lib" # default value for require_paths for bundler/inline
299
+ end
300
300
 
301
301
  "#{self.full_gem_path}/#{dirs}".dup.tap(&Gem::UNTAINT)
302
302
  end
@@ -65,9 +65,9 @@ module Gem::BundlerVersionFinder
65
65
  return unless gemfile
66
66
 
67
67
  lockfile = case gemfile
68
- when "gems.rb" then "gems.locked"
69
- else "#{gemfile}.lock"
70
- end.dup.tap(&Gem::UNTAINT)
68
+ when "gems.rb" then "gems.locked"
69
+ else "#{gemfile}.lock"
70
+ end.dup.tap(&Gem::UNTAINT)
71
71
 
72
72
  return unless File.file?(lockfile)
73
73
 
@@ -398,10 +398,10 @@ class Gem::Command
398
398
  version_to_expire = deprecation["rg_version_to_expire"]
399
399
 
400
400
  deprecate_option_msg = if version_to_expire
401
- "The \"#{option}\" option has been deprecated and will be removed in Rubygems #{version_to_expire}."
402
- else
403
- "The \"#{option}\" option has been deprecated and will be removed in future versions of Rubygems."
404
- end
401
+ "The \"#{option}\" option has been deprecated and will be removed in Rubygems #{version_to_expire}."
402
+ else
403
+ "The \"#{option}\" option has been deprecated and will be removed in future versions of Rubygems."
404
+ end
405
405
 
406
406
  extra_msg = deprecation["extra_msg"]
407
407
 
@@ -117,12 +117,12 @@ If no gems are named all gems in GEM_HOME are cleaned.
117
117
 
118
118
  def get_candidate_gems
119
119
  @candidate_gems = unless options[:args].empty?
120
- options[:args].map do |gem_name|
121
- Gem::Specification.find_all_by_name gem_name
122
- end.flatten
123
- else
124
- Gem::Specification.to_a
125
- end
120
+ options[:args].map do |gem_name|
121
+ Gem::Specification.find_all_by_name gem_name
122
+ end.flatten
123
+ else
124
+ Gem::Specification.to_a
125
+ end
126
126
  end
127
127
 
128
128
  def get_gems_to_cleanup
@@ -53,41 +53,41 @@ use with other commands.
53
53
  "#{program_name} REGEXP"
54
54
  end
55
55
 
56
- def fetch_remote_specs(dependency) # :nodoc:
56
+ def fetch_remote_specs(name, requirement, prerelease) # :nodoc:
57
57
  fetcher = Gem::SpecFetcher.fetcher
58
58
 
59
- ss, = fetcher.spec_for_dependency dependency
59
+ specs_type = prerelease ? :complete : :released
60
60
 
61
- ss.map {|spec, _| spec }
61
+ ss = if name.nil?
62
+ fetcher.detect(specs_type) { true }
63
+ else
64
+ fetcher.detect(specs_type) do |name_tuple|
65
+ name === name_tuple.name && requirement.satisfied_by?(name_tuple.version)
66
+ end
67
+ end
68
+
69
+ ss.map {|tuple, source| source.fetch_spec(tuple) }
62
70
  end
63
71
 
64
- def fetch_specs(name_pattern, dependency) # :nodoc:
72
+ def fetch_specs(name_pattern, requirement, prerelease) # :nodoc:
65
73
  specs = []
66
74
 
67
75
  if local?
68
76
  specs.concat Gem::Specification.stubs.find_all {|spec|
69
- name_pattern =~ spec.name and
70
- dependency.requirement.satisfied_by? spec.version
77
+ name_matches = name_pattern ? name_pattern =~ spec.name : true
78
+ version_matches = requirement.satisfied_by?(spec.version)
79
+
80
+ name_matches and version_matches
71
81
  }.map(&:to_spec)
72
82
  end
73
83
 
74
- specs.concat fetch_remote_specs dependency if remote?
84
+ specs.concat fetch_remote_specs name_pattern, requirement, prerelease if remote?
75
85
 
76
86
  ensure_specs specs
77
87
 
78
88
  specs.uniq.sort
79
89
  end
80
90
 
81
- def gem_dependency(pattern, version, prerelease) # :nodoc:
82
- dependency = Gem::Deprecate.skip_during do
83
- Gem::Dependency.new pattern, version
84
- end
85
-
86
- dependency.prerelease = prerelease
87
-
88
- dependency
89
- end
90
-
91
91
  def display_pipe(specs) # :nodoc:
92
92
  specs.each do |spec|
93
93
  unless spec.dependencies.empty?
@@ -119,11 +119,9 @@ use with other commands.
119
119
  ensure_local_only_reverse_dependencies
120
120
 
121
121
  pattern = name_pattern options[:args]
122
+ requirement = Gem::Requirement.new options[:version]
122
123
 
123
- dependency =
124
- gem_dependency pattern, options[:version], options[:prerelease]
125
-
126
- specs = fetch_specs pattern, dependency
124
+ specs = fetch_specs pattern, requirement, options[:prerelease]
127
125
 
128
126
  reverse = reverse_dependencies specs
129
127
 
@@ -162,14 +160,6 @@ use with other commands.
162
160
  response
163
161
  end
164
162
 
165
- def remote_specs(dependency) # :nodoc:
166
- fetcher = Gem::SpecFetcher.fetcher
167
-
168
- ss, _ = fetcher.spec_for_dependency dependency
169
-
170
- ss.map {|s,o| s }
171
- end
172
-
173
163
  def reverse_dependencies(specs) # :nodoc:
174
164
  reverse = Hash.new {|h, k| h[k] = [] }
175
165
 
@@ -205,7 +195,7 @@ use with other commands.
205
195
  private
206
196
 
207
197
  def name_pattern(args)
208
- args << '' if args.empty?
198
+ return if args.empty?
209
199
 
210
200
  if args.length == 1 and args.first =~ /\A(.*)(i)?\z/m
211
201
  flags = $2 ? Regexp::IGNORECASE : nil
@@ -8,7 +8,12 @@ class Gem::Commands::FetchCommand < Gem::Command
8
8
  include Gem::VersionOption
9
9
 
10
10
  def initialize
11
- super 'fetch', 'Download a gem and place it in the current directory'
11
+ defaults = {
12
+ :suggest_alternate => true,
13
+ :version => Gem::Requirement.default,
14
+ }
15
+
16
+ super 'fetch', 'Download a gem and place it in the current directory', defaults
12
17
 
13
18
  add_bulk_threshold_option
14
19
  add_proxy_option
@@ -18,6 +23,10 @@ class Gem::Commands::FetchCommand < Gem::Command
18
23
  add_version_option
19
24
  add_platform_option
20
25
  add_prerelease_option
26
+
27
+ add_option '--[no-]suggestions', 'Suggest alternates when gems are not found' do |value, options|
28
+ options[:suggest_alternate] = value
29
+ end
21
30
  end
22
31
 
23
32
  def arguments # :nodoc:
@@ -42,15 +51,27 @@ then repackaging it.
42
51
  "#{program_name} GEMNAME [GEMNAME ...]"
43
52
  end
44
53
 
54
+ def check_version # :nodoc:
55
+ if options[:version] != Gem::Requirement.default and
56
+ get_all_gem_names.size > 1
57
+ alert_error "Can't use --version with multiple gems. You can specify multiple gems with" \
58
+ " version requirements using `gem fetch 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'`"
59
+ terminate_interaction 1
60
+ end
61
+ end
62
+
45
63
  def execute
46
- version = options[:version] || Gem::Requirement.default
64
+ check_version
65
+ version = options[:version]
47
66
 
48
67
  platform = Gem.platforms.last
49
- gem_names = get_all_gem_names
68
+ gem_names = get_all_gem_names_and_versions
50
69
 
51
- gem_names.each do |gem_name|
52
- dep = Gem::Dependency.new gem_name, version
70
+ gem_names.each do |gem_name, gem_version|
71
+ gem_version ||= version
72
+ dep = Gem::Dependency.new gem_name, gem_version
53
73
  dep.prerelease = options[:prerelease]
74
+ suppress_suggestions = !options[:suggest_alternate]
54
75
 
55
76
  specs_and_sources, errors =
56
77
  Gem::SpecFetcher.fetcher.spec_for_dependency dep
@@ -63,12 +84,10 @@ then repackaging it.
63
84
  spec, source = specs_and_sources.max_by {|s,| s }
64
85
 
65
86
  if spec.nil?
66
- show_lookup_failure gem_name, version, errors, options[:domain]
87
+ show_lookup_failure gem_name, gem_version, errors, suppress_suggestions, options[:domain]
67
88
  next
68
89
  end
69
-
70
90
  source.download spec
71
-
72
91
  say "Downloaded #{spec.full_name}"
73
92
  end
74
93
  end
@@ -10,7 +10,7 @@ class Gem::Commands::ListCommand < Gem::Command
10
10
 
11
11
  def initialize
12
12
  super 'list', 'Display local gems whose name matches REGEXP',
13
- :name => //, :domain => :local, :details => false, :versions => true,
13
+ :domain => :local, :details => false, :versions => true,
14
14
  :installed => nil, :version => Gem::Requirement.default
15
15
 
16
16
  add_query_options
@@ -98,20 +98,20 @@ extensions will be restored.
98
98
 
99
99
  def execute
100
100
  specs = if options[:all]
101
- Gem::Specification.map
101
+ Gem::Specification.map
102
102
 
103
- # `--extensions` must be explicitly given to pristine only gems
104
- # with extensions.
105
- elsif options[:extensions_set] and
103
+ # `--extensions` must be explicitly given to pristine only gems
104
+ # with extensions.
105
+ elsif options[:extensions_set] and
106
106
  options[:extensions] and options[:args].empty?
107
- Gem::Specification.select do |spec|
108
- spec.extensions and not spec.extensions.empty?
109
- end
110
- else
111
- get_all_gem_names.sort.map do |gem_name|
112
- Gem::Specification.find_all_by_name(gem_name, options[:version]).reverse
113
- end.flatten
114
- end
107
+ Gem::Specification.select do |spec|
108
+ spec.extensions and not spec.extensions.empty?
109
+ end
110
+ else
111
+ get_all_gem_names.sort.map do |gem_name|
112
+ Gem::Specification.find_all_by_name(gem_name, options[:version]).reverse
113
+ end.flatten
114
+ end
115
115
 
116
116
  specs = specs.select{|spec| RUBY_ENGINE == spec.platform || Gem::Platform.local === spec.platform || spec.platform == Gem::Platform::RUBY }
117
117
 
@@ -52,14 +52,14 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo
52
52
  default_gem_server, push_host = get_hosts_for(gem_name)
53
53
 
54
54
  @host = if @user_defined_host
55
- options[:host]
56
- elsif default_gem_server
57
- default_gem_server
58
- elsif push_host
59
- push_host
60
- else
61
- options[:host]
62
- end
55
+ options[:host]
56
+ elsif default_gem_server
57
+ default_gem_server
58
+ elsif push_host
59
+ push_host
60
+ else
61
+ options[:host]
62
+ end
63
63
 
64
64
  sign_in @host, scope: get_push_scope
65
65
 
@@ -20,7 +20,7 @@ class Gem::Commands::QueryCommand < Gem::Command
20
20
  def initialize(name = 'query',
21
21
  summary = 'Query gem information in local or remote repositories')
22
22
  super name, summary,
23
- :name => //, :domain => :local, :details => false, :versions => true,
23
+ :domain => :local, :details => false, :versions => true,
24
24
  :installed => nil, :version => Gem::Requirement.default
25
25
 
26
26
  add_option('-n', '--name-matches REGEXP',
@@ -61,12 +61,12 @@ Use --overwrite to force rebuilding of documentation.
61
61
 
62
62
  def execute
63
63
  specs = if options[:all]
64
- Gem::Specification.to_a
65
- else
66
- get_all_gem_names.map do |name|
67
- Gem::Specification.find_by_name name, options[:version]
68
- end.flatten.uniq
69
- end
64
+ Gem::Specification.to_a
65
+ else
66
+ get_all_gem_names.map do |name|
67
+ Gem::Specification.find_by_name name, options[:version]
68
+ end.flatten.uniq
69
+ end
70
70
 
71
71
  if specs.empty?
72
72
  alert_error 'No matching gems found'
@@ -7,7 +7,7 @@ class Gem::Commands::SearchCommand < Gem::Command
7
7
 
8
8
  def initialize
9
9
  super 'search', 'Display remote gems whose name matches REGEXP',
10
- :name => //, :domain => :remote, :details => false, :versions => true,
10
+ :domain => :remote, :details => false, :versions => true,
11
11
  :installed => nil, :version => Gem::Requirement.default
12
12
 
13
13
  add_query_options
@@ -54,10 +54,10 @@ class Gem::Commands::SetupCommand < Gem::Command
54
54
  'List the documentation types you wish to',
55
55
  'generate. For example: rdoc,ri' do |value, options|
56
56
  options[:document] = case value
57
- when nil then %w[rdoc ri]
58
- when false then []
59
- else value
60
- end
57
+ when nil then %w[rdoc ri]
58
+ when false then []
59
+ else value
60
+ end
61
61
  end
62
62
 
63
63
  add_option '--[no-]rdoc',
@@ -666,10 +666,10 @@ abort "#{deprecation_message}"
666
666
 
667
667
  def target_bin_path(bin_dir, bin_file)
668
668
  bin_file_formatted = if options[:format_executable]
669
- Gem.default_exec_format % bin_file
670
- else
671
- bin_file
672
- end
669
+ Gem.default_exec_format % bin_file
670
+ else
671
+ bin_file
672
+ end
673
673
  File.join bin_dir, bin_file_formatted
674
674
  end
675
675
 
@@ -140,10 +140,10 @@ Specific fields in the specification can be extracted in YAML format:
140
140
  s = s.send field if field
141
141
 
142
142
  say case options[:format]
143
- when :ruby then s.to_ruby
144
- when :marshal then Marshal.dump s
145
- else s.to_yaml
146
- end
143
+ when :ruby then s.to_ruby
144
+ when :marshal then Marshal.dump s
145
+ else s.to_yaml
146
+ end
147
147
 
148
148
  say "\n"
149
149
  end