rubygems-update 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


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

Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/History.txt +29 -0
  5. data/Manifest.txt +1 -0
  6. data/lib/rubygems.rb +1 -1
  7. data/lib/rubygems/available_set.rb +3 -0
  8. data/lib/rubygems/commands/generate_index_command.rb +1 -1
  9. data/lib/rubygems/config_file.rb +3 -2
  10. data/lib/rubygems/dependency_installer.rb +1 -0
  11. data/lib/rubygems/ext/ext_conf_builder.rb +5 -1
  12. data/lib/rubygems/installer.rb +1 -1
  13. data/lib/rubygems/package/tar_header.rb +1 -1
  14. data/lib/rubygems/remote_fetcher.rb +24 -16
  15. data/lib/rubygems/request.rb +4 -4
  16. data/lib/rubygems/request_set.rb +8 -0
  17. data/lib/rubygems/resolver.rb +2 -0
  18. data/lib/rubygems/resolver/api_set.rb +6 -1
  19. data/lib/rubygems/resolver/best_set.rb +20 -1
  20. data/lib/rubygems/resolver/composed_set.rb +11 -0
  21. data/lib/rubygems/resolver/git_set.rb +3 -0
  22. data/lib/rubygems/resolver/index_set.rb +4 -0
  23. data/lib/rubygems/resolver/installer_set.rb +15 -1
  24. data/lib/rubygems/resolver/lock_set.rb +2 -0
  25. data/lib/rubygems/resolver/set.rb +17 -0
  26. data/lib/rubygems/resolver/vendor_set.rb +2 -0
  27. data/lib/rubygems/security.rb +3 -3
  28. data/lib/rubygems/source/git.rb +14 -0
  29. data/lib/rubygems/specification.rb +22 -22
  30. data/lib/rubygems/test_case.rb +29 -1
  31. data/lib/rubygems/version.rb +17 -11
  32. data/test/rubygems/test_gem.rb +28 -30
  33. data/test/rubygems/test_gem_ext_ext_conf_builder.rb +41 -27
  34. data/test/rubygems/test_gem_installer.rb +6 -2
  35. data/test/rubygems/test_gem_package_tar_header.rb +14 -0
  36. data/test/rubygems/test_gem_platform.rb +5 -1
  37. data/test/rubygems/test_gem_remote_fetcher.rb +3 -3
  38. data/test/rubygems/test_gem_request.rb +69 -0
  39. data/test/rubygems/test_gem_request_set.rb +21 -0
  40. data/test/rubygems/test_gem_resolver.rb +8 -0
  41. data/test/rubygems/test_gem_resolver_api_set.rb +41 -0
  42. data/test/rubygems/test_gem_resolver_best_set.rb +50 -0
  43. data/test/rubygems/test_gem_resolver_composed_set.rb +18 -0
  44. data/test/rubygems/test_gem_resolver_git_set.rb +15 -0
  45. data/test/rubygems/test_gem_resolver_index_set.rb +35 -0
  46. data/test/rubygems/test_gem_resolver_installer_set.rb +70 -0
  47. data/test/rubygems/test_gem_source_git.rb +43 -0
  48. data/test/rubygems/test_gem_specification.rb +9 -12
  49. data/test/rubygems/test_gem_version.rb +10 -0
  50. metadata +5 -3
  51. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e97ccc1877f6b954281b807df1da89661eaa83a3
4
- data.tar.gz: 5acbcfd60eefc261fbfe228f9956253f7a249167
3
+ metadata.gz: 401f2f6fdd7de3d75d6ee3771b3724c85f014303
4
+ data.tar.gz: 714ac30e7e175628d13a99f5c5f74de80e1bd5fe
5
5
  SHA512:
6
- metadata.gz: 5def3e84a3f43361d02f1d0d666cc045a375c32954210c1a4593101f1180608f2ab2e89852383a6ec187068d1b153b0fe556e490839e7c7e83104a4dd7a5477d
7
- data.tar.gz: 8796158be7be1294af2913a6ee140836ef0589acbe04fadcb715fa9db2423297c6945632256c4664da949aa46abd5d33d0703bc02612cc5203e102dd34256982
6
+ metadata.gz: adf17e7ae371343b92d21f0ae72db333aa4c295a5d30bba2fb7cbe4c66a837033531db1225cdfa1b56d9e4213c3e50e88b9c416ce3be3073e007b97043e35608
7
+ data.tar.gz: 6493b6a5b253715bc9388f8798451293fc87199e62a8d03df4210fcd01684d1de6ed94f08dde4176ab1cf6f7d85448cd673082cd28ce9be04afe13c041d659cb
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,32 @@
1
1
  # coding: UTF-8
