rubygems-update 3.3.22 → 3.3.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/Manifest.txt +1 -0
- data/POLICIES.md +38 -5
- data/bundler/CHANGELOG.md +18 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/init.rb +5 -1
- data/bundler/lib/bundler/definition.rb +2 -12
- data/bundler/lib/bundler/dsl.rb +0 -1
- data/bundler/lib/bundler/gem_version_promoter.rb +6 -7
- data/bundler/lib/bundler/index.rb +3 -26
- data/bundler/lib/bundler/resolver.rb +7 -11
- data/bundler/lib/bundler/rubygems_ext.rb +12 -1
- data/bundler/lib/bundler/spec_set.rb +1 -1
- data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +5 -4
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems/gemcutter_utilities.rb +8 -1
- data/lib/rubygems/package.rb +9 -4
- data/lib/rubygems/platform.rb +17 -1
- data/lib/rubygems/resolver.rb +1 -1
- data/lib/rubygems.rb +1 -1
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/helper.rb +23 -17
- data/test/rubygems/packages/Bluebie-legs-0.6.2.gem +0 -0
- data/test/rubygems/test_gem.rb +254 -212
- data/test/rubygems/test_gem_commands_owner_command.rb +105 -24
- data/test/rubygems/test_gem_commands_push_command.rb +44 -23
- data/test/rubygems/test_gem_commands_signin_command.rb +28 -3
- data/test/rubygems/test_gem_commands_yank_command.rb +9 -9
- data/test/rubygems/test_gem_gemcutter_utilities.rb +16 -12
- data/test/rubygems/test_gem_package.rb +15 -0
- data/test/rubygems/test_gem_platform.rb +35 -0
- data/test/rubygems/test_gem_resolver.rb +33 -0
- data/test/rubygems/test_require.rb +5 -5
- data/test/rubygems/utilities.rb +36 -14
- metadata +4 -3
data/test/rubygems/test_gem.rb
CHANGED
@@ -617,20 +617,22 @@ class TestGem < Gem::TestCase
|
|
617
617
|
end
|
618
618
|
|
619
619
|
def test_self_use_gemdeps
|
620
|
-
|
621
|
-
|
622
|
-
|
620
|
+
with_local_bundler_at(Gem.dir) do
|
621
|
+
with_rubygems_gemdeps("-") do
|
622
|
+
FileUtils.mkdir_p "detect/a/b"
|
623
|
+
FileUtils.mkdir_p "detect/a/Isolate"
|
623
624
|
|
624
|
-
|
625
|
+
FileUtils.touch "detect/Isolate"
|
625
626
|
|
626
|
-
|
627
|
-
|
627
|
+
begin
|
628
|
+
Dir.chdir "detect/a/b"
|
628
629
|
|
629
|
-
|
630
|
+
Gem.use_gemdeps
|
630
631
|
|
631
|
-
|
632
|
-
|
633
|
-
|
632
|
+
assert_equal add_bundler_full_name([]), loaded_spec_names
|
633
|
+
ensure
|
634
|
+
Dir.chdir @tempdir
|
635
|
+
end
|
634
636
|
end
|
635
637
|
end
|
636
638
|
end
|
@@ -775,39 +777,40 @@ class TestGem < Gem::TestCase
|
|
775
777
|
end
|
776
778
|
|
777
779
|
def test_self_find_files_with_gemfile
|
778
|
-
|
779
|
-
|
780
|
+
with_local_bundler_at(Gem.dir) do
|
781
|
+
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
782
|
+
actual_load_path = $LOAD_PATH.unshift(cwd).dup
|
780
783
|
|
781
|
-
|
784
|
+
discover_path = File.join "lib", "sff", "discover.rb"
|
782
785
|
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
+
foo1, _ = %w[1 2].map do |version|
|
787
|
+
spec = quick_gem "sff", version do |s|
|
788
|
+
s.files << discover_path
|
789
|
+
end
|
790
|
+
|
791
|
+
write_file(File.join "gems", spec.full_name, discover_path) do |fp|
|
792
|
+
fp.puts "# #{spec.full_name}"
|
793
|
+
end
|
794
|
+
|
795
|
+
spec
|
786
796
|
end
|
797
|
+
Gem.refresh
|
787
798
|
|
788
|
-
write_file(File.join
|
789
|
-
fp.puts "
|
799
|
+
write_file(File.join Dir.pwd, "Gemfile") do |fp|
|
800
|
+
fp.puts "source 'https://rubygems.org'"
|
801
|
+
fp.puts "gem '#{foo1.name}', '#{foo1.version}'"
|
790
802
|
end
|
803
|
+
Gem.use_gemdeps(File.join Dir.pwd, "Gemfile")
|
791
804
|
|
792
|
-
|
793
|
-
|
794
|
-
|
805
|
+
expected = [
|
806
|
+
File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
|
807
|
+
File.join(foo1.full_gem_path, discover_path),
|
808
|
+
].sort
|
795
809
|
|
796
|
-
|
797
|
-
|
798
|
-
|
810
|
+
assert_equal expected, Gem.find_files("sff/discover").sort
|
811
|
+
assert_equal expected, Gem.find_files("sff/**.rb").sort, "[ruby-core:31730]"
|
812
|
+
assert_equal cwd, actual_load_path.shift
|
799
813
|
end
|
800
|
-
Gem.use_gemdeps(File.join Dir.pwd, "Gemfile")
|
801
|
-
|
802
|
-
expected = [
|
803
|
-
File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
|
804
|
-
File.join(foo1.full_gem_path, discover_path),
|
805
|
-
].sort
|
806
|
-
|
807
|
-
assert_equal expected, Gem.find_files("sff/discover").sort
|
808
|
-
assert_equal expected, Gem.find_files("sff/**.rb").sort, "[ruby-core:31730]"
|
809
|
-
ensure
|
810
|
-
assert_equal cwd, actual_load_path.shift unless Gem.java_platform?
|
811
814
|
end
|
812
815
|
|
813
816
|
def test_self_find_latest_files
|
@@ -1335,12 +1338,10 @@ class TestGem < Gem::TestCase
|
|
1335
1338
|
refute Gem.try_activate "nonexistent"
|
1336
1339
|
end
|
1337
1340
|
|
1338
|
-
|
1339
|
-
|
1340
|
-
"Try: gem pristine ext --version 1\n"
|
1341
|
+
expected = "Ignoring ext-1 because its extensions are not built. " +
|
1342
|
+
"Try: gem pristine ext --version 1\n"
|
1341
1343
|
|
1342
|
-
|
1343
|
-
end
|
1344
|
+
assert_equal expected, err
|
1344
1345
|
end
|
1345
1346
|
|
1346
1347
|
def test_self_use_paths_with_nils
|
@@ -1640,159 +1641,164 @@ class TestGem < Gem::TestCase
|
|
1640
1641
|
end
|
1641
1642
|
|
1642
1643
|
def test_auto_activation_of_specific_gemdeps_file
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1644
|
+
with_local_bundler_at(Gem.dir) do
|
1645
|
+
a = util_spec "a", "1", nil, "lib/a.rb"
|
1646
|
+
b = util_spec "b", "1", nil, "lib/b.rb"
|
1647
|
+
c = util_spec "c", "1", nil, "lib/c.rb"
|
1646
1648
|
|
1647
|
-
|
1649
|
+
install_specs a, b, c
|
1648
1650
|
|
1649
|
-
|
1651
|
+
path = File.join @tempdir, "gem.deps.rb"
|
1650
1652
|
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1653
|
+
File.open path, "w" do |f|
|
1654
|
+
f.puts "gem 'a'"
|
1655
|
+
f.puts "gem 'b'"
|
1656
|
+
f.puts "gem 'c'"
|
1657
|
+
end
|
1656
1658
|
|
1657
|
-
|
1658
|
-
|
1659
|
+
with_rubygems_gemdeps(path) do
|
1660
|
+
Gem.use_gemdeps
|
1659
1661
|
|
1660
|
-
|
1662
|
+
assert_equal add_bundler_full_name(%W[a-1 b-1 c-1]), loaded_spec_names
|
1663
|
+
end
|
1661
1664
|
end
|
1662
1665
|
end
|
1663
1666
|
|
1664
1667
|
def test_auto_activation_of_used_gemdeps_file
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
+
with_local_bundler_at(Gem.dir) do
|
1669
|
+
a = util_spec "a", "1", nil, "lib/a.rb"
|
1670
|
+
b = util_spec "b", "1", nil, "lib/b.rb"
|
1671
|
+
c = util_spec "c", "1", nil, "lib/c.rb"
|
1668
1672
|
|
1669
|
-
|
1673
|
+
install_specs a, b, c
|
1670
1674
|
|
1671
|
-
|
1675
|
+
path = File.join @tempdir, "gem.deps.rb"
|
1672
1676
|
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1677
|
+
File.open path, "w" do |f|
|
1678
|
+
f.puts "gem 'a'"
|
1679
|
+
f.puts "gem 'b'"
|
1680
|
+
f.puts "gem 'c'"
|
1681
|
+
end
|
1678
1682
|
|
1679
|
-
|
1680
|
-
|
1683
|
+
with_rubygems_gemdeps("-") do
|
1684
|
+
expected_specs = [a, b, util_spec("bundler", Bundler::VERSION), c].compact.map(&:full_name)
|
1681
1685
|
|
1682
|
-
|
1686
|
+
Gem.use_gemdeps
|
1683
1687
|
|
1684
|
-
|
1688
|
+
assert_equal expected_specs, loaded_spec_names
|
1689
|
+
end
|
1685
1690
|
end
|
1686
1691
|
end
|
1687
1692
|
|
1688
|
-
BUNDLER_LIB_PATH = File.expand_path $LOAD_PATH.find {|lp| File.file?(File.join(lp, "bundler.rb")) }
|
1689
|
-
BUNDLER_FULL_NAME = "bundler-#{Bundler::VERSION}".freeze
|
1690
|
-
|
1691
1693
|
def add_bundler_full_name(names)
|
1692
|
-
names <<
|
1694
|
+
names << "bundler-#{Bundler::VERSION}".freeze
|
1693
1695
|
names.sort!
|
1694
1696
|
names
|
1695
1697
|
end
|
1696
1698
|
|
1697
1699
|
def test_looks_for_gemdeps_files_automatically_from_binstubs
|
1698
|
-
|
1700
|
+
path = File.join(@tempdir, "gd-tmp")
|
1699
1701
|
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1702
|
+
with_local_bundler_at(path) do
|
1703
|
+
a = util_spec "a", "1" do |s|
|
1704
|
+
s.executables = %w[foo]
|
1705
|
+
s.bindir = "exe"
|
1706
|
+
end
|
1704
1707
|
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
+
write_file File.join(@tempdir, "exe", "foo") do |fp|
|
1709
|
+
fp.puts "puts Gem.loaded_specs.values.map(&:full_name).sort"
|
1710
|
+
end
|
1708
1711
|
|
1709
|
-
|
1710
|
-
|
1712
|
+
b = util_spec "b", "1", nil, "lib/b.rb"
|
1713
|
+
c = util_spec "c", "1", nil, "lib/c.rb"
|
1711
1714
|
|
1712
|
-
|
1715
|
+
install_specs a, b, c
|
1713
1716
|
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
install_gem c, :install_dir => path
|
1717
|
+
install_gem a, :install_dir => path
|
1718
|
+
install_gem b, :install_dir => path
|
1719
|
+
install_gem c, :install_dir => path
|
1718
1720
|
|
1719
|
-
|
1721
|
+
ENV["GEM_PATH"] = path
|
1720
1722
|
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1723
|
+
with_rubygems_gemdeps("-") do
|
1724
|
+
new_PATH = [File.join(path, "bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
|
1725
|
+
new_RUBYOPT = "-I#{rubygems_path} -I#{bundler_path}"
|
1724
1726
|
|
1725
|
-
|
1727
|
+
path = File.join @tempdir, "gem.deps.rb"
|
1726
1728
|
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1729
|
+
File.open path, "w" do |f|
|
1730
|
+
f.puts "gem 'a'"
|
1731
|
+
end
|
1732
|
+
out0 = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
|
1733
|
+
IO.popen("foo", &:read).split(/\n/)
|
1734
|
+
end
|
1733
1735
|
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1736
|
+
File.open path, "a" do |f|
|
1737
|
+
f.puts "gem 'b'"
|
1738
|
+
f.puts "gem 'c'"
|
1739
|
+
end
|
1740
|
+
out = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
|
1741
|
+
IO.popen("foo", &:read).split(/\n/)
|
1742
|
+
end
|
1741
1743
|
|
1742
|
-
|
1744
|
+
assert_equal ["b-1", "c-1"], out - out0
|
1745
|
+
end
|
1743
1746
|
end
|
1744
1747
|
end
|
1745
1748
|
|
1746
1749
|
def test_looks_for_gemdeps_files_automatically_from_binstubs_in_parent_dir
|
1747
|
-
|
1750
|
+
path = File.join(@tempdir, "gd-tmp")
|
1748
1751
|
|
1749
|
-
|
1750
|
-
|
1751
|
-
s.bindir = "exe"
|
1752
|
-
end
|
1752
|
+
with_local_bundler_at(path) do
|
1753
|
+
pend "IO.popen has issues on JRuby when passed :chdir" if Gem.java_platform?
|
1753
1754
|
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1755
|
+
a = util_spec "a", "1" do |s|
|
1756
|
+
s.executables = %w[foo]
|
1757
|
+
s.bindir = "exe"
|
1758
|
+
end
|
1757
1759
|
|
1758
|
-
|
1759
|
-
|
1760
|
+
write_file File.join(@tempdir, "exe", "foo") do |fp|
|
1761
|
+
fp.puts "puts Gem.loaded_specs.values.map(&:full_name).sort"
|
1762
|
+
end
|
1760
1763
|
|
1761
|
-
|
1764
|
+
b = util_spec "b", "1", nil, "lib/b.rb"
|
1765
|
+
c = util_spec "c", "1", nil, "lib/c.rb"
|
1762
1766
|
|
1763
|
-
|
1764
|
-
install_gem a, :install_dir => path
|
1765
|
-
install_gem b, :install_dir => path
|
1766
|
-
install_gem c, :install_dir => path
|
1767
|
+
install_specs a, b, c
|
1767
1768
|
|
1768
|
-
|
1769
|
+
install_gem a, :install_dir => path
|
1770
|
+
install_gem b, :install_dir => path
|
1771
|
+
install_gem c, :install_dir => path
|
1769
1772
|
|
1770
|
-
|
1771
|
-
Dir.mkdir "sub1"
|
1773
|
+
ENV["GEM_PATH"] = path
|
1772
1774
|
|
1773
|
-
|
1774
|
-
|
1775
|
+
with_rubygems_gemdeps("-") do
|
1776
|
+
Dir.mkdir "sub1"
|
1775
1777
|
|
1776
|
-
|
1778
|
+
new_PATH = [File.join(path, "bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
|
1779
|
+
new_RUBYOPT = "-I#{rubygems_path} -I#{bundler_path}"
|
1777
1780
|
|
1778
|
-
|
1779
|
-
f.puts "gem 'a'"
|
1780
|
-
end
|
1781
|
-
out0 = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
|
1782
|
-
IO.popen("foo", :chdir => "sub1", &:read).split(/\n/)
|
1783
|
-
end
|
1781
|
+
path = File.join @tempdir, "gem.deps.rb"
|
1784
1782
|
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
end
|
1783
|
+
File.open path, "w" do |f|
|
1784
|
+
f.puts "gem 'a'"
|
1785
|
+
end
|
1786
|
+
out0 = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
|
1787
|
+
IO.popen("foo", :chdir => "sub1", &:read).split(/\n/)
|
1788
|
+
end
|
1792
1789
|
|
1793
|
-
|
1790
|
+
File.open path, "a" do |f|
|
1791
|
+
f.puts "gem 'b'"
|
1792
|
+
f.puts "gem 'c'"
|
1793
|
+
end
|
1794
|
+
out = with_path_and_rubyopt(new_PATH, new_RUBYOPT) do
|
1795
|
+
IO.popen("foo", :chdir => "sub1", &:read).split(/\n/)
|
1796
|
+
end
|
1794
1797
|
|
1795
|
-
|
1798
|
+
Dir.rmdir "sub1"
|
1799
|
+
|
1800
|
+
assert_equal ["b-1", "c-1"], out - out0
|
1801
|
+
end
|
1796
1802
|
end
|
1797
1803
|
end
|
1798
1804
|
|
@@ -1837,52 +1843,47 @@ class TestGem < Gem::TestCase
|
|
1837
1843
|
end
|
1838
1844
|
|
1839
1845
|
def test_use_gemdeps
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1846
|
+
with_local_bundler_at(Gem.dir) do
|
1847
|
+
gem_deps_file = "gem.deps.rb".tap(&Gem::UNTAINT)
|
1848
|
+
spec = util_spec "a", 1
|
1849
|
+
install_specs spec
|
1843
1850
|
|
1844
|
-
|
1845
|
-
|
1851
|
+
spec = Gem::Specification.find {|s| s == spec }
|
1852
|
+
refute spec.activated?
|
1846
1853
|
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1854
|
+
File.open gem_deps_file, "w" do |io|
|
1855
|
+
io.write 'gem "a"'
|
1856
|
+
end
|
1850
1857
|
|
1851
|
-
|
1858
|
+
assert_nil Gem.gemdeps
|
1852
1859
|
|
1853
|
-
|
1860
|
+
Gem.use_gemdeps gem_deps_file
|
1854
1861
|
|
1855
|
-
|
1856
|
-
|
1862
|
+
assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
|
1863
|
+
refute_nil Gem.gemdeps
|
1864
|
+
end
|
1857
1865
|
end
|
1858
1866
|
|
1859
1867
|
def test_use_gemdeps_ENV
|
1860
|
-
|
1861
|
-
|
1868
|
+
with_local_bundler_at(Gem.dir) do
|
1869
|
+
with_rubygems_gemdeps(nil) do
|
1870
|
+
spec = util_spec "a", 1
|
1862
1871
|
|
1863
|
-
|
1872
|
+
refute spec.activated?
|
1864
1873
|
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1874
|
+
File.open "gem.deps.rb", "w" do |io|
|
1875
|
+
io.write 'gem "a"'
|
1876
|
+
end
|
1868
1877
|
|
1869
|
-
|
1878
|
+
Gem.use_gemdeps
|
1870
1879
|
|
1871
|
-
|
1880
|
+
refute spec.activated?
|
1881
|
+
end
|
1872
1882
|
end
|
1873
1883
|
end
|
1874
1884
|
|
1875
1885
|
def test_use_gemdeps_argument_missing
|
1876
|
-
|
1877
|
-
Gem.use_gemdeps "gem.deps.rb"
|
1878
|
-
end
|
1879
|
-
|
1880
|
-
assert_equal "Unable to find gem dependencies file at gem.deps.rb",
|
1881
|
-
e.message
|
1882
|
-
end
|
1883
|
-
|
1884
|
-
def test_use_gemdeps_argument_missing_match_ENV
|
1885
|
-
with_rubygems_gemdeps("gem.deps.rb") do
|
1886
|
+
with_local_bundler_at(Gem.dir) do
|
1886
1887
|
e = assert_raise ArgumentError do
|
1887
1888
|
Gem.use_gemdeps "gem.deps.rb"
|
1888
1889
|
end
|
@@ -1892,85 +1893,108 @@ class TestGem < Gem::TestCase
|
|
1892
1893
|
end
|
1893
1894
|
end
|
1894
1895
|
|
1896
|
+
def test_use_gemdeps_argument_missing_match_ENV
|
1897
|
+
with_local_bundler_at(Gem.dir) do
|
1898
|
+
with_rubygems_gemdeps("gem.deps.rb") do
|
1899
|
+
e = assert_raise ArgumentError do
|
1900
|
+
Gem.use_gemdeps "gem.deps.rb"
|
1901
|
+
end
|
1902
|
+
|
1903
|
+
assert_equal "Unable to find gem dependencies file at gem.deps.rb",
|
1904
|
+
e.message
|
1905
|
+
end
|
1906
|
+
end
|
1907
|
+
end
|
1908
|
+
|
1895
1909
|
def test_use_gemdeps_automatic
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1910
|
+
with_local_bundler_at(Gem.dir) do
|
1911
|
+
with_rubygems_gemdeps("-") do
|
1912
|
+
spec = util_spec "a", 1
|
1913
|
+
install_specs spec
|
1914
|
+
spec = Gem::Specification.find {|s| s == spec }
|
1900
1915
|
|
1901
|
-
|
1916
|
+
refute spec.activated?
|
1902
1917
|
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1918
|
+
File.open "Gemfile", "w" do |io|
|
1919
|
+
io.write 'gem "a"'
|
1920
|
+
end
|
1906
1921
|
|
1907
|
-
|
1922
|
+
Gem.use_gemdeps
|
1908
1923
|
|
1909
|
-
|
1924
|
+
assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
|
1925
|
+
end
|
1910
1926
|
end
|
1911
1927
|
end
|
1912
1928
|
|
1913
1929
|
def test_use_gemdeps_automatic_missing
|
1914
|
-
|
1915
|
-
|
1930
|
+
with_local_bundler_at(Gem.dir) do
|
1931
|
+
with_rubygems_gemdeps("-") do
|
1932
|
+
Gem.use_gemdeps
|
1916
1933
|
|
1917
|
-
|
1934
|
+
assert true # count
|
1935
|
+
end
|
1918
1936
|
end
|
1919
1937
|
end
|
1920
1938
|
|
1921
1939
|
def test_use_gemdeps_disabled
|
1922
|
-
|
1923
|
-
|
1940
|
+
with_local_bundler_at(Gem.dir) do
|
1941
|
+
with_rubygems_gemdeps("") do
|
1942
|
+
spec = util_spec "a", 1
|
1924
1943
|
|
1925
|
-
|
1944
|
+
refute spec.activated?
|
1926
1945
|
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1946
|
+
File.open "gem.deps.rb", "w" do |io|
|
1947
|
+
io.write 'gem "a"'
|
1948
|
+
end
|
1930
1949
|
|
1931
|
-
|
1950
|
+
Gem.use_gemdeps
|
1932
1951
|
|
1933
|
-
|
1952
|
+
refute spec.activated?
|
1953
|
+
end
|
1934
1954
|
end
|
1935
1955
|
end
|
1936
1956
|
|
1937
1957
|
def test_use_gemdeps_missing_gem
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1958
|
+
with_local_bundler_at(Gem.dir) do
|
1959
|
+
with_rubygems_gemdeps("x") do
|
1960
|
+
File.open "x", "w" do |io|
|
1961
|
+
io.write 'gem "a"'
|
1962
|
+
end
|
1942
1963
|
|
1943
|
-
|
1964
|
+
expected = <<-EXPECTED
|
1944
1965
|
Could not find gem 'a' in locally installed gems.
|
1945
1966
|
You may need to `bundle install` to install missing gems
|
1946
1967
|
|
1947
1968
|
EXPECTED
|
1948
1969
|
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1970
|
+
Gem::Deprecate.skip_during do
|
1971
|
+
actual_stdout, actual_stderr = capture_output do
|
1972
|
+
Gem.use_gemdeps
|
1973
|
+
end
|
1974
|
+
assert_empty actual_stdout
|
1975
|
+
assert_equal(expected, actual_stderr)
|
1952
1976
|
end
|
1953
|
-
assert_empty actual_stdout
|
1954
|
-
assert_equal(expected, actual_stderr)
|
1955
1977
|
end
|
1956
1978
|
end
|
1957
1979
|
end
|
1958
1980
|
|
1959
1981
|
def test_use_gemdeps_specific
|
1960
|
-
|
1961
|
-
|
1962
|
-
|
1982
|
+
with_local_bundler_at(Gem.dir) do
|
1983
|
+
with_rubygems_gemdeps("x") do
|
1984
|
+
spec = util_spec "a", 1
|
1985
|
+
install_specs spec
|
1963
1986
|
|
1964
|
-
|
1965
|
-
|
1987
|
+
spec = Gem::Specification.find {|s| s == spec }
|
1988
|
+
refute spec.activated?
|
1966
1989
|
|
1967
|
-
|
1968
|
-
|
1969
|
-
|
1990
|
+
File.open "x", "w" do |io|
|
1991
|
+
io.write 'gem "a"'
|
1992
|
+
end
|
1970
1993
|
|
1971
|
-
|
1994
|
+
Gem.use_gemdeps
|
1972
1995
|
|
1973
|
-
|
1996
|
+
assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
|
1997
|
+
end
|
1974
1998
|
end
|
1975
1999
|
end
|
1976
2000
|
|
@@ -2109,4 +2133,22 @@ You may need to `bundle install` to install missing gems
|
|
2109
2133
|
ensure
|
2110
2134
|
ENV["RUBYGEMS_GEMDEPS"] = rubygems_gemdeps
|
2111
2135
|
end
|
2136
|
+
|
2137
|
+
def with_local_bundler_at(path)
|
2138
|
+
require "bundler"
|
2139
|
+
|
2140
|
+
# If bundler gemspec exists, pretend it's installed
|
2141
|
+
bundler_gemspec = File.expand_path("../../bundler/bundler.gemspec", __dir__)
|
2142
|
+
if File.exist?(bundler_gemspec)
|
2143
|
+
target_gemspec_location = "#{path}/specifications/bundler-#{Bundler::VERSION}.gemspec"
|
2144
|
+
|
2145
|
+
FileUtils.mkdir_p File.dirname(target_gemspec_location)
|
2146
|
+
|
2147
|
+
File.write target_gemspec_location, Gem::Specification.load(bundler_gemspec).to_ruby_for_cache
|
2148
|
+
end
|
2149
|
+
|
2150
|
+
yield
|
2151
|
+
ensure
|
2152
|
+
Bundler.reset!
|
2153
|
+
end
|
2112
2154
|
end
|