rubygems-update 1.0.1 → 1.1.0
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.tar.gz.sig +0 -0
- data/ChangeLog +248 -0
- data/README +2 -0
- data/Rakefile +47 -23
- data/bin/gem +9 -4
- data/bin/update_rubygems +15 -1
- data/examples/application/bin/myapp +0 -0
- data/lib/rubygems.rb +506 -373
- data/lib/rubygems/builder.rb +14 -7
- data/lib/rubygems/command.rb +9 -9
- data/lib/rubygems/command_manager.rb +1 -0
- data/lib/rubygems/commands/cleanup_command.rb +67 -69
- data/lib/rubygems/commands/environment_command.rb +16 -10
- data/lib/rubygems/commands/fetch_command.rb +7 -9
- data/lib/rubygems/commands/install_command.rb +9 -3
- data/lib/rubygems/commands/list_command.rb +2 -4
- data/lib/rubygems/commands/mirror_command.rb +1 -1
- data/lib/rubygems/commands/query_command.rb +52 -5
- data/lib/rubygems/commands/sources_command.rb +19 -10
- data/lib/rubygems/commands/specification_command.rb +10 -6
- data/lib/rubygems/commands/uninstall_command.rb +23 -6
- data/lib/rubygems/commands/unpack_command.rb +15 -3
- data/lib/rubygems/commands/update_command.rb +27 -25
- data/lib/rubygems/custom_require.rb +1 -1
- data/lib/rubygems/defaults.rb +8 -1
- data/lib/rubygems/dependency_installer.rb +72 -104
- data/lib/rubygems/digest/digest_adapter.rb +0 -0
- data/lib/rubygems/digest/md5.rb +0 -0
- data/lib/rubygems/digest/sha1.rb +0 -0
- data/lib/rubygems/digest/sha2.rb +0 -0
- data/lib/rubygems/exceptions.rb +22 -1
- data/lib/rubygems/format.rb +16 -10
- data/lib/rubygems/indexer.rb +46 -33
- data/lib/rubygems/indexer/abstract_index_builder.rb +10 -2
- data/lib/rubygems/indexer/latest_index_builder.rb +35 -0
- data/lib/rubygems/indexer/master_index_builder.rb +9 -8
- data/lib/rubygems/indexer/quick_index_builder.rb +5 -3
- data/lib/rubygems/install_update_options.rb +7 -1
- data/lib/rubygems/installer.rb +8 -5
- data/lib/rubygems/package.rb +17 -774
- data/lib/rubygems/package/f_sync_dir.rb +24 -0
- data/lib/rubygems/package/tar_header.rb +245 -0
- data/lib/rubygems/package/tar_input.rb +219 -0
- data/lib/rubygems/package/tar_output.rb +143 -0
- data/lib/rubygems/package/tar_reader.rb +86 -0
- data/lib/rubygems/package/tar_reader/entry.rb +99 -0
- data/lib/rubygems/package/tar_writer.rb +180 -0
- data/lib/rubygems/remote_fetcher.rb +131 -16
- data/lib/rubygems/requirement.rb +2 -0
- data/lib/rubygems/rubygems_version.rb +1 -1
- data/lib/rubygems/security.rb +1 -0
- data/lib/rubygems/server.rb +85 -104
- data/lib/rubygems/source_index.rb +412 -329
- data/lib/rubygems/source_info_cache.rb +232 -99
- data/lib/rubygems/source_info_cache_entry.rb +14 -4
- data/lib/rubygems/specification.rb +9 -10
- data/lib/rubygems/timer.rb +0 -0
- data/lib/rubygems/uninstaller.rb +56 -32
- data/lib/rubygems/user_interaction.rb +4 -10
- data/lib/rubygems/validator.rb +0 -0
- data/scripts/gemdoc.rb +0 -0
- data/scripts/specdoc.rb +0 -0
- data/setup.rb +56 -19
- data/test/gem_installer_test_case.rb +86 -0
- data/test/gem_installer_test_case.rbc +0 -0
- data/test/gem_package_tar_test_case.rb +146 -0
- data/test/gem_package_tar_test_case.rbc +0 -0
- data/test/gemutilities.rb +123 -38
- data/test/gemutilities.rbc +0 -0
- data/test/mockgemui.rb +5 -13
- data/test/mockgemui.rbc +0 -0
- data/test/private_key.pem +27 -0
- data/test/public_cert.pem +20 -0
- data/test/simple_gem.rbc +0 -0
- data/test/test_config.rbc +0 -0
- data/test/test_gem.rb +46 -4
- data/test/test_gem.rbc +0 -0
- data/test/test_gem_builder.rbc +0 -0
- data/test/test_gem_command.rbc +0 -0
- data/test/test_gem_command_manager.rb +4 -2
- data/test/test_gem_command_manager.rbc +0 -0
- data/test/test_gem_commands_build_command.rbc +0 -0
- data/test/test_gem_commands_cert_command.rb +5 -1
- data/test/test_gem_commands_cert_command.rbc +0 -0
- data/test/test_gem_commands_check_command.rbc +0 -0
- data/test/test_gem_commands_contents_command.rbc +0 -0
- data/test/test_gem_commands_dependency_command.rbc +0 -0
- data/test/test_gem_commands_environment_command.rb +17 -1
- data/test/test_gem_commands_environment_command.rbc +0 -0
- data/test/test_gem_commands_fetch_command.rb +6 -5
- data/test/test_gem_commands_fetch_command.rbc +0 -0
- data/test/test_gem_commands_generate_index_command.rbc +0 -0
- data/test/test_gem_commands_install_command.rb +36 -28
- data/test/test_gem_commands_install_command.rbc +0 -0
- data/test/test_gem_commands_mirror_command.rbc +0 -0
- data/test/test_gem_commands_pristine_command.rbc +0 -0
- data/test/test_gem_commands_query_command.rb +143 -19
- data/test/test_gem_commands_query_command.rbc +0 -0
- data/test/test_gem_commands_server_command.rb +1 -1
- data/test/test_gem_commands_server_command.rbc +0 -0
- data/test/test_gem_commands_sources_command.rb +67 -9
- data/test/test_gem_commands_sources_command.rbc +0 -0
- data/test/test_gem_commands_specification_command.rb +3 -2
- data/test/test_gem_commands_specification_command.rbc +0 -0
- data/test/test_gem_commands_unpack_command.rb +46 -4
- data/test/test_gem_commands_unpack_command.rbc +0 -0
- data/test/test_gem_commands_update_command.rb +174 -0
- data/test/test_gem_commands_update_command.rbc +0 -0
- data/test/test_gem_config_file.rbc +0 -0
- data/test/test_gem_dependency.rbc +0 -0
- data/test/test_gem_dependency_installer.rb +172 -187
- data/test/test_gem_dependency_installer.rbc +0 -0
- data/test/test_gem_dependency_list.rbc +0 -0
- data/test/test_gem_digest.rb +0 -0
- data/test/test_gem_digest.rbc +0 -0
- data/test/test_gem_doc_manager.rbc +0 -0
- data/test/test_gem_ext_configure_builder.rb +9 -6
- data/test/test_gem_ext_configure_builder.rbc +0 -0
- data/test/test_gem_ext_ext_conf_builder.rbc +0 -0
- data/test/test_gem_ext_rake_builder.rbc +0 -0
- data/test/test_gem_format.rb +1 -1
- data/test/test_gem_format.rbc +0 -0
- data/test/test_gem_gem_path_searcher.rbc +0 -0
- data/test/test_gem_gem_runner.rbc +0 -0
- data/test/test_gem_indexer.rb +7 -2
- data/test/test_gem_indexer.rbc +0 -0
- data/test/test_gem_install_update_options.rbc +0 -0
- data/test/test_gem_installer.rb +5 -84
- data/test/test_gem_installer.rbc +0 -0
- data/test/test_gem_local_remote_options.rbc +0 -0
- data/test/test_gem_outdated_command.rbc +0 -0
- data/test/test_gem_package_tar_header.rb +137 -0
- data/test/test_gem_package_tar_header.rbc +0 -0
- data/test/test_gem_package_tar_input.rb +119 -0
- data/test/test_gem_package_tar_input.rbc +0 -0
- data/test/test_gem_package_tar_output.rb +104 -0
- data/test/test_gem_package_tar_output.rbc +0 -0
- data/test/test_gem_package_tar_reader.rb +53 -0
- data/test/test_gem_package_tar_reader.rbc +0 -0
- data/test/test_gem_package_tar_reader_entry.rb +116 -0
- data/test/test_gem_package_tar_reader_entry.rbc +0 -0
- data/test/test_gem_package_tar_writer.rb +151 -0
- data/test/test_gem_package_tar_writer.rbc +0 -0
- data/test/test_gem_platform.rbc +0 -0
- data/test/test_gem_remote_fetcher.rb +189 -17
- data/test/test_gem_remote_fetcher.rbc +0 -0
- data/test/test_gem_requirement.rbc +0 -0
- data/test/test_gem_server.rb +13 -12
- data/test/test_gem_server.rbc +0 -0
- data/test/test_gem_source_index.rb +305 -56
- data/test/test_gem_source_index.rbc +0 -0
- data/test/test_gem_source_info_cache.rb +179 -53
- data/test/test_gem_source_info_cache.rbc +0 -0
- data/test/test_gem_source_info_cache_entry.rb +41 -10
- data/test/test_gem_source_info_cache_entry.rbc +0 -0
- data/test/test_gem_specification.rb +7 -7
- data/test/test_gem_specification.rbc +0 -0
- data/test/test_gem_stream_ui.rbc +0 -0
- data/test/test_gem_uninstaller.rb +43 -0
- data/test/test_gem_uninstaller.rbc +0 -0
- data/test/test_gem_validator.rbc +0 -0
- data/test/test_gem_version.rb +1 -1
- data/test/test_gem_version.rbc +0 -0
- data/test/test_gem_version_option.rbc +0 -0
- data/test/test_kernel.rb +1 -0
- data/test/test_kernel.rbc +0 -0
- metadata +85 -8
- metadata.gz.sig +0 -0
- data/lib/rubygems/gem_open_uri.rb +0 -7
- data/lib/rubygems/open-uri.rb +0 -773
- data/test/test_open_uri.rb +0 -13
- data/test/test_package.rb +0 -608
File without changes
|
data/lib/rubygems/digest/md5.rb
CHANGED
File without changes
|
data/lib/rubygems/digest/sha1.rb
CHANGED
File without changes
|
data/lib/rubygems/digest/sha2.rb
CHANGED
File without changes
|
data/lib/rubygems/exceptions.rb
CHANGED
@@ -11,8 +11,15 @@ class Gem::DependencyError < Gem::Exception; end
|
|
11
11
|
|
12
12
|
class Gem::DependencyRemovalException < Gem::Exception; end
|
13
13
|
|
14
|
+
##
|
15
|
+
# Raised when attempting to uninstall a gem that isn't in GEM_HOME.
|
16
|
+
|
17
|
+
class Gem::GemNotInHomeException < Gem::Exception
|
18
|
+
attr_accessor :spec
|
19
|
+
end
|
20
|
+
|
14
21
|
class Gem::DocumentError < Gem::Exception; end
|
15
|
-
|
22
|
+
|
16
23
|
##
|
17
24
|
# Potentially raised when a specification is validated.
|
18
25
|
class Gem::EndOfYAMLException < Gem::Exception; end
|
@@ -61,3 +68,17 @@ class Gem::RemoteSourceException < Gem::Exception; end
|
|
61
68
|
|
62
69
|
class Gem::VerificationError < Gem::Exception; end
|
63
70
|
|
71
|
+
##
|
72
|
+
# Raised to indicate that a system exit should occur with the specified
|
73
|
+
# exit_code
|
74
|
+
|
75
|
+
class Gem::SystemExitException < SystemExit
|
76
|
+
attr_accessor :exit_code
|
77
|
+
|
78
|
+
def initialize(exit_code)
|
79
|
+
@exit_code = exit_code
|
80
|
+
|
81
|
+
super "Exiting RubyGems with exit_code #{exit_code}"
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
data/lib/rubygems/format.rb
CHANGED
@@ -43,15 +43,12 @@ module Gem
|
|
43
43
|
|
44
44
|
# check for old version gem
|
45
45
|
if File.read(file_path, 20).include?("MD5SUM =")
|
46
|
-
#alert_warning "Gem #{file_path} is in old format."
|
47
46
|
require 'rubygems/old_format'
|
47
|
+
|
48
48
|
format = OldFormat.from_file_by_path(file_path)
|
49
49
|
else
|
50
|
-
|
51
|
-
|
52
|
-
format = from_io(f, file_path, security_policy)
|
53
|
-
ensure
|
54
|
-
f.close unless f.closed?
|
50
|
+
open file_path, Gem.binary_mode do |io|
|
51
|
+
format = from_io io, file_path, security_policy
|
55
52
|
end
|
56
53
|
end
|
57
54
|
|
@@ -65,15 +62,24 @@ module Gem
|
|
65
62
|
# io:: [IO] Stream from which to read the gem
|
66
63
|
#
|
67
64
|
def self.from_io(io, gem_path="(io)", security_policy = nil)
|
68
|
-
format =
|
69
|
-
|
65
|
+
format = new gem_path
|
66
|
+
|
67
|
+
Package.open io, 'r', security_policy do |pkg|
|
70
68
|
format.spec = pkg.metadata
|
71
69
|
format.file_entries = []
|
70
|
+
|
72
71
|
pkg.each do |entry|
|
73
|
-
|
74
|
-
|
72
|
+
size = entry.header.size
|
73
|
+
mode = entry.header.mode
|
74
|
+
|
75
|
+
format.file_entries << [{
|
76
|
+
"size" => size, "mode" => mode, "path" => entry.full_name,
|
77
|
+
},
|
78
|
+
entry.read
|
79
|
+
]
|
75
80
|
end
|
76
81
|
end
|
82
|
+
|
77
83
|
format
|
78
84
|
end
|
79
85
|
|
data/lib/rubygems/indexer.rb
CHANGED
@@ -11,6 +11,7 @@ end
|
|
11
11
|
|
12
12
|
##
|
13
13
|
# Top level class for building the gem repository index.
|
14
|
+
|
14
15
|
class Gem::Indexer
|
15
16
|
|
16
17
|
include Gem::UserInteraction
|
@@ -25,7 +26,9 @@ class Gem::Indexer
|
|
25
26
|
|
26
27
|
attr_reader :directory
|
27
28
|
|
29
|
+
##
|
28
30
|
# Create an indexer that will index the gems in +directory+.
|
31
|
+
|
29
32
|
def initialize(directory)
|
30
33
|
unless ''.respond_to? :to_xs then
|
31
34
|
fail "Gem::Indexer requires that the XML Builder library be installed:" \
|
@@ -39,52 +42,60 @@ class Gem::Indexer
|
|
39
42
|
|
40
43
|
@master_index = Gem::Indexer::MasterIndexBuilder.new "yaml", @directory
|
41
44
|
@marshal_index = Gem::Indexer::MarshalIndexBuilder.new marshal_name, @directory
|
42
|
-
@quick_index = Gem::Indexer::QuickIndexBuilder.new
|
45
|
+
@quick_index = Gem::Indexer::QuickIndexBuilder.new 'index', @directory
|
46
|
+
|
47
|
+
quick_dir = File.join @directory, 'quick'
|
48
|
+
@latest_index = Gem::Indexer::LatestIndexBuilder.new 'latest_index', quick_dir
|
43
49
|
end
|
44
50
|
|
51
|
+
##
|
45
52
|
# Build the index.
|
53
|
+
|
46
54
|
def build_index
|
47
55
|
@master_index.build do
|
48
56
|
@quick_index.build do
|
49
57
|
@marshal_index.build do
|
50
|
-
|
58
|
+
@latest_index.build do
|
59
|
+
progress = ui.progress_reporter gem_file_list.size,
|
51
60
|
"Generating index for #{gem_file_list.size} gems in #{@dest_directory}",
|
52
61
|
"Loaded all gems"
|
53
62
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
next
|
58
|
-
end
|
59
|
-
|
60
|
-
begin
|
61
|
-
spec = Gem::Format.from_file_by_path(gemfile).spec
|
62
|
-
|
63
|
-
unless gemfile =~ /\/#{Regexp.escape spec.original_name}.*\.gem\z/i then
|
64
|
-
alert_warning "Skipping misnamed gem: #{gemfile} => #{spec.full_name} (#{spec.original_name})"
|
63
|
+
gem_file_list.each do |gemfile|
|
64
|
+
if File.size(gemfile.to_s) == 0 then
|
65
|
+
alert_warning "Skipping zero-length gem: #{gemfile}"
|
65
66
|
next
|
66
67
|
end
|
67
68
|
|
68
|
-
|
69
|
-
|
69
|
+
begin
|
70
|
+
spec = Gem::Format.from_file_by_path(gemfile).spec
|
70
71
|
|
71
|
-
|
72
|
-
|
73
|
-
|
72
|
+
unless gemfile =~ /\/#{Regexp.escape spec.original_name}.*\.gem\z/i then
|
73
|
+
alert_warning "Skipping misnamed gem: #{gemfile} => #{spec.full_name} (#{spec.original_name})"
|
74
|
+
next
|
75
|
+
end
|
74
76
|
|
75
|
-
|
77
|
+
abbreviate spec
|
78
|
+
sanitize spec
|
76
79
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
end
|
80
|
+
@master_index.add spec
|
81
|
+
@quick_index.add spec
|
82
|
+
@marshal_index.add spec
|
83
|
+
@latest_index.add spec
|
84
|
+
|
85
|
+
progress.updated spec.original_name
|
84
86
|
|
85
|
-
|
87
|
+
rescue SignalException => e
|
88
|
+
alert_error "Recieved signal, exiting"
|
89
|
+
raise
|
90
|
+
rescue Exception => e
|
91
|
+
alert_error "Unable to process #{gemfile}\n#{e.message} (#{e.class})\n\t#{e.backtrace.join "\n\t"}"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
progress.done
|
86
96
|
|
87
|
-
|
97
|
+
say "Generating master indexes (this may take a while)"
|
98
|
+
end
|
88
99
|
end
|
89
100
|
end
|
90
101
|
end
|
@@ -95,14 +106,15 @@ class Gem::Indexer
|
|
95
106
|
|
96
107
|
say "Moving index into production dir #{@dest_directory}" if verbose
|
97
108
|
|
98
|
-
files = @master_index.files + @quick_index.files + @marshal_index.files
|
109
|
+
files = @master_index.files + @quick_index.files + @marshal_index.files +
|
110
|
+
@latest_index.files
|
99
111
|
|
100
112
|
files.each do |file|
|
101
|
-
|
102
|
-
|
113
|
+
src_name = File.join @directory, file
|
114
|
+
dst_name = File.join @dest_directory, file
|
103
115
|
|
104
|
-
FileUtils.rm_rf
|
105
|
-
FileUtils.mv
|
116
|
+
FileUtils.rm_rf dst_name, :verbose => verbose
|
117
|
+
FileUtils.mv src_name, @dest_directory, :verbose => verbose
|
106
118
|
end
|
107
119
|
end
|
108
120
|
|
@@ -160,4 +172,5 @@ require 'rubygems/indexer/abstract_index_builder'
|
|
160
172
|
require 'rubygems/indexer/master_index_builder'
|
161
173
|
require 'rubygems/indexer/quick_index_builder'
|
162
174
|
require 'rubygems/indexer/marshal_index_builder'
|
175
|
+
require 'rubygems/indexer/latest_index_builder'
|
163
176
|
|
@@ -22,16 +22,18 @@ class Gem::Indexer::AbstractIndexBuilder
|
|
22
22
|
@files = []
|
23
23
|
end
|
24
24
|
|
25
|
+
##
|
25
26
|
# Build a Gem index. Yields to block to handle the details of the
|
26
27
|
# actual building. Calls +begin_index+, +end_index+ and +cleanup+ at
|
27
28
|
# appropriate times to customize basic operations.
|
29
|
+
|
28
30
|
def build
|
29
31
|
FileUtils.mkdir_p @directory unless File.exist? @directory
|
30
32
|
raise "not a directory: #{@directory}" unless File.directory? @directory
|
31
33
|
|
32
34
|
file_path = File.join @directory, @filename
|
33
35
|
|
34
|
-
@files <<
|
36
|
+
@files << @filename
|
35
37
|
|
36
38
|
File.open file_path, "wb" do |file|
|
37
39
|
@file = file
|
@@ -39,14 +41,20 @@ class Gem::Indexer::AbstractIndexBuilder
|
|
39
41
|
yield
|
40
42
|
end_index
|
41
43
|
end
|
44
|
+
|
42
45
|
cleanup
|
43
46
|
ensure
|
44
47
|
@file = nil
|
45
48
|
end
|
46
49
|
|
50
|
+
##
|
47
51
|
# Compress the given file.
|
52
|
+
|
48
53
|
def compress(filename, ext="rz")
|
49
|
-
|
54
|
+
data = open filename, 'rb' do |fp| fp.read end
|
55
|
+
|
56
|
+
zipped = zip data
|
57
|
+
|
50
58
|
File.open "#{filename}.#{ext}", "wb" do |file|
|
51
59
|
file.write zipped
|
52
60
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rubygems/indexer'
|
2
|
+
|
3
|
+
##
|
4
|
+
# Construct the latest Gem index file.
|
5
|
+
|
6
|
+
class Gem::Indexer::LatestIndexBuilder < Gem::Indexer::AbstractIndexBuilder
|
7
|
+
|
8
|
+
def start_index
|
9
|
+
super
|
10
|
+
|
11
|
+
@index = Gem::SourceIndex.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def end_index
|
15
|
+
super
|
16
|
+
|
17
|
+
latest = @index.latest_specs.sort.map { |spec| spec.original_name }
|
18
|
+
|
19
|
+
@file.write latest.join("\n")
|
20
|
+
end
|
21
|
+
|
22
|
+
def cleanup
|
23
|
+
super
|
24
|
+
|
25
|
+
compress @file.path
|
26
|
+
|
27
|
+
@files.delete 'latest_index' # HACK installed via QuickIndexBuilder :/
|
28
|
+
end
|
29
|
+
|
30
|
+
def add(spec)
|
31
|
+
@index.add_spec(spec)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'rubygems/indexer'
|
2
2
|
|
3
|
+
##
|
3
4
|
# Construct the master Gem index file.
|
5
|
+
|
4
6
|
class Gem::Indexer::MasterIndexBuilder < Gem::Indexer::AbstractIndexBuilder
|
5
7
|
|
6
8
|
def start_index
|
@@ -10,6 +12,7 @@ class Gem::Indexer::MasterIndexBuilder < Gem::Indexer::AbstractIndexBuilder
|
|
10
12
|
|
11
13
|
def end_index
|
12
14
|
super
|
15
|
+
|
13
16
|
@file.puts "--- !ruby/object:#{@index.class}"
|
14
17
|
@file.puts "gems:"
|
15
18
|
|
@@ -28,11 +31,9 @@ class Gem::Indexer::MasterIndexBuilder < Gem::Indexer::AbstractIndexBuilder
|
|
28
31
|
index_file_name = File.join @directory, @filename
|
29
32
|
|
30
33
|
compress index_file_name, "Z"
|
31
|
-
|
32
|
-
|
33
|
-
paranoid index_file_name, compressed_file_name
|
34
|
+
paranoid index_file_name, "#{index_file_name}.Z"
|
34
35
|
|
35
|
-
@files <<
|
36
|
+
@files << "#{@filename}.Z"
|
36
37
|
end
|
37
38
|
|
38
39
|
def add(spec)
|
@@ -41,12 +42,12 @@ class Gem::Indexer::MasterIndexBuilder < Gem::Indexer::AbstractIndexBuilder
|
|
41
42
|
|
42
43
|
private
|
43
44
|
|
44
|
-
def paranoid(
|
45
|
-
data =
|
46
|
-
compressed_data =
|
45
|
+
def paranoid(path, compressed_path)
|
46
|
+
data = Gem.read_binary path
|
47
|
+
compressed_data = Gem.read_binary compressed_path
|
47
48
|
|
48
49
|
if data != unzip(compressed_data) then
|
49
|
-
|
50
|
+
raise "Compressed file #{compressed_path} does not match uncompressed file #{path}"
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'rubygems/indexer'
|
2
2
|
|
3
|
+
##
|
3
4
|
# Construct a quick index file and all of the individual specs to support
|
4
5
|
# incremental loading.
|
6
|
+
|
5
7
|
class Gem::Indexer::QuickIndexBuilder < Gem::Indexer::AbstractIndexBuilder
|
6
8
|
|
7
9
|
def initialize(filename, directory)
|
@@ -13,12 +15,12 @@ class Gem::Indexer::QuickIndexBuilder < Gem::Indexer::AbstractIndexBuilder
|
|
13
15
|
def cleanup
|
14
16
|
super
|
15
17
|
|
16
|
-
quick_index_file = File.join
|
18
|
+
quick_index_file = File.join @directory, @filename
|
17
19
|
compress quick_index_file
|
18
20
|
|
19
21
|
# the complete quick index is in a directory, so move it as a whole
|
20
|
-
@files.delete
|
21
|
-
@files <<
|
22
|
+
@files.delete 'index'
|
23
|
+
@files << 'quick'
|
22
24
|
end
|
23
25
|
|
24
26
|
def add(spec)
|
@@ -25,6 +25,12 @@ module Gem::InstallUpdateOptions
|
|
25
25
|
options[:install_dir] = File.expand_path(value)
|
26
26
|
end
|
27
27
|
|
28
|
+
add_option(:"Install/Update", '-n', '--bindir DIR',
|
29
|
+
'Directory where binary files are',
|
30
|
+
'located') do |value, options|
|
31
|
+
options[:bin_dir] = File.expand_path(value)
|
32
|
+
end
|
33
|
+
|
28
34
|
add_option(:"Install/Update", '-d', '--[no-]rdoc',
|
29
35
|
'Generate RDoc documentation for the gem on',
|
30
36
|
'install') do |value, options|
|
@@ -37,7 +43,7 @@ module Gem::InstallUpdateOptions
|
|
37
43
|
options[:generate_ri] = value
|
38
44
|
end
|
39
45
|
|
40
|
-
add_option(:"Install/Update", '-E', '--env-shebang',
|
46
|
+
add_option(:"Install/Update", '-E', '--[no-]env-shebang',
|
41
47
|
"Rewrite the shebang line on installed",
|
42
48
|
"scripts to use /usr/bin/env") do |value, options|
|
43
49
|
options[:env_shebang] = value
|
data/lib/rubygems/installer.rb
CHANGED
@@ -63,6 +63,8 @@ class Gem::Installer
|
|
63
63
|
:force => false,
|
64
64
|
:install_dir => Gem.dir,
|
65
65
|
:exec_format => false,
|
66
|
+
:env_shebang => false,
|
67
|
+
:bin_dir => nil
|
66
68
|
}.merge options
|
67
69
|
|
68
70
|
@env_shebang = options[:env_shebang]
|
@@ -73,6 +75,7 @@ class Gem::Installer
|
|
73
75
|
@format_executable = options[:format_executable]
|
74
76
|
@security_policy = options[:security_policy]
|
75
77
|
@wrappers = options[:wrappers]
|
78
|
+
@bin_dir = options[:bin_dir]
|
76
79
|
|
77
80
|
begin
|
78
81
|
@format = Gem::Format.from_file_by_path @gem, @security_policy
|
@@ -103,7 +106,7 @@ class Gem::Installer
|
|
103
106
|
|
104
107
|
unless @force then
|
105
108
|
if rrv = @spec.required_ruby_version then
|
106
|
-
unless rrv.satisfied_by? Gem
|
109
|
+
unless rrv.satisfied_by? Gem.ruby_version then
|
107
110
|
raise Gem::InstallError, "#{@spec.name} requires Ruby version #{rrv}"
|
108
111
|
end
|
109
112
|
end
|
@@ -224,7 +227,7 @@ class Gem::Installer
|
|
224
227
|
# If the user has asked for the gem to be installed in a directory that is
|
225
228
|
# the system gem directory, then use the system bin directory, else create
|
226
229
|
# (or use) a new bin dir under the gem_home.
|
227
|
-
bindir = Gem.bindir @gem_home
|
230
|
+
bindir = @bin_dir ? @bin_dir : (Gem.bindir @gem_home)
|
228
231
|
|
229
232
|
Dir.mkdir bindir unless File.exist? bindir
|
230
233
|
raise Gem::FilePermissionError.new(bindir) unless File.writable? bindir
|
@@ -302,7 +305,7 @@ class Gem::Installer
|
|
302
305
|
# necessary.
|
303
306
|
def shebang(bin_file_name)
|
304
307
|
if @env_shebang then
|
305
|
-
"#!/usr/bin/env
|
308
|
+
"#!/usr/bin/env " + Gem::ConfigMap[:ruby_install_name]
|
306
309
|
else
|
307
310
|
path = File.join @gem_dir, @spec.bindir, bin_file_name
|
308
311
|
|
@@ -351,10 +354,10 @@ TEXT
|
|
351
354
|
<<-TEXT
|
352
355
|
@ECHO OFF
|
353
356
|
IF NOT "%~f0" == "~f0" GOTO :WinNT
|
354
|
-
@"#{Gem.ruby}" "#{File.join(bindir, bin_file_name)}" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
357
|
+
@"#{File.basename(Gem.ruby)}" "#{File.join(bindir, bin_file_name)}" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
355
358
|
GOTO :EOF
|
356
359
|
:WinNT
|
357
|
-
"
|
360
|
+
@"#{File.basename(Gem.ruby)}" "%~dpn0" %*
|
358
361
|
TEXT
|
359
362
|
end
|
360
363
|
|