2
2
 
3
+ === 2.2.2 / 2014-02-05
4
+
5
+ Bug fixes:
6
+
7
+ * Fixed ruby tests when BASERUBY is not set. Patch for #778 by Nobuyoshi
8
+ Nakada.
9
+ * Removed double requests in RemoteFetcher#cache_update_path to improve remote
10
+ install speed. Pull request #772 by Charlie Somerville.
11
+ * The mkmf.log is now placed next to gem_make.out when building extensions.
12
+ * `gem install -g --local` no longer accesses the network. Bug #776 by Jeremy
13
+ Evans.
14
+ * RubyGems now correctly handles URL passwords with encoded characters. Pull
15
+ request #781 by Brian Fletcher.
16
+ * RubyGems now correctly escapes URL characters. Pull request #788 by Brian
17
+ Fletcher.
18
+ * RubyGems can now unpack tar files where the type flag is not given. Pull
19
+ request #790 by Cody Russell.
20
+ * Typo corrections. Pull request ruby/ruby#506 by windwiny.
21
+ * RubyGems now uses both the default certificates and ssl_ca_cert instead of
22
+ one or the other. Pull request #795 by zebardy.
23
+ * RubyGems can now use the bundler API against hosted gem servers in a
24
+ directory. Pull request #801 by Brian Fletcher.
25
+ * RubyGems bin stubs now ignore non-versions. This allows RubyGems bin stubs
26
+ to list file names like "_foo_". Issue #799 by Postmodern.
27
+ * Restored behavior of Gem::Version::new when subclassed. Issue #805 by
28
+ Sergio Rubio.
29
+
3
30
  === 2.2.1 / 2014-01-06
4
31
 
5
32
  Bug fixes:
@@ -25,6 +52,8 @@ Bug fixes:
25
52
  directories. Bug #758 Vít Ondruch.
26
53
  * Gem.read_binary can read read-only files again. This caused file://
27
54
  repositories to stop working. Bug #761 by John Anderson.
55
+ * Fixed specification file sorting for Ruby 1.8.7 compatibility. Pull
56
+ request #763 by James Mead
28
57
 
29
58
  === 2.2.0 / 2013-12-26
30
59
 
@@ -288,6 +288,7 @@ test/rubygems/test_gem_resolver_activation_request.rb
288
288
  test/rubygems/test_gem_resolver_api_set.rb
289
289
  test/rubygems/test_gem_resolver_api_specification.rb
290
290
  test/rubygems/test_gem_resolver_best_set.rb
291
+ test/rubygems/test_gem_resolver_composed_set.rb
291
292
  test/rubygems/test_gem_resolver_conflict.rb
292
293
  test/rubygems/test_gem_resolver_dependency_request.rb
293
294
  test/rubygems/test_gem_resolver_git_set.rb
@@ -8,7 +8,7 @@
8
8
  require 'rbconfig'
9
9
 
10
10
  module Gem
11
- VERSION = '2.2.1'
11
+ VERSION = '2.2.2'
12
12
  end
13
13
 
14
14
  # Must be first since it unloads the prelude from 1.9.2
@@ -4,9 +4,12 @@ class Gem::AvailableSet
4
4
 
5
5
  Tuple = Struct.new(:spec, :source)
6
6
 
7
+ attr_accessor :remote # :nodoc:
8
+
7
9
  def initialize
8
10
  @set = []
9
11
  @sorted = nil
12
+ @remote = true
10
13
  end
11
14
 
12
15
  attr_reader :set
@@ -62,7 +62,7 @@ Marshal::MINOR_VERSION constants. It is used to ensure compatibility.
62
62
  end
63
63
 
64
64
  def execute
65
- # This is always true becasue it's the only way now.
65
+ # This is always true because it's the only way now.
66
66
  options[:build_modern] = true
67
67
 
68
68
  if not File.exist?(options[:directory]) or
@@ -137,9 +137,10 @@ class Gem::ConfigFile
137
137
  attr_reader :ssl_verify_mode
138
138
 
139
139
  ##
