rubygems-update 2.6.1 → 2.6.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33fc382d6a0acd7e0eaa22d067a5b303e3db630e
4
- data.tar.gz: e62ae0a2c43adf972a86ec7e0b6cf86a61a48281
3
+ metadata.gz: 2e637cea941cba1038aa966e4b493ee19b015f16
4
+ data.tar.gz: 2f3a0e95c40344b31b87a509b76ba85b01884304
5
5
  SHA512:
6
- metadata.gz: 7bcb015d0fe23b6774a1c05b56bfcae79e6d3e5b8771cdc5b012defe1d81d2bc8c0a12bd5028ba5cdeb375d857fe03bf7796e3e8775e6f914121730b9acf4b47
7
- data.tar.gz: f4ad540901b518c621824ecd5ffee80dad0a24e90a3591bb898e5aa6fbd07ce675b6aa426a8991362731209dc43405518eeb214ea79d2aa283de1b6804c6b498
6
+ metadata.gz: 8e2600876b6e09cee7b0cc41b72ae5d5deefa904b38b886f594737f30e12facc67a9584d5fc2188eadb41b124211fdc91a70f1a17f531013be5d436511640071
7
+ data.tar.gz: d01dd0b8aea7c52cd8095f61b0bf637621798af6bf47821601b5e1df0ef2542261b32e21871702cdb4f35ee707b4bcf338bdcce16cf135507c889312f15eaa5b
@@ -3,7 +3,7 @@ after_script:
3
3
  - rake travis:after -t
4
4
  before_script:
5
5
  - gem uninstall executable-hooks gem-wrappers -x --force -i `gem env home`@global
6
- - gem install rake --no-document
6
+ - gem install rake -v '~> 10.5' --no-document
7
7
  - gem install hoe-travis --no-document
8
8
  - gem install minitest -v '~> 4.7' --no-document
9
9
  - rake travis:before -t
@@ -14,6 +14,11 @@ notifications:
14
14
  email:
15
15
  - drbrain@segment7.net
16
16
  - evan+notify@phx.io
17
+ branches:
18
+ only:
19
+ - master
20
+ - auto
21
+ - /[\d.]+/
17
22
  rvm:
18
23
  - 1.8.7
19
24
  - 1.9.2
@@ -1,5 +1,18 @@
1
1
  # coding: UTF-8
2
2
 
3
+ === 2.6.2 / 2016-03-12
4
+
5
+ Bug fixes:
6
+
7
+ * Fix wrong version of gem activation for bin stub. Pull request #1527 by
8
+ Aaron Patterson.
9
+ * Speed up gem activation failures. Pull request #1539 by Aaron Patterson.
10
+ * Fix platform sorting in the resolver. Pull request #1542 by Samuel E.
11
+ Giddins.
12
+ * Ensure we unlock the monitor even if try_activate throws. Pull request
13
+ #1538 by Charles Oliver Nutter.
14
+
15
+
3
16
  === 2.6.1 / 2016-02-28
4
17
 
5
18
  Bug fixes:
@@ -2,4 +2,4 @@ André Arko <andre@arko.net> (@indirect)
2
2
  Jeremy Hinegardner <jeremy@copiousfreetime.org> (@copiousfreetime)
3
3
  Kurtis Rainbolt-Greene <me@kurtisrainboltgreene.name> (@krainboltgreene)
4
4
  Samuel Giddins <segiddins@segiddins.me> (@segiddins)
5
- Marie Markwell <me@marie.so> (@duckinator)
5
+ Ellen Marie Dash <me@duckie.co> (@duckinator)
data/Rakefile CHANGED
@@ -26,7 +26,6 @@ end
26
26
 
27
27
  Hoe::RUBY_FLAGS << " --disable-gems" if RUBY_VERSION > "1.9"
28
28
 
29
- Hoe.plugin :minitest
30
29
  Hoe.plugin :git
31
30
  Hoe.plugin :travis
