rubygems-update 2.4.4 → 2.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rubygems-update might be problematic. Click here for more details.

Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.rdoc +58 -0
  3. data/History.txt +42 -0
  4. data/Manifest.txt +1 -1
  5. data/lib/rubygems.rb +8 -2
  6. data/lib/rubygems/basic_specification.rb +52 -22
  7. data/lib/rubygems/commands/contents_command.rb +0 -1
  8. data/lib/rubygems/commands/pristine_command.rb +15 -1
  9. data/lib/rubygems/commands/uninstall_command.rb +1 -1
  10. data/lib/rubygems/commands/update_command.rb +0 -2
  11. data/lib/rubygems/core_ext/kernel_gem.rb +8 -1
  12. data/lib/rubygems/core_ext/kernel_require.rb +1 -1
  13. data/lib/rubygems/dependency.rb +1 -1
  14. data/lib/rubygems/dependency_list.rb +1 -5
  15. data/lib/rubygems/ext/ext_conf_builder.rb +1 -1
  16. data/lib/rubygems/indexer.rb +1 -1
  17. data/lib/rubygems/installer.rb +2 -2
  18. data/lib/rubygems/package/old.rb +2 -2
  19. data/lib/rubygems/package/tar_writer.rb +9 -3
  20. data/lib/rubygems/remote_fetcher.rb +5 -1
  21. data/lib/rubygems/request/connection_pools.rb +5 -1
  22. data/lib/rubygems/request/http_pool.rb +9 -0
  23. data/lib/rubygems/request_set.rb +1 -4
  24. data/lib/rubygems/request_set/lockfile.rb +21 -8
  25. data/lib/rubygems/resolver/api_set.rb +1 -1
  26. data/lib/rubygems/resolver/api_specification.rb +1 -1
  27. data/lib/rubygems/resolver/installer_set.rb +1 -1
  28. data/lib/rubygems/source.rb +6 -2
  29. data/lib/rubygems/specification.rb +10 -2
  30. data/lib/rubygems/stub_specification.rb +11 -5
  31. data/lib/rubygems/test_case.rb +31 -0
  32. data/lib/rubygems/text.rb +2 -2
  33. data/lib/rubygems/user_interaction.rb +0 -1
  34. data/test/rubygems/test_gem.rb +15 -32
  35. data/test/rubygems/test_gem_commands_pristine_command.rb +92 -0
  36. data/test/rubygems/test_gem_package_tar_writer.rb +10 -6
  37. data/test/rubygems/test_gem_remote_fetcher.rb +25 -1
  38. data/test/rubygems/test_gem_request_set_lockfile.rb +28 -0
  39. data/test/rubygems/test_gem_resolver_api_specification.rb +2 -2
  40. data/test/rubygems/test_gem_resolver_installer_set.rb +14 -0
  41. data/test/rubygems/test_gem_source.rb +14 -0
  42. data/test/rubygems/test_gem_specification.rb +50 -1
  43. data/test/rubygems/test_gem_stub_specification.rb +9 -1
  44. data/test/rubygems/test_gem_text.rb +16 -0
  45. data/test/rubygems/test_kernel.rb +24 -0
  46. metadata +4 -3
  47. data/CONTRIBUTING +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d45335473804839a55a75fa236d648bcd9f33b17
4
- data.tar.gz: ace593b2f7f8b001fe67f038b0f6f9a3a837411a
3
+ metadata.gz: dc0bb2181c07efffa060674fa83f662444173e18
4
+ data.tar.gz: 4435d084f527dd663d15ecdba564b8ebe43792a4
5
5
  SHA512:
