rubygems-update 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/.autotest +24 -0
- data/.document +4 -3
- data/ChangeLog +382 -1
- data/Manifest.txt +214 -0
- data/README +1 -49
- data/Rakefile +124 -191
- data/bin/gem +1 -4
- data/cruise_config.rb +22 -0
- data/doc/release_notes/rel_1_3_1.rdoc +3 -3
- data/doc/release_notes/rel_1_3_2.rdoc +119 -0
- data/lib/gauntlet_rubygems.rb +50 -0
- data/lib/rubygems.rb +250 -25
- data/lib/rubygems/builder.rb +62 -60
- data/lib/rubygems/command.rb +421 -319
- data/lib/rubygems/command_manager.rb +153 -125
- data/lib/rubygems/commands/check_command.rb +12 -7
- data/lib/rubygems/commands/cleanup_command.rb +11 -2
- data/lib/rubygems/commands/contents_command.rb +42 -18
- data/lib/rubygems/commands/generate_index_command.rb +91 -15
- data/lib/rubygems/commands/install_command.rb +33 -47
- data/lib/rubygems/commands/query_command.rb +36 -20
- data/lib/rubygems/commands/rdoc_command.rb +62 -68
- data/lib/rubygems/commands/search_command.rb +26 -32
- data/lib/rubygems/commands/setup_command.rb +353 -0
- data/lib/rubygems/commands/sources_command.rb +5 -0
- data/lib/rubygems/commands/specification_command.rb +23 -3
- data/lib/rubygems/commands/uninstall_command.rb +71 -61
- data/lib/rubygems/commands/unpack_command.rb +14 -12
- data/lib/rubygems/commands/update_command.rb +26 -5
- data/lib/rubygems/defaults.rb +16 -3
- data/lib/rubygems/dependency.rb +38 -7
- data/lib/rubygems/dependency_installer.rb +7 -4
- data/lib/rubygems/digest/digest_adapter.rb +42 -33
- data/lib/rubygems/digest/sha1.rb +6 -1
- data/lib/rubygems/digest/sha2.rb +5 -0
- data/lib/rubygems/doc_manager.rb +31 -11
- data/lib/rubygems/ext/ext_conf_builder.rb +2 -1
- data/lib/rubygems/ext/rake_builder.rb +6 -2
- data/lib/rubygems/format.rb +63 -63
- data/lib/rubygems/gem_openssl.rb +14 -2
- data/lib/rubygems/gem_path_searcher.rb +7 -3
- data/lib/rubygems/gem_runner.rb +59 -39
- data/lib/rubygems/indexer.rb +450 -109
- data/lib/rubygems/install_update_options.rb +13 -1
- data/lib/rubygems/installer.rb +25 -22
- data/lib/rubygems/local_remote_options.rb +5 -3
- data/lib/rubygems/old_format.rb +124 -120
- data/lib/rubygems/package/tar_header.rb +25 -3
- data/lib/rubygems/package/tar_input.rb +5 -5
- data/lib/rubygems/package/tar_output.rb +2 -0
- data/lib/rubygems/package/tar_reader.rb +19 -0
- data/lib/rubygems/package/tar_reader/entry.rb +43 -0
- data/lib/rubygems/package/tar_writer.rb +65 -3
- data/lib/rubygems/package_task.rb +117 -0
- data/lib/rubygems/platform.rb +12 -8
- data/lib/rubygems/remote_fetcher.rb +43 -24
- data/lib/rubygems/require_paths_builder.rb +14 -12
- data/lib/rubygems/requirement.rb +15 -6
- data/lib/rubygems/rubygems_version.rb +14 -1
- data/lib/rubygems/source_index.rb +38 -16
- data/lib/rubygems/source_info_cache_entry.rb +2 -2
- data/lib/rubygems/spec_fetcher.rb +43 -20
- data/lib/rubygems/specification.rb +1122 -947
- data/lib/rubygems/text.rb +30 -0
- data/lib/rubygems/timer.rb +14 -11
- data/lib/rubygems/uninstaller.rb +25 -5
- data/lib/rubygems/user_interaction.rb +294 -264
- data/lib/rubygems/validator.rb +70 -36
- data/lib/rubygems/version.rb +97 -33
- data/lib/rubygems/version_option.rb +1 -0
- data/setup.rb +11 -306
- data/test/foo/discover.rb +0 -0
- data/test/gem_installer_test_case.rb +22 -11
- data/test/gem_package_tar_test_case.rb +0 -14
- data/test/gemutilities.rb +89 -8
- data/test/mockgemui.rb +2 -1
- data/test/rubygems_plugin.rb +16 -0
- data/test/test_gem.rb +107 -36
- data/test/test_gem_command.rb +3 -13
- data/test/test_gem_command_manager.rb +1 -14
- data/test/test_gem_commands_cert_command.rb +1 -1
- data/test/test_gem_commands_contents_command.rb +63 -0
- data/test/test_gem_commands_environment_command.rb +1 -1
- data/test/test_gem_commands_generate_index_command.rb +104 -1
- data/test/test_gem_commands_install_command.rb +95 -0
- data/test/test_gem_commands_pristine_command.rb +3 -3
- data/test/test_gem_commands_query_command.rb +46 -0
- data/test/test_gem_commands_sources_command.rb +9 -5
- data/test/test_gem_commands_specification_command.rb +31 -0
- data/test/test_gem_commands_uninstall_command.rb +3 -2
- data/test/test_gem_commands_unpack_command.rb +3 -2
- data/test/test_gem_commands_update_command.rb +12 -7
- data/test/test_gem_dependency.rb +62 -11
- data/test/test_gem_dependency_installer.rb +18 -5
- data/test/test_gem_dependency_list.rb +6 -6
- data/test/test_gem_doc_manager.rb +7 -1
- data/test/test_gem_ext_configure_builder.rb +8 -10
- data/test/test_gem_ext_ext_conf_builder.rb +14 -8
- data/test/test_gem_gem_path_searcher.rb +1 -1
- data/test/test_gem_gem_runner.rb +11 -0
- data/test/test_gem_indexer.rb +398 -21
- data/test/test_gem_install_update_options.rb +20 -6
- data/test/test_gem_installer.rb +22 -14
- data/test/test_gem_local_remote_options.rb +2 -1
- data/test/test_gem_package_tar_header.rb +3 -3
- data/test/test_gem_package_tar_input.rb +3 -3
- data/test/test_gem_package_tar_output.rb +2 -2
- data/test/test_gem_package_task.rb +70 -0
- data/test/test_gem_platform.rb +12 -6
- data/test/test_gem_remote_fetcher.rb +23 -1
- data/test/test_gem_source_index.rb +32 -21
- data/test/test_gem_spec_fetcher.rb +77 -5
- data/test/test_gem_specification.rb +274 -1
- data/test/test_gem_uninstaller.rb +34 -4
- data/test/test_gem_version.rb +94 -4
- data/test/test_gem_version_option.rb +13 -0
- data/test/test_kernel.rb +4 -4
- data/util/CL2notes +56 -0
- data/util/gem_prelude.rb.template +251 -0
- metadata +30 -20
- metadata.gz.sig +3 -4
- data/TODO +0 -1
- data/scripts/buildtests.rb +0 -31
- data/scripts/gemdoc.rb +0 -67
- data/scripts/runtest.rb +0 -40
- data/scripts/specdoc.rb +0 -171
- data/scripts/upload_gemdoc.rb +0 -140
|
@@ -8,139 +8,167 @@ require 'timeout'
|
|
|
8
8
|
require 'rubygems/command'
|
|
9
9
|
require 'rubygems/user_interaction'
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
11
|
+
##
|
|
12
|
+
# The command manager registers and installs all the individual sub-commands
|
|
13
|
+
# supported by the gem command.
|
|
14
|
+
#
|
|
15
|
+
# Extra commands can be provided by writing a rubygems_plugin.rb
|
|
16
|
+
# file in an installed gem. You should register your command against the
|
|
17
|
+
# Gem::CommandManager instance, like this:
|
|
18
|
+
#
|
|
19
|
+
# # file rubygems_plugin.rb
|
|
20
|
+
# require 'rubygems/command_manager'
|
|
21
|
+
#
|
|
22
|
+
# class Gem::Commands::EditCommand < Gem::Command
|
|
23
|
+
# # ...
|
|
24
|
+
# end
|
|
25
|
+
#
|
|
26
|
+
# Gem::CommandManager.instance.register_command :edit
|
|
27
|
+
#
|
|
28
|
+
# See Gem::Command for instructions on writing gem commands.
|
|
29
|
+
|
|
30
|
+
class Gem::CommandManager
|
|
31
|
+
|
|
32
|
+
include Gem::UserInteraction
|
|
33
|
+
|
|
34
|
+
##
|
|
35
|
+
# Return the authoritative instance of the command manager.
|
|
36
|
+
|
|
37
|
+
def self.instance
|
|
38
|
+
@command_manager ||= new
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
##
|
|
42
|
+
# Register all the subcommands supported by the gem command.
|
|
43
|
+
|
|
44
|
+
def initialize
|
|
45
|
+
@commands = {}
|
|
46
|
+
register_command :build
|
|
47
|
+
register_command :cert
|
|
48
|
+
register_command :check
|
|
49
|
+
register_command :cleanup
|
|
50
|
+
register_command :contents
|
|
51
|
+
register_command :dependency
|
|
52
|
+
register_command :environment
|
|
53
|
+
register_command :fetch
|
|
54
|
+
register_command :generate_index
|
|
55
|
+
register_command :help
|
|
56
|
+
register_command :install
|
|
57
|
+
register_command :list
|
|
58
|
+
register_command :lock
|
|
59
|
+
register_command :mirror
|
|
60
|
+
register_command :outdated
|
|
61
|
+
register_command :pristine
|
|
62
|
+
register_command :query
|
|
63
|
+
register_command :rdoc
|
|
64
|
+
register_command :search
|
|
65
|
+
register_command :server
|
|
66
|
+
register_command :sources
|
|
67
|
+
register_command :specification
|
|
68
|
+
register_command :stale
|
|
69
|
+
register_command :uninstall
|
|
70
|
+
register_command :unpack
|
|
71
|
+
register_command :update
|
|
72
|
+
register_command :which
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
##
|
|
76
|
+
# Register the command object.
|
|
77
|
+
|
|
78
|
+
def register_command(command_obj)
|
|
79
|
+
@commands[command_obj] = false
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
##
|
|
83
|
+
# Return the registered command from the command name.
|
|
84
|
+
|
|
85
|
+
def [](command_name)
|
|
86
|
+
command_name = command_name.intern
|
|
87
|
+
return nil if @commands[command_name].nil?
|
|
88
|
+
@commands[command_name] ||= load_and_instantiate(command_name)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
##
|
|
92
|
+
# Return a sorted list of all command names (as strings).
|
|
93
|
+
|
|
94
|
+
def command_names
|
|
95
|
+
@commands.keys.collect {|key| key.to_s}.sort
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
##
|
|
99
|
+
# Run the config specified by +args+.
|
|
100
|
+
|
|
101
|
+
def run(args)
|
|
102
|
+
process_args(args)
|
|
103
|
+
rescue StandardError, Timeout::Error => ex
|
|
104
|
+
alert_error "While executing gem ... (#{ex.class})\n #{ex.to_s}"
|
|
105
|
+
ui.errs.puts "\t#{ex.backtrace.join "\n\t"}" if
|
|
106
|
+
Gem.configuration.backtrace
|
|
107
|
+
terminate_interaction(1)
|
|
108
|
+
rescue Interrupt
|
|
109
|
+
alert_error "Interrupted"
|
|
110
|
+
terminate_interaction(1)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def process_args(args)
|
|
114
|
+
args = args.to_str.split(/\s+/) if args.respond_to?(:to_str)
|
|
115
|
+
if args.size == 0
|
|
116
|
+
say Gem::Command::HELP
|
|
80
117
|
terminate_interaction(1)
|
|
81
|
-
|
|
82
|
-
|
|
118
|
+
end
|
|
119
|
+
case args[0]
|
|
120
|
+
when '-h', '--help'
|
|
121
|
+
say Gem::Command::HELP
|
|
122
|
+
terminate_interaction(0)
|
|
123
|
+
when '-v', '--version'
|
|
124
|
+
say Gem::RubyGemsVersion
|
|
125
|
+
terminate_interaction(0)
|
|
126
|
+
when /^-/
|
|
127
|
+
alert_error "Invalid option: #{args[0]}. See 'gem --help'."
|
|
83
128
|
terminate_interaction(1)
|
|
129
|
+
else
|
|
130
|
+
cmd_name = args.shift.downcase
|
|
131
|
+
cmd = find_command(cmd_name)
|
|
132
|
+
cmd.invoke(*args)
|
|
84
133
|
end
|
|
134
|
+
end
|
|
85
135
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
case args[0]
|
|
93
|
-
when '-h', '--help'
|
|
94
|
-
say Gem::Command::HELP
|
|
95
|
-
terminate_interaction(0)
|
|
96
|
-
when '-v', '--version'
|
|
97
|
-
say Gem::RubyGemsVersion
|
|
98
|
-
terminate_interaction(0)
|
|
99
|
-
when /^-/
|
|
100
|
-
alert_error "Invalid option: #{args[0]}. See 'gem --help'."
|
|
101
|
-
terminate_interaction(1)
|
|
102
|
-
else
|
|
103
|
-
cmd_name = args.shift.downcase
|
|
104
|
-
cmd = find_command(cmd_name)
|
|
105
|
-
cmd.invoke(*args)
|
|
106
|
-
end
|
|
136
|
+
def find_command(cmd_name)
|
|
137
|
+
possibilities = find_command_possibilities cmd_name
|
|
138
|
+
if possibilities.size > 1 then
|
|
139
|
+
raise "Ambiguous command #{cmd_name} matches [#{possibilities.join(', ')}]"
|
|
140
|
+
elsif possibilities.size < 1 then
|
|
141
|
+
raise "Unknown command #{cmd_name}"
|
|
107
142
|
end
|
|
108
143
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if possibilities.size > 1
|
|
112
|
-
raise "Ambiguous command #{cmd_name} matches [#{possibilities.join(', ')}]"
|
|
113
|
-
end
|
|
114
|
-
if possibilities.size < 1
|
|
115
|
-
raise "Unknown command #{cmd_name}"
|
|
116
|
-
end
|
|
144
|
+
self[possibilities.first]
|
|
145
|
+
end
|
|
117
146
|
|
|
118
|
-
|
|
119
|
-
|
|
147
|
+
def find_command_possibilities(cmd_name)
|
|
148
|
+
len = cmd_name.length
|
|
120
149
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
require "rubygems/commands/#{command_name}_command"
|
|
141
|
-
retry
|
|
142
|
-
end
|
|
150
|
+
command_names.select { |n| cmd_name == n[0, len] }
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
private
|
|
154
|
+
|
|
155
|
+
def load_and_instantiate(command_name)
|
|
156
|
+
command_name = command_name.to_s
|
|
157
|
+
retried = false
|
|
158
|
+
|
|
159
|
+
begin
|
|
160
|
+
const_name = command_name.capitalize.gsub(/_(.)/) { $1.upcase }
|
|
161
|
+
Gem::Commands.const_get("#{const_name}Command").new
|
|
162
|
+
rescue NameError
|
|
163
|
+
if retried then
|
|
164
|
+
raise
|
|
165
|
+
else
|
|
166
|
+
retried = true
|
|
167
|
+
require "rubygems/commands/#{command_name}_command"
|
|
168
|
+
retry
|
|
143
169
|
end
|
|
144
170
|
end
|
|
145
171
|
end
|
|
146
|
-
|
|
172
|
+
|
|
173
|
+
end
|
|
174
|
+
|
|
@@ -21,6 +21,10 @@ class Gem::Commands::CheckCommand < Gem::Command
|
|
|
21
21
|
options[:alien] = true
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
add_option('-v', '--verbose', "Spew more words") do |value, options|
|
|
25
|
+
options[:verbose] = true
|
|
26
|
+
end
|
|
27
|
+
|
|
24
28
|
add_option('-t', '--test', "Run unit tests for gem") do |value, options|
|
|
25
29
|
options[:test] = true
|
|
26
30
|
end
|
|
@@ -38,16 +42,17 @@ class Gem::Commands::CheckCommand < Gem::Command
|
|
|
38
42
|
|
|
39
43
|
if options[:alien]
|
|
40
44
|
say "Performing the 'alien' operation"
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
say
|
|
46
|
+
gems = get_all_gem_names rescue []
|
|
47
|
+
Gem::Validator.new.alien(gems).sort.each do |key, val|
|
|
48
|
+
unless val.empty? then
|
|
43
49
|
say "#{key} has #{val.size} problems"
|
|
44
50
|
val.each do |error_entry|
|
|
45
|
-
say "
|
|
46
|
-
say "
|
|
47
|
-
say
|
|
51
|
+
say " #{error_entry.path}:"
|
|
52
|
+
say " #{error_entry.problem}"
|
|
48
53
|
end
|
|
49
|
-
else
|
|
50
|
-
say "#{key} is error-free"
|
|
54
|
+
else
|
|
55
|
+
say "#{key} is error-free" if options[:verbose]
|
|
51
56
|
end
|
|
52
57
|
say
|
|
53
58
|
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require 'rubygems/command'
|
|
2
2
|
require 'rubygems/source_index'
|
|
3
3
|
require 'rubygems/dependency_list'
|
|
4
|
+
require 'rubygems/uninstaller'
|
|
4
5
|
|
|
5
6
|
class Gem::Commands::CleanupCommand < Gem::Command
|
|
6
7
|
|
|
@@ -22,6 +23,13 @@ class Gem::Commands::CleanupCommand < Gem::Command
|
|
|
22
23
|
"--no-dryrun"
|
|
23
24
|
end
|
|
24
25
|
|
|
26
|
+
def description # :nodoc:
|
|
27
|
+
<<-EOF
|
|
28
|
+
The cleanup command removes old gems from GEM_HOME. If an older version is
|
|
29
|
+
installed elsewhere in GEM_PATH the cleanup command won't touch it.
|
|
30
|
+
EOF
|
|
31
|
+
end
|
|
32
|
+
|
|
25
33
|
def usage # :nodoc:
|
|
26
34
|
"#{program_name} [GEMNAME ...]"
|
|
27
35
|
end
|
|
@@ -41,7 +49,8 @@ class Gem::Commands::CleanupCommand < Gem::Command
|
|
|
41
49
|
|
|
42
50
|
unless options[:args].empty? then
|
|
43
51
|
options[:args].each do |gem_name|
|
|
44
|
-
|
|
52
|
+
dep = Gem::Dependency.new gem_name, Gem::Requirement.default
|
|
53
|
+
specs = Gem.source_index.search dep
|
|
45
54
|
specs.each do |spec|
|
|
46
55
|
gems_to_cleanup << spec
|
|
47
56
|
end
|
|
@@ -56,7 +65,6 @@ class Gem::Commands::CleanupCommand < Gem::Command
|
|
|
56
65
|
primary_gems[spec.name].version != spec.version
|
|
57
66
|
}
|
|
58
67
|
|
|
59
|
-
uninstall_command = Gem::CommandManager.instance['uninstall']
|
|
60
68
|
deplist = Gem::DependencyList.new
|
|
61
69
|
gems_to_cleanup.uniq.each do |spec| deplist.add spec end
|
|
62
70
|
|
|
@@ -77,6 +85,7 @@ class Gem::Commands::CleanupCommand < Gem::Command
|
|
|
77
85
|
begin
|
|
78
86
|
uninstaller.uninstall
|
|
79
87
|
rescue Gem::DependencyRemovalException,
|
|
88
|
+
Gem::InstallError,
|
|
80
89
|
Gem::GemNotInHomeException => e
|
|
81
90
|
say "Unable to uninstall #{spec.full_name}:"
|
|
82
91
|
say "\t#{e.class}: #{e.message}"
|
|
@@ -11,6 +11,11 @@ class Gem::Commands::ContentsCommand < Gem::Command
|
|
|
11
11
|
|
|
12
12
|
add_version_option
|
|
13
13
|
|
|
14
|
+
add_option( '--all',
|
|
15
|
+
"Contents for all gems") do |all, options|
|
|
16
|
+
options[:all] = all
|
|
17
|
+
end
|
|
18
|
+
|
|
14
19
|
add_option('-s', '--spec-dir a,b,c', Array,
|
|
15
20
|
"Search for gems under specific paths") do |spec_dirs, options|
|
|
16
21
|
options[:specdirs] = spec_dirs
|
|
@@ -20,6 +25,11 @@ class Gem::Commands::ContentsCommand < Gem::Command
|
|
|
20
25
|
"Only return files in the Gem's lib_dirs") do |lib_only, options|
|
|
21
26
|
options[:lib_only] = lib_only
|
|
22
27
|
end
|
|
28
|
+
|
|
29
|
+
add_option( '--[no-]prefix',
|
|
30
|
+
"Don't include installed path prefix") do |prefix, options|
|
|
31
|
+
options[:prefix] = prefix
|
|
32
|
+
end
|
|
23
33
|
end
|
|
24
34
|
|
|
25
35
|
def arguments # :nodoc:
|
|
@@ -27,46 +37,60 @@ class Gem::Commands::ContentsCommand < Gem::Command
|
|
|
27
37
|
end
|
|
28
38
|
|
|
29
39
|
def defaults_str # :nodoc:
|
|
30
|
-
"--no-lib-only"
|
|
40
|
+
"--no-lib-only --prefix"
|
|
31
41
|
end
|
|
32
42
|
|
|
33
43
|
def usage # :nodoc:
|
|
34
|
-
"#{program_name} GEMNAME"
|
|
44
|
+
"#{program_name} GEMNAME [GEMNAME ...]"
|
|
35
45
|
end
|
|
36
46
|
|
|
37
47
|
def execute
|
|
38
48
|
version = options[:version] || Gem::Requirement.default
|
|
39
|
-
gem = get_one_gem_name
|
|
40
49
|
|
|
41
|
-
|
|
50
|
+
spec_dirs = options[:specdirs].map do |i|
|
|
42
51
|
[i, File.join(i, "specifications")]
|
|
43
52
|
end.flatten
|
|
44
53
|
|
|
45
|
-
path_kind = if
|
|
46
|
-
|
|
54
|
+
path_kind = if spec_dirs.empty? then
|
|
55
|
+
spec_dirs = Gem::SourceIndex.installed_spec_directories
|
|
47
56
|
"default gem paths"
|
|
48
57
|
else
|
|
49
58
|
"specified path"
|
|
50
59
|
end
|
|
51
60
|
|
|
52
|
-
si = Gem::SourceIndex.from_gems_in(*
|
|
61
|
+
si = Gem::SourceIndex.from_gems_in(*spec_dirs)
|
|
53
62
|
|
|
54
|
-
|
|
63
|
+
gem_names = if options[:all] then
|
|
64
|
+
si.map { |_, spec| spec.name }
|
|
65
|
+
else
|
|
66
|
+
get_all_gem_names
|
|
67
|
+
end
|
|
55
68
|
|
|
56
|
-
|
|
57
|
-
|
|
69
|
+
gem_names.each do |name|
|
|
70
|
+
gem_spec = si.find_name(name, version).last
|
|
58
71
|
|
|
59
|
-
|
|
60
|
-
say "
|
|
61
|
-
|
|
72
|
+
unless gem_spec then
|
|
73
|
+
say "Unable to find gem '#{name}' in #{path_kind}"
|
|
74
|
+
|
|
75
|
+
if Gem.configuration.verbose then
|
|
76
|
+
say "\nDirectories searched:"
|
|
77
|
+
spec_dirs.each { |dir| say dir }
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
terminate_interaction 1 if gem_names.length == 1
|
|
62
81
|
end
|
|
63
82
|
|
|
64
|
-
|
|
65
|
-
end
|
|
83
|
+
files = options[:lib_only] ? gem_spec.lib_files : gem_spec.files
|
|
66
84
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
85
|
+
files.each do |f|
|
|
86
|
+
path = if options[:prefix] then
|
|
87
|
+
File.join gem_spec.full_gem_path, f
|
|
88
|
+
else
|
|
89
|
+
f
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
say path
|
|
93
|
+
end
|
|
70
94
|
end
|
|
71
95
|
end
|
|
72
96
|
|