32
31
 
@@ -78,6 +77,7 @@ end
78
77
 
79
78
  v = hoe.version
80
79
 
80
+ hoe.testlib = :minitest
81
81
  hoe.test_prelude = 'gem "minitest", "~> 4.0"'
82
82
 
83
83
  Rake::Task['docs'].clear
@@ -173,7 +173,7 @@ task :package => %W[
173
173
 
174
174
  desc "Upload release to gemcutter S3"
175
175
  task :upload_to_gemcutter do
176
- sh "s3cmd put -P pkg/rubygems-update-#{v}.gem pkg/rubygems-#{v}.zip pkg/rubygems-#{v}.tgz s3://production.s3.rubygems.org/rubygems/"
176
+ sh "s3cmd put -P pkg/rubygems-update-#{v}.gem pkg/rubygems-#{v}.zip pkg/rubygems-#{v}.tgz s3://oregon.production.s3.rubygems.org/rubygems/"
177
177
  end
178
178
 
179
179
  desc "Upload release to rubygems.org"
@@ -3,13 +3,15 @@ version: "{build}"
3
3
  branches:
4
4
  only:
5
5
  - master
6
+ - auto
7
+ - /[\d.]+/
6
8
  clone_depth: 10
7
9
  install:
8
10
  - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
9
11
  - SET GEM_HOME=%APPDATA%\.gem
10
12
  - ruby --version
11
13
  - gem --version
12
- - gem install rake --no-rdoc --no-ri
14
+ - gem install rake -v "~> 10.5" --no-rdoc --no-ri
13
15
  - gem install hoe-travis --no-rdoc --no-ri
14
16
  - gem install minitest -v "~> 4.7" --no-rdoc --no-ri
15
17
  - rake travis:before --trace
@@ -10,7 +10,7 @@ require 'rbconfig'
10
10
  require 'thread'
11
11
 
12
12
  module Gem
13
- VERSION = '2.6.1'
13
+ VERSION = '2.6.2'
14
14
  end
15
15
 
16
16
  # Must be first since it unloads the prelude from 1.9.2
@@ -174,14 +174,6 @@ module Gem
174
174
  @pre_reset_hooks ||= []
175
175
  @post_reset_hooks ||= []
176
176
 
177
- def self.env_requirement(gem_name)
178
- @env_requirements_by_name ||= {}
179
- @env_requirements_by_name[gem_name] ||= begin
180
- req = ENV["GEM_REQUIREMENT_#{gem_name.upcase}"] || '>= 0'.freeze
181
- Gem::Requirement.create(req)
182
- end
183
- end
184
-
185
177
  ##
186
178
  # Try to activate a gem containing +path+. Returns true if
187
179
  # activation succeeded or wasn't needed because it was already
@@ -243,11 +235,15 @@ module Gem
243
235
  requirements = Gem::Requirement.default if
244
236
  requirements.empty?
245
237
 
238
+ find_spec_for_exe(name, exec_name, requirements).bin_file exec_name
239
+ end
240
+
241
+ def self.find_spec_for_exe name, exec_name, requirements
246
242
  dep = Gem::Dependency.new name, requirements
247
243
 
248
244
  loaded = Gem.loaded_specs[name]
249
245
 
250
- return loaded.bin_file exec_name if loaded && dep.matches_spec?(loaded)
246
+ return loaded if loaded && dep.matches_spec?(loaded)
251
247
 
252
248
  specs = dep.matching_specs(true)
253
249
 
@@ -263,6 +259,24 @@ module Gem
263
259
  raise Gem::GemNotFoundException, msg
264
260
  end
265
261
 
262
+ spec
263
+ end
264
+ private_class_method :find_spec_for_exe
265
+
266
+ ##
267
+ # Find the full path to the executable for gem +name+. If the +exec_name+
268
+ # is not given, the gem's default_executable is chosen, otherwise the
269
+ # specified executable's path is returned. +requirements+ allows
270
+ # you to specify specific gem versions.
271
+ #
272
+ # A side effect of this method is that it will activate the gem that
273
+ # contains the executable.
274
+ #
275
+ # This method should *only* be used in bin stub files.
276
+
277
+ def self.activate_bin_path name, exec_name, requirement # :nodoc:
278
+ spec = find_spec_for_exe name, exec_name, [requirement]
279
+ Gem::LOADED_SPECS_MUTEX.synchronize { spec.activate }
266
280
  spec.bin_file exec_name
267
281
  end
268
282
 
@@ -849,6 +863,15 @@ An Array was passed in from #{caller[3]}
849
863
  @ruby_api_version ||= RbConfig::CONFIG['ruby_version'].dup
850
864
  end
851
865
 
866
+ def self.env_requirement(gem_name)
867
+ @env_requirements_by_name ||= {}
868
+ @env_requirements_by_name[gem_name] ||= begin
869
+ req = ENV["GEM_REQUIREMENT_#{gem_name.upcase}"] || '>= 0'.freeze
870
+ Gem::Requirement.create(req)
871
+ end
872
+ end
873
+ post_reset { @env_requirements_by_name = {} }
874
+
852
875
  ##
853
876
  # Returns the latest release-version specification for the gem +name+.
854
877
 
@@ -121,14 +121,17 @@ module Kernel
121
121
  rescue LoadError => load_error
122
122
  RUBYGEMS_ACTIVATION_MONITOR.enter
123
123
 
124
- if load_error.message.start_with?("Could not find") or
125
- (load_error.message.end_with?(path) and Gem.try_activate(path)) then
126
- RUBYGEMS_ACTIVATION_MONITOR.exit
127
- return gem_original_require(path)
128
- else
124
+ begin
125
+ if load_error.message.start_with?("Could not find") or
126
+ (load_error.message.end_with?(path) and Gem.try_activate(path)) then
127
+ require_again = true
128
+ end
129
+ ensure
129
130
  RUBYGEMS_ACTIVATION_MONITOR.exit
130
131
  end
131
132
 
133
+ return gem_original_require(path) if require_again
134
+
132
135
  raise load_error
133
136
  end
134
137
 
@@ -286,7 +286,9 @@ class Gem::Dependency
286
286
  }