6
- metadata.gz: d255ea71d77bd18fa781c6076dec28c3383818575e53876d912ff07b4ce504cfbf0d56c3cfe529d8bd09cadc7e46309bafd146fdaf9c20b8164a2f8d57a38848
7
- data.tar.gz: e625369d791159e76f18eaab91d52d3cdb8f4519e1cabeb27903e38ad25db9ff0614ca3796d33dd3e1ecae297e8a2afca7d741f5187f041a8ce91aa09acdc71b
6
+ metadata.gz: 0deecdcea9efcdc0e64ec35651c22b0019df5cf41bdd6a8667392d4e36648117ed512d624b44e4f7d3b388c74a494f0ec5d3f845563b8c67c8fc5ec5b252edac
7
+ data.tar.gz: e880b4f113c6a6549527c7754307fcf47d501cf7c6876a56ec3ef0cff4a2ade0b47bae7c445edc169778c526af5952ef31bf35606f89fb8e8ac1826b5ce466cf
@@ -0,0 +1,58 @@
1
+ = How to contribute
2
+
3
+ Community involvement is essential to RubyGems. We want to keep it easy as
4
+ possible to contribute changes. There are a few guidelines that we need
5
+ contributors to follow to reduce the time it takes to get changes merged in.
6
+
7
+ == Guidelines
8
+
9
+ 1. New features should be coupled with tests.
10
+
11
+ 2. Ensure that your code blends well with ours:
12
+ * No trailing whitespace
13
+ * Match indentation (two spaces)
14
+ * Match coding style (`if`, `elsif`, `when` need trailing `then`)
15
+
16
+ 3. Don't modify the history file or version number.
17
+
18
+ 4. If you have any questions, just ask on IRC in #rubygems on Freenode or file
19
+ an issue here: http://github.com/rubygems/rubygems/issues
20
+
21
+ For more information and ideas on how to contribute to RubyGems ecosystem, see
22
+ here: http://guides.rubygems.org/contributing/
23
+
24
+ == Getting Started
25
+
26
+ Run:
27
+
28
+ $ gem install hoe
29
+ $ rake newb
30
+
31
+ After `rake newb` finishes you can run `rake` to run the tests.
32
+
33
+ == Issues
34
+
35
+ RubyGems uses milestones and labels to track issues and pull requests.
36
+
37
+ A new milestone is created for each feature release. New features will be
38
+ merged (for a pull request) or implemented when "enough" have accumulated.
39
+ Upon release the milestone will be closed. Bug fixes are added to the next
40
+ feature release milestone and merged or fixed and released as-needed. Bug fix
41
+ releases use the previous feature release minor version number.
42
+
43
+ Issues in the "Unfulfilled Promises and Broken Dreams" milestone are looking
44
+ for implementors. It is highly unlikely they will be implemented by RubyGems
45
+ committers. They may be closed after one year.
46
+
47
+ Issues in the "Future" milestone are more likely to be implemented by RubyGems
48
+ committers. They are triaged with each new feature release and either move to
49
+ the new version numbered milestone, left in "Future" or moved to "Unfulfilled
50
+ Promises and Broken Dreams". They may be closed after one year.
51
+
52
+ Issues with accepted status in a feature release milestone have been reviewed
53
+ and triaged and are scheduled for a fix or implementation.
54
+
55
+ Issues with the feedback status may be closed one week after a request for more
56
+ information from a collaborator. They will be reopened when more information
57
+ becomes available.
58
+
@@ -1,5 +1,47 @@
1
1
  # coding: UTF-8
2
2
 
3
+ === 2.4.5 / 2014-12-03
4
+
5
+ Bug fixes:
6
+
7
+ * Improved speed of requiring gems. (Around 25% for a 60 gem test). Pull
8
+ request #1060 by unak.
9
+ * RubyGems no longer attempts to look up gems remotely with the --local flag.
10
+ Pull request #1084 by Jeremy Evans.
11
+ * Executable stubs use the correct gem version when RUBYGEMS_GEMDEPS is
12
+ active. Issue #1072 by Michael Kaiser-Nyman.
13
+ * Fixed handling of pinned gems in lockfiles with versions. Issue #1078 by
14
+ Ian Ker-Seymer.
15
+ * Fixed handling of git@example:gem.git URIs. Issue #1054 by Mogutan Mogu.
16
+ * Fixed handling of platforms retrieved from the dependencies API. Issue
17
+ #1058 and patch suggestion by tux-mind.
18
+ * RubyGems now suggests a copy-pasteable `gem pristine` command when
19
+ extensions are missing. Pull request #1057 by Shannon Skipper.
20
+ * Improved errors for long file names when packaging. Pull request #1016 by
21
+ Piotrek Bator.
22
+ * `gem pristine` now skips gems cannot be found remotely. Pull request #1064
23
+ by Tuomas Kareinen.
24
+ * `gem pristine` now caches gems to the proper directory. Pull request #1064
25
+ by Tuomas Kareinen.
26
+ * `gem pristine` now skips bundled gems properly. Pull request #1064 by
27
+ Tuomas Kareinen.
28
+ * Improved interoperability of Vagrant with RubyGems. Pull request #1057 by
29
+ Vít Ondruch.
30
+ * Renamed CONTRIBUTING to CONTRIBUTING.rdoc to allow markup. Pull request
31
+ #1090 by Roberto Miranda.
32
+ * Switched from #partition to #reject as only one collection is used. Pull
33
+ request #1074 by Tuomas Kareinen.
34
+ * Fixed installation of gems on systems using memory-mapped files. Pull
35
+ request #1038 by Justin Li.
36
+ * Fixed bug in Gem::Text#min3 where `a == b < c`. Pull request #1026 by
37
+ fortissimo1997.
38
+ * Fixed uninitialized variable warning in BasicSpecification. Pull request
39
+ #1019 by Piotr Szotkowski.
40
+ * Removed unneeded exception handling for cyclic dependencies. Pull request
41
+ #1043 by Jens Wille.
42
+ * Fixed grouped expression warning. Pull request #1081 by André Arko.
43
+ * Fixed handling of platforms when writing lockfiles.
44
+
3
45
  === 2.4.4 / 2014-11-12
