rubygems-update 0.9.4 → 0.9.5
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.
- data/ChangeLog +587 -0
- data/README +0 -1
- data/Rakefile +39 -12
- data/TODO +0 -5
- data/bin/gem +7 -7
- data/bin/update_rubygems +1 -1
- data/examples/application/an-app.gemspec +1 -1
- data/gemspecs/cgikit-1.1.0.gemspec +1 -2
- data/gemspecs/jabber4r.gemspec +1 -1
- data/gemspecs/linguistics.gemspec +1 -1
- data/gemspecs/ook.gemspec +1 -1
- data/gemspecs/progressbar.gemspec +1 -1
- data/gemspecs/redcloth.gemspec +1 -1
- data/gemspecs/rublog.gemspec +1 -1
- data/gemspecs/ruby-doom.gemspec +1 -1
- data/gemspecs/rubyjdwp.gemspec +1 -1
- data/gemspecs/statistics.gemspec +1 -1
- data/lib/rubygems.rb +167 -105
- data/lib/rubygems/builder.rb +12 -10
- data/lib/rubygems/command.rb +177 -60
- data/lib/rubygems/command_manager.rb +30 -38
- data/lib/rubygems/commands/build_command.rb +42 -46
- data/lib/rubygems/commands/cert_command.rb +72 -69
- data/lib/rubygems/commands/check_command.rb +63 -63
- data/lib/rubygems/commands/cleanup_command.rb +25 -7
- data/lib/rubygems/commands/contents_command.rb +70 -62
- data/lib/rubygems/commands/dependency_command.rb +131 -86
- data/lib/rubygems/commands/environment_command.rb +67 -46
- data/lib/rubygems/commands/fetch_command.rb +62 -0
- data/lib/rubygems/commands/generate_index_command.rb +57 -0
- data/lib/rubygems/commands/help_command.rb +163 -73
- data/lib/rubygems/commands/install_command.rb +114 -128
- data/lib/rubygems/commands/list_command.rb +10 -8
- data/lib/rubygems/commands/lock_command.rb +101 -0
- data/lib/rubygems/commands/mirror_command.rb +105 -0
- data/lib/rubygems/commands/outdated_command.rb +24 -15
- data/lib/rubygems/commands/pristine_command.rb +118 -88
- data/lib/rubygems/commands/query_command.rb +109 -77
- data/lib/rubygems/commands/rdoc_command.rb +13 -10
- data/lib/rubygems/commands/search_command.rb +10 -8
- data/lib/rubygems/commands/server_command.rb +48 -0
- data/lib/rubygems/commands/sources_command.rb +104 -83
- data/lib/rubygems/commands/specification_command.rb +65 -51
- data/lib/rubygems/commands/uninstall_command.rb +17 -12
- data/lib/rubygems/commands/unpack_command.rb +68 -68
- data/lib/rubygems/commands/update_command.rb +72 -25
- data/lib/rubygems/commands/which_command.rb +86 -0
- data/lib/rubygems/config_file.rb +202 -78
- data/lib/rubygems/custom_require.rb +7 -88
- data/lib/rubygems/dependency.rb +65 -0
- data/lib/rubygems/dependency_installer.rb +232 -0
- data/lib/rubygems/dependency_list.rb +133 -105
- data/lib/rubygems/digest/md5.rb +4 -1
- data/lib/rubygems/digest/sha2.rb +1 -1
- data/lib/rubygems/doc_manager.rb +41 -19
- data/lib/rubygems/exceptions.rb +63 -0
- data/lib/rubygems/ext.rb +18 -0
- data/lib/rubygems/ext/builder.rb +56 -0
- data/lib/rubygems/ext/configure_builder.rb +24 -0
- data/lib/rubygems/ext/ext_conf_builder.rb +23 -0
- data/lib/rubygems/ext/rake_builder.rb +27 -0
- data/lib/rubygems/format.rb +16 -6
- data/lib/rubygems/gem_openssl.rb +43 -6
- data/lib/rubygems/gem_path_searcher.rb +84 -0
- data/lib/rubygems/gem_runner.rb +20 -5
- data/lib/rubygems/indexer.rb +163 -0
- data/lib/rubygems/indexer/abstract_index_builder.rb +80 -0
- data/lib/rubygems/indexer/marshal_index_builder.rb +17 -0
- data/lib/rubygems/indexer/master_index_builder.rb +53 -0
- data/lib/rubygems/indexer/quick_index_builder.rb +48 -0
- data/lib/rubygems/install_update_options.rb +87 -0
- data/lib/rubygems/installer.rb +316 -562
- data/lib/rubygems/local_remote_options.rb +106 -0
- data/lib/rubygems/old_format.rb +5 -13
- data/lib/rubygems/open-uri.rb +2 -0
- data/lib/rubygems/package.rb +28 -32
- data/lib/rubygems/platform.rb +187 -0
- data/lib/rubygems/remote_fetcher.rb +46 -29
- data/lib/rubygems/remote_installer.rb +11 -18
- data/lib/rubygems/requirement.rb +157 -0
- data/lib/rubygems/rubygems_version.rb +1 -1
- data/lib/rubygems/security.rb +715 -457
- data/lib/rubygems/server.rb +77 -59
- data/lib/rubygems/source_index.rb +154 -83
- data/lib/rubygems/source_info_cache.rb +73 -30
- data/lib/rubygems/source_info_cache_entry.rb +12 -3
- data/lib/rubygems/specification.rb +378 -145
- data/lib/rubygems/uninstaller.rb +183 -0
- data/lib/rubygems/user_interaction.rb +38 -9
- data/lib/rubygems/validator.rb +53 -24
- data/lib/rubygems/version.rb +126 -289
- data/lib/rubygems/version_option.rb +49 -0
- data/pkgs/sources/lib/sources.rb +1 -4
- data/pkgs/sources/sources.gemspec +3 -3
- data/scripts/gemdoc.rb +0 -1
- data/setup.rb +166 -1505
- data/test/bogussources.rb +0 -1
- data/test/data/gem-private_key.pem +27 -0
- data/test/data/gem-public_cert.pem +20 -0
- data/test/functional.rb +3 -105
- data/test/gemutilities.rb +145 -24
- data/test/insure_session.rb +0 -1
- data/test/{test_datadir.rb → test_config.rb} +7 -13
- data/test/test_gem.rb +360 -9
- data/test/test_gem_builder.rb +34 -0
- data/test/{test_command.rb → test_gem_command.rb} +119 -62
- data/test/{test_parse_commands.rb → test_gem_command_manager.rb} +64 -40
- data/test/test_gem_commands_build_command.rb +75 -0
- data/test/test_gem_commands_cert_command.rb +122 -0
- data/test/test_gem_commands_check_command.rb +25 -0
- data/test/test_gem_commands_contents_command.rb +92 -0
- data/test/test_gem_commands_dependency_command.rb +108 -0
- data/test/test_gem_commands_environment_command.rb +117 -0
- data/test/test_gem_commands_fetch_command.rb +34 -0
- data/test/test_gem_commands_generate_index_command.rb +32 -0
- data/test/test_gem_commands_install_command.rb +160 -0
- data/test/test_gem_commands_mirror_command.rb +56 -0
- data/test/test_gem_commands_pristine_command.rb +100 -0
- data/test/test_gem_commands_query_command.rb +82 -0
- data/test/test_gem_commands_sources_command.rb +147 -0
- data/test/test_gem_commands_specification_command.rb +93 -0
- data/test/test_gem_commands_unpack_command.rb +55 -0
- data/test/test_gem_config_file.rb +210 -0
- data/test/test_gem_dependency.rb +89 -0
- data/test/test_gem_dependency_installer.rb +542 -0
- data/test/test_gem_dependency_list.rb +212 -0
- data/test/test_gem_doc_manager.rb +32 -0
- data/test/test_gem_ext_configure_builder.rb +13 -17
- data/test/test_gem_ext_ext_conf_builder.rb +9 -9
- data/test/test_gem_ext_rake_builder.rb +23 -11
- data/test/test_gem_format.rb +69 -0
- data/test/test_gem_gem_path_searcher.rb +57 -0
- data/test/test_gem_gem_runner.rb +35 -0
- data/test/test_gem_indexer.rb +119 -0
- data/test/test_gem_install_update_options.rb +40 -0
- data/test/test_gem_installer.rb +796 -0
- data/test/test_gem_local_remote_options.rb +84 -0
- data/test/test_gem_outdated_command.rb +11 -9
- data/test/test_gem_platform.rb +240 -0
- data/test/{test_remote_fetcher.rb → test_gem_remote_fetcher.rb} +124 -55
- data/test/{test_remote_installer.rb → test_gem_remote_installer.rb} +3 -4
- data/test/test_gem_requirement.rb +223 -0
- data/test/test_gem_server.rb +71 -0
- data/test/test_gem_source_index.rb +429 -0
- data/test/test_gem_source_info_cache.rb +79 -17
- data/test/test_gem_source_info_cache_entry.rb +11 -9
- data/test/test_gem_specification.rb +738 -0
- data/test/test_gem_stream_ui.rb +117 -0
- data/test/test_gem_validator.rb +70 -0
- data/test/test_gem_version.rb +191 -0
- data/test/test_gem_version_option.rb +77 -0
- data/test/{test_require_gem.rb → test_kernel.rb} +19 -12
- data/test/test_open_uri.rb +1 -2
- data/test/test_package.rb +45 -34
- metadata +116 -141
- data/Releases +0 -127
- data/bin/gem_mirror +0 -73
- data/bin/gem_server +0 -6
- data/bin/gemlock +0 -127
- data/bin/gemri +0 -24
- data/bin/gemwhich +0 -89
- data/bin/index_gem_repository.rb +0 -302
- data/lib/gemconfigure.rb +0 -24
- data/lib/rubygems/gem_commands.rb +0 -273
- data/pkgs/sources/sources-0.0.1.gem +0 -0
- data/post-install.rb +0 -121
- data/test/brokenbuildgem.rb +0 -35
- data/test/data/PostMessage-0.0.1.gem +0 -0
- data/test/data/a-0.0.1.gem +0 -0
- data/test/data/a-0.0.2.gem +0 -0
- data/test/data/b-0.0.2.gem +0 -0
- data/test/data/broken-1.0.0.gem +0 -0
- data/test/data/broken_build/broken-build.gemspec +0 -20
- data/test/data/broken_build/ext/extconf.rb +0 -3
- data/test/data/broken_build/ext/foo.c +0 -1
- data/test/data/c-1.2.gem +0 -0
- data/test/data/gemhome/cache/a-0.0.1.gem +0 -0
- data/test/data/gemhome/cache/a-0.0.2.gem +0 -0
- data/test/data/gemhome/cache/b-0.0.2.gem +0 -0
- data/test/data/gemhome/cache/c-1.2.gem +0 -0
- data/test/data/gemhome/gems/a-0.0.1/lib/code.rb +0 -1
- data/test/data/gemhome/gems/a-0.0.2/lib/code.rb +0 -1
- data/test/data/gemhome/gems/b-0.0.2/lib/code.rb +0 -1
- data/test/data/gemhome/gems/c-1.2/lib/code.rb +0 -1
- data/test/data/gemhome/specifications/a-0.0.1.gemspec +0 -8
- data/test/data/gemhome/specifications/a-0.0.2.gemspec +0 -8
- data/test/data/gemhome/specifications/b-0.0.2.gemspec +0 -8
- data/test/data/gemhome/specifications/c-1.2.gemspec +0 -8
- data/test/data/legacy/keyedlist-0.4.0.ruby +0 -11
- data/test/data/legacy/keyedlist-0.4.0.yaml +0 -16
- data/test/data/lib/code.rb +0 -1
- data/test/data/one/README.one +0 -1
- data/test/data/one/lib/one.rb +0 -9
- data/test/data/one/one-0.0.1.gem +0 -0
- data/test/data/one/one.gemspec +0 -17
- data/test/data/one/one.yaml +0 -40
- data/test/data/post_install.gemspec +0 -19
- data/test/functional_extension_gems.rb +0 -48
- data/test/functional_generate_yaml_index.rb +0 -104
- data/test/gemenvironment.rb +0 -59
- data/test/io_capture.rb +0 -33
- data/test/mock/gems/gems/sources-0.0.1/lib/sources.rb +0 -11
- data/test/mock/gems/specifications/sources-0.0.1.gemspec +0 -8
- data/test/onegem.rb +0 -35
- data/test/test_builder.rb +0 -34
- data/test/test_check_command.rb +0 -34
- data/test/test_configfile.rb +0 -42
- data/test/test_dependency_list.rb +0 -169
- data/test/test_file_list.rb +0 -101
- data/test/test_format.rb +0 -49
- data/test/test_gem_sources_command.rb +0 -135
- data/test/test_gemloadpaths.rb +0 -51
- data/test/test_gempaths.rb +0 -170
- data/test/test_installer.rb +0 -369
- data/test/test_loadmanager.rb +0 -48
- data/test/test_process_commands.rb +0 -52
- data/test/test_source_index.rb +0 -231
- data/test/test_specific_extras.rb +0 -46
- data/test/test_specification.rb +0 -565
- data/test/test_user_interaction.rb +0 -48
- data/test/test_validator.rb +0 -59
- data/test/test_version_comparison.rb +0 -321
- data/test/testgem.rc +0 -7
- data/test/user_capture.rb +0 -7
- data/test/yaml_data.rb +0 -63
@@ -0,0 +1,212 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
4
|
+
# All rights reserved.
|
5
|
+
# See LICENSE.txt for permissions.
|
6
|
+
#++
|
7
|
+
|
8
|
+
|
9
|
+
require 'test/unit'
|
10
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
11
|
+
require 'rubygems/dependency_list'
|
12
|
+
|
13
|
+
class TestGemDependencyList < RubyGemTestCase
|
14
|
+
|
15
|
+
def setup
|
16
|
+
super
|
17
|
+
|
18
|
+
@deplist = Gem::DependencyList.new
|
19
|
+
|
20
|
+
@a1 = quick_gem 'a', '1'
|
21
|
+
@a2 = quick_gem 'a', '2'
|
22
|
+
@a3 = quick_gem 'a', '3'
|
23
|
+
|
24
|
+
@b1 = quick_gem 'b', '1' do |s| s.add_dependency 'a', '>= 1' end
|
25
|
+
@b2 = quick_gem 'b', '2' do |s| s.add_dependency 'a', '>= 1' end
|
26
|
+
|
27
|
+
@c1 = quick_gem 'c', '1' do |s| s.add_dependency 'b', '>= 1' end
|
28
|
+
@c2 = quick_gem 'c', '2'
|
29
|
+
|
30
|
+
@d1 = quick_gem 'd', '1' do |s| s.add_dependency 'c', '>= 1' end
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_self_from_source_index
|
34
|
+
hash = {
|
35
|
+
'a-1' => @a1,
|
36
|
+
'b-2' => @b2,
|
37
|
+
}
|
38
|
+
|
39
|
+
si = Gem::SourceIndex.new hash
|
40
|
+
deps = Gem::DependencyList.from_source_index si
|
41
|
+
|
42
|
+
assert_equal %w[b-2 a-1], deps.dependency_order.map { |s| s.full_name }
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_active_count
|
46
|
+
assert_equal 0, @deplist.send(:active_count, [], {})
|
47
|
+
assert_equal 1, @deplist.send(:active_count, [@a1], {})
|
48
|
+
assert_equal 0, @deplist.send(:active_count, [@a1],
|
49
|
+
{ @a1.full_name => true })
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_add
|
53
|
+
assert_equal [], @deplist.dependency_order
|
54
|
+
|
55
|
+
@deplist.add @a1, @b2
|
56
|
+
|
57
|
+
assert_equal [@b2, @a1], @deplist.dependency_order
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_dependency_order
|
61
|
+
@deplist.add @a1, @b1, @c1, @d1
|
62
|
+
|
63
|
+
order = @deplist.dependency_order
|
64
|
+
|
65
|
+
assert_equal %w[d-1 c-1 b-1 a-1], order.map { |s| s.full_name }
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_dependency_order_circle
|
69
|
+
@a1.add_dependency 'c', '>= 1'
|
70
|
+
@deplist.add @a1, @b1, @c1
|
71
|
+
|
72
|
+
order = @deplist.dependency_order
|
73
|
+
|
74
|
+
assert_equal %w[b-1 c-1 a-1], order.map { |s| s.full_name }
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_dependency_order_diamond
|
78
|
+
util_diamond
|
79
|
+
e1 = quick_gem 'e', '1'
|
80
|
+
@deplist.add e1
|
81
|
+
@a1.add_dependency 'e', '>= 1'
|
82
|
+
|
83
|
+
order = @deplist.dependency_order
|
84
|
+
|
85
|
+
assert_equal %w[d-1 c-2 b-1 a-2 e-1], order.map { |s| s.full_name },
|
86
|
+
'deps of trimmed specs not included'
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_dependency_order_no_dependendencies
|
90
|
+
@deplist.add @a1, @c2
|
91
|
+
|
92
|
+
order = @deplist.dependency_order
|
93
|
+
|
94
|
+
assert_equal %w[c-2 a-1], order.map { |s| s.full_name }
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_find_name
|
98
|
+
@deplist.add @a1, @b2
|
99
|
+
|
100
|
+
assert_equal "a-1", @deplist.find_name("a-1").full_name
|
101
|
+
assert_equal "b-2", @deplist.find_name("b-2").full_name
|
102
|
+
|
103
|
+
assert_nil @deplist.find_name("c-2")
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_ok_eh
|
107
|
+
assert @deplist.ok?, 'no dependencies'
|
108
|
+
|
109
|
+
@deplist.add @b2
|
110
|
+
|
111
|
+
assert ! @deplist.ok?, 'unsatisfied dependency'
|
112
|
+
|
113
|
+
@deplist.add @a1
|
114
|
+
|
115
|
+
assert @deplist.ok?, 'satisfied dependency'
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_ok_eh_mismatch
|
119
|
+
a1 = quick_gem 'a', '1'
|
120
|
+
a2 = quick_gem 'a', '2'
|
121
|
+
|
122
|
+
b = quick_gem 'b', '1' do |s| s.add_dependency 'a', '= 1' end
|
123
|
+
c = quick_gem 'c', '1' do |s| s.add_dependency 'a', '= 2' end
|
124
|
+
|
125
|
+
d = quick_gem 'd', '1' do |s|
|
126
|
+
s.add_dependency 'b'
|
127
|
+
s.add_dependency 'c'
|
128
|
+
end
|
129
|
+
|
130
|
+
@deplist.add a1, a2, b, c, d
|
131
|
+
|
132
|
+
assert @deplist.ok?, 'this will break on require'
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_ok_eh_redundant
|
136
|
+
@deplist.add @a1, @a3, @b2
|
137
|
+
|
138
|
+
@deplist.remove_by_name("a-1")
|
139
|
+
|
140
|
+
assert @deplist.ok?
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_ok_to_remove_eh
|
144
|
+
@deplist.add @a1
|
145
|
+
|
146
|
+
assert @deplist.ok_to_remove?("a-1")
|
147
|
+
|
148
|
+
@deplist.add @b2
|
149
|
+
|
150
|
+
assert ! @deplist.ok_to_remove?("a-1")
|
151
|
+
|
152
|
+
@deplist.add @a2
|
153
|
+
|
154
|
+
assert @deplist.ok_to_remove?("a-1")
|
155
|
+
assert @deplist.ok_to_remove?("a-2")
|
156
|
+
assert @deplist.ok_to_remove?("b-2")
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_ok_to_remove_eh_after_sibling_removed
|
160
|
+
@deplist.add @a1, @a2, @b2
|
161
|
+
|
162
|
+
assert @deplist.ok_to_remove?("a-1")
|
163
|
+
assert @deplist.ok_to_remove?("a-2")
|
164
|
+
|
165
|
+
@deplist.remove_by_name("a-1")
|
166
|
+
|
167
|
+
assert ! @deplist.ok_to_remove?("a-2")
|
168
|
+
end
|
169
|
+
|
170
|
+
def test_remove_by_name
|
171
|
+
@deplist.add @a1, @b2
|
172
|
+
|
173
|
+
@deplist.remove_by_name "a-1"
|
174
|
+
|
175
|
+
assert ! @deplist.ok?
|
176
|
+
end
|
177
|
+
|
178
|
+
def test_tsort_each_node
|
179
|
+
util_diamond
|
180
|
+
|
181
|
+
order = %w[a-1 a-2 b-1 c-2 d-1]
|
182
|
+
|
183
|
+
@deplist.tsort_each_node do |node|
|
184
|
+
assert_equal order.shift, node.full_name
|
185
|
+
end
|
186
|
+
|
187
|
+
assert order.empty?
|
188
|
+
end
|
189
|
+
|
190
|
+
def test_tsort_each_child
|
191
|
+
util_diamond
|
192
|
+
|
193
|
+
order = %w[a-2]
|
194
|
+
|
195
|
+
@deplist.tsort_each_child(@b1) do |node|
|
196
|
+
assert_equal order.shift, node.full_name
|
197
|
+
end
|
198
|
+
|
199
|
+
assert order.empty?
|
200
|
+
end
|
201
|
+
|
202
|
+
# d1 -> b1 -> a1
|
203
|
+
# d1 -> c2 -> a2
|
204
|
+
def util_diamond
|
205
|
+
@c2.add_dependency 'a', '>= 2'
|
206
|
+
@d1.add_dependency 'b'
|
207
|
+
|
208
|
+
@deplist.add @a1, @a2, @b1, @c2, @d1
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
212
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
+
# All rights reserved.
|
4
|
+
# See LICENSE.txt for permissions.
|
5
|
+
#++
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
9
|
+
require 'rubygems/doc_manager'
|
10
|
+
|
11
|
+
class TestGemDocManager < RubyGemTestCase
|
12
|
+
|
13
|
+
def setup
|
14
|
+
super
|
15
|
+
|
16
|
+
@spec = quick_gem 'a'
|
17
|
+
@manager = Gem::DocManager.new(@spec)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_uninstall_doc_unwritable
|
21
|
+
orig_mode = File.stat(@spec.installation_path).mode
|
22
|
+
File.chmod 0, @spec.installation_path
|
23
|
+
|
24
|
+
assert_raise Gem::FilePermissionError do
|
25
|
+
@manager.uninstall_doc
|
26
|
+
end
|
27
|
+
ensure
|
28
|
+
File.chmod orig_mode, @spec.installation_path
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'test/unit'
|
2
|
-
require '
|
3
|
-
|
4
|
-
require 'rubygems/installer'
|
2
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
3
|
+
require 'rubygems/ext'
|
5
4
|
|
6
5
|
class TestGemExtConfigureBuilder < RubyGemTestCase
|
7
6
|
|
@@ -27,7 +26,7 @@ class TestGemExtConfigureBuilder < RubyGemTestCase
|
|
27
26
|
output = []
|
28
27
|
|
29
28
|
Dir.chdir @ext do
|
30
|
-
Gem::
|
29
|
+
Gem::Ext::ConfigureBuilder.build nil, nil, @dest_path, output
|
31
30
|
end
|
32
31
|
|
33
32
|
expected = [
|
@@ -44,24 +43,21 @@ class TestGemExtConfigureBuilder < RubyGemTestCase
|
|
44
43
|
|
45
44
|
error = assert_raise Gem::InstallError do
|
46
45
|
Dir.chdir @ext do
|
47
|
-
Gem::
|
46
|
+
Gem::Ext::ConfigureBuilder.build nil, nil, @dest_path, output
|
48
47
|
end
|
49
48
|
end
|
50
49
|
|
51
|
-
expected =
|
52
|
-
|
53
|
-
sh ./configure --prefix=#{@dest_path}
|
54
|
-
./configure: ./configure: No such file or directory
|
55
|
-
"
|
50
|
+
expected = %r|configure failed:
|
56
51
|
|
57
|
-
|
52
|
+
sh \./configure --prefix=#{Regexp.escape @dest_path}
|
53
|
+
.*?: \./configure: No such file or directory
|
54
|
+
|
|
58
55
|
|
59
|
-
expected
|
60
|
-
"sh ./configure --prefix=#{@dest_path}",
|
61
|
-
"./configure: ./configure: No such file or directory\n"
|
62
|
-
]
|
56
|
+
assert_match expected, error.message
|
63
57
|
|
64
|
-
assert_equal
|
58
|
+
assert_equal "sh ./configure --prefix=#{@dest_path}", output.shift
|
59
|
+
assert_match %r|\./configure: No such file or directory\n|, output.shift
|
60
|
+
assert_equal true, output.empty?
|
65
61
|
end
|
66
62
|
|
67
63
|
def test_self_build_has_makefile
|
@@ -71,7 +67,7 @@ sh ./configure --prefix=#{@dest_path}
|
|
71
67
|
|
72
68
|
output = []
|
73
69
|
Dir.chdir @ext do
|
74
|
-
Gem::
|
70
|
+
Gem::Ext::ConfigureBuilder.build nil, nil, @dest_path, output
|
75
71
|
end
|
76
72
|
|
77
73
|
case RUBY_PLATFORM
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test/unit'
|
2
|
-
require '
|
3
|
-
require 'rubygems/
|
2
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
3
|
+
require 'rubygems/ext'
|
4
4
|
|
5
5
|
class TestGemExtExtConfBuilder < RubyGemTestCase
|
6
6
|
|
@@ -22,7 +22,7 @@ class TestGemExtExtConfBuilder < RubyGemTestCase
|
|
22
22
|
output = []
|
23
23
|
|
24
24
|
Dir.chdir @ext do
|
25
|
-
Gem::
|
25
|
+
Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
|
26
26
|
end
|
27
27
|
|
28
28
|
expected = [
|
@@ -34,7 +34,7 @@ class TestGemExtExtConfBuilder < RubyGemTestCase
|
|
34
34
|
"make: Nothing to be done for `install'.\n"
|
35
35
|
]
|
36
36
|
|
37
|
-
assert_match(
|
37
|
+
assert_match(/^#{Gem.ruby} extconf.rb/, output[0])
|
38
38
|
assert_equal "creating Makefile\n", output[1]
|
39
39
|
case RUBY_PLATFORM
|
40
40
|
when /mswin/ then
|
@@ -57,16 +57,16 @@ class TestGemExtExtConfBuilder < RubyGemTestCase
|
|
57
57
|
|
58
58
|
error = assert_raise Gem::InstallError do
|
59
59
|
Dir.chdir @ext do
|
60
|
-
Gem::
|
60
|
+
Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
assert_match(/\Aextconf failed:
|
65
65
|
|
66
|
-
ruby extconf.rb.*
|
66
|
+
#{Gem.ruby} extconf.rb.*
|
67
67
|
checking for main\(\) in .*?nonexistent/m, error.message)
|
68
68
|
|
69
|
-
assert_match(
|
69
|
+
assert_match(/^#{Gem.ruby} extconf.rb/, output[0])
|
70
70
|
end
|
71
71
|
|
72
72
|
def test_class_make
|
@@ -80,7 +80,7 @@ checking for main\(\) in .*?nonexistent/m, error.message)
|
|
80
80
|
end
|
81
81
|
|
82
82
|
Dir.chdir @ext do
|
83
|
-
Gem::
|
83
|
+
Gem::Ext::ExtConfBuilder.make @ext, output
|
84
84
|
end
|
85
85
|
|
86
86
|
case RUBY_PLATFORM
|
@@ -105,7 +105,7 @@ install:
|
|
105
105
|
def test_class_make_no_Makefile
|
106
106
|
error = assert_raise Gem::InstallError do
|
107
107
|
Dir.chdir @ext do
|
108
|
-
Gem::
|
108
|
+
Gem::Ext::ExtConfBuilder.make @ext, ['output']
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test/unit'
|
2
|
-
require '
|
3
|
-
require 'rubygems/
|
2
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
3
|
+
require 'rubygems/ext'
|
4
4
|
|
5
5
|
class TestGemExtRakeBuilder < RubyGemTestCase
|
6
6
|
|
@@ -15,8 +15,12 @@ class TestGemExtRakeBuilder < RubyGemTestCase
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_class_build
|
18
|
-
File.open File.join(@ext, '
|
19
|
-
|
18
|
+
File.open File.join(@ext, 'mkrf_conf.rb'), 'w' do |mkrf_conf|
|
19
|
+
mkrf_conf.puts <<-EO_MKRF
|
20
|
+
File.open("Rakefile","w") do |f|
|
21
|
+
f.puts "task :default"
|
22
|
+
end
|
23
|
+
EO_MKRF
|
20
24
|
end
|
21
25
|
|
22
26
|
output = []
|
@@ -24,11 +28,13 @@ class TestGemExtRakeBuilder < RubyGemTestCase
|
|
24
28
|
|
25
29
|
Dir.chdir @ext do
|
26
30
|
realdir = Dir.pwd
|
27
|
-
Gem::
|
31
|
+
Gem::Ext::RakeBuilder.build 'mkrf_conf.rb', nil, @dest_path, output
|
28
32
|
end
|
29
33
|
|
30
34
|
expected = [
|
31
|
-
"
|
35
|
+
"#{Gem.ruby} mkrf_conf.rb",
|
36
|
+
"",
|
37
|
+
"rake RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path}",
|
32
38
|
"(in #{realdir})\n"
|
33
39
|
]
|
34
40
|
|
@@ -36,25 +42,31 @@ class TestGemExtRakeBuilder < RubyGemTestCase
|
|
36
42
|
end
|
37
43
|
|
38
44
|
def test_class_build_fail
|
39
|
-
File.open File.join(@ext, '
|
40
|
-
|
45
|
+
File.open File.join(@ext, 'mkrf_conf.rb'), 'w' do |mkrf_conf|
|
46
|
+
mkrf_conf.puts <<-EO_MKRF
|
47
|
+
File.open("Rakefile","w") do |f|
|
48
|
+
f.puts "task :default do abort 'fail' end"
|
49
|
+
end
|
50
|
+
EO_MKRF
|
41
51
|
end
|
42
52
|
|
43
53
|
output = []
|
44
54
|
|
45
55
|
error = assert_raise Gem::InstallError do
|
46
56
|
Dir.chdir @ext do
|
47
|
-
Gem::
|
57
|
+
Gem::Ext::RakeBuilder.build "mkrf_conf.rb", nil, @dest_path, output
|
48
58
|
end
|
49
59
|
end
|
50
60
|
|
51
61
|
expected = <<-EOF.strip
|
52
62
|
rake failed:
|
53
63
|
|
54
|
-
|
64
|
+
#{Gem.ruby} mkrf_conf.rb
|
65
|
+
|
66
|
+
rake RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path}
|
55
67
|
EOF
|
56
68
|
|
57
|
-
assert_equal expected, error.message.split("\n")[0..
|
69
|
+
assert_equal expected, error.message.split("\n")[0..4].join("\n")
|
58
70
|
end
|
59
71
|
|
60
72
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
+
# All rights reserved.
|
4
|
+
# See LICENSE.txt for permissions.
|
5
|
+
#++
|
6
|
+
|
7
|
+
require 'test/unit'
|
8
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
|
9
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), 'simple_gem')
|
10
|
+
require 'rubygems/format'
|
11
|
+
|
12
|
+
class TestGemFormat < RubyGemTestCase
|
13
|
+
|
14
|
+
def setup
|
15
|
+
super
|
16
|
+
|
17
|
+
@simple_gem = SIMPLE_GEM
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_from_file_by_path
|
21
|
+
util_make_gems
|
22
|
+
|
23
|
+
gems = Dir[File.join(@gemhome, 'cache', '*.gem')]
|
24
|
+
|
25
|
+
names = [@a0_0_1, @a0_0_2, @b0_0_2, @c1_2, @pl1].map do |spec|
|
26
|
+
spec.original_name
|
27
|
+
end
|
28
|
+
|
29
|
+
gems_n_names = gems.sort.zip names
|
30
|
+
|
31
|
+
gems_n_names.each do |gemfile, name|
|
32
|
+
spec = Gem::Format.from_file_by_path(gemfile).spec
|
33
|
+
|
34
|
+
assert_equal name, spec.original_name
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_from_file_by_path_nonexistent
|
39
|
+
assert_raise Gem::Exception do
|
40
|
+
Gem::Format.from_file_by_path '/nonexistent'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_from_io_garbled
|
45
|
+
e = assert_raise Gem::Package::FormatError do
|
46
|
+
# subtly bogus input
|
47
|
+
Gem::Format.from_io(StringIO.new(@simple_gem.upcase))
|
48
|
+
end
|
49
|
+
|
50
|
+
assert_equal 'No metadata found!', e.message
|
51
|
+
|
52
|
+
e = assert_raise Gem::Package::FormatError do
|
53
|
+
# Totally bogus input
|
54
|
+
Gem::Format.from_io(StringIO.new(@simple_gem.reverse))
|
55
|
+
end
|
56
|
+
|
57
|
+
assert_equal 'No metadata found!', e.message
|
58
|
+
|
59
|
+
e = assert_raise Gem::Package::FormatError do
|
60
|
+
# This was intentionally screws up YAML parsing.
|
61
|
+
Gem::Format.from_io(StringIO.new(@simple_gem.gsub(/:/, "boom")))
|
62
|
+
end
|
63
|
+
|
64
|
+
assert_equal 'No metadata found!', e.message
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
|