rubygems-update 2.7.4 → 2.7.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.
- checksums.yaml +4 -4
- data/.travis.yml +5 -8
- data/Manifest.txt +2 -1
- data/Rakefile +7 -0
- data/bundler/CHANGELOG.md +13 -0
- data/bundler/bundler.gemspec +2 -0
- data/bundler/lib/bundler/cli/gem.rb +1 -1
- data/bundler/lib/bundler/cli/init.rb +1 -5
- data/bundler/lib/bundler/cli/update.rb +3 -1
- data/bundler/lib/bundler/definition.rb +1 -1
- data/bundler/lib/bundler/resolver.rb +4 -1
- data/bundler/lib/bundler/source/rubygems.rb +2 -4
- data/bundler/lib/bundler/templates/.document +1 -0
- data/bundler/lib/bundler/templates/Executable +11 -3
- data/bundler/lib/bundler/templates/newgem/{.travis.yml.tt → travis.yml.tt} +0 -0
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems.rb +5 -5
- data/lib/rubygems/commands/generate_index_command.rb +1 -1
- data/lib/rubygems/commands/setup_command.rb +12 -6
- data/lib/rubygems/commands/unpack_command.rb +2 -2
- data/lib/rubygems/config_file.rb +1 -1
- data/lib/rubygems/ext/builder.rb +1 -1
- data/lib/rubygems/indexer.rb +5 -4
- data/lib/rubygems/installer.rb +9 -4
- data/lib/rubygems/package.rb +2 -2
- data/lib/rubygems/package/file_source.rb +2 -2
- data/lib/rubygems/package/old.rb +1 -1
- data/lib/rubygems/request_set/lockfile.rb +1 -1
- data/lib/rubygems/security.rb +1 -1
- data/lib/rubygems/security/trust_dir.rb +1 -1
- data/lib/rubygems/source.rb +1 -1
- data/lib/rubygems/specification.rb +4 -0
- data/lib/rubygems/stub_specification.rb +2 -0
- data/lib/rubygems/test_case.rb +14 -8
- data/lib/rubygems/test_utilities.rb +1 -1
- data/lib/rubygems/util.rb +2 -1
- data/lib/rubygems/validator.rb +3 -3
- data/test/rubygems/test_gem.rb +17 -14
- data/test/rubygems/test_gem_commands_cleanup_command.rb +1 -1
- data/test/rubygems/test_gem_commands_install_command.rb +1 -0
- data/test/rubygems/test_gem_commands_push_command.rb +5 -5
- data/test/rubygems/test_gem_commands_setup_command.rb +20 -20
- data/test/rubygems/test_gem_commands_uninstall_command.rb +2 -2
- data/test/rubygems/test_gem_dependency_installer.rb +1 -1
- data/test/rubygems/test_gem_doctor.rb +2 -2
- data/test/rubygems/test_gem_ext_builder.rb +6 -6
- data/test/rubygems/test_gem_gemcutter_utilities.rb +4 -4
- data/test/rubygems/test_gem_indexer.rb +1 -2
- data/test/rubygems/test_gem_install_update_options.rb +2 -0
- data/test/rubygems/test_gem_installer.rb +5 -1
- data/test/rubygems/test_gem_package.rb +15 -15
- data/test/rubygems/test_gem_package_old.rb +1 -1
- data/test/rubygems/test_gem_rdoc.rb +2 -0
- data/test/rubygems/test_gem_remote_fetcher.rb +1 -1
- data/test/rubygems/test_gem_request_connection_pools.rb +6 -7
- data/test/rubygems/test_gem_request_set.rb +7 -7
- data/test/rubygems/test_gem_request_set_lockfile.rb +4 -4
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +1 -1
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +1 -1
- data/test/rubygems/test_gem_resolver_git_specification.rb +1 -1
- data/test/rubygems/test_gem_server.rb +4 -4
- data/test/rubygems/test_gem_source.rb +3 -3
- data/test/rubygems/test_gem_source_git.rb +1 -1
- data/test/rubygems/test_gem_specification.rb +21 -17
- data/test/rubygems/test_gem_stub_specification.rb +7 -7
- data/test/rubygems/test_gem_util.rb +23 -0
- data/test/rubygems/test_gem_version.rb +11 -0
- data/test/rubygems/test_require.rb +15 -21
- metadata +4 -3
data/lib/rubygems/package.rb
CHANGED
@@ -219,7 +219,7 @@ class Gem::Package
|
|
219
219
|
next unless stat.file?
|
220
220
|
|
221
221
|
tar.add_file_simple file, stat.mode, stat.size do |dst_io|
|
222
|
-
open file, 'rb' do |src_io|
|
222
|
+
File.open file, 'rb' do |src_io|
|
223
223
|
dst_io.write src_io.read 16384 until src_io.eof?
|
224
224
|
end
|
225
225
|
end
|
@@ -380,7 +380,7 @@ EOM
|
|
380
380
|
|
381
381
|
FileUtils.mkdir_p mkdir, mkdir_options
|
382
382
|
|
383
|
-
open destination, 'wb' do |out|
|
383
|
+
File.open destination, 'wb' do |out|
|
384
384
|
out.write entry.read
|
385
385
|
FileUtils.chmod entry.header.mode, destination
|
386
386
|
end if entry.file?
|
@@ -23,11 +23,11 @@ class Gem::Package::FileSource < Gem::Package::Source # :nodoc: all
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def with_write_io &block
|
26
|
-
open path, 'wb', &block
|
26
|
+
File.open path, 'wb', &block
|
27
27
|
end
|
28
28
|
|
29
29
|
def with_read_io &block
|
30
|
-
open path, 'rb', &block
|
30
|
+
File.open path, 'rb', &block
|
31
31
|
end
|
32
32
|
|
33
33
|
end
|
data/lib/rubygems/package/old.rb
CHANGED
data/lib/rubygems/security.rb
CHANGED
@@ -578,7 +578,7 @@ module Gem::Security
|
|
578
578
|
def self.write pemmable, path, permissions = 0600, passphrase = nil, cipher = KEY_CIPHER
|
579
579
|
path = File.expand_path path
|
580
580
|
|
581
|
-
open path, 'wb', permissions do |io|
|
581
|
+
File.open path, 'wb', permissions do |io|
|
582
582
|
if passphrase and cipher
|
583
583
|
io.write pemmable.to_pem cipher, passphrase
|
584
584
|
else
|
data/lib/rubygems/source.rb
CHANGED
@@ -738,6 +738,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
738
738
|
def self._all # :nodoc:
|
739
739
|
unless defined?(@@all) && @@all then
|
740
740
|
@@all = stubs.map(&:to_spec)
|
741
|
+
if @@all.any?(&:nil?) # TODO: remove once we're happy
|
742
|
+
raise "pid: #{$$} nil spec! included in #{stubs.inspect}"
|
743
|
+
end
|
741
744
|
|
742
745
|
# After a reset, make sure already loaded specs
|
743
746
|
# are still marked as activated.
|
@@ -958,6 +961,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
958
961
|
# -- wilsonb
|
959
962
|
|
960
963
|
def self.all= specs
|
964
|
+
raise "nil spec!" if specs.any?(&:nil?) # TODO: remove once we're happy
|
961
965
|
@@stubs_by_name = specs.group_by(&:name)
|
962
966
|
@@all = @@stubs = specs
|
963
967
|
end
|
@@ -113,6 +113,8 @@ class Gem::StubSpecification < Gem::BasicSpecification
|
|
113
113
|
unless @data
|
114
114
|
begin
|
115
115
|
saved_lineno = $.
|
116
|
+
|
117
|
+
# TODO It should be use `File.open`, but bundler-1.16.1 example expects Kernel#open.
|
116
118
|
open loaded_from, OPEN_MODE do |file|
|
117
119
|
begin
|
118
120
|
file.readline # discard encoding line
|
data/lib/rubygems/test_case.rb
CHANGED
@@ -25,7 +25,9 @@ unless Gem::Dependency.new('rdoc', '>= 3.10').matching_specs.empty?
|
|
25
25
|
gem 'json'
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
if Gem::USE_BUNDLER_FOR_GEMDEPS
|
29
|
+
require 'bundler'
|
30
|
+
end
|
29
31
|
require 'minitest/autorun'
|
30
32
|
|
31
33
|
require 'rubygems/deprecate'
|
@@ -235,7 +237,9 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
235
237
|
@current_dir = Dir.pwd
|
236
238
|
@fetcher = nil
|
237
239
|
|
238
|
-
|
240
|
+
if Gem::USE_BUNDLER_FOR_GEMDEPS
|
241
|
+
Bundler.ui = Bundler::UI::Silent.new
|
242
|
+
end
|
239
243
|
@back_ui = Gem::DefaultUserInteraction.ui
|
240
244
|
@ui = Gem::MockGemUi.new
|
241
245
|
# This needs to be a new instance since we call use_ui(@ui) when we want to
|
@@ -331,7 +335,9 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
331
335
|
Gem.loaded_specs.clear
|
332
336
|
Gem.clear_default_specs
|
333
337
|
Gem::Specification.unresolved_deps.clear
|
334
|
-
|
338
|
+
if Gem::USE_BUNDLER_FOR_GEMDEPS
|
339
|
+
Bundler.reset!
|
340
|
+
end
|
335
341
|
|
336
342
|
Gem.configuration.verbose = true
|
337
343
|
Gem.configuration.update_sources = true
|
@@ -482,7 +488,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
482
488
|
|
483
489
|
gemspec = "#{name}.gemspec"
|
484
490
|
|
485
|
-
open File.join(directory, gemspec), 'w' do |io|
|
491
|
+
File.open File.join(directory, gemspec), 'w' do |io|
|
486
492
|
io.write git_spec.to_ruby
|
487
493
|
end
|
488
494
|
|
@@ -586,7 +592,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
586
592
|
# Reads a Marshal file at +path+
|
587
593
|
|
588
594
|
def read_cache(path)
|
589
|
-
open path.dup.untaint, 'rb' do |io|
|
595
|
+
File.open path.dup.untaint, 'rb' do |io|
|
590
596
|
Marshal.load io.read
|
591
597
|
end
|
592
598
|
end
|
@@ -606,7 +612,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
606
612
|
dir = File.dirname path
|
607
613
|
FileUtils.mkdir_p dir unless File.directory? dir
|
608
614
|
|
609
|
-
open path, 'wb' do |io|
|
615
|
+
File.open path, 'wb' do |io|
|
610
616
|
yield io if block_given?
|
611
617
|
end
|
612
618
|
|
@@ -721,7 +727,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
721
727
|
install_default_specs(*specs)
|
722
728
|
|
723
729
|
specs.each do |spec|
|
724
|
-
open spec.loaded_from, 'w' do |io|
|
730
|
+
File.open spec.loaded_from, 'w' do |io|
|
725
731
|
io.write spec.to_ruby_for_cache
|
726
732
|
end
|
727
733
|
end
|
@@ -1357,7 +1363,7 @@ Also, a list:
|
|
1357
1363
|
yield specification if block_given?
|
1358
1364
|
end
|
1359
1365
|
|
1360
|
-
open File.join(directory, "#{name}.gemspec"), 'w' do |io|
|
1366
|
+
File.open File.join(directory, "#{name}.gemspec"), 'w' do |io|
|
1361
1367
|
io.write vendor_spec.to_ruby
|
1362
1368
|
end
|
1363
1369
|
|
data/lib/rubygems/util.rb
CHANGED
@@ -114,7 +114,8 @@ module Gem::Util
|
|
114
114
|
|
115
115
|
here = File.expand_path directory
|
116
116
|
loop do
|
117
|
-
Dir.chdir here, &block
|
117
|
+
Dir.chdir here, &block rescue Errno::EACCES
|
118
|
+
|
118
119
|
new_here = File.expand_path('..', here)
|
119
120
|
return if new_here == here # toplevel
|
120
121
|
here = new_here
|
data/lib/rubygems/validator.rb
CHANGED
@@ -34,7 +34,7 @@ class Gem::Validator
|
|
34
34
|
# gem_path:: [String] Path to gem file
|
35
35
|
|
36
36
|
def verify_gem_file(gem_path)
|
37
|
-
open gem_path, Gem.binary_mode do |file|
|
37
|
+
File.open gem_path, Gem.binary_mode do |file|
|
38
38
|
gem_data = file.read
|
39
39
|
verify_gem gem_data
|
40
40
|
end
|
@@ -109,7 +109,7 @@ class Gem::Validator
|
|
109
109
|
|
110
110
|
good, gone, unreadable = nil, nil, nil, nil
|
111
111
|
|
112
|
-
open gem_path, Gem.binary_mode do |file|
|
112
|
+
File.open gem_path, Gem.binary_mode do |file|
|
113
113
|
package = Gem::Package.new gem_path
|
114
114
|
|
115
115
|
good, gone = package.contents.partition { |file_name|
|
@@ -134,7 +134,7 @@ class Gem::Validator
|
|
134
134
|
|
135
135
|
source = File.join gem_directory, entry['path']
|
136
136
|
|
137
|
-
open source, Gem.binary_mode do |f|
|
137
|
+
File.open source, Gem.binary_mode do |f|
|
138
138
|
unless f.read == data then
|
139
139
|
errors[gem_name][entry['path']] = "Modified from original"
|
140
140
|
end
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -7,7 +7,7 @@ require 'pathname'
|
|
7
7
|
require 'tmpdir'
|
8
8
|
|
9
9
|
# TODO: push this up to test_case.rb once battle tested
|
10
|
-
|
10
|
+
|
11
11
|
$LOAD_PATH.map! do |path|
|
12
12
|
path.dup.untaint
|
13
13
|
end
|
@@ -463,7 +463,7 @@ class TestGem < Gem::TestCase
|
|
463
463
|
assert File.directory?(util_cache_dir)
|
464
464
|
end
|
465
465
|
|
466
|
-
unless win_platform? then # only for FS that support write protection
|
466
|
+
unless win_platform? || Process.uid.zero? then # only for FS that support write protection
|
467
467
|
def test_self_ensure_gem_directories_write_protected
|
468
468
|
gemdir = File.join @tempdir, "egd"
|
469
469
|
FileUtils.rm_r gemdir rescue nil
|
@@ -775,7 +775,7 @@ class TestGem < Gem::TestCase
|
|
775
775
|
end
|
776
776
|
|
777
777
|
def test_self_read_binary
|
778
|
-
open 'test', 'w' do |io|
|
778
|
+
File.open 'test', 'w' do |io|
|
779
779
|
io.write "\xCF\x80"
|
780
780
|
end
|
781
781
|
|
@@ -1480,8 +1480,11 @@ class TestGem < Gem::TestCase
|
|
1480
1480
|
end
|
1481
1481
|
|
1482
1482
|
LIB_PATH = File.expand_path "../../../lib".dup.untaint, __FILE__.dup.untaint
|
1483
|
-
|
1484
|
-
|
1483
|
+
|
1484
|
+
if Gem::USE_BUNDLER_FOR_GEMDEPS
|
1485
|
+
BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }.dup.untaint
|
1486
|
+
BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}"
|
1487
|
+
end
|
1485
1488
|
|
1486
1489
|
def add_bundler_full_name(names)
|
1487
1490
|
return names unless Gem::USE_BUNDLER_FOR_GEMDEPS
|
@@ -1529,7 +1532,7 @@ class TestGem < Gem::TestCase
|
|
1529
1532
|
out = IO.popen(cmd, &:read).split(/\n/)
|
1530
1533
|
|
1531
1534
|
assert_equal ["b-1", "c-1"], out - out0
|
1532
|
-
end
|
1535
|
+
end if Gem::USE_BUNDLER_FOR_GEMDEPS
|
1533
1536
|
|
1534
1537
|
def test_looks_for_gemdeps_files_automatically_on_start_in_parent_dir
|
1535
1538
|
util_clear_gems
|
@@ -1574,7 +1577,7 @@ class TestGem < Gem::TestCase
|
|
1574
1577
|
Dir.rmdir "sub1"
|
1575
1578
|
|
1576
1579
|
assert_equal ["b-1", "c-1"], out - out0
|
1577
|
-
end
|
1580
|
+
end if Gem::USE_BUNDLER_FOR_GEMDEPS
|
1578
1581
|
|
1579
1582
|
def test_register_default_spec
|
1580
1583
|
Gem.clear_default_specs
|
@@ -1639,7 +1642,7 @@ class TestGem < Gem::TestCase
|
|
1639
1642
|
spec = Gem::Specification.find { |s| s == spec }
|
1640
1643
|
refute spec.activated?
|
1641
1644
|
|
1642
|
-
open gem_deps_file, 'w' do |io|
|
1645
|
+
File.open gem_deps_file, 'w' do |io|
|
1643
1646
|
io.write 'gem "a"'
|
1644
1647
|
end
|
1645
1648
|
|
@@ -1658,7 +1661,7 @@ class TestGem < Gem::TestCase
|
|
1658
1661
|
|
1659
1662
|
refute spec.activated?
|
1660
1663
|
|
1661
|
-
open 'gem.deps.rb', 'w' do |io|
|
1664
|
+
File.open 'gem.deps.rb', 'w' do |io|
|
1662
1665
|
io.write 'gem "a"'
|
1663
1666
|
end
|
1664
1667
|
|
@@ -1702,7 +1705,7 @@ class TestGem < Gem::TestCase
|
|
1702
1705
|
|
1703
1706
|
refute spec.activated?
|
1704
1707
|
|
1705
|
-
open 'Gemfile', 'w' do |io|
|
1708
|
+
File.open 'Gemfile', 'w' do |io|
|
1706
1709
|
io.write 'gem "a"'
|
1707
1710
|
end
|
1708
1711
|
|
@@ -1731,7 +1734,7 @@ class TestGem < Gem::TestCase
|
|
1731
1734
|
|
1732
1735
|
refute spec.activated?
|
1733
1736
|
|
1734
|
-
open 'gem.deps.rb', 'w' do |io|
|
1737
|
+
File.open 'gem.deps.rb', 'w' do |io|
|
1735
1738
|
io.write 'gem "a"'
|
1736
1739
|
end
|
1737
1740
|
|
@@ -1746,7 +1749,7 @@ class TestGem < Gem::TestCase
|
|
1746
1749
|
skip 'Insecure operation - read' if RUBY_VERSION <= "1.8.7"
|
1747
1750
|
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
|
1748
1751
|
|
1749
|
-
open 'x', 'w' do |io|
|
1752
|
+
File.open 'x', 'w' do |io|
|
1750
1753
|
io.write 'gem "a"'
|
1751
1754
|
end
|
1752
1755
|
|
@@ -1775,7 +1778,7 @@ You may need to `gem install -g` to install missing gems
|
|
1775
1778
|
end
|
1776
1779
|
ensure
|
1777
1780
|
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1778
|
-
end
|
1781
|
+
end if Gem::USE_BUNDLER_FOR_GEMDEPS
|
1779
1782
|
|
1780
1783
|
def test_use_gemdeps_specific
|
1781
1784
|
skip 'Insecure operation - read' if RUBY_VERSION <= "1.8.7"
|
@@ -1787,7 +1790,7 @@ You may need to `gem install -g` to install missing gems
|
|
1787
1790
|
spec = Gem::Specification.find { |s| s == spec }
|
1788
1791
|
refute spec.activated?
|
1789
1792
|
|
1790
|
-
open 'x', 'w' do |io|
|
1793
|
+
File.open 'x', 'w' do |io|
|
1791
1794
|
io.write 'gem "a"'
|
1792
1795
|
end
|
1793
1796
|
|
@@ -158,7 +158,7 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
|
|
158
158
|
assert_path_exists @a_1_1.gem_dir
|
159
159
|
ensure
|
160
160
|
FileUtils.chmod 0755, @gemhome
|
161
|
-
end unless win_platform?
|
161
|
+
end unless win_platform? || Process.uid.zero?
|
162
162
|
|
163
163
|
def test_execute_dry_run
|
164
164
|
@cmd.options[:args] = %w[a]
|
@@ -131,6 +131,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|
131
131
|
|
132
132
|
def test_execute_no_user_install
|
133
133
|
skip 'skipped on MS Windows (chmod has no effect)' if win_platform?
|
134
|
+
skip 'skipped in root privilege' if Process.uid.zero?
|
134
135
|
|
135
136
|
specs = spec_fetcher do |fetcher|
|
136
137
|
fetcher.gem 'a', 2
|
@@ -132,7 +132,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
132
132
|
}
|
133
133
|
|
134
134
|
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
|
135
|
-
open Gem.configuration.credentials_path, 'w' do |f|
|
135
|
+
File.open Gem.configuration.credentials_path, 'w' do |f|
|
136
136
|
f.write keys.to_yaml
|
137
137
|
end
|
138
138
|
Gem.configuration.load_api_keys
|
@@ -166,7 +166,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
166
166
|
}
|
167
167
|
|
168
168
|
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
|
169
|
-
open Gem.configuration.credentials_path, 'w' do |f|
|
169
|
+
File.open Gem.configuration.credentials_path, 'w' do |f|
|
170
170
|
f.write keys.to_yaml
|
171
171
|
end
|
172
172
|
Gem.configuration.load_api_keys
|
@@ -193,7 +193,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
193
193
|
}
|
194
194
|
|
195
195
|
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
|
196
|
-
open Gem.configuration.credentials_path, 'w' do |f|
|
196
|
+
File.open Gem.configuration.credentials_path, 'w' do |f|
|
197
197
|
f.write keys.to_yaml
|
198
198
|
end
|
199
199
|
Gem.configuration.load_api_keys
|
@@ -235,7 +235,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
235
235
|
}
|
236
236
|
|
237
237
|
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
|
238
|
-
open Gem.configuration.credentials_path, 'w' do |f|
|
238
|
+
File.open Gem.configuration.credentials_path, 'w' do |f|
|
239
239
|
f.write keys.to_yaml
|
240
240
|
end
|
241
241
|
Gem.configuration.load_api_keys
|
@@ -266,7 +266,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
266
266
|
}
|
267
267
|
|
268
268
|
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
|
269
|
-
open Gem.configuration.credentials_path, 'w' do |f|
|
269
|
+
File.open Gem.configuration.credentials_path, 'w' do |f|
|
270
270
|
f.write keys.to_yaml
|
271
271
|
end
|
272
272
|
Gem.configuration.load_api_keys
|
@@ -6,7 +6,7 @@ require 'rubygems/commands/setup_command'
|
|
6
6
|
|
7
7
|
class TestGemCommandsSetupCommand < Gem::TestCase
|
8
8
|
|
9
|
-
BUNDLER_VERS = `gem list -e bundler`[/([^() ]+)\)\Z/, 1] || "1.16.
|
9
|
+
BUNDLER_VERS = `gem list -e bundler`[/([^() ]+)\)\Z/, 1] || "1.16.1"
|
10
10
|
|
11
11
|
def setup
|
12
12
|
super
|
@@ -18,27 +18,27 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
18
18
|
FileUtils.mkdir_p 'bin'
|
19
19
|
FileUtils.mkdir_p 'lib/rubygems/ssl_certs/rubygems.org'
|
20
20
|
|
21
|
-
open 'bin/gem', 'w' do |io| io.puts '# gem' end
|
22
|
-
open 'lib/rubygems.rb', 'w' do |io| io.puts '# rubygems.rb' end
|
23
|
-
open 'lib/rubygems/test_case.rb', 'w' do |io| io.puts '# test_case.rb' end
|
24
|
-
open 'lib/rubygems/ssl_certs/rubygems.org/foo.pem', 'w' do |io| io.puts 'PEM' end
|
21
|
+
File.open 'bin/gem', 'w' do |io| io.puts '# gem' end
|
22
|
+
File.open 'lib/rubygems.rb', 'w' do |io| io.puts '# rubygems.rb' end
|
23
|
+
File.open 'lib/rubygems/test_case.rb', 'w' do |io| io.puts '# test_case.rb' end
|
24
|
+
File.open 'lib/rubygems/ssl_certs/rubygems.org/foo.pem', 'w' do |io| io.puts 'PEM' end
|
25
25
|
|
26
26
|
FileUtils.mkdir_p 'bundler/exe'
|
27
27
|
FileUtils.mkdir_p 'bundler/lib/bundler'
|
28
28
|
|
29
|
-
open 'bundler/exe/bundle', 'w' do |io| io.puts '# bundle' end
|
30
|
-
open 'bundler/lib/bundler.rb', 'w' do |io| io.puts '# bundler.rb' end
|
31
|
-
open 'bundler/lib/bundler/b.rb', 'w' do |io| io.puts '# b.rb' end
|
29
|
+
File.open 'bundler/exe/bundle', 'w' do |io| io.puts '# bundle' end
|
30
|
+
File.open 'bundler/lib/bundler.rb', 'w' do |io| io.puts '# bundler.rb' end
|
31
|
+
File.open 'bundler/lib/bundler/b.rb', 'w' do |io| io.puts '# b.rb' end
|
32
32
|
|
33
33
|
FileUtils.mkdir_p 'default/gems'
|
34
34
|
|
35
35
|
gemspec = Gem::Specification.new
|
36
36
|
gemspec.name = "bundler"
|
37
|
-
gemspec.version =
|
37
|
+
gemspec.version = BUNDLER_VERS
|
38
38
|
gemspec.bindir = "exe"
|
39
39
|
gemspec.executables = ["bundle"]
|
40
40
|
|
41
|
-
open 'bundler/bundler.gemspec', 'w' do |io|
|
41
|
+
File.open 'bundler/bundler.gemspec', 'w' do |io|
|
42
42
|
io.puts gemspec.to_ruby
|
43
43
|
end
|
44
44
|
|
@@ -50,7 +50,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
50
50
|
FileUtils.mkdir_p File.join(Gem.default_dir, "specifications")
|
51
51
|
|
52
52
|
open(File.join(Gem.default_dir, "specifications", "bundler-#{BUNDLER_VERS}.gemspec"), 'w') do |io|
|
53
|
-
io.puts
|
53
|
+
io.puts "# bundler-#{BUNDLER_VERS}"
|
54
54
|
end
|
55
55
|
|
56
56
|
open(File.join(Gem.default_dir, "specifications", "bundler-audit-1.0.0.gemspec"), 'w') do |io|
|
@@ -151,13 +151,13 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
151
151
|
# expect to remove normal gem that was same version. because it's promoted default gems.
|
152
152
|
refute_path_exists File.join(Gem.default_dir, "specifications", "bundler-#{BUNDLER_VERS}.gemspec")
|
153
153
|
|
154
|
-
# expect to install default gems. It location was `site_ruby`
|
154
|
+
# expect to install default gems. It location was `site_ruby` directory on real world.
|
155
155
|
assert_path_exists "default/gems/bundler-#{BUNDLER_VERS}"
|
156
156
|
|
157
157
|
# expect to not remove other versions of bundler on `site_ruby`
|
158
158
|
assert_path_exists 'default/gems/bundler-1.15.4'
|
159
159
|
|
160
|
-
# TODO: We need to assert to remove same version of bundler on gem_dir
|
160
|
+
# TODO: We need to assert to remove same version of bundler on gem_dir directory(It's not site_ruby dir)
|
161
161
|
|
162
162
|
# expect to not remove bundler-* direcotyr.
|
163
163
|
assert_path_exists 'default/gems/bundler-audit-1.0.0'
|
@@ -181,14 +181,14 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
181
181
|
FileUtils.mkdir_p lib_rubygems_defaults
|
182
182
|
FileUtils.mkdir_p lib_bundler
|
183
183
|
|
184
|
-
open securerandom_rb, 'w' do |io| io.puts '# securerandom.rb' end
|
184
|
+
File.open securerandom_rb, 'w' do |io| io.puts '# securerandom.rb' end
|
185
185
|
|
186
|
-
open old_builder_rb, 'w' do |io| io.puts '# builder.rb' end
|
187
|
-
open old_format_rb, 'w' do |io| io.puts '# format.rb' end
|
188
|
-
open old_bundler_c_rb, 'w' do |io| io.puts '# c.rb' end
|
186
|
+
File.open old_builder_rb, 'w' do |io| io.puts '# builder.rb' end
|
187
|
+
File.open old_format_rb, 'w' do |io| io.puts '# format.rb' end
|
188
|
+
File.open old_bundler_c_rb, 'w' do |io| io.puts '# c.rb' end
|
189
189
|
|
190
|
-
open engine_defaults_rb, 'w' do |io| io.puts '# jruby.rb' end
|
191
|
-
open os_defaults_rb, 'w' do |io| io.puts '# operating_system.rb' end
|
190
|
+
File.open engine_defaults_rb, 'w' do |io| io.puts '# jruby.rb' end
|
191
|
+
File.open os_defaults_rb, 'w' do |io| io.puts '# operating_system.rb' end
|
192
192
|
|
193
193
|
@cmd.remove_old_lib_files lib
|
194
194
|
|
@@ -210,7 +210,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
210
210
|
|
211
211
|
@cmd.options[:previous_version] = Gem::Version.new '2.0.2'
|
212
212
|
|
213
|
-
open 'History.txt', 'w' do |io|
|
213
|
+
File.open 'History.txt', 'w' do |io|
|
214
214
|
io.puts <<-History_txt
|
215
215
|
# coding: UTF-8
|
216
216
|
|