4
46
 
5
47
  Bug fixes:
@@ -1,6 +1,6 @@
1
1
  .autotest
2
2
  .document
3
- CONTRIBUTING
3
+ CONTRIBUTING.rdoc
4
4
  CVE-2013-4287.txt
5
5
  CVE-2013-4363.txt
6
6
  History.txt
@@ -9,7 +9,7 @@ require 'rbconfig'
9
9
  require 'thread'
10
10
 
11
11
  module Gem
12
- VERSION = '2.4.4'
12
+ VERSION = '2.4.5'
13
13
  end
14
14
 
15
15
  # Must be first since it unloads the prelude from 1.9.2
@@ -232,7 +232,13 @@ module Gem
232
232
  requirements = Gem::Requirement.default if
233
233
  requirements.empty?
234
234
 
235
- specs = Gem::Dependency.new(name, requirements).matching_specs(true)
235
+ dep = Gem::Dependency.new name, requirements
236
+
237
+ loaded = Gem.loaded_specs[name]
238
+
239
+ return loaded.bin_file exec_name if loaded && dep.matches_spec?(loaded)
240
+
241
+ specs = dep.matching_specs(true)
236
242
 
237
243
  raise Gem::GemNotFoundException,
238
244
  "can't find gem #{name} (#{requirements})" if specs.empty?
@@ -58,23 +58,28 @@ class Gem::BasicSpecification
58
58
  # Return true if this spec can require +file+.
59
59
 
60
60
  def contains_requirable_file? file
61
- if instance_variable_defined?(:@ignored) or
62
- instance_variable_defined?('@ignored') then
63
- return false
64
- elsif missing_extensions? then
65
- @ignored = true
66
-
67
- warn "Ignoring #{full_name} because its extensions are not built. " +
68
- "Try: gem pristine #{full_name}"
69
- return false
70
- end
71
-
72
- suffixes = Gem.suffixes
73
-
74
- full_require_paths.any? do |dir|
75
- base = "#{dir}/#{file}"
76
- suffixes.any? { |suf| File.file? "#{base}#{suf}" }
77
- end
61
+ @contains_requirable_file ||= {}
62
+ @contains_requirable_file[file] ||=
63
+ begin
64
+ if instance_variable_defined?(:@ignored) or
65
+ instance_variable_defined?('@ignored') then
66
+ return false
67
+ elsif missing_extensions? then
68
+ @ignored = true
69
+
70
+ warn "Ignoring #{full_name} because its extensions are not built. " +
71
+ "Try: gem pristine #{name} --version #{version}"
72
+ return false
73
+ end
74
+
75
+ suffixes = Gem.suffixes
76
+
77
+ full_require_paths.any? do |dir|
78
+ base = "#{dir}/#{file}"
79
+ suffixes.any? { |suf| File.file? "#{base}#{suf}" }
80
+ end
81
+ end ? :yes : :no
82
+ @contains_requirable_file[file] == :yes
78
83
  end
79
84
 
80
85
  def default_gem?
@@ -134,13 +139,38 @@ class Gem::BasicSpecification
134
139
  # activated.
135
140
 
136
141
  def full_require_paths
137
- full_paths = raw_require_paths.map do |path|
138
- File.join full_gem_path, path
139
- end
142
+ @full_require_paths ||=
143
+ begin
144
+ full_paths = raw_require_paths.map do |path|
145
+ File.join full_gem_path, path
146
+ end
140
147
 
141
- full_paths.unshift extension_dir unless @extensions.nil? || @extensions.empty?
148
+ full_paths.unshift extension_dir unless @extensions.nil? || @extensions.empty?
142
149
 