140
- # Path name of directory or file of openssl CA certificate, used for remote https connection
140
+ # Path name of directory or file of openssl CA certificate, used for remote
141
+ # https connection
141
142
 
142
- attr_reader :ssl_ca_cert
143
+ attr_accessor :ssl_ca_cert
143
144
 
144
145
  ##
145
146
  # Path name of directory or file of openssl client certificate, used for remote https connection with client authentication
@@ -419,6 +419,7 @@ class Gem::DependencyInstaller
419
419
 
420
420
  request_set = as.to_request_set install_development_deps
421
421
  request_set.soft_missing = @force
422
+ request_set.remote = false unless consider_remote?
422
423
 
423
424
  installer_set = Gem::Resolver::InstallerSet.new @domain
424
425
  installer_set.always_install.concat request_set.always_install
@@ -34,7 +34,11 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
34
34
  ENV["RUBYOPT"] = ["-r#{siteconf_path}", rubyopt].compact.join(' ')
35
35
  cmd = [Gem.ruby, File.basename(extension), *args].join ' '
36
36
 
37
- run cmd, results
37
+ begin
38
+ run cmd, results
39
+ ensure
40
+ FileUtils.mv 'mkmf.log', dest_path if File.exist? 'mkmf.log'
41
+ end
38
42
 
39
43
  ENV["DESTDIR"] = nil
40
44
  ENV["RUBYOPT"] = rubyopt
@@ -641,7 +641,7 @@ version = "#{Gem::Requirement.default}"
641
641
  if ARGV.first
642
642
  str = ARGV.first
643
643
  str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
644
- if str =~ /\\A_(.*)_\\z/
644
+ if str =~ /\\A_(.*)_\\z/ and Gem::Version.correct?($1) then
645
645
  version = $1
646
646
  ARGV.shift
647
647
  end
@@ -134,7 +134,7 @@ class Gem::Package::TarHeader
134
134
  vals[:gid] ||= 0
135
135
  vals[:mtime] ||= 0
136
136
  vals[:checksum] ||= ""
137
- vals[:typeflag] ||= "0"
137
+ vals[:typeflag] = "0" if vals[:typeflag].nil? || vals[:typeflag].empty?
138
138
  vals[:magic] ||= "ustar"
139
139
  vals[:version] ||= "00"
140
140
  vals[:uname] ||= "wheel"
@@ -131,11 +131,19 @@ class Gem::RemoteFetcher
131
131
 
132
132
  FileUtils.mkdir_p cache_dir rescue nil unless File.exist? cache_dir
133
133
 
134
- # Always escape URI's to deal with potential spaces and such
135
- unless URI::Generic === source_uri
136
- source_uri = URI.parse(URI.const_defined?(:DEFAULT_PARSER) ?
137
- URI::DEFAULT_PARSER.escape(source_uri.to_s) :
138
- URI.escape(source_uri.to_s))
134
+ # Always escape URI's to deal with potential spaces and such
135
+ # It should also be considered that source_uri may already be
136
+ # a valid URI with escaped characters. e.g. "{DESede}" is encoded
137
+ # as "%7BDESede%7D". If this is escaped again the percentage
138
+ # symbols will be escaped.
139
+ unless source_uri.is_a?(URI::Generic)
140
+ begin
141
+ source_uri = URI.parse(source_uri)
142
+ rescue
143
+ source_uri = URI.parse(URI.const_defined?(:DEFAULT_PARSER) ?
144
+ URI::DEFAULT_PARSER.escape(source_uri.to_s) :
145
+ URI.escape(source_uri.to_s))
146
+ end
139
147
  end
140
148
 
141
149
  scheme = source_uri.scheme
@@ -285,20 +293,20 @@ class Gem::RemoteFetcher
285
293
  def cache_update_path uri, path = nil, update = true
286
294
  mtime = path && File.stat(path).mtime rescue nil
287
295
 
288
- if mtime && Net::HTTPNotModified === fetch_path(uri, mtime, true)
289
- Gem.read_binary(path)
290
- else
291
- data = fetch_path(uri)
296
+ data = fetch_path(uri, mtime)
292
297
 
293
- if update and path then
294
- open(path, 'wb') do |io|
295
- io.flock(File::LOCK_EX)
296
- io.write data
297
- end
298
- end
298
+ if data == nil # indicates the server returned 304 Not Modified
299
+ return Gem.read_binary(path)
300
+ end
299
301
 
