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/gemenvironment.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# Create a test environment for gems.
|
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
|
-
$SAFE = 1
|
10
|
-
|
11
|
-
require 'rubygems'
|
12
|
-
require 'rubygems/installer'
|
13
|
-
require 'rubygems/builder'
|
14
|
-
require 'test/mockgemui'
|
15
|
-
require 'rake'
|
16
|
-
|
17
|
-
module TestEnvironment
|
18
|
-
include Gem::DefaultUserInteraction
|
19
|
-
|
20
|
-
# Create a testing environment for gems.
|
21
|
-
def create
|
22
|
-
Dir.chdir("test/data") do
|
23
|
-
mkdir "lib" unless File.exists? "lib"
|
24
|
-
open("lib/code.rb", "w") do |f|
|
25
|
-
f.puts "CODE = 1"
|
26
|
-
end unless File.exists? "lib/code.rb"
|
27
|
-
|
28
|
-
spec = Gem::Specification.new do |s|
|
29
|
-
s.files = ['lib/code.rb']
|
30
|
-
s.name = "a"
|
31
|
-
s.version = "0.0.1"
|
32
|
-
s.summary = "summary"
|
33
|
-
s.description = "desc"
|
34
|
-
s.require_path = 'lib'
|
35
|
-
end
|
36
|
-
|
37
|
-
use_ui(MockGemUi.new) do
|
38
|
-
Gem::Builder.new(spec).build
|
39
|
-
spec.version = "0.0.2"
|
40
|
-
Gem::Builder.new(spec).build
|
41
|
-
spec.name = 'b'
|
42
|
-
Gem::Builder.new(spec).build
|
43
|
-
spec.name = 'c'
|
44
|
-
spec.version = '1.2'
|
45
|
-
Gem::Builder.new(spec).build
|
46
|
-
FileUtils.rm_rf "gemhome"
|
47
|
-
FileUtils.mkdir("gemhome")
|
48
|
-
dest_dir = File.expand_path 'gemhome'
|
49
|
-
dest_dir.untaint
|
50
|
-
Gem::Installer.new("a-0.0.1.gem").install(false, dest_dir, false)
|
51
|
-
Gem::Installer.new("a-0.0.2.gem").install(false, dest_dir, false)
|
52
|
-
Gem::Installer.new("b-0.0.2.gem").install(false, dest_dir, false)
|
53
|
-
Gem::Installer.new("c-1.2.gem").install(false, dest_dir, false)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
extend(self)
|
59
|
-
end
|
data/test/io_capture.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'stringio'
|
4
|
-
|
5
|
-
module Gem
|
6
|
-
module IoCapture
|
7
|
-
|
8
|
-
# Return output to $stdout during block execution as a string.
|
9
|
-
def capture_stdout
|
10
|
-
old_stdout = $stdout
|
11
|
-
sio = StringIO.new
|
12
|
-
$stdout = sio
|
13
|
-
yield
|
14
|
-
sio.string
|
15
|
-
ensure
|
16
|
-
$stdout = old_stdout
|
17
|
-
end
|
18
|
-
private :capture_stdout
|
19
|
-
|
20
|
-
# Return output to $stderr during block execution as a string.
|
21
|
-
def capture_stderr
|
22
|
-
old_stderr = $stderr
|
23
|
-
sio = StringIO.new
|
24
|
-
$stderr = sio
|
25
|
-
yield
|
26
|
-
sio.string
|
27
|
-
ensure
|
28
|
-
$stderr = old_stderr
|
29
|
-
end
|
30
|
-
private :capture_stderr
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
data/test/onegem.rb
DELETED
@@ -1,35 +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
|
-
module OneGem
|
8
|
-
|
9
|
-
ONEDIR = "test/data/one"
|
10
|
-
ONENAME = "one-0.0.1.gem"
|
11
|
-
ONEGEM = "#{ONEDIR}/#{ONENAME}"
|
12
|
-
|
13
|
-
def clear
|
14
|
-
FileUtils.rm_f ONEGEM
|
15
|
-
end
|
16
|
-
|
17
|
-
def make(controller)
|
18
|
-
unless File.exist?(ONEGEM)
|
19
|
-
build(controller)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def build(controller)
|
24
|
-
Dir.chdir(ONEDIR) do
|
25
|
-
controller.gem "build one.gemspec"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def rebuild(controller)
|
30
|
-
clear
|
31
|
-
build(controller)
|
32
|
-
end
|
33
|
-
|
34
|
-
extend self
|
35
|
-
end
|
data/test/test_builder.rb
DELETED
@@ -1,34 +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/mockgemui'
|
11
|
-
|
12
|
-
class TestBuilder < Test::Unit::TestCase
|
13
|
-
def setup
|
14
|
-
@ui = MockGemUi.new
|
15
|
-
Gem::DefaultUserInteraction.ui = @ui
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_valid_specification_builds_successfully
|
19
|
-
spec = Gem::Specification.load(File.join(File.dirname(__FILE__), '/data/post_install.gemspec'))
|
20
|
-
builder = Gem::Builder.new(spec)
|
21
|
-
assert_nothing_raised {
|
22
|
-
builder.build
|
23
|
-
}
|
24
|
-
assert_match(/Successfully built RubyGem\n Name: PostMessage/, @ui.output)
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_invalid_spec_does_not_build
|
28
|
-
spec = Gem::Specification.new
|
29
|
-
builder = Gem::Builder.new(spec)
|
30
|
-
assert_raises(Gem::InvalidSpecificationException) {
|
31
|
-
builder.build
|
32
|
-
}
|
33
|
-
end
|
34
|
-
end
|
data/test/test_check_command.rb
DELETED
@@ -1,34 +0,0 @@
|
|
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 'rubygems/command_manager'
|
11
|
-
require 'rubygems/user_interaction'
|
12
|
-
require 'test/mockgemui'
|
13
|
-
|
14
|
-
class TestCheckCommand < Test::Unit::TestCase
|
15
|
-
include Gem::DefaultUserInteraction
|
16
|
-
|
17
|
-
def setup
|
18
|
-
@cm = Gem::CommandManager.new
|
19
|
-
@cmd = @cm['check']
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_create
|
23
|
-
assert_equal "check", @cmd.command
|
24
|
-
assert_equal "gem check", @cmd.program_name
|
25
|
-
assert_match(/Check/, @cmd.summary)
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_invoke_help
|
29
|
-
use_ui(MockGemUi.new) do
|
30
|
-
assert ! @cmd.invoke('--help')
|
31
|
-
assert_match(/Usage:/, ui.output)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
data/test/test_configfile.rb
DELETED
@@ -1,42 +0,0 @@
|
|
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 'rubygems/config_file'
|
11
|
-
|
12
|
-
class TestArgPreprocessor < Test::Unit::TestCase
|
13
|
-
def setup
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_create
|
17
|
-
@cfg = Gem::ConfigFile.new([])
|
18
|
-
assert ! @cfg.backtrace
|
19
|
-
assert_equal File.join(Gem.user_home, '.gemrc'), @cfg.config_file_name
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_backtrace
|
23
|
-
args = %w(--this --that --backtrace --other stuff)
|
24
|
-
@cfg = Gem::ConfigFile.new(args)
|
25
|
-
assert @cfg.backtrace
|
26
|
-
assert_equal %w(--this --that --other stuff), @cfg.args
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_config_file
|
30
|
-
args = %w(--this --that --config-file test/testgem.rc --other stuff)
|
31
|
-
@cfg = Gem::ConfigFile.new(args)
|
32
|
-
assert_equal 'test/testgem.rc', @cfg.config_file_name
|
33
|
-
assert_equal %w(--this --that --other stuff), @cfg.args
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_config_file2
|
37
|
-
args = %w(--this --that --config-file=test/testgem.rc --other stuff)
|
38
|
-
@cfg = Gem::ConfigFile.new(args)
|
39
|
-
assert_equal 'test/testgem.rc', @cfg.config_file_name
|
40
|
-
assert_equal %w(--this --that --other stuff), @cfg.args
|
41
|
-
end
|
42
|
-
end
|
@@ -1,169 +0,0 @@
|
|
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 'rubygems/dependency_list'
|
11
|
-
require 'rubygems/specification'
|
12
|
-
|
13
|
-
class TestDependencyList < Test::Unit::TestCase
|
14
|
-
def setup
|
15
|
-
@deplist = Gem::DependencyList.new
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_create
|
19
|
-
assert @deplist.ok?, "all dependencies should be satisfied"
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_one_unsatisfied_gem
|
23
|
-
@deplist.add(bspec)
|
24
|
-
assert ! @deplist.ok?
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_one_satisfied_gem
|
28
|
-
@deplist.add(create_spec("a", "1.1"))
|
29
|
-
assert @deplist.ok?
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_two_gems_with_dependency
|
33
|
-
@deplist.add(create_spec("a", "1.1"))
|
34
|
-
@deplist.add(bspec)
|
35
|
-
assert @deplist.ok?
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_removing_required_gem
|
39
|
-
@deplist.add(create_spec("a", "1.1"))
|
40
|
-
@deplist.add(bspec)
|
41
|
-
a = @deplist.remove_by_name("a-1.1")
|
42
|
-
assert ! @deplist.ok?
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_removing_redundent_gem
|
46
|
-
@deplist.add(create_spec("a", "1.1"))
|
47
|
-
@deplist.add(create_spec("a", "1.3"))
|
48
|
-
@deplist.add(bspec)
|
49
|
-
a = @deplist.remove_by_name("a-1.1")
|
50
|
-
assert @deplist.ok?
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_finding_gems
|
54
|
-
@deplist.add(create_spec("a", "1.1"))
|
55
|
-
@deplist.add(bspec)
|
56
|
-
assert_equal "a-1.1", @deplist.find_name("a-1.1").full_name
|
57
|
-
assert_equal "b-1.2", @deplist.find_name("b-1.2").full_name
|
58
|
-
assert_nil @deplist.find_name("c-1.2")
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_ok_to_remove
|
62
|
-
@deplist.add(create_spec("a", "1.1"))
|
63
|
-
assert @deplist.ok_to_remove?("a-1.1")
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_not_ok_to_remove
|
67
|
-
@deplist.add(create_spec("a", "1.1"))
|
68
|
-
@deplist.add(bspec)
|
69
|
-
assert ! @deplist.ok_to_remove?("a-1.1")
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_ok_to_remove_with_extras
|
73
|
-
@deplist.add(create_spec("a", "1.1"))
|
74
|
-
@deplist.add(create_spec("a", "1.2"))
|
75
|
-
@deplist.add(bspec)
|
76
|
-
assert @deplist.ok_to_remove?("a-1.1")
|
77
|
-
assert @deplist.ok_to_remove?("a-1.2")
|
78
|
-
assert @deplist.ok_to_remove?("b-1.2")
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_not_ok_to_remove_after_sibling_removed
|
82
|
-
@deplist.add(create_spec("a", "1.1"))
|
83
|
-
@deplist.add(create_spec("a", "1.2"))
|
84
|
-
@deplist.add(bspec)
|
85
|
-
assert @deplist.ok_to_remove?("a-1.1")
|
86
|
-
assert @deplist.ok_to_remove?("a-1.2")
|
87
|
-
@deplist.remove_by_name("a-1.1")
|
88
|
-
assert ! @deplist.ok_to_remove?("a-1.2")
|
89
|
-
end
|
90
|
-
|
91
|
-
def test_sorting
|
92
|
-
@deplist.add(create_spec("a", "1.1"))
|
93
|
-
@deplist.add(bspec)
|
94
|
-
@deplist.add(create_spec("a", "1.3"))
|
95
|
-
order = @deplist.dependency_order
|
96
|
-
assert_equal "b-1.2", order.first.full_name
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_sorting_four_with_out_ambiguities
|
100
|
-
@deplist.add(Gem::Specification.new do |s|
|
101
|
-
s.name = "a"
|
102
|
-
s.version = '1.1'
|
103
|
-
end)
|
104
|
-
@deplist.add(Gem::Specification.new do |s|
|
105
|
-
s.name = "b"
|
106
|
-
s.version = '1.1'
|
107
|
-
s.add_dependency("a", ">= 1.1")
|
108
|
-
end)
|
109
|
-
@deplist.add(Gem::Specification.new do |s|
|
110
|
-
s.name = "c"
|
111
|
-
s.version = '1.1'
|
112
|
-
s.add_dependency("b", ">= 1.1")
|
113
|
-
end)
|
114
|
-
@deplist.add(Gem::Specification.new do |s|
|
115
|
-
s.name = "d"
|
116
|
-
s.version = '1.1'
|
117
|
-
s.add_dependency("c", ">= 1.1")
|
118
|
-
end)
|
119
|
-
order = @deplist.dependency_order
|
120
|
-
assert_equal ['d', 'c', 'b', 'a'], order.collect { |s| s.name }
|
121
|
-
end
|
122
|
-
|
123
|
-
def test_sorting_with_circular_dependency
|
124
|
-
@deplist.add(Gem::Specification.new do |s|
|
125
|
-
s.name = "a"
|
126
|
-
s.version = '1.1'
|
127
|
-
s.add_dependency("c", ">= 1.1")
|
128
|
-
end)
|
129
|
-
@deplist.add(Gem::Specification.new do |s|
|
130
|
-
s.name = "b"
|
131
|
-
s.version = '1.1'
|
132
|
-
s.add_dependency("a", ">= 1.1")
|
133
|
-
end)
|
134
|
-
@deplist.add(Gem::Specification.new do |s|
|
135
|
-
s.name = "c"
|
136
|
-
s.version = '1.1'
|
137
|
-
s.add_dependency("b", ">= 1.1")
|
138
|
-
end)
|
139
|
-
order = @deplist.dependency_order
|
140
|
-
end
|
141
|
-
|
142
|
-
def test_from_source_index
|
143
|
-
hash = {
|
144
|
-
'a-1.1' => create_spec("a", "1.1"),
|
145
|
-
'b-1.2' => bspec,
|
146
|
-
}
|
147
|
-
si = Gem::SourceIndex.new(hash)
|
148
|
-
deps = Gem::DependencyList.from_source_index(si)
|
149
|
-
assert_equal ['b-1.2', 'a-1.1'],
|
150
|
-
deps.dependency_order.collect { |s| s.full_name }
|
151
|
-
end
|
152
|
-
|
153
|
-
# ------------------------------------------------------------------
|
154
|
-
|
155
|
-
def bspec
|
156
|
-
Gem::Specification.new do |s|
|
157
|
-
s.name = "b"
|
158
|
-
s.version = "1.2"
|
159
|
-
s.add_dependency("a", ">= 1.1")
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
def create_spec(name, version)
|
164
|
-
Gem::Specification.new do |s|
|
165
|
-
s.name = name
|
166
|
-
s.version = version
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|
data/test/test_file_list.rb
DELETED
@@ -1,101 +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 'fileutils'
|
8
|
-
require 'tmpdir'
|
9
|
-
require 'test/unit'
|
10
|
-
require 'rubygems'
|
11
|
-
require 'test/gemutilities'
|
12
|
-
Gem::manage_gems
|
13
|
-
|
14
|
-
class TestFileList < RubyGemTestCase
|
15
|
-
|
16
|
-
def import_spec(name)
|
17
|
-
file = File.join(@gem_install_path, "specifications", name)
|
18
|
-
eval File.read(file)
|
19
|
-
end
|
20
|
-
|
21
|
-
def setup
|
22
|
-
@spec = Gem::Specification.new do |s|
|
23
|
-
s.files = ['lib/code.rb','lib/apple.rb','lib/brown.rb']
|
24
|
-
s.name = "a"
|
25
|
-
s.version = "0.0.1"
|
26
|
-
s.summary = "summary"
|
27
|
-
s.description = "desc"
|
28
|
-
s.require_path = 'lib'
|
29
|
-
end
|
30
|
-
|
31
|
-
@cm = Gem::CommandManager.new
|
32
|
-
@contents = @cm['contents']
|
33
|
-
|
34
|
-
current_path = Dir.getwd
|
35
|
-
@gem_install_path = File.join(current_path, "test/mock/gems/")
|
36
|
-
@gem_root_dir = File.join(@gem_install_path, "gems", @spec.name + "-" + @spec.version.to_s)
|
37
|
-
|
38
|
-
@gemspec_filename = @spec.name + '-' + @spec.version.to_s + '.gemspec'
|
39
|
-
@spec_destination_path = File.join(@gem_install_path, "specifications", @gemspec_filename)
|
40
|
-
|
41
|
-
begin
|
42
|
-
File.open(@spec_destination_path, 'w') do |fp|
|
43
|
-
fp.write @spec.to_ruby
|
44
|
-
end
|
45
|
-
rescue Exception => e
|
46
|
-
# ignore errors in setup
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
def teardown
|
52
|
-
FileUtils.rm_rf @spec_destination_path unless $DEBUG
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_inspect_list
|
56
|
-
args = ["-s", @gem_install_path, "a"]
|
57
|
-
Gem::Command.instance_eval "public :handle_options"
|
58
|
-
@contents.handle_options(args)
|
59
|
-
sio = StringIO.new
|
60
|
-
@contents.execute(sio)
|
61
|
-
files = sio.string.split("\n")
|
62
|
-
code = File.join(@gem_root_dir,"lib/code.rb")
|
63
|
-
assert_match(code, files[0])
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_inspect_list_unknown
|
67
|
-
args = ["-s", @gem_install_path, "not_there"]
|
68
|
-
Gem::Command.instance_eval "public :handle_options"
|
69
|
-
@contents.handle_options(args)
|
70
|
-
sio = StringIO.new
|
71
|
-
@contents.execute(sio)
|
72
|
-
assert_match(/Unable to find/, sio.string)
|
73
|
-
end
|
74
|
-
|
75
|
-
def disable_test_specification
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
puts " dest path: " + @spec_destination_path
|
80
|
-
assert(FileTest.exists?(@spec_destination_path))
|
81
|
-
assert(FileTest.size(@spec_destination_path)>0)
|
82
|
-
spec = import_spec(@gemspec_filename)
|
83
|
-
|
84
|
-
p spec.require_paths
|
85
|
-
p spec.full_gem_path
|
86
|
-
|
87
|
-
files = spec.files.map do |f|
|
88
|
-
end
|
89
|
-
|
90
|
-
root = @gem_install_path + "a-0.0.1";
|
91
|
-
|
92
|
-
puts " files[0] is: " + files[0]
|
93
|
-
|
94
|
-
check1 = root + "/lib/code.rb"
|
95
|
-
puts " check1 is " + check1
|
96
|
-
assert(files[0] == check1)
|
97
|
-
assert(files[1] == root + "/lib/apple.rb");
|
98
|
-
assert(files[2] == root + "/lib/brown.rb");
|
99
|
-
end
|
100
|
-
|
101
|
-
end
|