287
287
  end
288
288
 
289
- matches.sort_by { |s| s.sort_obj } # HACK: shouldn't be needed
289
+ # `stubs_for` returns oldest first, but `matching_specs` is supposed to
290
+ # return newest first, so just reverse the list
291
+ matches.reverse
290
292
  end
291
293
 
292
294
  ##
@@ -302,14 +304,13 @@ class Gem::Dependency
302
304
  # TODO: check Gem.activated_spec[self.name] in case matches falls outside
303
305
 
304
306
  if matches.empty? then
305
- specs = Gem::Specification.find_all { |s|
306
- s.name == name
307
- }.map { |x| x.full_name }
307
+ specs = Gem::Specification.stubs_for name
308
308
 
309
309
  if specs.empty?
310
- total = Gem::Specification.to_a.size
310
+ total = Gem::Specification.stubs.size
311
311
  msg = "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)\n".dup
312
312
  else
313
+ specs = specs.map(&:full_name)
313
314
  msg = "Could not find '#{name}' (#{requirement}) - did find: [#{specs.join ','}]\n".dup
314
315
  end
315
316
  msg << "Checked in 'GEM_PATH=#{Gem.path.join(File::PATH_SEPARATOR)}', execute `gem env` for more information"
@@ -334,6 +335,6 @@ class Gem::Dependency
334
335
 
335
336
  matches.delete_if { |spec| spec.nil? || spec.version.prerelease? } unless prerelease?
336
337
 
337
- matches.last
338
+ matches.first
338
339
  end
339
340
  end