300
- data
302
+ if update and path
303
+ open(path, 'wb') do |io|
304
+ io.flock(File::LOCK_EX)
305
+ io.write data
306
+ end
301
307
  end
308
+
309
+ data
302
310
  end
303
311
 
304
312
  ##
@@ -48,15 +48,14 @@ class Gem::Request
48
48
  connection.key = OpenSSL::PKey::RSA.new pem
49
49
  end
50
50
 
51
+ store.set_default_paths
52
+ add_rubygems_trusted_certs(store)
51
53
  if Gem.configuration.ssl_ca_cert
52
54
  if File.directory? Gem.configuration.ssl_ca_cert
53
55
  store.add_path Gem.configuration.ssl_ca_cert
54
56
  else
55
57
  store.add_file Gem.configuration.ssl_ca_cert
56
58
  end
57
- else
58
- store.set_default_paths
59
- add_rubygems_trusted_certs(store)
60
59
  end
61
60
  connection.cert_store = store
62
61
  rescue LoadError => e
@@ -106,7 +105,8 @@ class Gem::Request
106
105
  request = @request_class.new @uri.request_uri
107
106
 
108
107
  unless @uri.nil? || @uri.user.nil? || @uri.user.empty? then
109
- request.basic_auth @uri.user, @uri.password
108
+ request.basic_auth Gem::UriFormatter.new(@uri.user).unescape,
109
+ Gem::UriFormatter.new(@uri.password).unescape
110
110
  end
111
111
 
112
112
  request.add_field 'User-Agent', @user_agent
@@ -38,6 +38,11 @@ class Gem::RequestSet
38
38
 
39
39
  attr_accessor :ignore_dependencies
40
40
 
41
+ ##
42
+ # When false no remote sets are used for resolving gems.
43
+
44
+ attr_accessor :remote
45
+
41
46
  ##
42
47
  # Sets used for resolution
43
48
 
@@ -71,6 +76,7 @@ class Gem::RequestSet
71
76
  @git_set = nil
72
77
  @ignore_dependencies = false
73
78
  @install_dir = Gem.dir
79
+ @remote = true
74
80
  @requests = []
75
81
  @sets = []
76
82
  @soft_missing = false
@@ -150,6 +156,7 @@ class Gem::RequestSet
150
156
  gemdeps = options[:gemdeps]
151
157
 
152
158
  @install_dir = options[:install_dir] || Gem.dir
159
+ @remote = options[:domain] != :local
153
160
 
154
161
  load_gemdeps gemdeps, options[:without_groups]
155
162
 
@@ -235,6 +242,7 @@ class Gem::RequestSet
235
242
  @sets << @vendor_set
236
243
 
237
244
  set = Gem::Resolver.compose_sets(*@sets)
245
+ set.remote = @remote
238
246
 
239
247
  resolver = Gem::Resolver.new @dependencies, set
240
248
  resolver.development = @development
@@ -59,6 +59,8 @@ class Gem::Resolver
59
59
 
60
60
  sets = sets.map do |set|
61
61
  case set
62
+ when Gem::Resolver::BestSet then
63
+ set
62
64
  when Gem::Resolver::ComposedSet then
63
65
  set.sets
64
66
  else
@@ -25,10 +25,12 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
25
25
  # http://guides.rubygems.org/rubygems-org-api
26
26
 
27
27
  def initialize dep_uri = 'https://rubygems.org/api/v1/dependencies'
28
+ super()
29
+
28
30
  dep_uri = URI dep_uri unless URI === dep_uri # for ruby 1.8
29
31
 
30
32
  @dep_uri = dep_uri
31
- @uri = dep_uri + '../../..'
33
+ @uri = dep_uri + '../..'
32
34
 
33
35
  @data = Hash.new { |h,k| h[k] = [] }
34
36
  @source = Gem::Source.new @uri
@@ -41,6 +43,8 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
41
43
  def find_all req
42
44
  res = []
43
45
 
46
+ return res unless @remote
47
+
44
48
  versions(req.name).each do |ver|
45
49
  if req.dependency.match? req.name, ver[:number]
46
50
  res << Gem::Resolver::APISpecification.new(self, ver)
@@ -55,6 +59,7 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
55
59
  # data for DependencyRequests +reqs+.
56
60
 
57
61
  def prefetch reqs