143
- full_paths
150
+ full_paths
151
+ end
152
+ end
153
+
154
+ ##
155
+ # Full path of the target library file.
156
+ # If the file is not in this gem, return nil.
157
+
158
+ def to_fullpath path
159
+ if activated? then
160
+ @paths_map ||= {}
161
+ @paths_map[path] ||=
162
+ begin
163
+ fullpath = nil
164
+ suffixes = Gem.suffixes
165
+ full_require_paths.find do |dir|
166
+ suffixes.find do |suf|
167
+ File.file?(fullpath = "#{dir}/#{path}#{suf}")
168
+ end
169
+ end ? fullpath : nil
170
+ end
171
+ else
172
+ nil
173
+ end
144
174
  end
145
175
 
146
176
  ##
@@ -146,7 +146,6 @@ prefix or only the files that are requireable.
146
146
 
147
147
  def path_description spec_dirs # :nodoc:
148
148
  if spec_dirs.empty? then
149
- spec_dirs = Gem::Specification.dirs
150
149
  "default gem paths"
151
150
  else
152
151
  "specified path"
@@ -109,6 +109,11 @@ extensions will be restored.
109
109
  next
110
110
  end
111
111
 
112
+ if spec.bundled_gem_in_old_ruby?
113
+ say "Skipped #{spec.full_name}, it is bundled with old Ruby"
114
+ next
115
+ end
116
+
112
117
  unless spec.extensions.empty? or options[:extensions] then
113
118
  say "Skipped #{spec.full_name}, it needs to compile an extension"
114
119
  next
@@ -120,8 +125,17 @@ extensions will be restored.
120
125
  require 'rubygems/remote_fetcher'
121
126
 
122
127
  say "Cached gem for #{spec.full_name} not found, attempting to fetch..."
128
+
123
129
  dep = Gem::Dependency.new spec.name, spec.version
124
- Gem::RemoteFetcher.fetcher.download_to_cache dep
130
+ found, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dep
131
+
132
+ if found.empty?
133
+ say "Skipped #{spec.full_name}, it was not found from cache and remote sources"
134
+ next
135
+ end
136
+
137
+ spec_candidate, source = found.first
138
+ Gem::RemoteFetcher.fetcher.download spec_candidate, source.uri.to_s, spec.base_dir
125
139
  end
126
140
 
127
141
  env_shebang =
@@ -124,7 +124,7 @@ that is a dependency of an existing gem. You can use the
124
124
  end
125
125
 
126
126
  def uninstall_all
127
- _, specs = Gem::Specification.partition { |spec| spec.default_gem? }
127
+ specs = Gem::Specification.reject { |spec| spec.default_gem? }
128
128
 
129
129
  specs.each do |spec|
130
130
  options[:version] = spec.version
@@ -84,8 +84,6 @@ command to remove old versions.
84
84
  end
85
85
 
86
86
  def execute
87
- hig = {}
88
-
89
87
  if options[:system] then
90
88
  update_rubygems
91
89
  return
@@ -55,7 +55,14 @@ module Kernel
55
55
  gem_name = gem_name.name
56
56
  end
57
57
 
58
- spec = Gem::Dependency.new(gem_name, *requirements).to_spec
58
+ dep = Gem::Dependency.new(gem_name, *requirements)
59
+
60
+ loaded = Gem.loaded_specs[gem_name]
61
+
62
+ return false if loaded && dep.matches_spec?(loaded)
63
+
64
+ spec = dep.to_spec
65
+
59
66
  Gem::LOADED_SPECS_MUTEX.synchronize {
60
67
  spec.activate
61
68
  } if spec
@@ -66,7 +66,7 @@ module Kernel
66
66
 
67
67
  begin
68
68
  RUBYGEMS_ACTIVATION_MONITOR.exit
69
- return gem_original_require(path)
69
+ return gem_original_require(spec.to_fullpath(path) || path)
70
70
  end if spec
71
71
 
72
72
  # Attempt to find +path+ in any unresolved gems...
@@ -281,7 +281,7 @@ class Gem::Dependency
281
281
  }
282
282
  end
283
283
 
284
- matches = matches.sort_by { |s| s.sort_obj } # HACK: shouldn't be needed
284
+ matches.sort_by { |s| s.sort_obj } # HACK: shouldn't be needed
285
285
  end
286
286
 
287
287
  ##
@@ -219,11 +219,7 @@ class Gem::DependencyList
219
219
  dependencies.each do |dep|
220
220
  specs.each do |spec|
221
221
  if spec.satisfies_requirement? dep then
222
- begin
223
- yield spec
224
- rescue TSort::Cyclic
225
- # do nothing
226
- end
222
+ yield spec
227
223
  break
228
224
  end
229
225
  end
