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
|
@@ -1,37 +1,31 @@
|
|
|
1
1
|
require 'rubygems/command'
|
|
2
2
|
require 'rubygems/commands/query_command'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"STRING fragment of gem name to search for"
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def defaults_str # :nodoc:
|
|
22
|
-
"--local --no-details"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def usage # :nodoc:
|
|
26
|
-
"#{program_name} [STRING]"
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def execute
|
|
30
|
-
string = get_one_optional_argument
|
|
31
|
-
options[:name] = /#{string}/i
|
|
32
|
-
super
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
4
|
+
class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand
|
|
5
|
+
|
|
6
|
+
def initialize
|
|
7
|
+
super 'search', 'Display all gems whose name contains STRING'
|
|
8
|
+
|
|
9
|
+
remove_option '--name-matches'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def arguments # :nodoc:
|
|
13
|
+
"STRING fragment of gem name to search for"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def defaults_str # :nodoc:
|
|
17
|
+
"--local --no-details"
|
|
36
18
|
end
|
|
19
|
+
|
|
20
|
+
def usage # :nodoc:
|
|
21
|
+
"#{program_name} [STRING]"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def execute
|
|
25
|
+
string = get_one_optional_argument
|
|
26
|
+
options[:name] = /#{string}/i
|
|
27
|
+
super
|
|
28
|
+
end
|
|
29
|
+
|
|
37
30
|
end
|
|
31
|
+
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
require 'rubygems/command'
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
require 'rbconfig'
|
|
4
|
+
require 'tmpdir'
|
|
5
|
+
require 'pathname'
|
|
6
|
+
|
|
7
|
+
##
|
|
8
|
+
# Installs RubyGems itself. This command is ordinarily only available from a
|
|
9
|
+
# RubyGems checkout or tarball.
|
|
10
|
+
|
|
11
|
+
class Gem::Commands::SetupCommand < Gem::Command
|
|
12
|
+
|
|
13
|
+
def initialize
|
|
14
|
+
super 'setup', 'Install RubyGems',
|
|
15
|
+
:format_executable => true, :rdoc => true, :ri => true,
|
|
16
|
+
:site_or_vendor => :sitelibdir,
|
|
17
|
+
:destdir => '', :prefix => ''
|
|
18
|
+
|
|
19
|
+
add_option '--prefix=PREFIX',
|
|
20
|
+
'Prefix path for installing RubyGems',
|
|
21
|
+
'Will not affect gem repository location' do |prefix, options|
|
|
22
|
+
options[:prefix] = File.expand_path prefix
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
add_option '--destdir=DESTDIR',
|
|
26
|
+
'Root directory to install RubyGems into',
|
|
27
|
+
'Mainly used for packaging RubyGems' do |destdir, options|
|
|
28
|
+
options[:destdir] = File.expand_path destdir
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
add_option '--[no-]vendor',
|
|
32
|
+
'Install into vendorlibdir not sitelibdir',
|
|
33
|
+
'(Requires Ruby 1.8.7)' do |vendor, options|
|
|
34
|
+
if vendor and Gem.ruby_version < Gem::Version.new('1.8.7') then
|
|
35
|
+
raise OptionParser::InvalidOption,
|
|
36
|
+
"requires ruby 1.8.7+ (you have #{Gem.ruby_version})"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
options[:site_or_vendor] = vendor ? :vendorlibdir : :sitelibdir
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
add_option '--[no-]format_executable',
|
|
43
|
+
'Makes `gem` match ruby',
|
|
44
|
+
'If ruby is ruby18, gem will be gem18' do |value, options|
|
|
45
|
+
options[:format_executable] = value
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
add_option '--[no-]rdoc',
|
|
49
|
+
'Generate RDoc documentation for RubyGems' do |value, options|
|
|
50
|
+
options[:rdoc] = value
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
add_option '--[no-]ri',
|
|
54
|
+
'Generate RI documentation for RubyGems' do |value, options|
|
|
55
|
+
options[:ri] = value
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def check_ruby_version
|
|
60
|
+
required_version = Gem::Version.new '1.8.3'
|
|
61
|
+
|
|
62
|
+
unless Gem.ruby_version > required_version then
|
|
63
|
+
alert_error "Ruby version > #{required_version} required, is #{Gem.ruby_version}"
|
|
64
|
+
terminate_interaction 1
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def defaults_str # :nodoc:
|
|
69
|
+
"--format-executable --rdoc --ri"
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def description # :nodoc:
|
|
73
|
+
<<-EOF
|
|
74
|
+
Installs RubyGems itself.
|
|
75
|
+
|
|
76
|
+
RubyGems installs RDoc for itself in GEM_HOME. By default this is:
|
|
77
|
+
#{Gem.dir}
|
|
78
|
+
|
|
79
|
+
If you prefer a different directory, set the GEM_HOME environment variable.
|
|
80
|
+
|
|
81
|
+
RubyGems will install the gem command with a name matching ruby's
|
|
82
|
+
prefix and suffix. If ruby was installed as `ruby18`, gem will be
|
|
83
|
+
installed as `gem18`.
|
|
84
|
+
|
|
85
|
+
By default, this RubyGems will install gem as:
|
|
86
|
+
#{Gem.default_exec_format % 'gem'}
|
|
87
|
+
EOF
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def execute
|
|
91
|
+
install_destdir = options[:destdir]
|
|
92
|
+
|
|
93
|
+
unless install_destdir.empty? then
|
|
94
|
+
ENV['GEM_HOME'] ||= File.join(install_destdir,
|
|
95
|
+
Gem.default_dir.gsub(/^[a-zA-Z]:/, ''))
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
check_ruby_version
|
|
99
|
+
|
|
100
|
+
if Gem.configuration.really_verbose then
|
|
101
|
+
extend FileUtils::Verbose
|
|
102
|
+
else
|
|
103
|
+
extend FileUtils
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
lib_dir, bin_dir = make_destination_dirs install_destdir
|
|
107
|
+
|
|
108
|
+
install_lib lib_dir
|
|
109
|
+
|
|
110
|
+
install_executables bin_dir
|
|
111
|
+
|
|
112
|
+
remove_old_bin_files bin_dir
|
|
113
|
+
|
|
114
|
+
remove_source_caches install_destdir
|
|
115
|
+
|
|
116
|
+
install_rdoc
|
|
117
|
+
|
|
118
|
+
say
|
|
119
|
+
say "-" * 78
|
|
120
|
+
say
|
|
121
|
+
|
|
122
|
+
release_notes = File.join Dir.pwd, 'doc', 'release_notes',
|
|
123
|
+
"rel_#{Gem::RubyGemsVersion.gsub '.', '_'}.rdoc"
|
|
124
|
+
|
|
125
|
+
if File.exist? release_notes then
|
|
126
|
+
say File.read(release_notes)
|
|
127
|
+
else
|
|
128
|
+
say "Oh-no! Unable to find release notes!"
|
|
129
|
+
say "Looked in: #{release_notes}" if Gem.configuration.really_verbose
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
say
|
|
133
|
+
say "-" * 78
|
|
134
|
+
say
|
|
135
|
+
|
|
136
|
+
say "RubyGems installed the following executables:"
|
|
137
|
+
say @bin_file_names.map { |name| "\t#{name}\n" }
|
|
138
|
+
say
|
|
139
|
+
|
|
140
|
+
unless @bin_file_names.grep(/#{File::SEPARATOR}gem$/) then
|
|
141
|
+
say "If `gem` was installed by a previous RubyGems installation, you may need"
|
|
142
|
+
say "to remove it by hand."
|
|
143
|
+
say
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def install_executables(bin_dir)
|
|
148
|
+
say "Installing gem executable"
|
|
149
|
+
|
|
150
|
+
@bin_file_names = []
|
|
151
|
+
|
|
152
|
+
Dir.chdir 'bin' do
|
|
153
|
+
bin_files = Dir['*']
|
|
154
|
+
|
|
155
|
+
bin_files.delete 'update_rubygems'
|
|
156
|
+
|
|
157
|
+
bin_files.each do |bin_file|
|
|
158
|
+
bin_file_formatted = if options[:format_executable] then
|
|
159
|
+
Gem.default_exec_format % bin_file
|
|
160
|
+
else
|
|
161
|
+
bin_file
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
dest_file = File.join bin_dir, bin_file_formatted
|
|
165
|
+
bin_tmp_file = File.join Dir.tmpdir, bin_file
|
|
166
|
+
|
|
167
|
+
begin
|
|
168
|
+
bin = File.readlines bin_file
|
|
169
|
+
bin[0] = "#!#{Gem.ruby}\n"
|
|
170
|
+
|
|
171
|
+
File.open bin_tmp_file, 'w' do |fp|
|
|
172
|
+
fp.puts bin.join
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
install bin_tmp_file, dest_file, :mode => 0755
|
|
176
|
+
@bin_file_names << dest_file
|
|
177
|
+
ensure
|
|
178
|
+
rm bin_tmp_file
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
next unless Gem.win_platform?
|
|
182
|
+
|
|
183
|
+
begin
|
|
184
|
+
bin_cmd_file = File.join Dir.tmpdir, "#{bin_file}.bat"
|
|
185
|
+
|
|
186
|
+
File.open bin_cmd_file, 'w' do |file|
|
|
187
|
+
file.puts <<-TEXT
|
|
188
|
+
@ECHO OFF
|
|
189
|
+
IF NOT "%~f0" == "~f0" GOTO :WinNT
|
|
190
|
+
@"#{File.basename(Gem.ruby).chomp('"')}" "#{dest_file}" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
|
191
|
+
GOTO :EOF
|
|
192
|
+
:WinNT
|
|
193
|
+
@"#{File.basename(Gem.ruby).chomp('"')}" "%~dpn0" %*
|
|
194
|
+
TEXT
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
install bin_cmd_file, "#{dest_file}.bat", :mode => 0755
|
|
198
|
+
ensure
|
|
199
|
+
rm bin_cmd_file
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def install_lib(lib_dir)
|
|
206
|
+
say "Installing RubyGems"
|
|
207
|
+
|
|
208
|
+
Dir.chdir 'lib' do
|
|
209
|
+
lib_files = Dir[File.join('**', '*rb')]
|
|
210
|
+
|
|
211
|
+
lib_files.each do |lib_file|
|
|
212
|
+
dest_file = File.join lib_dir, lib_file
|
|
213
|
+
dest_dir = File.dirname dest_file
|
|
214
|
+
mkdir_p dest_dir unless File.directory? dest_dir
|
|
215
|
+
|
|
216
|
+
install lib_file, dest_file, :mode => 0644
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def install_rdoc
|
|
222
|
+
gem_doc_dir = File.join Gem.dir, 'doc'
|
|
223
|
+
rubygems_name = "rubygems-#{Gem::RubyGemsVersion}"
|
|
224
|
+
rubygems_doc_dir = File.join gem_doc_dir, rubygems_name
|
|
225
|
+
|
|
226
|
+
if File.writable? gem_doc_dir and
|
|
227
|
+
(not File.exist? rubygems_doc_dir or
|
|
228
|
+
File.writable? rubygems_doc_dir) then
|
|
229
|
+
say "Removing old RubyGems RDoc and ri"
|
|
230
|
+
Dir[File.join(Gem.dir, 'doc', 'rubygems-[0-9]*')].each do |dir|
|
|
231
|
+
rm_rf dir
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
if options[:ri] then
|
|
235
|
+
ri_dir = File.join rubygems_doc_dir, 'ri'
|
|
236
|
+
say "Installing #{rubygems_name} ri into #{ri_dir}"
|
|
237
|
+
run_rdoc '--ri', '--op', ri_dir
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
if options[:rdoc] then
|
|
241
|
+
rdoc_dir = File.join rubygems_doc_dir, 'rdoc'
|
|
242
|
+
say "Installing #{rubygems_name} rdoc into #{rdoc_dir}"
|
|
243
|
+
run_rdoc '--op', rdoc_dir
|
|
244
|
+
end
|
|
245
|
+
else
|
|
246
|
+
say "Skipping RDoc generation, #{gem_doc_dir} not writable"
|
|
247
|
+
say "Set the GEM_HOME environment variable if you want RDoc generated"
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
def make_destination_dirs(install_destdir)
|
|
252
|
+
lib_dir = nil
|
|
253
|
+
bin_dir = nil
|
|
254
|
+
|
|
255
|
+
prefix = options[:prefix]
|
|
256
|
+
site_or_vendor = options[:site_or_vendor]
|
|
257
|
+
|
|
258
|
+
if prefix.empty? then
|
|
259
|
+
lib_dir = Gem::ConfigMap[site_or_vendor]
|
|
260
|
+
bin_dir = Gem::ConfigMap[:bindir]
|
|
261
|
+
else
|
|
262
|
+
# Apple installed RubyGems into libdir, and RubyGems <= 1.1.0 gets
|
|
263
|
+
# confused about installation location, so switch back to
|
|
264
|
+
# sitelibdir/vendorlibdir.
|
|
265
|
+
if defined?(APPLE_GEM_HOME) and
|
|
266
|
+
# just in case Apple and RubyGems don't get this patched up proper.
|
|
267
|
+
(prefix == Gem::ConfigMap[:libdir] or
|
|
268
|
+
# this one is important
|
|
269
|
+
prefix == File.join(Gem::ConfigMap[:libdir], 'ruby')) then
|
|
270
|
+
lib_dir = Gem::ConfigMap[site_or_vendor]
|
|
271
|
+
bin_dir = Gem::ConfigMap[:bindir]
|
|
272
|
+
else
|
|
273
|
+
lib_dir = File.join prefix, 'lib'
|
|
274
|
+
bin_dir = File.join prefix, 'bin'
|
|
275
|
+
end
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
unless install_destdir.empty? then
|
|
279
|
+
lib_dir = File.join install_destdir, lib_dir.gsub(/^[a-zA-Z]:/, '')
|
|
280
|
+
bin_dir = File.join install_destdir, bin_dir.gsub(/^[a-zA-Z]:/, '')
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
mkdir_p lib_dir
|
|
284
|
+
mkdir_p bin_dir
|
|
285
|
+
|
|
286
|
+
return lib_dir, bin_dir
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def remove_old_bin_files(bin_dir)
|
|
290
|
+
old_bin_files = {
|
|
291
|
+
'gem_mirror' => 'gem mirror',
|
|
292
|
+
'gem_server' => 'gem server',
|
|
293
|
+
'gemlock' => 'gem lock',
|
|
294
|
+
'gemri' => 'ri',
|
|
295
|
+
'gemwhich' => 'gem which',
|
|
296
|
+
'index_gem_repository.rb' => 'gem generate_index',
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
old_bin_files.each do |old_bin_file, new_name|
|
|
300
|
+
old_bin_path = File.join bin_dir, old_bin_file
|
|
301
|
+
next unless File.exist? old_bin_path
|
|
302
|
+
|
|
303
|
+
deprecation_message = "`#{old_bin_file}` has been deprecated. Use `#{new_name}` instead."
|
|
304
|
+
|
|
305
|
+
File.open old_bin_path, 'w' do |fp|
|
|
306
|
+
fp.write <<-EOF
|
|
307
|
+
#!#{Gem.ruby}
|
|
308
|
+
|
|
309
|
+
abort "#{deprecation_message}"
|
|
310
|
+
EOF
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
next unless Gem.win_platform?
|
|
314
|
+
|
|
315
|
+
File.open "#{old_bin_path}.bat", 'w' do |fp|
|
|
316
|
+
fp.puts %{@ECHO.#{deprecation_message}}
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
def remove_source_caches(install_destdir)
|
|
322
|
+
if install_destdir.empty?
|
|
323
|
+
require 'rubygems/source_info_cache'
|
|
324
|
+
|
|
325
|
+
user_cache_file = File.join(install_destdir,
|
|
326
|
+
Gem::SourceInfoCache.user_cache_file)
|
|
327
|
+
system_cache_file = File.join(install_destdir,
|
|
328
|
+
Gem::SourceInfoCache.system_cache_file)
|
|
329
|
+
|
|
330
|
+
say "Removing old source_cache files"
|
|
331
|
+
rm_f user_cache_file if File.writable? File.dirname(user_cache_file)
|
|
332
|
+
rm_f system_cache_file if File.writable? File.dirname(system_cache_file)
|
|
333
|
+
end
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
def run_rdoc(*args)
|
|
337
|
+
begin
|
|
338
|
+
gem 'rdoc'
|
|
339
|
+
rescue Gem::LoadError
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
require 'rdoc/rdoc'
|
|
343
|
+
|
|
344
|
+
args << '--quiet'
|
|
345
|
+
args << '--main' << 'README'
|
|
346
|
+
args << '.' << 'README' << 'LICENSE.txt' << 'GPL.txt'
|
|
347
|
+
|
|
348
|
+
r = RDoc::RDoc.new
|
|
349
|
+
r.document args
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
end
|
|
353
|
+
|
|
@@ -3,9 +3,12 @@ require 'rubygems/command'
|
|
|
3
3
|
require 'rubygems/remote_fetcher'
|
|
4
4
|
require 'rubygems/source_info_cache'
|
|
5
5
|
require 'rubygems/spec_fetcher'
|
|
6
|
+
require 'rubygems/local_remote_options'
|
|
6
7
|
|
|
7
8
|
class Gem::Commands::SourcesCommand < Gem::Command
|
|
8
9
|
|
|
10
|
+
include Gem::LocalRemoteOptions
|
|
11
|
+
|
|
9
12
|
def initialize
|
|
10
13
|
super 'sources',
|
|
11
14
|
'Manage the sources and cache file RubyGems uses to search for gems'
|
|
@@ -30,6 +33,8 @@ class Gem::Commands::SourcesCommand < Gem::Command
|
|
|
30
33
|
add_option '-u', '--update', 'Update source cache' do |value, options|
|
|
31
34
|
options[:update] = value
|
|
32
35
|
end
|
|
36
|
+
|
|
37
|
+
add_proxy_option
|
|
33
38
|
end
|
|
34
39
|
|
|
35
40
|
def defaults_str
|
|
@@ -12,7 +12,8 @@ class Gem::Commands::SpecificationCommand < Gem::Command
|
|
|
12
12
|
|
|
13
13
|
def initialize
|
|
14
14
|
super 'specification', 'Display gem specification (in yaml)',
|
|
15
|
-
:domain => :local, :version => Gem::Requirement.default
|
|
15
|
+
:domain => :local, :version => Gem::Requirement.default,
|
|
16
|
+
:format => :yaml
|
|
16
17
|
|
|
17
18
|
add_version_option('examine')
|
|
18
19
|
add_platform_option
|
|
@@ -22,6 +23,18 @@ class Gem::Commands::SpecificationCommand < Gem::Command
|
|
|
22
23
|
options[:all] = true
|
|
23
24
|
end
|
|
24
25
|
|
|
26
|
+
add_option('--ruby', 'Output ruby format') do |value, options|
|
|
27
|
+
options[:format] = :ruby
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
add_option('--yaml', 'Output RUBY format') do |value, options|
|
|
31
|
+
options[:format] = :yaml
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
add_option('--marshal', 'Output Marshal format') do |value, options|
|
|
35
|
+
options[:format] = :marshal
|
|
36
|
+
end
|
|
37
|
+
|
|
25
38
|
add_local_remote_options
|
|
26
39
|
end
|
|
27
40
|
|
|
@@ -30,7 +43,7 @@ class Gem::Commands::SpecificationCommand < Gem::Command
|
|
|
30
43
|
end
|
|
31
44
|
|
|
32
45
|
def defaults_str # :nodoc:
|
|
33
|
-
"--local --version '#{Gem::Requirement.default}'"
|
|
46
|
+
"--local --version '#{Gem::Requirement.default}' --yaml"
|
|
34
47
|
end
|
|
35
48
|
|
|
36
49
|
def usage # :nodoc:
|
|
@@ -63,7 +76,14 @@ class Gem::Commands::SpecificationCommand < Gem::Command
|
|
|
63
76
|
terminate_interaction 1
|
|
64
77
|
end
|
|
65
78
|
|
|
66
|
-
output = lambda
|
|
79
|
+
output = lambda do |s|
|
|
80
|
+
say case options[:format]
|
|
81
|
+
when :ruby then s.to_ruby
|
|
82
|
+
when :marshal then Marshal.dump s
|
|
83
|
+
else s.to_yaml
|
|
84
|
+
end
|
|
85
|
+
say "\n"
|
|
86
|
+
end
|
|
67
87
|
|
|
68
88
|
if options[:all] then
|
|
69
89
|
specs.each(&output)
|