62
+ return unless @remote
58
63
  names = reqs.map { |r| r.dependency.name }
59
64
  needed = names - @data.keys
60
65
 
@@ -12,11 +12,30 @@ class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet
12
12
  def initialize sources = Gem.sources
13
13
  super()
14
14
 
15
- sources.each_source do |source|
15
+ @sources = sources
16
+ end
17
+
18
+ ##
19
+ # Picks which sets to use for the configured sources.
20
+
21
+ def pick_sets # :nodoc:
22
+ @sources.each_source do |source|
16
23
  @sets << source.dependency_resolver_set
17
24
  end
18
25
  end
19
26
 
27
+ def find_all req # :nodoc:
28
+ pick_sets if @remote and @sets.empty?
29
+
30
+ super
31
+ end
32
+
33
+ def prefetch reqs # :nodoc:
34
+ pick_sets if @remote and @sets.empty?
35
+
36
+ super
37
+ end
38
+
20
39
  def pretty_print q # :nodoc:
21
40
  q.group 2, '[BestSet', ']' do
22
41
  q.breakable
@@ -16,9 +16,20 @@ class Gem::Resolver::ComposedSet < Gem::Resolver::Set
16
16
  # Gem::Resolver::compose_sets instead.
17
17
 
18
18
  def initialize *sets
19
+ super()
20
+
19
21
  @sets = sets
20
22
  end
21
23
 
24
+ ##
25
+ # Sets the remote network access for all composed sets.
26
+
27
+ def remote= remote
28
+ super
29
+
30
+ @sets.each { |set| set.remote = remote }
31
+ end
32
+
22
33
  ##
23
34
  # Finds all specs matching +req+ in all sets.
24
35
 
@@ -33,6 +33,8 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
33
33
  attr_reader :specs # :nodoc:
34
34
 
35
35
  def initialize # :nodoc:
36
+ super()
37
+
36
38
  @git = ENV['git'] || 'git'
37
39
  @need_submodules = {}
38
40
  @repositories = {}
@@ -91,6 +93,7 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
91
93
  @repositories.each do |name, (repository, reference)|
92
94
  source = Gem::Source::Git.new name, repository, reference
93
95
  source.root_dir = @root_dir
96
+ source.remote = @remote
94
97
 
95
98
  source.specs.each do |spec|
96
99
  git_spec = Gem::Resolver::GitSpecification.new self, spec, source
@@ -5,6 +5,8 @@
5
5
  class Gem::Resolver::IndexSet < Gem::Resolver::Set
6
6
 
7
7
  def initialize source = nil # :nodoc:
8
+ super()
9
+
8
10
  @f =
9
11
  if source then
10
12
  sources = Gem::SourceList.from [source]
@@ -34,6 +36,8 @@ class Gem::Resolver::IndexSet < Gem::Resolver::Set
34
36
  def find_all req
35
37
  res = []
36
38
 
39
+ return res unless @remote
40
+
37
41
  name = req.dependency.name
38
42
 
39
43
  @all[name].each do |uri, n|
@@ -24,14 +24,17 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
24
24
  # Creates a new InstallerSet that will look for gems in +domain+.
25
25
 
26
26
  def initialize domain
27
+ super()
28
+
27
29
  @domain = domain
30
+ @remote = consider_remote?
28
31
 
29
32
  @f = Gem::SpecFetcher.fetcher
30
33
 
31
34
  @always_install = []
32
35
  @ignore_dependencies = false
33
36
  @ignore_installed = false
34
- @remote_set = Gem::Resolver::BestSet.new if consider_remote?
37
+ @remote_set = Gem::Resolver::BestSet.new
35
38
  @specs = {}
36
39
  end
37
40
 
@@ -120,5 +123,16 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
120
123
  end
121
124
  end
122
125
 
126
+ def remote= remote # :nodoc:
127
+ case @domain
128
+ when :local then
129
+ @domain = :both if remote
130
+ when :remote then
131
+ @domain = nil unless remote
132
+ when :both then
133
+ @domain = :local unless remote
134
+ end
135
+ end
136
+
123
137
  end
124
138
 
@@ -9,6 +9,8 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
9
9
  # Creates a new LockSet from the given +source+
10
10
 
11
11
  def initialize source
12
+ super()
13
+
12
14
  @source = Gem::Source::Lock.new source
13
15
  @specs = []
14
16
  end