@@ -49,7 +49,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
49
49
  FileUtils.mkdir_p lib_dir
50
50
  entries = Dir.entries(tmp_dest) - %w[. ..]
51
51
  entries = entries.map { |entry| File.join tmp_dest, entry }
52
- FileUtils.cp_r entries, lib_dir
52
+ FileUtils.cp_r entries, lib_dir, :remove_destination => true
53
53
  end
54
54
 
55
55
  FileEntry.new(tmp_dest).traverse do |ent|
@@ -235,7 +235,7 @@ class Gem::Indexer
235
235
  sanitize spec
236
236
 
237
237
  spec
238
- rescue SignalException => e
238
+ rescue SignalException
239
239
  alert_error "Received signal, exiting"
240
240
  raise
241
241
  rescue Exception => e
@@ -421,8 +421,8 @@ class Gem::Installer
421
421
  next
422
422
  end
423
423
 
424
- mode = File.stat(bin_path).mode | 0111
425
- FileUtils.chmod mode, bin_path
424
+ mode = File.stat(bin_path).mode
425
+ FileUtils.chmod mode | 0111, bin_path unless (mode | 0111) == mode
426
426
 
427
427
  check_executable_overwrite filename
428
428
 
@@ -153,10 +153,10 @@ class Gem::Package::Old < Gem::Package
153
153
 
154
154
  begin
155
155
  @spec = Gem::Specification.from_yaml yaml
156
- rescue yaml_error => e
156
+ rescue yaml_error
157
157
  raise Gem::Exception, "Failed to parse gem specification out of gem file"
158
158
  end
159
- rescue ArgumentError => e
159
+ rescue ArgumentError
160
160
  raise Gem::Exception, "Failed to parse gem specification out of gem file"
161
161
  end
162
162
 
@@ -290,7 +290,9 @@ class Gem::Package::TarWriter
290
290
  # Splits +name+ into a name and prefix that can fit in the TarHeader
291
291
 
292
292
  def split_name(name) # :nodoc:
293
- raise Gem::Package::TooLongFileName if name.bytesize > 256
293
+ if name.bytesize > 256
294
+ raise Gem::Package::TooLongFileName.new("File \"#{name}\" has a too long path (should be 256 or less)")
295
+ end
294
296
 
295
297
  if name.bytesize <= 100 then
296
298
  prefix = ""
@@ -308,8 +310,12 @@ class Gem::Package::TarWriter
308
310
  prefix = (parts + [nxt]).join "/"
309
311
  name = newname
310
312
 
311
- if name.bytesize > 100 or prefix.bytesize > 155 then
312
- raise Gem::Package::TooLongFileName
313
+ if name.bytesize > 100
314
+ raise Gem::Package::TooLongFileName.new("File \"#{prefix}/#{name}\" has a too long name (should be 100 or less)")
315
+ end
316
+
317
+ if prefix.bytesize > 155 then
318
+ raise Gem::Package::TooLongFileName.new("File \"#{prefix}/#{name}\" has a too long base path (should be 155 or less)")
313
319
  end
314
320
  end
315
321
 
@@ -326,7 +326,7 @@ class Gem::RemoteFetcher
326
326
 
327
327
  def correct_for_windows_path(path)
328
328
  if path[0].chr == '/' && path[1].chr =~ /[a-z]/i && path[2].chr == ':'
329
- path = path[1..-1]
329
+ path[1..-1]
330
330
  else
331
331
  path
332
332
  end
@@ -352,6 +352,10 @@ class Gem::RemoteFetcher
352
352
  uri.scheme.downcase == 'https'
353
353
  end
354
354
 
355
+ def close_all
356
+ @pools.each_value {|pool| pool.close_all}
357
+ end
358
+
355
359
  protected
356
360
 
357
361
  # we have our own signing code here to avoid a dependency on the aws-sdk gem
@@ -28,6 +28,10 @@ class Gem::Request::ConnectionPools # :nodoc:
28
28
  end
29
29
  end
30
30
 
31
+ def close_all
32
+ @pools.each_value {|pool| pool.close_all}
33
+ end
34
+
31
35
  private
32
36
 
33
37
  ##
@@ -69,7 +73,7 @@ class Gem::Request::ConnectionPools # :nodoc:
69
73
  Gem::UriFormatter.new(proxy_uri.password).unescape,
70
74
  ]
71
75
  elsif no_proxy? uri.host, no_proxy then
72
- net_http_args += [nil, nil]
76
+ net_http_args + [nil, nil]
73
77
  else
74
78
  net_http_args
75
79
  end