rubygems-update 2.0.0 → 2.0.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -1
- data/.autotest +1 -0
- data/History.txt +32 -0
- data/Manifest.txt +2 -0
- data/lib/rubygems.rb +14 -5
- data/lib/rubygems/available_set.rb +70 -72
- data/lib/rubygems/commands/cert_command.rb +1 -0
- data/lib/rubygems/commands/query_command.rb +7 -7
- data/lib/rubygems/commands/setup_command.rb +21 -4
- data/lib/rubygems/commands/sources_command.rb +13 -0
- data/lib/rubygems/config_file.rb +29 -16
- data/lib/rubygems/defaults.rb +1 -1
- data/lib/rubygems/dependency_installer.rb +18 -10
- data/lib/rubygems/dependency_list.rb +1 -1
- data/lib/rubygems/dependency_resolver.rb +17 -4
- data/lib/rubygems/ext/builder.rb +0 -7
- data/lib/rubygems/ext/ext_conf_builder.rb +43 -8
- data/lib/rubygems/installer.rb +4 -4
- data/lib/rubygems/package.rb +2 -1
- data/lib/rubygems/rdoc.rb +10 -1
- data/lib/rubygems/remote_fetcher.rb +8 -3
- data/lib/rubygems/security.rb +21 -1
- data/lib/rubygems/security/policy.rb +2 -0
- data/lib/rubygems/source.rb +10 -0
- data/lib/rubygems/spec_fetcher.rb +38 -0
- data/lib/rubygems/specification.rb +1 -1
- data/lib/rubygems/ssl_certs/GeoTrust_Global_CA.pem +20 -0
- data/lib/rubygems/test_utilities.rb +6 -3
- data/test/rubygems/test_gem.rb +13 -1
- data/test/rubygems/test_gem_commands_fetch_command.rb +4 -0
- data/test/rubygems/test_gem_commands_query_command.rb +16 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +18 -1
- data/test/rubygems/test_gem_commands_sources_command.rb +39 -0
- data/test/rubygems/test_gem_config_file.rb +15 -0
- data/test/rubygems/test_gem_dependency_installer.rb +55 -0
- data/test/rubygems/test_gem_dependency_resolver_api_set.rb +80 -0
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +1 -7
- data/test/rubygems/test_gem_installer.rb +92 -1
- data/test/rubygems/test_gem_remote_fetcher.rb +3 -0
- data/test/rubygems/test_gem_source.rb +11 -0
- data/test/rubygems/test_gem_source_list.rb +1 -1
- data/test/rubygems/test_gem_spec_fetcher.rb +80 -8
- data/test/rubygems/test_require.rb +19 -8
- metadata +14 -11
- metadata.gz.sig +0 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
|
3
|
+
MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
|
4
|
+
YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG
|
5
|
+
EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg
|
6
|
+
R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9
|
7
|
+
9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq
|
8
|
+
fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv
|
9
|
+
iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU
|
10
|
+
1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+
|
11
|
+
bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW
|
12
|
+
MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA
|
13
|
+
ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l
|
14
|
+
uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn
|
15
|
+
Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS
|
16
|
+
tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF
|
17
|
+
PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un
|
18
|
+
hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV
|
19
|
+
5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw==
|
20
|
+
-----END CERTIFICATE-----
|
@@ -38,6 +38,11 @@ class Gem::FakeFetcher
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def find_data(path)
|
41
|
+
if URI === path and "URI::#{path.scheme.upcase}" != path.class.name then
|
42
|
+
raise ArgumentError,
|
43
|
+
"mismatch for scheme #{path.scheme} and class #{path.class}"
|
44
|
+
end
|
45
|
+
|
41
46
|
path = path.to_s
|
42
47
|
@paths << path
|
43
48
|
raise ArgumentError, 'need full URI' unless path =~ %r'^https?://'
|
@@ -49,7 +54,7 @@ class Gem::FakeFetcher
|
|
49
54
|
@data[path]
|
50
55
|
end
|
51
56
|
|
52
|
-
def fetch_path path, mtime = nil
|
57
|
+
def fetch_path path, mtime = nil, head = false
|
53
58
|
data = find_data(path)
|
54
59
|
|
55
60
|
if data.respond_to?(:call) then
|
@@ -121,8 +126,6 @@ class Gem::FakeFetcher
|
|
121
126
|
|
122
127
|
path = File.join path, name
|
123
128
|
|
124
|
-
Gem.ensure_gem_subdirectories install_dir
|
125
|
-
|
126
129
|
if source_uri =~ /^http/ then
|
127
130
|
File.open(path, "wb") do |f|
|
128
131
|
f.write fetch_path(File.join(source_uri, "gems", name))
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -665,7 +665,7 @@ class TestGem < Gem::TestCase
|
|
665
665
|
end
|
666
666
|
|
667
667
|
def test_self_default_sources
|
668
|
-
assert_equal %w[
|
668
|
+
assert_equal %w[https://rubygems.org/], Gem.default_sources
|
669
669
|
end
|
670
670
|
|
671
671
|
def test_self_detect_gemdeps
|
@@ -700,6 +700,18 @@ class TestGem < Gem::TestCase
|
|
700
700
|
assert File.directory? File.join(@gemhome, "cache")
|
701
701
|
end
|
702
702
|
|
703
|
+
def test_self_ensure_gem_directories_permissions
|
704
|
+
FileUtils.rm_r @gemhome
|
705
|
+
Gem.use_paths @gemhome
|
706
|
+
|
707
|
+
Gem.ensure_gem_subdirectories @gemhome, 0750
|
708
|
+
|
709
|
+
assert File.directory? File.join(@gemhome, "cache")
|
710
|
+
|
711
|
+
assert_equal 0750, File::Stat.new(@gemhome).mode & 0777
|
712
|
+
assert_equal 0750, File::Stat.new(File.join(@gemhome, "cache")).mode & 0777
|
713
|
+
end unless win_platform?
|
714
|
+
|
703
715
|
def test_self_ensure_gem_directories_safe_permissions
|
704
716
|
FileUtils.rm_r @gemhome
|
705
717
|
Gem.use_paths @gemhome
|
@@ -18,6 +18,8 @@ class TestGemCommandsFetchCommand < Gem::TestCase
|
|
18
18
|
@fetcher.data["#{@gem_repo}gems/#{@a2.file_name}"] =
|
19
19
|
File.read(@a2.cache_file)
|
20
20
|
|
21
|
+
refute_path_exists File.join(@tempdir, 'cache'), 'sanity check'
|
22
|
+
|
21
23
|
@cmd.options[:args] = [@a2.name]
|
22
24
|
|
23
25
|
use_ui @ui do
|
@@ -28,6 +30,8 @@ class TestGemCommandsFetchCommand < Gem::TestCase
|
|
28
30
|
|
29
31
|
assert_path_exists(File.join(@tempdir, @a2.file_name),
|
30
32
|
"#{@a2.full_name} not fetched")
|
33
|
+
refute_path_exists File.join(@tempdir, 'cache'),
|
34
|
+
'gem repository directories must not be created'
|
31
35
|
end
|
32
36
|
|
33
37
|
def test_execute_prerelease
|
@@ -430,5 +430,21 @@ pl \(1\)
|
|
430
430
|
assert_equal expected, @ui.output
|
431
431
|
end
|
432
432
|
|
433
|
+
def test_make_entry
|
434
|
+
@fetcher.data.delete \
|
435
|
+
"#{@gem_repo}quick/Marshal.#{Gem.marshal_version}/#{@a2.original_name}.gemspec.rz"
|
436
|
+
|
437
|
+
entry_tuples = [
|
438
|
+
[Gem::NameTuple.new(@a2.name, @a2.version, @a2.platform),
|
439
|
+
Gem.sources.first],
|
440
|
+
]
|
441
|
+
|
442
|
+
platforms = { @a2.version => [@a2.platform] }
|
443
|
+
|
444
|
+
entry = @cmd.send :make_entry, entry_tuples, platforms
|
445
|
+
|
446
|
+
assert_equal 'a (2)', entry
|
447
|
+
end
|
448
|
+
|
433
449
|
end
|
434
450
|
|
@@ -11,11 +11,17 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
11
11
|
@cmd.options[:prefix] = @install_dir
|
12
12
|
|
13
13
|
FileUtils.mkdir_p 'bin'
|
14
|
-
FileUtils.mkdir_p 'lib/rubygems'
|
14
|
+
FileUtils.mkdir_p 'lib/rubygems/ssl_certs'
|
15
15
|
|
16
16
|
open 'bin/gem', 'w' do |io| io.puts '# gem' end
|
17
17
|
open 'lib/rubygems.rb', 'w' do |io| io.puts '# rubygems.rb' end
|
18
18
|
open 'lib/rubygems/test_case.rb', 'w' do |io| io.puts '# test_case.rb' end
|
19
|
+
open 'lib/rubygems/ssl_certs/foo.pem', 'w' do |io| io.puts 'PEM' end
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_pem_files_in
|
23
|
+
assert_equal %w[rubygems/ssl_certs/foo.pem],
|
24
|
+
@cmd.pem_files_in('lib').sort
|
19
25
|
end
|
20
26
|
|
21
27
|
def test_rb_files_in
|
@@ -23,6 +29,17 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
23
29
|
@cmd.rb_files_in('lib').sort
|
24
30
|
end
|
25
31
|
|
32
|
+
def test_install_lib
|
33
|
+
@cmd.extend FileUtils
|
34
|
+
|
35
|
+
Dir.mktmpdir 'lib' do |dir|
|
36
|
+
@cmd.install_lib dir
|
37
|
+
|
38
|
+
assert_path_exists File.join(dir, 'rubygems.rb')
|
39
|
+
assert_path_exists File.join(dir, 'rubygems/ssl_certs/foo.pem')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
26
43
|
def test_remove_old_lib_files
|
27
44
|
lib = File.join @install_dir, 'lib'
|
28
45
|
lib_rubygems = File.join lib, 'rubygems'
|
@@ -118,6 +118,45 @@ source #{@gem_repo} already present in the cache
|
|
118
118
|
assert_equal '', @ui.error
|
119
119
|
end
|
120
120
|
|
121
|
+
def test_execute_add_http_rubygems_org
|
122
|
+
http_rubygems_org = 'http://rubygems.org'
|
123
|
+
util_setup_fake_fetcher
|
124
|
+
|
125
|
+
install_specs @a1
|
126
|
+
|
127
|
+
specs = Gem::Specification.map { |spec|
|
128
|
+
[spec.name, spec.version, spec.original_platform]
|
129
|
+
}
|
130
|
+
|
131
|
+
specs_dump_gz = StringIO.new
|
132
|
+
Zlib::GzipWriter.wrap specs_dump_gz do |io|
|
133
|
+
Marshal.dump specs, io
|
134
|
+
end
|
135
|
+
|
136
|
+
@fetcher.data["#{http_rubygems_org}/specs.#{@marshal_version}.gz"] =
|
137
|
+
specs_dump_gz.string
|
138
|
+
|
139
|
+
@cmd.handle_options %W[--add #{http_rubygems_org}]
|
140
|
+
|
141
|
+
util_setup_spec_fetcher
|
142
|
+
|
143
|
+
ui = Gem::MockGemUi.new "n"
|
144
|
+
|
145
|
+
use_ui ui do
|
146
|
+
assert_raises Gem::MockGemUi::TermError do
|
147
|
+
@cmd.execute
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
assert_equal [@gem_repo], Gem.sources
|
152
|
+
|
153
|
+
expected = <<-EXPECTED
|
154
|
+
EXPECTED
|
155
|
+
|
156
|
+
assert_equal expected, @ui.output
|
157
|
+
assert_empty @ui.error
|
158
|
+
end
|
159
|
+
|
121
160
|
def test_execute_add_bad_uri
|
122
161
|
@cmd.handle_options %w[--add beta-gems.example.com]
|
123
162
|
|
@@ -164,6 +164,21 @@ class TestGemConfigFile < Gem::TestCase
|
|
164
164
|
assert_equal 2048, @cfg.bulk_threshold
|
165
165
|
end
|
166
166
|
|
167
|
+
def test_api_keys
|
168
|
+
assert_nil @cfg.instance_variable_get :@api_keys
|
169
|
+
|
170
|
+
temp_cred = File.join Gem.user_home, '.gem', 'credentials'
|
171
|
+
FileUtils.mkdir File.dirname(temp_cred)
|
172
|
+
File.open temp_cred, 'w', 0600 do |fp|
|
173
|
+
fp.puts ':rubygems_api_key: 701229f217cdf23b1344c7b4b54ca97'
|
174
|
+
end
|
175
|
+
|
176
|
+
util_config_file
|
177
|
+
|
178
|
+
assert_equal({:rubygems => '701229f217cdf23b1344c7b4b54ca97'},
|
179
|
+
@cfg.api_keys)
|
180
|
+
end
|
181
|
+
|
167
182
|
def test_check_credentials_permissions
|
168
183
|
skip 'chmod not supported' if win_platform?
|
169
184
|
|
@@ -35,6 +35,61 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
35
35
|
util_reset_gems
|
36
36
|
end
|
37
37
|
|
38
|
+
def test_available_set_for_name
|
39
|
+
util_setup_gems
|
40
|
+
p1a, = util_gem 'a', '10.a'
|
41
|
+
util_setup_spec_fetcher p1a, @a1, @a1_pre
|
42
|
+
|
43
|
+
inst = Gem::DependencyInstaller.new
|
44
|
+
|
45
|
+
available = inst.available_set_for 'a', Gem::Requirement.default
|
46
|
+
|
47
|
+
assert_equal %w[a-1], available.set.map { |s| s.spec.full_name }
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_available_set_for_name_prerelease
|
51
|
+
util_setup_gems
|
52
|
+
p1a, = util_gem 'a', '10.a'
|
53
|
+
util_setup_spec_fetcher p1a, @a1, @a1_pre
|
54
|
+
|
55
|
+
inst = Gem::DependencyInstaller.new :prerelease => true
|
56
|
+
|
57
|
+
available = inst.available_set_for 'a', Gem::Requirement.default
|
58
|
+
|
59
|
+
assert_equal %w[a-10.a],
|
60
|
+
available.sorted.map { |s| s.spec.full_name }
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_available_set_for_dep
|
64
|
+
util_setup_gems
|
65
|
+
p1a, = util_gem 'a', '10.a'
|
66
|
+
util_setup_spec_fetcher p1a, @a1, @a1_pre
|
67
|
+
|
68
|
+
inst = Gem::DependencyInstaller.new
|
69
|
+
|
70
|
+
dep = Gem::Dependency.new 'a', Gem::Requirement.default
|
71
|
+
|
72
|
+
available = inst.available_set_for dep, Gem::Requirement.default
|
73
|
+
|
74
|
+
assert_equal %w[a-1], available.set.map { |s| s.spec.full_name }
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_available_set_for_dep_prerelease
|
78
|
+
util_setup_gems
|
79
|
+
p1a, = util_gem 'a', '10.a'
|
80
|
+
util_setup_spec_fetcher p1a, @a1, @a1_pre
|
81
|
+
|
82
|
+
inst = Gem::DependencyInstaller.new :prerelease => true
|
83
|
+
|
84
|
+
dep = Gem::Dependency.new 'a', Gem::Requirement.default
|
85
|
+
dep.prerelease = true
|
86
|
+
|
87
|
+
available = inst.available_set_for dep, Gem::Requirement.default
|
88
|
+
|
89
|
+
assert_equal %w[a-10.a],
|
90
|
+
available.sorted.map { |s| s.spec.full_name }
|
91
|
+
end
|
92
|
+
|
38
93
|
def test_install
|
39
94
|
util_setup_gems
|
40
95
|
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'rubygems/test_case'
|
2
|
+
require 'rubygems/dependency_resolver'
|
3
|
+
|
4
|
+
class TestGemDependencyResolverAPISet < Gem::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
super
|
8
|
+
|
9
|
+
@DR = Gem::DependencyResolver
|
10
|
+
|
11
|
+
@api_set = @DR::APISet.new
|
12
|
+
@uri = 'https://rubygems.org/api/v1/dependencies'
|
13
|
+
@fetcher = Gem::FakeFetcher.new
|
14
|
+
Gem::RemoteFetcher.fetcher = @fetcher
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_find_all
|
18
|
+
b_entry = {
|
19
|
+
:name => 'b',
|
20
|
+
:number => '2',
|
21
|
+
:platform => 'ruby',
|
22
|
+
:dependencies => [['a', '>= 0']],
|
23
|
+
}
|
24
|
+
|
25
|
+
@fetcher.data["#{@uri}?gems=b"] = Marshal.dump [b_entry]
|
26
|
+
|
27
|
+
b_req = @DR::DependencyRequest.new dep('b', '>= 0'), nil
|
28
|
+
|
29
|
+
expected = [
|
30
|
+
@DR::APISpecification.new(@api_set, b_entry)
|
31
|
+
]
|
32
|
+
|
33
|
+
assert_equal expected, @api_set.find_all(b_req)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_prefetch
|
37
|
+
b_entry = {
|
38
|
+
:name => 'b',
|
39
|
+
:number => '2',
|
40
|
+
:platform => 'ruby',
|
41
|
+
:dependencies => [['a', '>= 0']],
|
42
|
+
}
|
43
|
+
|
44
|
+
a_entry = {
|
45
|
+
:name => 'a',
|
46
|
+
:number => '2',
|
47
|
+
:platform => 'ruby',
|
48
|
+
:dependencies => [],
|
49
|
+
}
|
50
|
+
|
51
|
+
@fetcher.data["#{@uri}?gems=a,b"] = Marshal.dump [a_entry, b_entry]
|
52
|
+
|
53
|
+
a_req = @DR::DependencyRequest.new dep('a', '>= 0'), nil
|
54
|
+
b_req = @DR::DependencyRequest.new dep('b', '>= 0'), nil
|
55
|
+
|
56
|
+
@api_set.prefetch([b_req, a_req])
|
57
|
+
|
58
|
+
assert_equal [a_entry], @api_set.versions('a')
|
59
|
+
assert_equal [b_entry], @api_set.versions('b')
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_versions_cache
|
63
|
+
entry = {
|
64
|
+
:name => 'b',
|
65
|
+
:number => '2',
|
66
|
+
:platform => 'ruby',
|
67
|
+
:dependencies => [['a', '>= 0']],
|
68
|
+
}
|
69
|
+
|
70
|
+
@fetcher.data["#{@uri}?gems=b"] = Marshal.dump [entry]
|
71
|
+
|
72
|
+
assert_equal [entry], @api_set.versions('b')
|
73
|
+
|
74
|
+
@fetcher.data["#{@uri}?gems=b"] = 'garbage'
|
75
|
+
|
76
|
+
assert_equal [entry], @api_set.versions('b'), 'version data must be cached'
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
@@ -110,7 +110,7 @@ class TestGemExtExtConfBuilder < Gem::TestCase
|
|
110
110
|
#{Gem.ruby} extconf.rb.*
|
111
111
|
checking for main\(\) in .*?nonexistent/m, error.message)
|
112
112
|
|
113
|
-
|
113
|
+
assert_equal("#{Gem.ruby} extconf.rb", output[0])
|
114
114
|
end
|
115
115
|
|
116
116
|
def test_class_make
|
@@ -134,12 +134,6 @@ checking for main\(\) in .*?nonexistent/m, error.message)
|
|
134
134
|
|
135
135
|
assert_equal make_command, output[0]
|
136
136
|
assert_equal "#{make_command} install", output[2]
|
137
|
-
|
138
|
-
edited_makefile = Gem.read_binary makefile_path
|
139
|
-
edited_makefile.gsub!(/\r/, '') if Gem.win_platform?
|
140
|
-
|
141
|
-
assert_match "\nRUBYARCHDIR = #{@ext}$(target_prefix)\n", edited_makefile
|
142
|
-
assert_match "\nRUBYLIBDIR = #{@ext}$(target_prefix)\n", edited_makefile
|
143
137
|
end
|
144
138
|
|
145
139
|
def test_class_make_no_Makefile
|
@@ -119,7 +119,8 @@ load Gem.bin_path('a', 'executable', version)
|
|
119
119
|
File.open File.join(@spec.gem_dir, "extconf.rb"), "w" do |f|
|
120
120
|
f.write <<-'RUBY'
|
121
121
|
puts "IN EXTCONF"
|
122
|
-
File.
|
122
|
+
extconf_args = File.join File.dirname(__FILE__), 'extconf_args'
|
123
|
+
File.open extconf_args, 'w' do |f|
|
123
124
|
f.puts ARGV.inspect
|
124
125
|
end
|
125
126
|
|
@@ -190,6 +191,43 @@ load Gem.bin_path('a', 'executable', version)
|
|
190
191
|
Gem::ConfigMap[:bindir] = orig_bindir
|
191
192
|
end
|
192
193
|
|
194
|
+
def test_check_executable_overwrite_format_executable
|
195
|
+
@installer.generate_bin
|
196
|
+
|
197
|
+
@spec = Gem::Specification.new do |s|
|
198
|
+
s.files = ['lib/code.rb']
|
199
|
+
s.name = "a"
|
200
|
+
s.version = "3"
|
201
|
+
s.summary = "summary"
|
202
|
+
s.description = "desc"
|
203
|
+
s.require_path = 'lib'
|
204
|
+
end
|
205
|
+
|
206
|
+
open File.join(util_inst_bindir, 'executable'), 'w' do |io|
|
207
|
+
io.write <<-EXEC
|
208
|
+
#!/usr/local/bin/ruby
|
209
|
+
#
|
210
|
+
# This file was generated by RubyGems
|
211
|
+
|
212
|
+
gem 'other', version
|
213
|
+
EXEC
|
214
|
+
end
|
215
|
+
|
216
|
+
util_make_exec
|
217
|
+
Gem::Installer.exec_format = 'foo-%s-bar'
|
218
|
+
@installer.gem_dir = @spec.gem_dir
|
219
|
+
@installer.wrappers = true
|
220
|
+
@installer.format_executable = true
|
221
|
+
|
222
|
+
@installer.generate_bin # should not raise
|
223
|
+
|
224
|
+
installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
|
225
|
+
assert File.exist? installed_exec
|
226
|
+
|
227
|
+
wrapper = File.read installed_exec
|
228
|
+
assert_match %r|generated by RubyGems|, wrapper
|
229
|
+
end
|
230
|
+
|
193
231
|
def test_check_executable_overwrite_other_gem
|
194
232
|
util_conflict_executable true
|
195
233
|
|
@@ -1000,7 +1038,17 @@ load Gem.bin_path('a', 'executable', version)
|
|
1000
1038
|
RUBY
|
1001
1039
|
end
|
1002
1040
|
|
1041
|
+
Dir.mkdir(File.join("lib", @spec.name))
|
1042
|
+
rb2 = File.join("lib", @spec.name, "#{@spec.name}.rb")
|
1043
|
+
@spec.files << rb2
|
1044
|
+
write_file File.join(@tempdir, rb2) do |io|
|
1045
|
+
io.write <<-RUBY
|
1046
|
+
# #{@spec.name}/#{@spec.name}.rb
|
1047
|
+
RUBY
|
1048
|
+
end
|
1049
|
+
|
1003
1050
|
assert !File.exist?(File.join(@spec.gem_dir, rb))
|
1051
|
+
assert !File.exist?(File.join(@spec.gem_dir, rb2))
|
1004
1052
|
use_ui @ui do
|
1005
1053
|
path = Gem::Package.build @spec
|
1006
1054
|
|
@@ -1008,6 +1056,49 @@ load Gem.bin_path('a', 'executable', version)
|
|
1008
1056
|
@installer.install
|
1009
1057
|
end
|
1010
1058
|
assert File.exist?(File.join(@spec.gem_dir, rb))
|
1059
|
+
assert File.exist?(File.join(@spec.gem_dir, rb2))
|
1060
|
+
end
|
1061
|
+
|
1062
|
+
def test_install_extension_flat
|
1063
|
+
skip '1.9.2 and earlier mkmf.rb does not create TOUCH' if
|
1064
|
+
RUBY_VERSION < '1.9.3'
|
1065
|
+
|
1066
|
+
@spec.require_paths = ["."]
|
1067
|
+
|
1068
|
+
@spec.extensions << "extconf.rb"
|
1069
|
+
|
1070
|
+
write_file File.join(@tempdir, "extconf.rb") do |io|
|
1071
|
+
io.write <<-RUBY
|
1072
|
+
require "mkmf"
|
1073
|
+
|
1074
|
+
CONFIG['CC'] = '$(TOUCH) $@ ||'
|
1075
|
+
CONFIG['LDSHARED'] = '$(TOUCH) $@ ||'
|
1076
|
+
|
1077
|
+
create_makefile("#{@spec.name}")
|
1078
|
+
RUBY
|
1079
|
+
end
|
1080
|
+
|
1081
|
+
# empty depend file for no auto dependencies
|
1082
|
+
@spec.files += %W"depend #{@spec.name}.c".each {|file|
|
1083
|
+
write_file File.join(@tempdir, file)
|
1084
|
+
}
|
1085
|
+
|
1086
|
+
so = File.join(@spec.gem_dir, "#{@spec.name}.#{RbConfig::CONFIG["DLEXT"]}")
|
1087
|
+
assert !File.exist?(so)
|
1088
|
+
use_ui @ui do
|
1089
|
+
path = Gem::Package.build @spec
|
1090
|
+
|
1091
|
+
@installer = Gem::Installer.new path
|
1092
|
+
@installer.install
|
1093
|
+
end
|
1094
|
+
assert File.exist?(so)
|
1095
|
+
rescue
|
1096
|
+
puts '-' * 78
|
1097
|
+
puts File.read File.join(@gemhome, 'gems', 'a-2', 'Makefile')
|
1098
|
+
puts '-' * 78
|
1099
|
+
puts File.read File.join(@gemhome, 'gems', 'a-2', 'gem_make.out')
|
1100
|
+
puts '-' * 78
|
1101
|
+
raise
|
1011
1102
|
end
|
1012
1103
|
|
1013
1104
|
def test_installation_satisfies_dependency_eh
|