@@ -216,7 +216,8 @@ class Gem::Installer
216
216
  existing = io.read.slice(%r{
217
217
  ^(
218
218
  gem \s |
219
- load \s Gem\.bin_path\(
219
+ load \s Gem\.bin_path\( |
220
+ load \s Gem\.activate_bin_path\(
220
221
  )
221
222
  (['"])(.*?)(\2),
222
223
  }x, 3)
@@ -719,7 +720,7 @@ if ARGV.first
719
720
  end
720
721
  end
721
722
 
722
- load Gem.bin_path('#{spec.name}', '#{bin_file_name}', version)
723
+ load Gem.activate_bin_path('#{spec.name}', '#{bin_file_name}', version)
723
724
  TEXT
724
725
  end
725
726
 
@@ -170,6 +170,8 @@ class Gem::InstallerTestCase < Gem::TestCase
170
170
  EOF
171
171
  end
172
172
 
173
+ yield @spec if block_given?
174
+
173
175
  use_ui ui do
174
176
  FileUtils.rm_f @gem
175
177
 
@@ -193,7 +193,7 @@ class Gem::Resolver
193
193
  conflict = e.conflicts.values.first
194
194
  raise Gem::DependencyResolutionError, Conflict.new(conflict.requirement_trees.first.first, conflict.existing, conflict.requirement)
195
195
  ensure
196
- @output.close if @output and !debug?
196
+ @output.close if defined?(@output) and !debug?
197
197
  end
198
198
 
199
199
  ##
@@ -233,7 +233,7 @@ class Gem::Resolver
233
233
  exc.errors = @set.errors
234
234
  raise exc
235
235
  end
236
- possibles.sort_by { |s| [s.source, s.version, s.platform.to_s == Gem::Platform.local.to_s ? 1 : 0] }.
236
+ possibles.sort_by { |s| [s.source, s.version, Gem::Platform.local =~ s.platform ? 1 : 0] }.
237
237
  map { |s| ActivationRequest.new s, dependency, [] }
238
238
  end
239
239
 
@@ -223,6 +223,10 @@ class Gem::TestCase < MiniTest::Unit::TestCase
223
223
  @orig_gem_spec_cache = ENV['GEM_SPEC_CACHE']
224
224
  @orig_rubygems_gemdeps = ENV['RUBYGEMS_GEMDEPS']
225
225
  @orig_rubygems_host = ENV['RUBYGEMS_HOST']
226
+ ENV.keys.find_all { |k| k.start_with?('GEM_REQUIREMENT_') }.each do |k|
227
+ ENV.delete k
228
+ end
229
+ @orig_gem_env_requirements = ENV.to_hash
226
230
 
227
231
  ENV['GEM_VENDOR'] = nil
228
232
 
@@ -277,6 +281,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
277
281
  ENV['HOME'] = @userhome
278
282
  Gem.instance_variable_set :@user_home, nil
279
283
  Gem.instance_variable_set :@gemdeps, nil
284
+ Gem.instance_variable_set :@env_requirements_by_name, nil
280
285
  Gem.send :remove_instance_variable, :@ruby_version if
281
286
  Gem.instance_variables.include? :@ruby_version
282
287
 
@@ -368,6 +373,11 @@ class Gem::TestCase < MiniTest::Unit::TestCase
368
373
 
369
374
  FileUtils.rm_rf @tempdir unless ENV['KEEP_FILES']
370
375
 
376
+ ENV.clear
377
+ @orig_gem_env_requirements.each do |k,v|
378
+ ENV[k] = v
379
+ end
380
+
371
381
  ENV['GEM_HOME'] = @orig_gem_home
372
382
  ENV['GEM_PATH'] = @orig_gem_path
373
383
  ENV['GEM_VENDOR'] = @orig_gem_vendor
@@ -1493,4 +1503,3 @@ tmpdirs << (ENV['GEM_PATH'] = Dir.mktmpdir("path"))
1493
1503
  pid = $$
1494
1504
  END {tmpdirs.each {|dir| Dir.rmdir(dir)} if $$ == pid}
1495
1505
  Gem.clear_paths
1496
-
@@ -816,6 +816,17 @@ class TestGem < Gem::TestCase
816
816
  RbConfig::CONFIG['ruby_version'] = orig_ruby_version
817
817
  end
818
818
 
819
+ def test_self_env_requirement
820
+ ENV["GEM_REQUIREMENT_FOO"] = '>= 1.2.3'
821
+ ENV["GEM_REQUIREMENT_BAR"] = '1.2.3'
822
+ ENV["GEM_REQUIREMENT_BAZ"] = 'abcd'
823
+
824
+ assert_equal Gem::Requirement.create('>= 1.2.3'), Gem.env_requirement('foo')
825
+ assert_equal Gem::Requirement.create('1.2.3'), Gem.env_requirement('bAr')
826
+ assert_raises(Gem::Requirement::BadRequirementError) { Gem.env_requirement('baz') }
827
+ assert_equal Gem::Requirement.default, Gem.env_requirement('qux')
828
+ end
829
+
819
830
  def test_self_ruby_version_1_8_5
820
831
  util_set_RUBY_VERSION '1.8.5'
821
832
 
@@ -48,7 +48,7 @@ if ARGV.first
48
48
  end
49
49
  end
50
50
 
51
- load Gem.bin_path('a', 'executable', version)
51
+ load Gem.activate_bin_path('a', 'executable', version)
52
52
  EOF
53
53
 
54
54
  wrapper = @installer.app_script_text 'executable'
@@ -781,6 +781,55 @@ gem 'other', version
781
781
  assert_match(/ran executable/, e.message)
782
782
  end
783
783
 
784
+ def test_conflicting_binstubs
785
+ Dir.mkdir util_inst_bindir
786
+ util_clear_gems
787
+
788
+ # build old version that has a bin file
789
+ util_setup_gem do |spec|
790
+ File.open File.join('bin', 'executable'), 'w' do |f|
791
+ f.puts "require 'code'"
792
+ end
793
+ File.open File.join('lib', 'code.rb'), 'w' do |f|
794
+ f.puts 'raise "I have an executable"'
795
+ end
796
+ end
797
+
798
+ @installer.wrappers = true
799
+ build_rake_in do
800
+ use_ui @ui do
801
+ @newspec = @installer.install
802
+ end
803
+ end
804
+
805
+ old_bin_file = File.join @installer.bin_dir, 'executable'
806
+
807
+ # build new version that doesn't have a bin file
808
+ util_setup_gem do |spec|
809
+ FileUtils.rm File.join('bin', 'executable')
810
+ spec.files.delete File.join('bin', 'executable')
811
+ spec.executables.delete 'executable'
812
+ spec.version = @spec.version.bump
813
+ File.open File.join('lib', 'code.rb'), 'w' do |f|
814
+ f.puts 'raise "I do not have an executable"'
815
+ end
816
+ end
817
+
818
+ build_rake_in do
819
+ use_ui @ui do
820
+ @newspec = @installer.install
821
+ end
822
+ end
823
+
824
+ e = assert_raises RuntimeError do
825
+ instance_eval File.read(old_bin_file)
826
+ end
827
+
828
+ # We expect the bin stub to activate the version that actually contains
829
+ # the binstub.
830
+ assert_match('I have an executable', e.message)
831
+ end
832
+
784
833
  def test_install_creates_binstub_that_understand_version
785
834
  Dir.mkdir util_inst_bindir
786
835
  util_setup_gem
@@ -695,6 +695,18 @@ class TestGemResolver < Gem::TestCase
695
695
  assert_equal [a1, a1_p1], selected
696
696
  end
697
697
 
698
+ def test_search_for_local_platform_partial_string_match
699
+ a1 = util_spec 'a', 1
700
+ a1_p1 = util_spec 'a', 1 do |s| s.platform = Gem::Platform.local.os end
701
+ a1_p2 = util_spec 'a', 1 do |s| s.platform = 'unknown' end
702
+
703
+ s = set(a1_p1, a1_p2, a1)
704
+ d = [make_dep('a')]
705
+ r = Gem::Resolver.new(d, s)
706
+
707
+ assert_resolves_to [a1_p1], r
708
+ end
709
+
698
710
  def test_raises_and_explains_when_platform_prevents_install
699
711
  a1 = util_spec "a", "1" do |s|
700
712
  s.platform = Gem::Platform.new %w[c p 1]
@@ -64,6 +64,13 @@ class TestKernel < Gem::TestCase
64
64
  assert gem('d', '>= 1.a'), 'prerelease requirement may load prerelease'
65
65
  end
66
66
 
67
+ def test_gem_env_req
68
+ ENV["GEM_REQUIREMENT_A"] = '~> 2.0'
69
+ assert_raises(Gem::LoadError) { gem('a', '= 1') }
70
+ assert gem('a', '> 1')
71
+ assert_equal @a2, Gem.loaded_specs['a']
72
+ end
73
+
67
74
  def test_gem_conflicting
68
75
  assert gem('a', '= 1'), "Should load"
69
76
 
@@ -319,4 +319,32 @@ class TestGemRequire < Gem::TestCase
319
319
  def unresolved_names
320
320
  Gem::Specification.unresolved_deps.values.map(&:to_s).sort
321
321
  end
322
+
323
+ def test_try_activate_error_unlocks_require_monitor
324
+ silence_warnings do
325
+ class << ::Gem
326
+ alias old_try_activate try_activate
327
+ def try_activate(*); raise 'raised from try_activate'; end
328
+ end
329
+ end
330
+
331
+ require 'does_not_exist_for_try_activate_test'
332
+ rescue RuntimeError => e
333
+ assert_match(/raised from try_activate/, e.message)
334
+ assert Kernel::RUBYGEMS_ACTIVATION_MONITOR.try_enter, "require monitor was not unlocked when try_activate raised"
335
+ ensure
336
+ silence_warnings do
337
+ class << ::Gem
338
+ alias try_activate old_try_activate
339
+ end
340
+ end
341
+ Kernel::RUBYGEMS_ACTIVATION_MONITOR.exit
342
+ end
343
+
344
+ def silence_warnings
345
+ old_verbose, $VERBOSE = $VERBOSE, false
346
+ yield
347
+ ensure
348
+ $VERBOSE = old_verbose
349
+ end
322
350
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-update
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -10,22 +10,8 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-02-28 00:00:00.000000000 Z
13
+ date: 2016-03-12 00:00:00.000000000 Z
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: minitest
17
- requirement: !ruby/object:Gem::Requirement
18
- requirements:
19
- - - "~>"
20
- - !ruby/object:Gem::Version
21
- version: '5.8'
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- requirements:
26
- - - "~>"
27
- - !ruby/object:Gem::Version
28
- version: '5.8'
29
15
  - !ruby/object:Gem::Dependency
30
16
  name: rdoc
31
17
  requirement: !ruby/object:Gem::Requirement
@@ -96,6 +82,20 @@ dependencies:
96
82
  - - "~>"
97
83
  - !ruby/object:Gem::Version
98
84
  version: 0.9.3
85
+ - !ruby/object:Gem::Dependency
86
+ name: minitest
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '4.0'
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - "~>"
97
+ - !ruby/object:Gem::Version
98
+ version: '4.0'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: hoe
101
101
  requirement: !ruby/object:Gem::Requirement
@@ -555,7 +555,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
555
555
  version: '0'
556
556
  requirements: []
557
557
  rubyforge_project:
558
- rubygems_version: 2.6.0
558
+ rubygems_version: 2.6.2
559
559
  signing_key:
560
560
  specification_version: 4
561
561
  summary: RubyGems is a package management framework for Ruby