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,66 +1,74 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
1
|
+
require 'rubygems/command'
|
2
|
+
require 'rubygems/version_option'
|
3
|
+
|
4
|
+
class Gem::Commands::ContentsCommand < Gem::Command
|
5
|
+
|
6
|
+
include Gem::VersionOption
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
super 'contents', 'Display the contents of the installed gems',
|
10
|
+
:specdirs => [], :lib_only => false
|
11
|
+
|
12
|
+
add_version_option
|
13
|
+
|
14
|
+
add_option('-s', '--spec-dir a,b,c', Array,
|
15
|
+
"Search for gems under specific paths") do |spec_dirs, options|
|
16
|
+
options[:specdirs] = spec_dirs
|
17
|
+
end
|
18
|
+
|
19
|
+
add_option('-l', '--[no-]lib-only',
|
20
|
+
"Only return files in the Gem's lib_dirs") do |lib_only, options|
|
21
|
+
options[:lib_only] = lib_only
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def arguments # :nodoc:
|
26
|
+
"GEMNAME name of gem to list contents for"
|
27
|
+
end
|
28
|
+
|
29
|
+
def defaults_str # :nodoc:
|
30
|
+
"--no-lib-only"
|
31
|
+
end
|
26
32
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
return
|
57
|
-
end
|
58
|
-
# show the list of files.
|
59
|
-
gem_spec.files.each do |f|
|
60
|
-
io.puts File.join(gem_spec.full_gem_path, f)
|
61
|
-
end
|
62
|
-
end
|
33
|
+
def usage # :nodoc:
|
34
|
+
"#{program_name} GEMNAME"
|
35
|
+
end
|
36
|
+
|
37
|
+
def execute
|
38
|
+
version = options[:version] || Gem::Requirement.default
|
39
|
+
gem = get_one_gem_name
|
40
|
+
|
41
|
+
s = options[:specdirs].map do |i|
|
42
|
+
[i, File.join(i, "specifications")]
|
43
|
+
end.flatten
|
44
|
+
|
45
|
+
path_kind = if s.empty? then
|
46
|
+
s = Gem::SourceIndex.installed_spec_directories
|
47
|
+
"default gem paths"
|
48
|
+
else
|
49
|
+
"specified path"
|
50
|
+
end
|
51
|
+
|
52
|
+
si = Gem::SourceIndex.from_gems_in(*s)
|
53
|
+
|
54
|
+
gem_spec = si.search(/\A#{gem}\z/, version).last
|
55
|
+
|
56
|
+
unless gem_spec then
|
57
|
+
say "Unable to find gem '#{gem}' in #{path_kind}"
|
58
|
+
|
59
|
+
if Gem.configuration.verbose then
|
60
|
+
say "\nDirectories searched:"
|
61
|
+
s.each { |dir| say dir }
|
63
62
|
end
|
63
|
+
|
64
|
+
terminate_interaction
|
65
|
+
end
|
66
|
+
|
67
|
+
files = options[:lib_only] ? gem_spec.lib_files : gem_spec.files
|
68
|
+
files.each do |f|
|
69
|
+
say File.join(gem_spec.full_gem_path, f)
|
64
70
|
end
|
65
71
|
end
|
66
|
-
|
72
|
+
|
73
|
+
end
|
74
|
+
|
@@ -1,105 +1,150 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
require 'rubygems/command'
|
2
|
+
require 'rubygems/local_remote_options'
|
3
|
+
require 'rubygems/version_option'
|
4
|
+
require 'rubygems/source_info_cache'
|
5
|
+
|
6
|
+
class Gem::Commands::DependencyCommand < Gem::Command
|
7
|
+
|
8
|
+
include Gem::LocalRemoteOptions
|
9
|
+
include Gem::VersionOption
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
super 'dependency',
|
9
13
|
'Show the dependencies of an installed gem',
|
10
|
-
|
11
|
-
add_version_option('dependency')
|
12
|
-
add_option('-r', '--[no-]reverse-dependencies',
|
13
|
-
'Include reverse dependencies in the output'
|
14
|
-
) do |value, options|
|
15
|
-
options[:reverse_dependencies] = value
|
16
|
-
end
|
17
|
-
add_option('-p', '--pipe', "Pipe Format (name --version ver)") do |value, options|
|
18
|
-
options[:pipe_format] = value
|
19
|
-
end
|
20
|
-
end
|
14
|
+
:version => Gem::Requirement.default, :domain => :local
|
21
15
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
16
|
+
add_version_option
|
17
|
+
add_platform_option
|
18
|
+
|
19
|
+
add_option('-R', '--[no-]reverse-dependencies',
|
20
|
+
'Include reverse dependencies in the output') do
|
21
|
+
|value, options|
|
22
|
+
options[:reverse_dependencies] = value
|
23
|
+
end
|
24
|
+
|
25
|
+
add_option('-p', '--pipe',
|
26
|
+
"Pipe Format (name --version ver)") do |value, options|
|
27
|
+
options[:pipe_format] = value
|
28
|
+
end
|
29
|
+
|
30
|
+
add_local_remote_options
|
31
|
+
end
|
32
|
+
|
33
|
+
def arguments # :nodoc:
|
34
|
+
"GEMNAME name of gem to show dependencies for"
|
35
|
+
end
|
36
|
+
|
37
|
+
def defaults_str # :nodoc:
|
38
|
+
"--local --version '#{Gem::Requirement.default}' --no-reverse-dependencies"
|
39
|
+
end
|
40
|
+
|
41
|
+
def usage # :nodoc:
|
42
|
+
"#{program_name} GEMNAME"
|
43
|
+
end
|
44
|
+
|
45
|
+
def execute
|
46
|
+
options[:args] << '.' if options[:args].empty?
|
47
|
+
specs = {}
|
48
|
+
|
49
|
+
source_indexes = []
|
50
|
+
|
51
|
+
if local? then
|
52
|
+
source_indexes << Gem::SourceIndex.from_installed_gems
|
53
|
+
end
|
54
|
+
|
55
|
+
if remote? then
|
56
|
+
Gem::SourceInfoCache.cache_data.map do |_, sice|
|
57
|
+
source_indexes << sice.source_index
|
28
58
|
end
|
59
|
+
end
|
29
60
|
|
30
|
-
|
31
|
-
|
61
|
+
options[:args].each do |name|
|
62
|
+
new_specs = nil
|
63
|
+
source_indexes.each do |source_index|
|
64
|
+
new_specs = find_gems(name, source_index)
|
32
65
|
end
|
33
66
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
48
|
-
reverse = Hash.new { |h, k| h[k] = [] }
|
49
|
-
if options[:reverse_dependencies]
|
50
|
-
specs.values.each do |spec|
|
51
|
-
reverse[spec.full_name] = find_reverse_dependencies(spec, srcindex)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
if options[:pipe_format]
|
55
|
-
specs.values.sort.each do |spec|
|
56
|
-
unless spec.dependencies.empty?
|
57
|
-
spec.dependencies.each do |dep|
|
58
|
-
puts "#{dep.name} --version '#{dep.version_requirements}'"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
else
|
63
|
-
response = ''
|
64
|
-
specs.values.sort.each do |spec|
|
65
|
-
response << print_dependencies(spec)
|
66
|
-
unless reverse[spec.full_name].empty?
|
67
|
-
response << " Used by\n"
|
68
|
-
reverse[spec.full_name].each do |sp, dep|
|
69
|
-
response << " #{sp} (#{dep})\n"
|
70
|
-
end
|
71
|
-
end
|
72
|
-
response << "\n"
|
73
|
-
end
|
74
|
-
say response
|
75
|
-
end
|
67
|
+
say "No match found for #{name} (#{options[:version]})" if
|
68
|
+
new_specs.empty?
|
69
|
+
|
70
|
+
specs = specs.merge new_specs
|
71
|
+
end
|
72
|
+
|
73
|
+
terminate_interaction 1 if specs.empty?
|
74
|
+
|
75
|
+
reverse = Hash.new { |h, k| h[k] = [] }
|
76
|
+
|
77
|
+
if options[:reverse_dependencies] then
|
78
|
+
specs.values.each do |source_index, spec|
|
79
|
+
reverse[spec.full_name] = find_reverse_dependencies spec, source_index
|
76
80
|
end
|
81
|
+
end
|
77
82
|
|
78
|
-
|
79
|
-
|
80
|
-
response << ' ' * level + "Gem #{spec.full_name}\n"
|
83
|
+
if options[:pipe_format] then
|
84
|
+
specs.values.sort_by { |_, spec| spec }.each do |_, spec|
|
81
85
|
unless spec.dependencies.empty?
|
82
|
-
# response << ' ' * level + " Requires\n"
|
83
86
|
spec.dependencies.each do |dep|
|
84
|
-
|
87
|
+
say "#{dep.name} --version '#{dep.version_requirements}'"
|
85
88
|
end
|
86
89
|
end
|
87
|
-
response
|
88
90
|
end
|
91
|
+
else
|
92
|
+
response = ''
|
89
93
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
dep.version_requirements.satisfied_by?(spec.version)
|
97
|
-
result << [sp.full_name, dep]
|
98
|
-
end
|
94
|
+
specs.values.sort_by { |_, spec| spec }.each do |_, spec|
|
95
|
+
response << print_dependencies(spec)
|
96
|
+
unless reverse[spec.full_name].empty? then
|
97
|
+
response << " Used by\n"
|
98
|
+
reverse[spec.full_name].each do |sp, dep|
|
99
|
+
response << " #{sp} (#{dep})\n"
|
99
100
|
end
|
100
101
|
end
|
101
|
-
|
102
|
+
response << "\n"
|
103
|
+
end
|
104
|
+
|
105
|
+
say response
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def print_dependencies(spec, level = 0)
|
110
|
+
response = ''
|
111
|
+
response << ' ' * level + "Gem #{spec.full_name}\n"
|
112
|
+
unless spec.dependencies.empty? then
|
113
|
+
spec.dependencies.each do |dep|
|
114
|
+
response << ' ' * level + " #{dep}\n"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
response
|
118
|
+
end
|
119
|
+
|
120
|
+
# Retuns list of [specification, dep] that are satisfied by spec.
|
121
|
+
def find_reverse_dependencies(spec, source_index)
|
122
|
+
result = []
|
123
|
+
|
124
|
+
source_index.each do |name, sp|
|
125
|
+
sp.dependencies.each do |dep|
|
126
|
+
dep = Gem::Dependency.new(*dep) unless Gem::Dependency === dep
|
127
|
+
|
128
|
+
if spec.name == dep.name and
|
129
|
+
dep.version_requirements.satisfied_by?(spec.version) then
|
130
|
+
result << [sp.full_name, dep]
|
131
|
+
end
|
102
132
|
end
|
103
|
-
end
|
133
|
+
end
|
134
|
+
|
135
|
+
result
|
136
|
+
end
|
137
|
+
|
138
|
+
def find_gems(name, source_index)
|
139
|
+
specs = {}
|
140
|
+
|
141
|
+
spec_list = source_index.search name, options[:version]
|
142
|
+
|
143
|
+
spec_list.each do |spec|
|
144
|
+
specs[spec.full_name] = [source_index, spec]
|
145
|
+
end
|
146
|
+
|
147
|
+
specs
|
104
148
|
end
|
105
149
|
end
|
150
|
+
|
@@ -1,59 +1,80 @@
|
|
1
|
-
|
2
|
-
module Commands
|
3
|
-
class EnvironmentCommand < Command
|
4
|
-
include CommandAids
|
1
|
+
require 'rubygems/command'
|
5
2
|
|
6
|
-
|
7
|
-
super('environment', 'Display information about the RubyGems environment')
|
8
|
-
end
|
3
|
+
class Gem::Commands::EnvironmentCommand < Gem::Command
|
9
4
|
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
def initialize
|
6
|
+
super 'environment', 'Display information about the RubyGems environment'
|
7
|
+
end
|
13
8
|
|
14
|
-
|
15
|
-
|
9
|
+
def arguments # :nodoc:
|
10
|
+
args = <<-EOF
|
16
11
|
packageversion display the package version
|
17
12
|
gemdir display the path where gems are installed
|
18
13
|
gempath display path used to search for gems
|
19
14
|
version display the gem format version
|
20
15
|
remotesources display the remote gem servers
|
21
16
|
<omitted> display everything
|
22
|
-
|
23
|
-
|
17
|
+
EOF
|
18
|
+
return args.gsub(/^\s+/, '')
|
19
|
+
end
|
20
|
+
|
21
|
+
def usage # :nodoc:
|
22
|
+
"#{program_name} [arg]"
|
23
|
+
end
|
24
|
+
|
25
|
+
def execute
|
26
|
+
out = ''
|
27
|
+
arg = options[:args][0]
|
28
|
+
if begins?("packageversion", arg) then
|
29
|
+
out << Gem::RubyGemsPackageVersion
|
30
|
+
elsif begins?("version", arg) then
|
31
|
+
out << Gem::RubyGemsVersion
|
32
|
+
elsif begins?("gemdir", arg) then
|
33
|
+
out << Gem.dir
|
34
|
+
elsif begins?("gempath", arg) then
|
35
|
+
out << Gem.path.join("\n")
|
36
|
+
elsif begins?("remotesources", arg) then
|
37
|
+
out << Gem.sources.join("\n")
|
38
|
+
elsif arg then
|
39
|
+
fail Gem::CommandLineError, "Unknown enviroment option [#{arg}]"
|
40
|
+
else
|
41
|
+
out = "RubyGems Environment:\n"
|
42
|
+
|
43
|
+
out << " - RUBYGEMS VERSION: #{Gem::RubyGemsVersion} (#{Gem::RubyGemsPackageVersion})\n"
|
44
|
+
|
45
|
+
out << " - RUBY VERSION: #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}"
|
46
|
+
out << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
|
47
|
+
out << ") [#{RUBY_PLATFORM}]\n"
|
48
|
+
|
49
|
+
out << " - INSTALLATION DIRECTORY: #{Gem.dir}\n"
|
50
|
+
|
51
|
+
out << " - RUBYGEMS PREFIX: #{Gem.prefix}\n" unless Gem.prefix.nil?
|
52
|
+
|
53
|
+
out << " - RUBY EXECUTABLE: #{Gem.ruby}\n"
|
54
|
+
|
55
|
+
out << " - RUBYGEMS PLATFORMS:\n"
|
56
|
+
Gem.platforms.each do |platform|
|
57
|
+
out << " - #{platform}\n"
|
58
|
+
end
|
59
|
+
|
60
|
+
out << " - GEM PATHS:\n"
|
61
|
+
Gem.path.each do |p|
|
62
|
+
out << " - #{p}\n"
|
24
63
|
end
|
25
64
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
if begins?("packageversion", arg)
|
30
|
-
out = Gem::RubyGemsPackageVersion.to_s
|
31
|
-
elsif begins?("version", arg)
|
32
|
-
out = Gem::RubyGemsVersion.to_s
|
33
|
-
elsif begins?("gemdir", arg)
|
34
|
-
out = Gem.dir
|
35
|
-
elsif begins?("gempath", arg)
|
36
|
-
Gem.path.collect { |p| out << "#{p}\n" }
|
37
|
-
elsif begins?("remotesources", arg)
|
38
|
-
require 'sources'
|
39
|
-
out << Gem.sources.join("\n") << "\n"
|
40
|
-
elsif arg
|
41
|
-
fail Gem::CommandLineError, "Unknown enviroment option [#{arg}]"
|
42
|
-
else
|
43
|
-
out = "RubyGems Environment:\n"
|
44
|
-
out << " - VERSION: #{Gem::RubyGemsVersion} (#{Gem::RubyGemsPackageVersion})\n"
|
45
|
-
out << " - INSTALLATION DIRECTORY: #{Gem.dir}\n"
|
46
|
-
out << " - GEM PATH:\n"
|
47
|
-
Gem.path.collect { |p| out << " - #{p}\n" }
|
48
|
-
out << " - REMOTE SOURCES:\n"
|
49
|
-
require 'sources'
|
50
|
-
Gem.sources.collect do |s|
|
51
|
-
out << " - #{s}\n"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
say out
|
55
|
-
true
|
65
|
+
out << " - GEM CONFIGURATION:\n"
|
66
|
+
Gem.configuration.each do |name, value|
|
67
|
+
out << " - #{name.inspect} => #{value.inspect}\n"
|
56
68
|
end
|
57
|
-
|
69
|
+
|
70
|
+
out << " - REMOTE SOURCES:\n"
|
71
|
+
Gem.sources.each do |s|
|
72
|
+
out << " - #{s}\n"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
say out
|
76
|
+
true
|
58
77
|
end
|
59
|
-
|
78
|
+
|
79
|
+
end
|
80
|
+
|