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
data/test/bogussources.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIIEpQIBAAKCAQEAz0tTOtsJuHDKAEXrQx0f6DUEzBEUTSLR1fk0iEHsY9rDCQxm
|
3
|
+
sw5Bf2UnVhdD03B4/XzIK+pat2CMQc37/vLIBuVgS7g/fzatGiM0m5rAHtycr0XU
|
4
|
+
8Ek6zjx4iSv70OLjybY+/utHCEc838awGDMCFR21jYxgATPVwqAIyasvwbKh/Vhw
|
5
|
+
uErFPqT9G8BKTHsaX+H+ADIRH001OmWkjB6EyjF05114kNMa0+2C7daV9hoBL3md
|
6
|
+
hCt6zOGcapl/9LkGxhcNEUB/So16V1ZQldg9macGyWktyNTSfctlF+f8okAmicG3
|
7
|
+
XIwaW8UTmjFCmvDs/h1R/uKpe2IOHz87n29d2QIDAQABAoIBAQCR6n/nyg+JmTtX
|
8
|
+
/d+hGns/RTLfQpZ7xarXZ9gmoeD4WSE42VXhbIOGXXnXDAFecKl6Jb/xycGZm4if
|
9
|
+
OZPM3rEWyZeDNWrc7WvkHiwF7GSYVMqmRg2iJqoSSla+mAtl+pBFiNfHMW6K0Tp0
|
10
|
+
erOyFRW+L2+A9/MMZaR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hkiG9w0BAQUFAAOCAQEATRrJC05l
|
14
|
+
dOmx67Sy3bU+AVXkOr7B9nn2Myqo9uSIAncPoElN6aHr/Q8wOOjtok4r0JcHPe1e
|
15
|
+
eotDCZUE1Jkl13Tpv26rOfOOUHtGlyAIAtpsUGOraaJkSut4WKLr1/KckyAAEtgP
|
16
|
+
c13A0s0mEiWFRuYxIdEi54561pTT2qQBE/DUPGoYD5rUg9XYAlSovMMwG99Oca7L
|
17
|
+
cI6vCymr1bzzddExoywBNOy0fbBT62I3ICBGbH5yOVVKVmlxeo2Zp10FCj0kDrnq
|
18
|
+
OuMJSDr5I2XPYqoC+W4YSbwn55o2jGIUX1lOq2Hvj4tFgSxlnJZn0tUhBfR3gSOn
|
19
|
+
IFnrqu8PlZsLFw==
|
20
|
+
-----END CERTIFICATE-----
|
data/test/functional.rb
CHANGED
@@ -5,14 +5,11 @@
|
|
5
5
|
# See LICENSE.txt for permissions.
|
6
6
|
#++
|
7
7
|
|
8
|
-
|
9
8
|
require 'test/unit'
|
10
9
|
require 'rubygems'
|
11
|
-
Gem.manage_gems
|
12
|
-
require 'yaml'
|
13
|
-
require 'fileutils'
|
14
10
|
require 'test/insure_session'
|
15
|
-
require '
|
11
|
+
require 'rubygems/format'
|
12
|
+
require 'rubygems/command_manager'
|
16
13
|
|
17
14
|
class FunctionalTest < Test::Unit::TestCase
|
18
15
|
def setup
|
@@ -24,7 +21,7 @@ class FunctionalTest < Test::Unit::TestCase
|
|
24
21
|
|
25
22
|
def test_gem_help_options
|
26
23
|
gem_nossl 'help options'
|
27
|
-
assert_match(/Usage:/, @out)
|
24
|
+
assert_match(/Usage:/, @out, @err)
|
28
25
|
assert_status
|
29
26
|
end
|
30
27
|
|
@@ -40,60 +37,6 @@ class FunctionalTest < Test::Unit::TestCase
|
|
40
37
|
assert_status 1
|
41
38
|
end
|
42
39
|
|
43
|
-
def test_environment
|
44
|
-
gem_nossl 'environment'
|
45
|
-
|
46
|
-
assert_match(/VERSION:\s+(\d+\.)*\d+/, @out)
|
47
|
-
assert_match(/INSTALLATION DIRECTORY:/, @out)
|
48
|
-
assert_match(/GEM PATH:/, @out)
|
49
|
-
assert_match(/REMOTE SOURCES:/, @out)
|
50
|
-
assert_status
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_env_version
|
54
|
-
gem_nossl 'environment version'
|
55
|
-
assert_match(/\d+\.\d+$/, @out)
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_env_gemdir
|
59
|
-
gem_nossl 'environment gemdir'
|
60
|
-
assert_equal Gem.dir, @out.chomp
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_env_gempath
|
64
|
-
gem_nossl 'environment gempath'
|
65
|
-
assert_equal Gem.path, @out.chomp.split("\n")
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_env_remotesources
|
69
|
-
gem_nossl 'environment remotesources'
|
70
|
-
assert_equal Gem.sources, @out.chomp.split("\n")
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_build
|
74
|
-
OneGem.rebuild(self)
|
75
|
-
assert File.exist?(OneGem::ONEGEM), "Gem file (#{OneGem::ONEGEM}) should exist"
|
76
|
-
assert_match(/Successfully built RubyGem/, @out)
|
77
|
-
assert_match(/Name: one$/, @out)
|
78
|
-
assert_match(/Version: 0.0.1$/, @out)
|
79
|
-
assert_match(/File: #{OneGem::ONENAME}/, @out)
|
80
|
-
spec = read_gem_file(OneGem::ONEGEM)
|
81
|
-
assert_equal "one", spec.name
|
82
|
-
assert_equal "Test GEM One", spec.summary
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_build_from_yaml
|
86
|
-
OneGem.rebuild(self)
|
87
|
-
assert File.exist?(OneGem::ONEGEM), "Gem file (#{OneGem::ONEGEM}) should exist"
|
88
|
-
assert_match(/Successfully built RubyGem/, @out)
|
89
|
-
assert_match(/Name: one$/, @out)
|
90
|
-
assert_match(/Version: 0.0.1$/, @out)
|
91
|
-
assert_match(/File: #{OneGem::ONENAME}/, @out)
|
92
|
-
spec = read_gem_file(OneGem::ONEGEM)
|
93
|
-
assert_equal "one", spec.name
|
94
|
-
assert_equal "Test GEM One", spec.summary
|
95
|
-
end
|
96
|
-
|
97
40
|
# This test is disabled because of the insanely long time it takes
|
98
41
|
# to time out.
|
99
42
|
def xtest_bogus_source_hoses_up_remote_install_but_gem_command_gives_decent_error_message
|
@@ -112,47 +55,6 @@ class FunctionalTest < Test::Unit::TestCase
|
|
112
55
|
end
|
113
56
|
end
|
114
57
|
|
115
|
-
def test_gemrc_paths
|
116
|
-
gem_nossl "env --config-file test/testgem.rc"
|
117
|
-
assert_match %{/usr/local/rubygems}, @out
|
118
|
-
assert_match %{/another/spot/for/rubygems}, @out
|
119
|
-
assert_match %{test/data/gemhome}, @out
|
120
|
-
end
|
121
|
-
|
122
|
-
def test_gemrc_args
|
123
|
-
gem_nossl "help --config-file test/testgem.rc"
|
124
|
-
assert_match %{gem build}, @out
|
125
|
-
assert_match %{gem install}, @out
|
126
|
-
end
|
127
|
-
|
128
|
-
SIGN_FILES = %w(gem-private_key.pem gem-public_cert.pem)
|
129
|
-
|
130
|
-
def test_cert_build
|
131
|
-
begin
|
132
|
-
require 'openssl'
|
133
|
-
rescue LoadError => ex
|
134
|
-
puts "WARNING: openssl is not availble, " +
|
135
|
-
"unable to test the cert functions"
|
136
|
-
return
|
137
|
-
end
|
138
|
-
|
139
|
-
SIGN_FILES.each do |fn| FileUtils.rm_f fn end
|
140
|
-
gem_withssl "cert --build x@y.z"
|
141
|
-
SIGN_FILES.each do |fn|
|
142
|
-
assert File.exist?(fn),
|
143
|
-
"Signing key/cert file '#{fn}' should exist"
|
144
|
-
end
|
145
|
-
ensure
|
146
|
-
SIGN_FILES.each do |fn| FileUtils.rm_f fn end
|
147
|
-
end
|
148
|
-
|
149
|
-
def test_nossl_cert
|
150
|
-
gem_nossl "cert --build x@y.z"
|
151
|
-
assert_not_equal 0, @status
|
152
|
-
assert_match(/not installed/, @err,
|
153
|
-
"Should have a not installed error for openssl")
|
154
|
-
end
|
155
|
-
|
156
58
|
# :section: Help Methods
|
157
59
|
|
158
60
|
# Run a gem command without the SSL library.
|
@@ -190,8 +92,4 @@ class FunctionalTest < Test::Unit::TestCase
|
|
190
92
|
assert_equal expected_status, @status
|
191
93
|
end
|
192
94
|
|
193
|
-
def read_gem_file(filename)
|
194
|
-
Gem::Format.from_file_by_path(filename).spec
|
195
|
-
end
|
196
|
-
|
197
95
|
end
|
data/test/gemutilities.rb
CHANGED
@@ -5,47 +5,50 @@
|
|
5
5
|
# See LICENSE.txt for permissions.
|
6
6
|
#++
|
7
7
|
|
8
|
+
at_exit { $SAFE = 1 }
|
9
|
+
|
8
10
|
require 'fileutils'
|
9
11
|
require 'test/unit/testcase'
|
10
12
|
require 'tmpdir'
|
11
13
|
require 'uri'
|
12
14
|
require 'rubygems/gem_open_uri'
|
15
|
+
require 'rubygems/source_info_cache'
|
13
16
|
|
14
|
-
require '
|
15
|
-
require 'test/mockgemui'
|
17
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), 'mockgemui')
|
16
18
|
|
17
|
-
module
|
18
|
-
def
|
19
|
-
|
20
|
-
open(fn, 'wb') do |f| f.write Marshal.dump(cache_hash(*uris)) end
|
19
|
+
module Gem
|
20
|
+
def self.source_index=(si)
|
21
|
+
@@source_index = si
|
21
22
|
end
|
22
|
-
|
23
|
-
module_function :make_cache_area
|
24
23
|
end
|
25
24
|
|
26
25
|
class FakeFetcher
|
27
26
|
|
28
27
|
attr_reader :data
|
29
28
|
attr_accessor :uri
|
29
|
+
attr_accessor :paths
|
30
30
|
|
31
31
|
def initialize
|
32
32
|
@data = {}
|
33
|
+
@paths = []
|
33
34
|
@uri = nil
|
34
35
|
end
|
35
36
|
|
36
37
|
def fetch_path(path)
|
37
38
|
path = path.to_s
|
39
|
+
@paths << path
|
38
40
|
raise ArgumentError, 'need full URI' unless path =~ %r'^http://'
|
39
41
|
data = @data[path]
|
40
|
-
raise
|
42
|
+
raise Gem::RemoteFetcher::FetchError, "no data for #{path}" if data.nil?
|
41
43
|
data.respond_to?(:call) ? data.call : data
|
42
44
|
end
|
43
45
|
|
44
46
|
def fetch_size(path)
|
45
47
|
path = path.to_s
|
48
|
+
@paths << path
|
46
49
|
raise ArgumentError, 'need full URI' unless path =~ %r'^http://'
|
47
50
|
data = @data[path]
|
48
|
-
raise
|
51
|
+
raise Gem::RemoteFetcher::FetchError, "no data for #{path}" if data.nil?
|
49
52
|
data.respond_to?(:call) ? data.call : data.length
|
50
53
|
end
|
51
54
|
|
@@ -59,7 +62,12 @@ class RubyGemTestCase < Test::Unit::TestCase
|
|
59
62
|
|
60
63
|
def setup
|
61
64
|
super
|
62
|
-
|
65
|
+
|
66
|
+
@ui = MockGemUi.new
|
67
|
+
tmpdir = nil
|
68
|
+
Dir.chdir Dir.tmpdir do tmpdir = Dir.pwd end # HACK OSX /private/tmp
|
69
|
+
@tempdir = File.join tmpdir, "test_rubygems_#{$$}"
|
70
|
+
@tempdir.untaint
|
63
71
|
@gemhome = File.join @tempdir, "gemhome"
|
64
72
|
@gemcache = File.join(@gemhome, "source_cache")
|
65
73
|
@usrcache = File.join(@gemhome, ".gem", "user_cache")
|
@@ -68,30 +76,66 @@ class RubyGemTestCase < Test::Unit::TestCase
|
|
68
76
|
|
69
77
|
ENV['GEMCACHE'] = @usrcache
|
70
78
|
Gem.use_paths(@gemhome)
|
79
|
+
Gem.loaded_specs.clear
|
80
|
+
|
81
|
+
Gem.configuration.verbose = true
|
82
|
+
Gem.configuration.update_sources = true
|
83
|
+
|
84
|
+
@gem_repo = "http://gems.example.com"
|
85
|
+
Gem.sources.replace [@gem_repo]
|
86
|
+
|
87
|
+
@orig_arch = Config::CONFIG['arch']
|
88
|
+
|
89
|
+
if win_platform?
|
90
|
+
util_set_arch 'i386-mswin32'
|
91
|
+
else
|
92
|
+
util_set_arch 'i686-darwin8.10.1'
|
93
|
+
end
|
94
|
+
|
95
|
+
@marshal_version = "#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}"
|
71
96
|
end
|
72
97
|
|
73
98
|
def teardown
|
99
|
+
Config::CONFIG['arch'] = @orig_arch
|
100
|
+
|
74
101
|
if defined? Gem::RemoteFetcher then
|
75
102
|
Gem::RemoteFetcher.instance_variable_set :@fetcher, nil
|
76
103
|
end
|
77
104
|
|
78
105
|
FileUtils.rm_rf @tempdir
|
79
|
-
|
106
|
+
|
107
|
+
ENV.delete 'GEMCACHE'
|
108
|
+
ENV.delete 'GEM_HOME'
|
109
|
+
ENV.delete 'GEM_PATH'
|
110
|
+
|
80
111
|
Gem.clear_paths
|
81
112
|
Gem::SourceInfoCache.instance_variable_set :@cache, nil
|
82
113
|
end
|
83
114
|
|
115
|
+
def install_gem gem
|
116
|
+
require 'rubygems/installer'
|
117
|
+
|
118
|
+
use_ui MockGemUi.new do
|
119
|
+
Dir.chdir @tempdir do
|
120
|
+
Gem::Builder.new(gem).build
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
gem = File.join(@tempdir, "#{gem.full_name}.gem").untaint
|
125
|
+
Gem::Installer.new(gem).install
|
126
|
+
end
|
127
|
+
|
84
128
|
def prep_cache_files(lc)
|
85
129
|
[ [lc.system_cache_file, 'sys'],
|
86
130
|
[lc.user_cache_file, 'usr'],
|
87
131
|
].each do |fn, data|
|
88
|
-
FileUtils.mkdir_p File.dirname(fn)
|
89
|
-
open(fn, "wb") { |f| f.write(Marshal.dump({'key' => data})) }
|
132
|
+
FileUtils.mkdir_p File.dirname(fn).untaint
|
133
|
+
open(fn.dup.untaint, "wb") { |f| f.write(Marshal.dump({'key' => data})) }
|
90
134
|
end
|
91
135
|
end
|
92
136
|
|
93
137
|
def read_cache(fn)
|
94
|
-
open(fn) { |f| Marshal.load
|
138
|
+
open(fn.dup.untaint) { |f| Marshal.load f.read }
|
95
139
|
end
|
96
140
|
|
97
141
|
def write_file(path)
|
@@ -101,9 +145,12 @@ class RubyGemTestCase < Test::Unit::TestCase
|
|
101
145
|
File.open(path, "w") { |io|
|
102
146
|
yield(io)
|
103
147
|
}
|
148
|
+
path
|
104
149
|
end
|
105
150
|
|
106
151
|
def quick_gem(gemname, version='0.0.2')
|
152
|
+
require 'rubygems/specification'
|
153
|
+
|
107
154
|
spec = Gem::Specification.new do |s|
|
108
155
|
s.platform = Gem::Platform::RUBY
|
109
156
|
s.name = gemname
|
@@ -117,15 +164,85 @@ class RubyGemTestCase < Test::Unit::TestCase
|
|
117
164
|
yield(s) if block_given?
|
118
165
|
end
|
119
166
|
|
120
|
-
|
167
|
+
path = File.join "specifications", "#{spec.full_name}.gemspec"
|
168
|
+
written_path = write_file path do |io|
|
121
169
|
io.write(spec.to_ruby)
|
122
170
|
end
|
123
171
|
|
172
|
+
spec.loaded_from = written_path
|
173
|
+
|
124
174
|
return spec
|
125
175
|
end
|
126
176
|
|
177
|
+
def util_build_gem(spec)
|
178
|
+
dir = File.join(@gemhome, 'gems', spec.full_name)
|
179
|
+
FileUtils.mkdir_p dir
|
180
|
+
|
181
|
+
Dir.chdir dir do
|
182
|
+
spec.files.each do |file|
|
183
|
+
next if File.exist? file
|
184
|
+
FileUtils.mkdir_p File.dirname(file)
|
185
|
+
File.open file, 'w' do |fp| fp.puts "# #{file}" end
|
186
|
+
end
|
187
|
+
|
188
|
+
use_ui MockGemUi.new do
|
189
|
+
Gem::Builder.new(spec).build
|
190
|
+
end
|
191
|
+
|
192
|
+
FileUtils.mv "#{spec.full_name}.gem",
|
193
|
+
File.join(@gemhome, 'cache', "#{spec.original_name}.gem")
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
def util_make_gems
|
198
|
+
spec = proc do |s|
|
199
|
+
s.files = %w[lib/code.rb]
|
200
|
+
s.require_paths = %w[lib]
|
201
|
+
end
|
202
|
+
|
203
|
+
@a0_0_1 = quick_gem('a', '0.0.1', &spec)
|
204
|
+
@a0_0_2 = quick_gem('a', '0.0.2', &spec)
|
205
|
+
@b0_0_2 = quick_gem('b', '0.0.2', &spec)
|
206
|
+
@c1_2 = quick_gem('c', '1.2', &spec)
|
207
|
+
@pl1 = quick_gem 'pl', '1' do |s| # l for legacy
|
208
|
+
s.files = %w[lib/code.rb]
|
209
|
+
s.require_paths = %w[lib]
|
210
|
+
s.platform = Gem::Platform.new 'i386-linux'
|
211
|
+
s.instance_variable_set :@original_platform, 'i386-linux'
|
212
|
+
end
|
213
|
+
|
214
|
+
write_file File.join(*%W[gems #{@a0_0_1.original_name} lib code.rb]) do end
|
215
|
+
write_file File.join(*%W[gems #{@a0_0_2.original_name} lib code.rb]) do end
|
216
|
+
write_file File.join(*%W[gems #{@b0_0_2.original_name} lib code.rb]) do end
|
217
|
+
write_file File.join(*%W[gems #{@c1_2.original_name} lib code.rb]) do end
|
218
|
+
write_file File.join(*%W[gems #{@pl1.original_name} lib code.rb]) do end
|
219
|
+
|
220
|
+
[@a0_0_1, @a0_0_2, @b0_0_2, @c1_2, @pl1].each { |spec| util_build_gem spec }
|
221
|
+
|
222
|
+
FileUtils.rm_r File.join(@gemhome, 'gems', @pl1.original_name)
|
223
|
+
|
224
|
+
Gem.source_index = nil
|
225
|
+
end
|
226
|
+
|
227
|
+
##
|
228
|
+
# Set the platform to +cpu+ and +os+
|
229
|
+
|
230
|
+
def util_set_arch(arch)
|
231
|
+
Config::CONFIG['arch'] = arch
|
232
|
+
platform = Gem::Platform.new arch
|
233
|
+
|
234
|
+
Gem.instance_variable_set :@platforms, nil
|
235
|
+
Gem::Platform.instance_variable_set :@local, nil
|
236
|
+
|
237
|
+
platform
|
238
|
+
end
|
239
|
+
|
127
240
|
def util_setup_fake_fetcher
|
128
|
-
|
241
|
+
require 'zlib'
|
242
|
+
require 'socket'
|
243
|
+
require 'rubygems/remote_fetcher'
|
244
|
+
|
245
|
+
@uri = URI.parse @gem_repo
|
129
246
|
@fetcher = FakeFetcher.new
|
130
247
|
@fetcher.uri = @uri
|
131
248
|
|
@@ -146,6 +263,9 @@ class RubyGemTestCase < Test::Unit::TestCase
|
|
146
263
|
gem.files = %w[Rakefile lib/gem_one.rb]
|
147
264
|
end
|
148
265
|
|
266
|
+
@all_gems = [@gem1, @gem2, @gem3, @gem4].sort
|
267
|
+
@all_gem_names = @all_gems.map { |gem| gem.full_name }
|
268
|
+
|
149
269
|
gem_names = [@gem1.full_name, @gem2.full_name, @gem4.full_name]
|
150
270
|
@gem_names = gem_names.sort.join("\n")
|
151
271
|
|
@@ -157,12 +277,14 @@ class RubyGemTestCase < Test::Unit::TestCase
|
|
157
277
|
end
|
158
278
|
|
159
279
|
def util_setup_source_info_cache(*specs)
|
280
|
+
require 'rubygems/source_info_cache_entry'
|
281
|
+
|
160
282
|
specs = Hash[*specs.map { |spec| [spec.full_name, spec] }.flatten]
|
161
283
|
si = Gem::SourceIndex.new specs
|
162
284
|
|
163
285
|
sice = Gem::SourceInfoCacheEntry.new si, 0
|
164
286
|
sic = Gem::SourceInfoCache.new
|
165
|
-
sic.set_cache_data( {
|
287
|
+
sic.set_cache_data( { @gem_repo => sice } )
|
166
288
|
Gem::SourceInfoCache.instance_variable_set :@cache, sic
|
167
289
|
si
|
168
290
|
end
|
@@ -171,13 +293,12 @@ class RubyGemTestCase < Test::Unit::TestCase
|
|
171
293
|
Zlib::Deflate.deflate data
|
172
294
|
end
|
173
295
|
|
174
|
-
|
296
|
+
def self.win_platform?
|
297
|
+
Gem.win_platform?
|
298
|
+
end
|
299
|
+
|
175
300
|
def win_platform?
|
176
|
-
|
177
|
-
patterns = [/mswin/i, /mingw/i, /bccwin/i, /wince/i]
|
178
|
-
@@win_platform = patterns.find{|r| RUBY_PLATFORM =~ r} ? true : false
|
179
|
-
end
|
180
|
-
@@win_platform
|
301
|
+
Gem.win_platform?
|
181
302
|
end
|
182
303
|
|
183
304
|
end
|