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
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'stringio'
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
require 'rubygems/user_interaction'
|
6
|
-
|
7
|
-
class TestStreamUI < Test::Unit::TestCase
|
8
|
-
|
9
|
-
def setup
|
10
|
-
Gem.send :instance_variable_set, :@configuration, nil
|
11
|
-
@cfg = Gem.configuration
|
12
|
-
|
13
|
-
@in = StringIO.new
|
14
|
-
@out = StringIO.new
|
15
|
-
@err = StringIO.new
|
16
|
-
|
17
|
-
@sui = Gem::StreamUI.new @in, @out, @err
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_proress_reporter_silent_nil
|
21
|
-
@cfg[:verbose] = nil
|
22
|
-
reporter = @sui.progress_reporter 10, 'hi'
|
23
|
-
assert_kind_of Gem::StreamUI::SilentProgressReporter, reporter
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_proress_reporter_silent_false
|
27
|
-
@cfg[:verbose] = false
|
28
|
-
reporter = @sui.progress_reporter 10, 'hi'
|
29
|
-
assert_kind_of Gem::StreamUI::SilentProgressReporter, reporter
|
30
|
-
assert_equal "", @out.string
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_proress_reporter_simple
|
34
|
-
@cfg[:verbose] = true
|
35
|
-
reporter = @sui.progress_reporter 10, 'hi'
|
36
|
-
assert_kind_of Gem::StreamUI::SimpleProgressReporter, reporter
|
37
|
-
assert_equal "hi\n", @out.string
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_proress_reporter_verbose
|
41
|
-
@cfg[:verbose] = 0
|
42
|
-
reporter = @sui.progress_reporter 10, 'hi'
|
43
|
-
assert_kind_of Gem::StreamUI::VerboseProgressReporter, reporter
|
44
|
-
assert_equal "hi\n", @out.string
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
|
data/test/test_validator.rb
DELETED
@@ -1,59 +0,0 @@
|
|
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 'rubygems'
|
9
|
-
Gem::manage_gems
|
10
|
-
require "test/simple_gem"
|
11
|
-
|
12
|
-
class TestValidator < Test::Unit::TestCase
|
13
|
-
def test_missing_gem_throws_error
|
14
|
-
assert_raises(Gem::VerificationError) {
|
15
|
-
Gem::Validator.new.verify_gem_file("")
|
16
|
-
}
|
17
|
-
assert_raises(Gem::VerificationError) {
|
18
|
-
Gem::Validator.new.verify_gem_file("/this/path/will/almost/definitely/not/exist.gem")
|
19
|
-
}
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_invalid_gem_throws_error
|
23
|
-
assert_raises(Gem::VerificationError) {
|
24
|
-
Gem::Validator.new.verify_gem("")
|
25
|
-
}
|
26
|
-
assert_raises(Gem::VerificationError) {
|
27
|
-
Gem::Validator.new.verify_gem(@simple_gem.upcase)
|
28
|
-
}
|
29
|
-
|
30
|
-
# TODO: Since the new format does not support MD5 checking, the
|
31
|
-
# following code will not throw an exception. So we disable this
|
32
|
-
# assertion for now.
|
33
|
-
# assert_raises(Gem::VerificationError) {
|
34
|
-
# Gem::Validator.new.verify_gem(@simple_gem.reverse)
|
35
|
-
# }
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_simple_valid_gem_verifies
|
39
|
-
assert_nothing_raised {
|
40
|
-
Gem::Validator.new.verify_gem(@simple_gem)
|
41
|
-
}
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_truncated_simple_valid_gem_fails
|
45
|
-
assert_raises(Gem::VerificationError) {
|
46
|
-
Gem::Validator.new.verify_gem(@simple_gem.chop)
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_invalid_checksum_fails_appropriately
|
51
|
-
assert_raises(Gem::VerificationError) {
|
52
|
-
Gem::Validator.new.verify_gem(@simple_gem.sub(/MD5SUM.*=.*/, 'MD5SUM = "foo"'))
|
53
|
-
}
|
54
|
-
end
|
55
|
-
|
56
|
-
def setup
|
57
|
-
@simple_gem = SIMPLE_GEM
|
58
|
-
end
|
59
|
-
end
|
@@ -1,321 +0,0 @@
|
|
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 'rubygems'
|
9
|
-
Gem::manage_gems
|
10
|
-
|
11
|
-
module VersionAsserts
|
12
|
-
def assert_adequate(version, requirement)
|
13
|
-
ver = Gem::Version.new(version)
|
14
|
-
req = Gem::Version::Requirement.new(requirement)
|
15
|
-
assert req.satisfied_by?(ver),
|
16
|
-
"Version #{version} should be adequate for Requirement #{requirement}"
|
17
|
-
end
|
18
|
-
|
19
|
-
def assert_inadequate(version, requirement)
|
20
|
-
ver = Gem::Version.new(version)
|
21
|
-
req = Gem::Version::Requirement.new(requirement)
|
22
|
-
assert ! req.satisfied_by?(ver),
|
23
|
-
"Version #{version} should not be adequate for Requirement #{requirement}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
class Versions < Test::Unit::TestCase
|
29
|
-
include VersionAsserts
|
30
|
-
|
31
|
-
def test_ok
|
32
|
-
assert_adequate( "0.2.33", "= 0.2.33")
|
33
|
-
assert_adequate( "0.2.34", "> 0.2.33")
|
34
|
-
assert_adequate( "1.0", "= 1.0")
|
35
|
-
assert_adequate( "1.0", "1.0")
|
36
|
-
assert_adequate( "1.8.2", "> 1.8.0")
|
37
|
-
assert_adequate( "1.112", "> 1.111")
|
38
|
-
assert_adequate( "0.2", "> 0.0.0")
|
39
|
-
assert_adequate( "0.0.0.0.0.2", "> 0.0.0")
|
40
|
-
assert_adequate( "0.0.1.0", "> 0.0.0.1")
|
41
|
-
assert_adequate( "10.3.2", "> 9.3.2")
|
42
|
-
assert_adequate( "1.0.0.0", "= 1.0")
|
43
|
-
assert_adequate( "10.3.2", "!= 9.3.4")
|
44
|
-
assert_adequate( "10.3.2", "> 9.3.2")
|
45
|
-
assert_adequate( "10.3.2", "> 9.3.2")
|
46
|
-
assert_adequate( " 9.3.2", ">= 9.3.2")
|
47
|
-
assert_adequate( "9.3.2 ", ">= 9.3.2")
|
48
|
-
assert_adequate( "", "= 0")
|
49
|
-
assert_adequate( "", "< 0.1")
|
50
|
-
assert_adequate( " ", "< 0.1 ")
|
51
|
-
assert_adequate( "", " < 0.1")
|
52
|
-
assert_adequate( "0", "=")
|
53
|
-
assert_adequate( "0", ">=")
|
54
|
-
assert_adequate( "0", "<=")
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_bad
|
58
|
-
assert_inadequate( "", "> 0.1")
|
59
|
-
assert_inadequate( "1.2.3", "!= 1.2.3")
|
60
|
-
assert_inadequate( "1.2.003.0.0", "!= 1.02.3")
|
61
|
-
assert_inadequate( "4.5.6", "< 1.2.3")
|
62
|
-
assert_inadequate( "1.0", "> 1.1")
|
63
|
-
assert_inadequate( "0", ">")
|
64
|
-
assert_inadequate( "0", "<")
|
65
|
-
assert_inadequate( "", "= 0.1")
|
66
|
-
assert_inadequate( "1.1.1", "> 1.1.1")
|
67
|
-
assert_inadequate( "1.2", "= 1.1")
|
68
|
-
assert_inadequate( "1.40", "= 1.1")
|
69
|
-
assert_inadequate( "1.3", "= 1.40")
|
70
|
-
assert_inadequate( "9.3.3", "<= 9.3.2")
|
71
|
-
assert_inadequate( "9.3.1", ">= 9.3.2")
|
72
|
-
assert_inadequate( "9.3.03", "<= 9.3.2")
|
73
|
-
assert_inadequate( "1.0.0.1", "= 1.0")
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_illformed_version
|
77
|
-
[ "blah", "1.3.a", "1.3.5." ].each do |wn|
|
78
|
-
assert_raises(ArgumentError) { Gem::Version.new(wn) }
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_illformed_requirements
|
83
|
-
[ ">>> 1.3.5", "> blah" ].each do |rq|
|
84
|
-
assert_raises(ArgumentError, "req [#{rq}] should fail") {
|
85
|
-
Gem::Version::Requirement.new(rq)
|
86
|
-
}
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
class TestVersion < Test::Unit::TestCase
|
92
|
-
def test_to_s
|
93
|
-
v = Gem::Version.new("5.2.4")
|
94
|
-
assert_equal "5.2.4", v.to_s
|
95
|
-
end
|
96
|
-
def test_bump
|
97
|
-
v = Gem::Version.new("5.2.4")
|
98
|
-
assert_equal "5.3", v.bump.to_s
|
99
|
-
end
|
100
|
-
def test_bump_one_level
|
101
|
-
v = Gem::Version.new("5")
|
102
|
-
assert_equal "6", v.bump.to_s
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
class TestVersionEquality < Test::Unit::TestCase
|
107
|
-
def test_same_versions_are_equal
|
108
|
-
v = Gem::Version.new("1.2")
|
109
|
-
u = Gem::Version.new("1.2")
|
110
|
-
assert v == u
|
111
|
-
assert u == v
|
112
|
-
end
|
113
|
-
|
114
|
-
def test_same_versions_have_same_hash
|
115
|
-
v = Gem::Version.new("1.2")
|
116
|
-
u = Gem::Version.new("1.2")
|
117
|
-
assert_equal v.hash, u.hash
|
118
|
-
end
|
119
|
-
|
120
|
-
def test_different_versions_are_not_equal
|
121
|
-
v = Gem::Version.new("1.2")
|
122
|
-
u = Gem::Version.new("1.3")
|
123
|
-
assert v != u
|
124
|
-
assert u != v
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_difference3_versions_have_different_hash
|
128
|
-
v = Gem::Version.new("1.2")
|
129
|
-
u = Gem::Version.new("1.3")
|
130
|
-
assert_not_equal v.hash, u.hash
|
131
|
-
end
|
132
|
-
|
133
|
-
end
|
134
|
-
|
135
|
-
class TestExtendedVersionComparisons < Test::Unit::TestCase
|
136
|
-
include VersionAsserts
|
137
|
-
|
138
|
-
def test_multiple
|
139
|
-
req = [">= 1.4", "<= 1.6", "!= 1.5"]
|
140
|
-
assert_inadequate("1.3", req)
|
141
|
-
assert_adequate( "1.4", req)
|
142
|
-
assert_inadequate("1.5", req)
|
143
|
-
assert_adequate( "1.6", req)
|
144
|
-
assert_inadequate("1.7", req)
|
145
|
-
assert_inadequate("2.0", req)
|
146
|
-
end
|
147
|
-
|
148
|
-
def test_boxed
|
149
|
-
assert_inadequate("1.3", "~> 1.4")
|
150
|
-
assert_adequate( "1.4", "~> 1.4")
|
151
|
-
assert_adequate( "1.5", "~> 1.4")
|
152
|
-
assert_inadequate("2.0", "~> 1.4")
|
153
|
-
end
|
154
|
-
|
155
|
-
end
|
156
|
-
|
157
|
-
class TestDependencies < Test::Unit::TestCase
|
158
|
-
def test_create
|
159
|
-
dep = Gem::Dependency.new("pkg", ["> 1.0"])
|
160
|
-
assert_equal "pkg", dep.name
|
161
|
-
assert_equal Gem::Version::Requirement.new(["> 1.0"]), dep.version_requirements
|
162
|
-
end
|
163
|
-
|
164
|
-
def test_create_single
|
165
|
-
dep = Gem::Dependency.new("pkg", "> 1.0")
|
166
|
-
assert_equal Gem::Version::Requirement.new(["> 1.0"]), dep.version_requirements
|
167
|
-
end
|
168
|
-
|
169
|
-
def test_create_double
|
170
|
-
dep = Gem::Dependency.new("pkg", ["> 1.0", "< 2.0"])
|
171
|
-
assert_equal Gem::Version::Requirement.new(["> 1.0", "< 2.0"]), dep.version_requirements
|
172
|
-
end
|
173
|
-
|
174
|
-
def test_create_wacked
|
175
|
-
require 'yaml'
|
176
|
-
dep = Gem::Dependency.new("pkg", [])
|
177
|
-
old_req = Gem::Version::Requirement.new(["> 1.0"])
|
178
|
-
old_req.instance_eval do
|
179
|
-
@version = ">= 1.0"
|
180
|
-
@op = ">="
|
181
|
-
@nums = [1,0]
|
182
|
-
@requirements = nil
|
183
|
-
end
|
184
|
-
dep.instance_eval do
|
185
|
-
@version_requirement = old_req
|
186
|
-
@version_requirements = nil
|
187
|
-
end
|
188
|
-
assert_equal Gem::Version::Requirement.new([">= 1.0"]), dep.version_requirements
|
189
|
-
end
|
190
|
-
|
191
|
-
def test_create_from_string
|
192
|
-
req = Gem::Version::Requirement.create(">1")
|
193
|
-
assert ! req.satisfied_by?(Gem::Version.new("1.0"))
|
194
|
-
assert req.satisfied_by?(Gem::Version.new("1.1"))
|
195
|
-
end
|
196
|
-
|
197
|
-
def test_create_from_string_equal
|
198
|
-
req = Gem::Version::Requirement.create("1.3")
|
199
|
-
assert ! req.satisfied_by?(Gem::Version.new("1.0"))
|
200
|
-
assert req.satisfied_by?(Gem::Version.new("1.3"))
|
201
|
-
end
|
202
|
-
|
203
|
-
def test_create_from_requirement
|
204
|
-
req = Gem::Version::Requirement.create(Gem::Version::Requirement.new("1.3"))
|
205
|
-
assert ! req.satisfied_by?(Gem::Version.new("1.0"))
|
206
|
-
assert req.satisfied_by?(Gem::Version.new("1.3"))
|
207
|
-
end
|
208
|
-
|
209
|
-
def test_compare_to_nil
|
210
|
-
assert(Gem::Version.new("0.0") > nil)
|
211
|
-
req = Gem::Version::Requirement.create("1.3")
|
212
|
-
assert ! req.satisfied_by?(nil)
|
213
|
-
end
|
214
|
-
|
215
|
-
def test_create_from_list
|
216
|
-
req = Gem::Version::Requirement.create([">1", "<2"])
|
217
|
-
assert ! req.satisfied_by?(Gem::Version.new("1.0"))
|
218
|
-
assert ! req.satisfied_by?(Gem::Version.new("2.0"))
|
219
|
-
assert req.satisfied_by?(Gem::Version.new("1.3"))
|
220
|
-
end
|
221
|
-
|
222
|
-
# We may get some old gems that have requirements in old formats.
|
223
|
-
# We need to be able to handle those old requirements by normalizing
|
224
|
-
# them to the latest format.
|
225
|
-
def test_normalization
|
226
|
-
require 'yaml'
|
227
|
-
yamldep = %{--- !ruby/object:Gem::Version::Requirement
|
228
|
-
nums:
|
229
|
-
- 1
|
230
|
-
- 0
|
231
|
-
- 4
|
232
|
-
op: ">="
|
233
|
-
version: ">= 1.0.4"}
|
234
|
-
dep = YAML.load(yamldep)
|
235
|
-
dep.normalize
|
236
|
-
assert_equal ">= 1.0.4", dep.to_s
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
|
-
class TestDependencyEquality < Test::Unit::TestCase
|
241
|
-
def test_same_dependencies_are_equal
|
242
|
-
d = Gem::Dependency.new("sample", "= 1.2.3")
|
243
|
-
e = Gem::Dependency.new("sample", "= 1.2.3")
|
244
|
-
assert d == e
|
245
|
-
assert e == d
|
246
|
-
end
|
247
|
-
|
248
|
-
def test_same_dependencies_have_save_hash_codes
|
249
|
-
d = Gem::Dependency.new("sample", "= 1.2.3")
|
250
|
-
e = Gem::Dependency.new("sample", "= 1.2.3")
|
251
|
-
assert_equal d.hash, e.hash
|
252
|
-
end
|
253
|
-
|
254
|
-
def test_different_with_different_versions_are_not_equal
|
255
|
-
d = Gem::Dependency.new("sample", "= 1.2.3")
|
256
|
-
e = Gem::Dependency.new("sample", "= 1.2.4")
|
257
|
-
assert d != e
|
258
|
-
assert e != d
|
259
|
-
end
|
260
|
-
|
261
|
-
def test_dependencies_with_different_names_are_not_equal
|
262
|
-
d = Gem::Dependency.new("sample", "= 1.2.3")
|
263
|
-
e = Gem::Dependency.new("example", "= 1.2.3")
|
264
|
-
assert d != e
|
265
|
-
assert e != d
|
266
|
-
end
|
267
|
-
|
268
|
-
def test_dependencies_with_different_versions_have_different_hash_codes
|
269
|
-
d = Gem::Dependency.new("sample", "= 1.2.3")
|
270
|
-
e = Gem::Dependency.new("sample", "= 1.2.4")
|
271
|
-
assert_not_equal d.hash, e.hash
|
272
|
-
end
|
273
|
-
|
274
|
-
def test_dependencies_with_different_names_have_different_hash_codes
|
275
|
-
d = Gem::Dependency.new("sample", "= 1.2.3")
|
276
|
-
e = Gem::Dependency.new("example", "= 1.2.3")
|
277
|
-
assert_not_equal d.hash, e.hash
|
278
|
-
end
|
279
|
-
|
280
|
-
def test_dependencies_can_be_compared_to_non_dependencies
|
281
|
-
d = Gem::Dependency.new("sample", "= 1.2.3")
|
282
|
-
obj = Object.new
|
283
|
-
assert d != obj
|
284
|
-
assert obj != d
|
285
|
-
end
|
286
|
-
end
|
287
|
-
|
288
|
-
class TestRequirementEquality < Test::Unit::TestCase
|
289
|
-
def test_same_requirements_are_equal
|
290
|
-
r = Gem::Requirement.new("= 1.2")
|
291
|
-
p = Gem::Requirement.new("= 1.2")
|
292
|
-
assert r == p
|
293
|
-
assert p == r
|
294
|
-
end
|
295
|
-
|
296
|
-
def test_same_requirements_have_same_hash_code
|
297
|
-
r = Gem::Requirement.new("= 1.2")
|
298
|
-
p = Gem::Requirement.new("= 1.2")
|
299
|
-
assert_equal r.hash, p.hash
|
300
|
-
end
|
301
|
-
|
302
|
-
def test_different_requirements_are_not_equal
|
303
|
-
r = Gem::Requirement.new("= 1.2")
|
304
|
-
p = Gem::Requirement.new("< 1.2")
|
305
|
-
assert r != p
|
306
|
-
assert p != r
|
307
|
-
end
|
308
|
-
|
309
|
-
def test_different_requirements_have_different_hash_codes
|
310
|
-
r = Gem::Requirement.new("= 1.2")
|
311
|
-
p = Gem::Requirement.new("< 1.2")
|
312
|
-
assert_not_equal r.hash, p.hash
|
313
|
-
end
|
314
|
-
|
315
|
-
def test_requirements_can_be_compared_to_non_requirements
|
316
|
-
r = Gem::Requirement.new("= 1.2")
|
317
|
-
obj = Object.new
|
318
|
-
assert r != obj
|
319
|
-
assert obj != r
|
320
|
-
end
|
321
|
-
end
|
data/test/testgem.rc
DELETED
data/test/user_capture.rb
DELETED
data/test/yaml_data.rb
DELETED
@@ -1,63 +0,0 @@
|
|
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 'yaml'
|
8
|
-
require 'rubygems'
|
9
|
-
require 'rubygems/source_index'
|
10
|
-
require 'rubygems/remote_installer'
|
11
|
-
|
12
|
-
YAML_DATA = <<EOS
|
13
|
-
--- !ruby/object:Gem::Cache
|
14
|
-
gems:
|
15
|
-
rake-0.4.11: !ruby/object:Gem::Specification
|
16
|
-
rubygems_version: "0.7"
|
17
|
-
specification_version: 1
|
18
|
-
name: rake
|
19
|
-
version: !ruby/object:Gem::Version
|
20
|
-
version: 0.4.11
|
21
|
-
date: 2004-11-12
|
22
|
-
summary: Ruby based make-like utility.
|
23
|
-
require_paths:
|
24
|
-
- lib
|
25
|
-
author: Jim Weirich
|
26
|
-
email: jim@weirichhouse.org
|
27
|
-
homepage: http://rake.rubyforge.org
|
28
|
-
rubyforge_project: rake
|
29
|
-
description: Rake is a Make-like program implemented in Ruby. Tasks and dependencies are specified in standard Ruby syntax.
|
30
|
-
autorequire:
|
31
|
-
default_executable: rake
|
32
|
-
bindir: bin
|
33
|
-
has_rdoc: true
|
34
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
35
|
-
requirements:
|
36
|
-
-
|
37
|
-
- ">"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: 0.0.0
|
40
|
-
version:
|
41
|
-
platform: ruby
|
42
|
-
files:
|
43
|
-
- README
|
44
|
-
test_files: []
|
45
|
-
library_stubs:
|
46
|
-
rdoc_options:
|
47
|
-
extra_rdoc_files:
|
48
|
-
executables:
|
49
|
-
- rake
|
50
|
-
extensions: []
|
51
|
-
requirements: []
|
52
|
-
dependencies: []
|
53
|
-
EOS
|
54
|
-
|
55
|
-
PROXY_DATA = YAML_DATA.gsub(/0.4.11/, '0.4.2')
|
56
|
-
|
57
|
-
def cache_hash(*uris)
|
58
|
-
result = Hash.new
|
59
|
-
uris.each do |uri|
|
60
|
-
result[uri] = Gem::SourceInfoCacheEntry.new(YAML.load(YAML_DATA), YAML_DATA.size)
|
61
|
-
end
|
62
|
-
result
|
63
|
-
end
|