rubygems-update 3.4.5 → 3.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1115 -1095
- data/Manifest.txt +5 -5
- data/bundler/CHANGELOG.md +12 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/binstubs.rb +5 -1
- data/bundler/lib/bundler/inline.rb +6 -8
- data/bundler/lib/bundler/installer/standalone.rb +11 -7
- data/bundler/lib/bundler/rubygems_integration.rb +8 -4
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems/core_ext/kernel_require.rb +113 -109
- data/lib/rubygems/ext/builder.rb +1 -2
- data/lib/rubygems/ext/cargo_builder.rb +129 -89
- data/lib/rubygems/specification_policy.rb +1 -1
- data/lib/rubygems.rb +11 -1
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/bundler_test_gem.rb +419 -0
- data/test/rubygems/test_gem.rb +0 -412
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +2 -4
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/{Cargo.lock → ext/custom_name_lib/Cargo.lock} +0 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/{Cargo.toml → ext/custom_name_lib/Cargo.toml} +0 -0
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/{src → ext/custom_name_lib/src}/lib.rs +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/lib/custom_name.rb +1 -0
- data/test/rubygems/test_gem_ext_cargo_builder.rb +9 -16
- data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +5 -10
- metadata +8 -8
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +0 -21
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +0 -21
data/test/rubygems/test_gem.rb
CHANGED
@@ -616,27 +616,6 @@ class TestGem < Gem::TestCase
|
|
616
616
|
assert_equal %w[https://rubygems.org/], Gem.default_sources
|
617
617
|
end
|
618
618
|
|
619
|
-
def test_self_use_gemdeps
|
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"
|
624
|
-
|
625
|
-
FileUtils.touch "detect/Isolate"
|
626
|
-
|
627
|
-
begin
|
628
|
-
Dir.chdir "detect/a/b"
|
629
|
-
|
630
|
-
Gem.use_gemdeps
|
631
|
-
|
632
|
-
assert_equal add_bundler_full_name([]), loaded_spec_names
|
633
|
-
ensure
|
634
|
-
Dir.chdir @tempdir
|
635
|
-
end
|
636
|
-
end
|
637
|
-
end
|
638
|
-
end
|
639
|
-
|
640
619
|
def test_self_dir
|
641
620
|
assert_equal @gemhome, Gem.dir
|
642
621
|
end
|
@@ -776,43 +755,6 @@ class TestGem < Gem::TestCase
|
|
776
755
|
assert_equal cwd, $LOAD_PATH.shift
|
777
756
|
end
|
778
757
|
|
779
|
-
def test_self_find_files_with_gemfile
|
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
|
783
|
-
|
784
|
-
discover_path = File.join "lib", "sff", "discover.rb"
|
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
|
796
|
-
end
|
797
|
-
Gem.refresh
|
798
|
-
|
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}'"
|
802
|
-
end
|
803
|
-
Gem.use_gemdeps(File.join Dir.pwd, "Gemfile")
|
804
|
-
|
805
|
-
expected = [
|
806
|
-
File.expand_path("test/rubygems/sff/discover.rb", PROJECT_DIR),
|
807
|
-
File.join(foo1.full_gem_path, discover_path),
|
808
|
-
].sort
|
809
|
-
|
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
|
813
|
-
end
|
814
|
-
end
|
815
|
-
|
816
758
|
def test_self_find_latest_files
|
817
759
|
cwd = File.expand_path("test/rubygems", PROJECT_DIR)
|
818
760
|
$LOAD_PATH.unshift cwd
|
@@ -1640,168 +1582,6 @@ class TestGem < Gem::TestCase
|
|
1640
1582
|
"Wrong spec selected"
|
1641
1583
|
end
|
1642
1584
|
|
1643
|
-
def test_auto_activation_of_specific_gemdeps_file
|
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"
|
1648
|
-
|
1649
|
-
install_specs a, b, c
|
1650
|
-
|
1651
|
-
path = File.join @tempdir, "gem.deps.rb"
|
1652
|
-
|
1653
|
-
File.open path, "w" do |f|
|
1654
|
-
f.puts "gem 'a'"
|
1655
|
-
f.puts "gem 'b'"
|
1656
|
-
f.puts "gem 'c'"
|
1657
|
-
end
|
1658
|
-
|
1659
|
-
with_rubygems_gemdeps(path) do
|
1660
|
-
Gem.use_gemdeps
|
1661
|
-
|
1662
|
-
assert_equal add_bundler_full_name(%W[a-1 b-1 c-1]), loaded_spec_names
|
1663
|
-
end
|
1664
|
-
end
|
1665
|
-
end
|
1666
|
-
|
1667
|
-
def test_auto_activation_of_used_gemdeps_file
|
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"
|
1672
|
-
|
1673
|
-
install_specs a, b, c
|
1674
|
-
|
1675
|
-
path = File.join @tempdir, "gem.deps.rb"
|
1676
|
-
|
1677
|
-
File.open path, "w" do |f|
|
1678
|
-
f.puts "gem 'a'"
|
1679
|
-
f.puts "gem 'b'"
|
1680
|
-
f.puts "gem 'c'"
|
1681
|
-
end
|
1682
|
-
|
1683
|
-
with_rubygems_gemdeps("-") do
|
1684
|
-
expected_specs = [a, b, util_spec("bundler", Bundler::VERSION), c].compact.map(&:full_name)
|
1685
|
-
|
1686
|
-
Gem.use_gemdeps
|
1687
|
-
|
1688
|
-
assert_equal expected_specs, loaded_spec_names
|
1689
|
-
end
|
1690
|
-
end
|
1691
|
-
end
|
1692
|
-
|
1693
|
-
def add_bundler_full_name(names)
|
1694
|
-
names << "bundler-#{Bundler::VERSION}".freeze
|
1695
|
-
names.sort!
|
1696
|
-
names
|
1697
|
-
end
|
1698
|
-
|
1699
|
-
def test_looks_for_gemdeps_files_automatically_from_binstubs
|
1700
|
-
path = File.join(@tempdir, "gd-tmp")
|
1701
|
-
|
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
|
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
|
1711
|
-
|
1712
|
-
b = util_spec "b", "1", nil, "lib/b.rb"
|
1713
|
-
c = util_spec "c", "1", nil, "lib/c.rb"
|
1714
|
-
|
1715
|
-
install_specs a, b, c
|
1716
|
-
|
1717
|
-
install_gem a, :install_dir => path
|
1718
|
-
install_gem b, :install_dir => path
|
1719
|
-
install_gem c, :install_dir => path
|
1720
|
-
|
1721
|
-
ENV["GEM_PATH"] = path
|
1722
|
-
|
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}"
|
1726
|
-
|
1727
|
-
path = File.join @tempdir, "gem.deps.rb"
|
1728
|
-
|
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
|
1735
|
-
|
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
|
1743
|
-
|
1744
|
-
assert_equal ["b-1", "c-1"], out - out0
|
1745
|
-
end
|
1746
|
-
end
|
1747
|
-
end
|
1748
|
-
|
1749
|
-
def test_looks_for_gemdeps_files_automatically_from_binstubs_in_parent_dir
|
1750
|
-
path = File.join(@tempdir, "gd-tmp")
|
1751
|
-
|
1752
|
-
with_local_bundler_at(path) do
|
1753
|
-
pend "IO.popen has issues on JRuby when passed :chdir" if Gem.java_platform?
|
1754
|
-
|
1755
|
-
a = util_spec "a", "1" do |s|
|
1756
|
-
s.executables = %w[foo]
|
1757
|
-
s.bindir = "exe"
|
1758
|
-
end
|
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
|
1763
|
-
|
1764
|
-
b = util_spec "b", "1", nil, "lib/b.rb"
|
1765
|
-
c = util_spec "c", "1", nil, "lib/c.rb"
|
1766
|
-
|
1767
|
-
install_specs a, b, c
|
1768
|
-
|
1769
|
-
install_gem a, :install_dir => path
|
1770
|
-
install_gem b, :install_dir => path
|
1771
|
-
install_gem c, :install_dir => path
|
1772
|
-
|
1773
|
-
ENV["GEM_PATH"] = path
|
1774
|
-
|
1775
|
-
with_rubygems_gemdeps("-") do
|
1776
|
-
Dir.mkdir "sub1"
|
1777
|
-
|
1778
|
-
new_PATH = [File.join(path, "bin"), ENV["PATH"]].join(File::PATH_SEPARATOR)
|
1779
|
-
new_RUBYOPT = "-I#{rubygems_path} -I#{bundler_path}"
|
1780
|
-
|
1781
|
-
path = File.join @tempdir, "gem.deps.rb"
|
1782
|
-
|
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
|
1789
|
-
|
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
|
1797
|
-
|
1798
|
-
Dir.rmdir "sub1"
|
1799
|
-
|
1800
|
-
assert_equal ["b-1", "c-1"], out - out0
|
1801
|
-
end
|
1802
|
-
end
|
1803
|
-
end
|
1804
|
-
|
1805
1585
|
def test_register_default_spec
|
1806
1586
|
Gem.clear_default_specs
|
1807
1587
|
|
@@ -1842,162 +1622,6 @@ class TestGem < Gem::TestCase
|
|
1842
1622
|
assert_equal old_style, Gem.find_unresolved_default_spec("foo.rb")
|
1843
1623
|
end
|
1844
1624
|
|
1845
|
-
def test_use_gemdeps
|
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
|
1850
|
-
|
1851
|
-
spec = Gem::Specification.find {|s| s == spec }
|
1852
|
-
refute spec.activated?
|
1853
|
-
|
1854
|
-
File.open gem_deps_file, "w" do |io|
|
1855
|
-
io.write 'gem "a"'
|
1856
|
-
end
|
1857
|
-
|
1858
|
-
assert_nil Gem.gemdeps
|
1859
|
-
|
1860
|
-
Gem.use_gemdeps gem_deps_file
|
1861
|
-
|
1862
|
-
assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
|
1863
|
-
refute_nil Gem.gemdeps
|
1864
|
-
end
|
1865
|
-
end
|
1866
|
-
|
1867
|
-
def test_use_gemdeps_ENV
|
1868
|
-
with_local_bundler_at(Gem.dir) do
|
1869
|
-
with_rubygems_gemdeps(nil) do
|
1870
|
-
spec = util_spec "a", 1
|
1871
|
-
|
1872
|
-
refute spec.activated?
|
1873
|
-
|
1874
|
-
File.open "gem.deps.rb", "w" do |io|
|
1875
|
-
io.write 'gem "a"'
|
1876
|
-
end
|
1877
|
-
|
1878
|
-
Gem.use_gemdeps
|
1879
|
-
|
1880
|
-
refute spec.activated?
|
1881
|
-
end
|
1882
|
-
end
|
1883
|
-
end
|
1884
|
-
|
1885
|
-
def test_use_gemdeps_argument_missing
|
1886
|
-
with_local_bundler_at(Gem.dir) do
|
1887
|
-
e = assert_raise ArgumentError do
|
1888
|
-
Gem.use_gemdeps "gem.deps.rb"
|
1889
|
-
end
|
1890
|
-
|
1891
|
-
assert_equal "Unable to find gem dependencies file at gem.deps.rb",
|
1892
|
-
e.message
|
1893
|
-
end
|
1894
|
-
end
|
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
|
-
|
1909
|
-
def test_use_gemdeps_automatic
|
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 }
|
1915
|
-
|
1916
|
-
refute spec.activated?
|
1917
|
-
|
1918
|
-
File.open "Gemfile", "w" do |io|
|
1919
|
-
io.write 'gem "a"'
|
1920
|
-
end
|
1921
|
-
|
1922
|
-
Gem.use_gemdeps
|
1923
|
-
|
1924
|
-
assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
|
1925
|
-
end
|
1926
|
-
end
|
1927
|
-
end
|
1928
|
-
|
1929
|
-
def test_use_gemdeps_automatic_missing
|
1930
|
-
with_local_bundler_at(Gem.dir) do
|
1931
|
-
with_rubygems_gemdeps("-") do
|
1932
|
-
Gem.use_gemdeps
|
1933
|
-
|
1934
|
-
assert true # count
|
1935
|
-
end
|
1936
|
-
end
|
1937
|
-
end
|
1938
|
-
|
1939
|
-
def test_use_gemdeps_disabled
|
1940
|
-
with_local_bundler_at(Gem.dir) do
|
1941
|
-
with_rubygems_gemdeps("") do
|
1942
|
-
spec = util_spec "a", 1
|
1943
|
-
|
1944
|
-
refute spec.activated?
|
1945
|
-
|
1946
|
-
File.open "gem.deps.rb", "w" do |io|
|
1947
|
-
io.write 'gem "a"'
|
1948
|
-
end
|
1949
|
-
|
1950
|
-
Gem.use_gemdeps
|
1951
|
-
|
1952
|
-
refute spec.activated?
|
1953
|
-
end
|
1954
|
-
end
|
1955
|
-
end
|
1956
|
-
|
1957
|
-
def test_use_gemdeps_missing_gem
|
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
|
1963
|
-
|
1964
|
-
expected = <<-EXPECTED
|
1965
|
-
Could not find gem 'a' in locally installed gems.
|
1966
|
-
You may need to `bundle install` to install missing gems
|
1967
|
-
|
1968
|
-
EXPECTED
|
1969
|
-
|
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)
|
1976
|
-
end
|
1977
|
-
end
|
1978
|
-
end
|
1979
|
-
end
|
1980
|
-
|
1981
|
-
def test_use_gemdeps_specific
|
1982
|
-
with_local_bundler_at(Gem.dir) do
|
1983
|
-
with_rubygems_gemdeps("x") do
|
1984
|
-
spec = util_spec "a", 1
|
1985
|
-
install_specs spec
|
1986
|
-
|
1987
|
-
spec = Gem::Specification.find {|s| s == spec }
|
1988
|
-
refute spec.activated?
|
1989
|
-
|
1990
|
-
File.open "x", "w" do |io|
|
1991
|
-
io.write 'gem "a"'
|
1992
|
-
end
|
1993
|
-
|
1994
|
-
Gem.use_gemdeps
|
1995
|
-
|
1996
|
-
assert_equal add_bundler_full_name(%W[a-1]), loaded_spec_names
|
1997
|
-
end
|
1998
|
-
end
|
1999
|
-
end
|
2000
|
-
|
2001
1625
|
def test_operating_system_defaults
|
2002
1626
|
operating_system_defaults = Gem.operating_system_defaults
|
2003
1627
|
|
@@ -2110,40 +1734,4 @@ You may need to `bundle install` to install missing gems
|
|
2110
1734
|
def util_cache_dir
|
2111
1735
|
File.join Gem.dir, "cache"
|
2112
1736
|
end
|
2113
|
-
|
2114
|
-
def with_path_and_rubyopt(path_value, rubyopt_value)
|
2115
|
-
path, ENV["PATH"] = ENV["PATH"], path_value
|
2116
|
-
rubyopt, ENV["RUBYOPT"] = ENV["RUBYOPT"], rubyopt_value
|
2117
|
-
|
2118
|
-
yield
|
2119
|
-
ensure
|
2120
|
-
ENV["PATH"] = path
|
2121
|
-
ENV["RUBYOPT"] = rubyopt
|
2122
|
-
end
|
2123
|
-
|
2124
|
-
def with_rubygems_gemdeps(value)
|
2125
|
-
rubygems_gemdeps, ENV["RUBYGEMS_GEMDEPS"] = ENV["RUBYGEMS_GEMDEPS"], value
|
2126
|
-
|
2127
|
-
yield
|
2128
|
-
ensure
|
2129
|
-
ENV["RUBYGEMS_GEMDEPS"] = rubygems_gemdeps
|
2130
|
-
end
|
2131
|
-
|
2132
|
-
def with_local_bundler_at(path)
|
2133
|
-
require "bundler"
|
2134
|
-
|
2135
|
-
# If bundler gemspec exists, pretend it's installed
|
2136
|
-
bundler_gemspec = File.expand_path("../../bundler/bundler.gemspec", __dir__)
|
2137
|
-
if File.exist?(bundler_gemspec)
|
2138
|
-
target_gemspec_location = "#{path}/specifications/bundler-#{Bundler::VERSION}.gemspec"
|
2139
|
-
|
2140
|
-
FileUtils.mkdir_p File.dirname(target_gemspec_location)
|
2141
|
-
|
2142
|
-
File.write target_gemspec_location, Gem::Specification.load(bundler_gemspec).to_ruby_for_cache
|
2143
|
-
end
|
2144
|
-
|
2145
|
-
yield
|
2146
|
-
ensure
|
2147
|
-
Bundler.reset!
|
2148
|
-
end
|
2149
1737
|
end
|
@@ -2,9 +2,7 @@ Gem::Specification.new do |s|
|
|
2
2
|
s.name = "custom_name"
|
3
3
|
s.version = "0.1.0"
|
4
4
|
s.summary = "A Rust extension for Ruby"
|
5
|
-
s.extensions = ["Cargo.toml"]
|
5
|
+
s.extensions = ["ext/custom_name_lib/Cargo.toml"]
|
6
6
|
s.authors = ["Ian Ker-Seymer"]
|
7
|
-
s.files = ["Cargo.toml", "Cargo.lock", "src/lib.rs"]
|
8
|
-
|
9
|
-
s.metadata["cargo_crate_name"] = "custom-name-ext"
|
7
|
+
s.files = ["lib/custom_name.rb", "ext/custom_name_lib/Cargo.toml", "ext/custom_name_lib/Cargo.lock", "ext/custom_name_lib/src/lib.rs"]
|
10
8
|
end
|
File without changes
|
File without changes
|
data/test/rubygems/test_gem_ext_cargo_builder/custom_name/{src → ext/custom_name_lib/src}/lib.rs
RENAMED
@@ -12,7 +12,7 @@ unsafe extern "C" fn say_hello(_klass: VALUE) -> VALUE {
|
|
12
12
|
|
13
13
|
#[allow(non_snake_case)]
|
14
14
|
#[no_mangle]
|
15
|
-
pub extern "C" fn
|
15
|
+
pub extern "C" fn Init_custom_name_ext() {
|
16
16
|
let name = CString::new("CustomName").unwrap();
|
17
17
|
let function_name = CString::new("say_hello").unwrap();
|
18
18
|
// bindgen does not properly detect the arity of the ruby callback function, so we have to transmute
|
@@ -0,0 +1 @@
|
|
1
|
+
require "custom_name_lib/custom_name_ext"
|
@@ -31,13 +31,12 @@ class TestGemExtCargoBuilder < Gem::TestCase
|
|
31
31
|
|
32
32
|
Dir.chdir @ext do
|
33
33
|
ENV.update(@rust_envs)
|
34
|
-
|
35
|
-
builder
|
36
|
-
builder.build nil, @dest_path, output
|
34
|
+
builder = Gem::Ext::CargoBuilder.new
|
35
|
+
builder.build "Cargo.toml", @dest_path, output
|
37
36
|
end
|
38
37
|
|
39
38
|
output = output.join "\n"
|
40
|
-
bundle = File.join(@dest_path, "
|
39
|
+
bundle = File.join(@dest_path, "rust_ruby_example.#{RbConfig::CONFIG['DLEXT']}")
|
41
40
|
|
42
41
|
assert_match(/Finished/, output)
|
43
42
|
assert_match(/release/, output)
|
@@ -58,13 +57,12 @@ class TestGemExtCargoBuilder < Gem::TestCase
|
|
58
57
|
|
59
58
|
Dir.chdir @ext do
|
60
59
|
ENV.update(@rust_envs)
|
61
|
-
|
62
|
-
builder
|
63
|
-
builder.build nil, @dest_path, output
|
60
|
+
builder = Gem::Ext::CargoBuilder.new
|
61
|
+
builder.build "Cargo.toml", @dest_path, output
|
64
62
|
end
|
65
63
|
|
66
64
|
output = output.join "\n"
|
67
|
-
bundle = File.join(@dest_path, "
|
65
|
+
bundle = File.join(@dest_path, "rust_ruby_example.#{RbConfig::CONFIG['DLEXT']}")
|
68
66
|
|
69
67
|
assert_ffi_handle bundle, "hello_from_rubygems"
|
70
68
|
assert_ffi_handle bundle, "hello_from_rubygems_version"
|
@@ -79,22 +77,17 @@ class TestGemExtCargoBuilder < Gem::TestCase
|
|
79
77
|
skip_unsupported_platforms!
|
80
78
|
setup_rust_gem "rust_ruby_example"
|
81
79
|
|
82
|
-
output = []
|
83
|
-
|
84
80
|
FileUtils.rm(File.join(@ext, "src/lib.rs"))
|
85
81
|
|
86
82
|
error = assert_raise(Gem::InstallError) do
|
87
83
|
Dir.chdir @ext do
|
88
84
|
ENV.update(@rust_envs)
|
89
|
-
|
90
|
-
builder
|
91
|
-
builder.build nil, @dest_path, output
|
85
|
+
builder = Gem::Ext::CargoBuilder.new
|
86
|
+
builder.build "Cargo.toml", @dest_path, []
|
92
87
|
end
|
93
88
|
end
|
94
89
|
|
95
|
-
|
96
|
-
|
97
|
-
assert_match "cargo failed", error.message
|
90
|
+
assert_match /cargo\s.*\sfailed/, error.message
|
98
91
|
end
|
99
92
|
|
100
93
|
def test_full_integration
|
@@ -6,8 +6,7 @@ require "rubygems/ext"
|
|
6
6
|
class TestGemExtCargoBuilderUnit < Gem::TestCase
|
7
7
|
def test_cargo_command_passes_args
|
8
8
|
skip_unsupported_platforms!
|
9
|
-
|
10
|
-
builder = Gem::Ext::CargoBuilder.new(spec)
|
9
|
+
builder = Gem::Ext::CargoBuilder.new
|
11
10
|
command = builder.cargo_command(Dir.pwd, @tempdir, ["--all-features"])
|
12
11
|
|
13
12
|
assert_includes command, "--all-features"
|
@@ -15,8 +14,7 @@ class TestGemExtCargoBuilderUnit < Gem::TestCase
|
|
15
14
|
|
16
15
|
def test_cargo_command_locks_in_release_profile
|
17
16
|
skip_unsupported_platforms!
|
18
|
-
|
19
|
-
builder = Gem::Ext::CargoBuilder.new(spec)
|
17
|
+
builder = Gem::Ext::CargoBuilder.new
|
20
18
|
builder.profile = :release
|
21
19
|
command = builder.cargo_command(Dir.pwd, @tempdir)
|
22
20
|
|
@@ -27,8 +25,7 @@ class TestGemExtCargoBuilderUnit < Gem::TestCase
|
|
27
25
|
skip_unsupported_platforms!
|
28
26
|
old_cargo = ENV["CARGO"]
|
29
27
|
ENV["CARGO"] = "mycargo"
|
30
|
-
|
31
|
-
builder = Gem::Ext::CargoBuilder.new(spec)
|
28
|
+
builder = Gem::Ext::CargoBuilder.new
|
32
29
|
command = builder.cargo_command(Dir.pwd, @tempdir)
|
33
30
|
|
34
31
|
assert_includes command, "mycargo"
|
@@ -38,8 +35,7 @@ class TestGemExtCargoBuilderUnit < Gem::TestCase
|
|
38
35
|
|
39
36
|
def test_build_env_includes_rbconfig
|
40
37
|
skip_unsupported_platforms!
|
41
|
-
|
42
|
-
builder = Gem::Ext::CargoBuilder.new(spec)
|
38
|
+
builder = Gem::Ext::CargoBuilder.new
|
43
39
|
env = builder.build_env
|
44
40
|
|
45
41
|
assert_equal env.fetch("RBCONFIG_RUBY_SO_NAME"), RbConfig::CONFIG["RUBY_SO_NAME"]
|
@@ -49,8 +45,7 @@ class TestGemExtCargoBuilderUnit < Gem::TestCase
|
|
49
45
|
skip_unsupported_platforms!
|
50
46
|
old_cargo = ENV["CARGO_BUILD_TARGET"]
|
51
47
|
ENV["CARGO_BUILD_TARGET"] = "x86_64-unknown-linux-gnu"
|
52
|
-
|
53
|
-
builder = Gem::Ext::CargoBuilder.new(spec)
|
48
|
+
builder = Gem::Ext::CargoBuilder.new
|
54
49
|
command = builder.cargo_command(Dir.pwd, @tempdir, ["--locked"])
|
55
50
|
|
56
51
|
assert_includes command, "--target"
|
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: 3.4.
|
4
|
+
version: 3.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Weirich
|
@@ -16,7 +16,7 @@ authors:
|
|
16
16
|
autorequire:
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
|
-
date: 2023-01-
|
19
|
+
date: 2023-01-31 00:00:00.000000000 Z
|
20
20
|
dependencies: []
|
21
21
|
description: |-
|
22
22
|
A package (also known as a library) contains a set of functionality
|
@@ -601,6 +601,7 @@ files:
|
|
601
601
|
- test/rubygems/alternate_cert_32.pem
|
602
602
|
- test/rubygems/alternate_key.pem
|
603
603
|
- test/rubygems/bad_rake.rb
|
604
|
+
- test/rubygems/bundler_test_gem.rb
|
604
605
|
- test/rubygems/ca_cert.pem
|
605
606
|
- test/rubygems/child_cert.pem
|
606
607
|
- test/rubygems/child_cert_32.pem
|
@@ -708,15 +709,14 @@ files:
|
|
708
709
|
- test/rubygems/test_gem_ext_builder.rb
|
709
710
|
- test/rubygems/test_gem_ext_cargo_builder.rb
|
710
711
|
- test/rubygems/test_gem_ext_cargo_builder/custom_name/.gitignore
|
711
|
-
- test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock
|
712
|
-
- test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml
|
713
|
-
- test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb
|
714
712
|
- test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec
|
715
|
-
- test/rubygems/test_gem_ext_cargo_builder/custom_name/
|
713
|
+
- test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock
|
714
|
+
- test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml
|
715
|
+
- test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/src/lib.rs
|
716
|
+
- test/rubygems/test_gem_ext_cargo_builder/custom_name/lib/custom_name.rb
|
716
717
|
- test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/.gitignore
|
717
718
|
- test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock
|
718
719
|
- test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml
|
719
|
-
- test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb
|
720
720
|
- test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/rust_ruby_example.gemspec
|
721
721
|
- test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs
|
722
722
|
- test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb
|
@@ -834,7 +834,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
834
834
|
- !ruby/object:Gem::Version
|
835
835
|
version: '0'
|
836
836
|
requirements: []
|
837
|
-
rubygems_version: 3.4.
|
837
|
+
rubygems_version: 3.4.6
|
838
838
|
signing_key:
|
839
839
|
specification_version: 4
|
840
840
|
summary: RubyGems is a package management framework for Ruby.
|
@@ -1,21 +0,0 @@
|
|
1
|
-
if ENV["RUBYOPT"] || defined? Gem
|
2
|
-
ENV.delete "RUBYOPT"
|
3
|
-
|
4
|
-
require "rbconfig"
|
5
|
-
cmd = [RbConfig.ruby, "--disable-gems", "build.rb", *ARGV]
|
6
|
-
|
7
|
-
exec(*cmd)
|
8
|
-
end
|
9
|
-
|
10
|
-
require "tmpdir"
|
11
|
-
|
12
|
-
lp = File.expand_path("../../../../lib", __dir__)
|
13
|
-
gem = ["ruby", "-I#{lp}", File.expand_path("../../../../bin/gem", __dir__)]
|
14
|
-
gemspec = File.expand_path("custom_name.gemspec", __dir__)
|
15
|
-
|
16
|
-
Dir.mktmpdir("custom_name") do |dir|
|
17
|
-
built_gem = File.expand_path(File.join(dir, "custom_name.gem"))
|
18
|
-
system(*gem, "build", gemspec, "--output", built_gem)
|
19
|
-
system(*gem, "install", "--verbose", "--local", built_gem, *ARGV)
|
20
|
-
system %q(ruby -rcustom_name -e "puts 'Result: ' + CustomName.say_hello")
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
if ENV["RUBYOPT"] || defined? Gem
|
2
|
-
ENV.delete "RUBYOPT"
|
3
|
-
|
4
|
-
require "rbconfig"
|
5
|
-
cmd = [RbConfig.ruby, "--disable-gems", "build.rb", *ARGV]
|
6
|
-
|
7
|
-
exec(*cmd)
|
8
|
-
end
|
9
|
-
|
10
|
-
require "tmpdir"
|
11
|
-
|
12
|
-
lp = File.expand_path("../../../../lib", __dir__)
|
13
|
-
gem = ["ruby", "-I#{lp}", File.expand_path("../../../../bin/gem", __dir__)]
|
14
|
-
gemspec = File.expand_path("rust_ruby_example.gemspec", __dir__)
|
15
|
-
|
16
|
-
Dir.mktmpdir("rust_ruby_example") do |dir|
|
17
|
-
built_gem = File.expand_path(File.join(dir, "rust_ruby_example.gem"))
|
18
|
-
system(*gem, "build", gemspec, "--output", built_gem)
|
19
|
-
system(*gem, "install", "--verbose", "--local", built_gem, *ARGV)
|
20
|
-
system %q(ruby -rrust_ruby_example -e "puts 'Result: ' + RustRubyExample.reverse('hello world')")
|
21
|
-
end
|