rubygems-update 1.8.30 → 2.0.0.preview2
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.
- checksums.yaml +6 -6
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +3 -0
- data/.autotest +6 -3
- data/History.txt +137 -63
- data/LICENSE.txt +1 -5
- data/Manifest.txt +69 -32
- data/README.rdoc +11 -9
- data/Rakefile +24 -38
- data/bin/gem +0 -9
- data/bin/update_rubygems +1 -0
- data/lib/rubygems.rb +193 -405
- data/lib/rubygems/available_set.rb +95 -0
- data/lib/rubygems/command.rb +88 -45
- data/lib/rubygems/command_manager.rb +67 -40
- data/lib/rubygems/commands/build_command.rb +5 -23
- data/lib/rubygems/commands/cert_command.rb +199 -57
- data/lib/rubygems/commands/check_command.rb +14 -39
- data/lib/rubygems/commands/cleanup_command.rb +9 -1
- data/lib/rubygems/commands/contents_command.rb +30 -12
- data/lib/rubygems/commands/dependency_command.rb +3 -8
- data/lib/rubygems/commands/environment_command.rb +13 -8
- data/lib/rubygems/commands/fetch_command.rb +3 -16
- data/lib/rubygems/commands/generate_index_command.rb +7 -47
- data/lib/rubygems/commands/help_command.rb +1 -1
- data/lib/rubygems/commands/install_command.rb +69 -36
- data/lib/rubygems/commands/list_command.rb +6 -4
- data/lib/rubygems/commands/lock_command.rb +1 -1
- data/lib/rubygems/commands/mirror_command.rb +17 -0
- data/lib/rubygems/commands/outdated_command.rb +6 -3
- data/lib/rubygems/commands/owner_command.rb +13 -5
- data/lib/rubygems/commands/pristine_command.rb +19 -4
- data/lib/rubygems/commands/push_command.rb +12 -1
- data/lib/rubygems/commands/query_command.rb +43 -27
- data/lib/rubygems/commands/rdoc_command.rb +23 -28
- data/lib/rubygems/commands/search_command.rb +4 -18
- data/lib/rubygems/commands/server_command.rb +1 -1
- data/lib/rubygems/commands/setup_command.rb +124 -38
- data/lib/rubygems/commands/sources_command.rb +16 -16
- data/lib/rubygems/commands/specification_command.rb +11 -13
- data/lib/rubygems/commands/uninstall_command.rb +24 -7
- data/lib/rubygems/commands/unpack_command.rb +7 -3
- data/lib/rubygems/commands/update_command.rb +22 -36
- data/lib/rubygems/commands/yank_command.rb +98 -0
- data/lib/rubygems/compatibility.rb +51 -0
- data/lib/rubygems/config_file.rb +82 -54
- data/lib/rubygems/core_ext/kernel_gem.rb +53 -0
- data/lib/rubygems/core_ext/kernel_require.rb +119 -0
- data/lib/rubygems/defaults.rb +10 -21
- data/lib/rubygems/dependency.rb +61 -10
- data/lib/rubygems/dependency_installer.rb +157 -69
- data/lib/rubygems/dependency_list.rb +11 -19
- data/lib/rubygems/dependency_resolver.rb +562 -0
- data/lib/rubygems/deprecate.rb +40 -40
- data/lib/rubygems/errors.rb +77 -24
- data/lib/rubygems/exceptions.rb +25 -7
- data/lib/rubygems/ext/builder.rb +20 -23
- data/lib/rubygems/ext/configure_builder.rb +2 -2
- data/lib/rubygems/ext/ext_conf_builder.rb +5 -45
- data/lib/rubygems/ext/rake_builder.rb +2 -2
- data/lib/rubygems/gem_runner.rb +3 -16
- data/lib/rubygems/gemcutter_utilities.rb +22 -7
- data/lib/rubygems/indexer.rb +6 -159
- data/lib/rubygems/install_message.rb +12 -0
- data/lib/rubygems/install_update_options.rb +56 -18
- data/lib/rubygems/installer.rb +244 -134
- data/lib/rubygems/installer_test_case.rb +71 -19
- data/lib/rubygems/mock_gem_ui.rb +17 -0
- data/lib/rubygems/name_tuple.rb +110 -0
- data/lib/rubygems/package.rb +514 -43
- data/lib/rubygems/package/digest_io.rb +64 -0
- data/lib/rubygems/package/old.rb +147 -0
- data/lib/rubygems/package/tar_header.rb +18 -55
- data/lib/rubygems/package/tar_reader.rb +20 -3
- data/lib/rubygems/package/tar_writer.rb +63 -7
- data/lib/rubygems/package_task.rb +3 -4
- data/lib/rubygems/path_support.rb +14 -7
- data/lib/rubygems/platform.rb +19 -26
- data/lib/rubygems/rdoc.rb +316 -0
- data/lib/rubygems/remote_fetcher.rb +117 -54
- data/lib/rubygems/request_set.rb +182 -0
- data/lib/rubygems/requirement.rb +63 -26
- data/lib/rubygems/security.rb +295 -555
- data/lib/rubygems/security/policies.rb +115 -0
- data/lib/rubygems/security/policy.rb +227 -0
- data/lib/rubygems/security/signer.rb +136 -0
- data/lib/rubygems/security/trust_dir.rb +104 -0
- data/lib/rubygems/server.rb +45 -55
- data/lib/rubygems/source.rb +144 -0
- data/lib/rubygems/source_list.rb +87 -0
- data/lib/rubygems/source_local.rb +92 -0
- data/lib/rubygems/source_specific_file.rb +28 -0
- data/lib/rubygems/spec_fetcher.rb +116 -184
- data/lib/rubygems/specification.rb +731 -335
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem +88 -30
- data/lib/rubygems/ssl_certs/Entrust_net-Secure-Server-Certification-Authority.pem +90 -0
- data/lib/rubygems/ssl_certs/VerisignClass3PublicPrimaryCertificationAuthority-G2.pem +57 -0
- data/lib/rubygems/syck_hack.rb +2 -0
- data/lib/rubygems/test_case.rb +199 -109
- data/lib/rubygems/test_utilities.rb +25 -5
- data/lib/rubygems/uninstaller.rb +62 -20
- data/lib/rubygems/user_interaction.rb +10 -0
- data/lib/rubygems/validator.rb +33 -40
- data/lib/rubygems/version.rb +19 -8
- data/setup.rb +8 -1
- data/test/rubygems/alternate_cert.pem +9 -0
- data/test/rubygems/alternate_cert_32.pem +9 -0
- data/test/rubygems/alternate_key.pem +9 -0
- data/test/rubygems/bad_rake.rb +1 -0
- data/test/rubygems/child_cert.pem +9 -0
- data/test/rubygems/child_cert_32.pem +9 -0
- data/test/rubygems/child_key.pem +9 -0
- data/test/rubygems/data/null-type.gemspec.rz +0 -0
- data/test/rubygems/expired_cert.pem +9 -0
- data/test/rubygems/future_cert.pem +9 -0
- data/test/rubygems/future_cert_32.pem +9 -0
- data/test/rubygems/good_rake.rb +1 -0
- data/test/rubygems/grandchild_cert.pem +9 -0
- data/test/rubygems/grandchild_cert_32.pem +9 -0
- data/test/rubygems/grandchild_key.pem +9 -0
- data/test/rubygems/invalid_issuer_cert.pem +9 -0
- data/test/rubygems/invalid_issuer_cert_32.pem +9 -0
- data/test/rubygems/invalid_key.pem +9 -0
- data/test/rubygems/invalid_signer_cert.pem +9 -0
- data/test/rubygems/invalid_signer_cert_32.pem +9 -0
- data/test/rubygems/invalidchild_cert.pem +9 -0
- data/test/rubygems/invalidchild_cert_32.pem +9 -0
- data/test/rubygems/invalidchild_key.pem +9 -0
- data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
- data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
- data/test/rubygems/private_key.pem +7 -25
- data/test/rubygems/public_cert.pem +8 -18
- data/test/rubygems/public_cert_32.pem +10 -0
- data/test/rubygems/public_key.pem +4 -0
- data/test/rubygems/rubygems/commands/crash_command.rb +1 -1
- data/test/rubygems/test_config.rb +4 -6
- data/test/rubygems/test_deprecate.rb +76 -0
- data/test/rubygems/test_gem.rb +318 -83
- data/test/rubygems/test_gem_available_set.rb +106 -0
- data/test/rubygems/test_gem_command.rb +10 -0
- data/test/rubygems/test_gem_command_manager.rb +55 -9
- data/test/rubygems/test_gem_commands_build_command.rb +11 -19
- data/test/rubygems/test_gem_commands_cert_command.rb +441 -42
- data/test/rubygems/test_gem_commands_cleanup_command.rb +29 -1
- data/test/rubygems/test_gem_commands_contents_command.rb +23 -0
- data/test/rubygems/test_gem_commands_dependency_command.rb +5 -0
- data/test/rubygems/test_gem_commands_fetch_command.rb +19 -20
- data/test/rubygems/test_gem_commands_generate_index_command.rb +2 -83
- data/test/rubygems/test_gem_commands_help_command.rb +2 -1
- data/test/rubygems/test_gem_commands_install_command.rb +647 -48
- data/test/rubygems/test_gem_commands_mirror.rb +32 -0
- data/test/rubygems/test_gem_commands_owner_command.rb +4 -8
- data/test/rubygems/test_gem_commands_pristine_command.rb +99 -4
- data/test/rubygems/test_gem_commands_push_command.rb +62 -8
- data/test/rubygems/test_gem_commands_query_command.rb +51 -0
- data/test/rubygems/test_gem_commands_search_command.rb +25 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +45 -0
- data/test/rubygems/test_gem_commands_sources_command.rb +21 -6
- data/test/rubygems/test_gem_commands_specification_command.rb +33 -1
- data/test/rubygems/test_gem_commands_uninstall_command.rb +91 -31
- data/test/rubygems/test_gem_commands_unpack_command.rb +3 -3
- data/test/rubygems/test_gem_commands_update_command.rb +56 -38
- data/test/rubygems/test_gem_commands_which_command.rb +4 -4
- data/test/rubygems/test_gem_commands_yank_command.rb +97 -0
- data/test/rubygems/test_gem_config_file.rb +66 -21
- data/test/rubygems/test_gem_dependency.rb +46 -0
- data/test/rubygems/test_gem_dependency_installer.rb +228 -18
- data/test/rubygems/test_gem_dependency_list.rb +0 -9
- data/test/rubygems/test_gem_dependency_resolver.rb +327 -0
- data/test/rubygems/test_gem_ext_configure_builder.rb +4 -4
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +21 -49
- data/test/rubygems/test_gem_ext_rake_builder.rb +13 -13
- data/test/rubygems/test_gem_gem_runner.rb +27 -5
- data/test/rubygems/test_gem_gemcutter_utilities.rb +19 -0
- data/test/rubygems/test_gem_indexer.rb +14 -227
- data/test/rubygems/test_gem_install_update_options.rb +83 -3
- data/test/rubygems/test_gem_installer.rb +211 -236
- data/test/rubygems/test_gem_local_remote_options.rb +8 -2
- data/test/rubygems/test_gem_name_tuple.rb +15 -0
- data/test/rubygems/test_gem_package.rb +547 -0
- data/test/rubygems/test_gem_package_old.rb +37 -0
- data/test/rubygems/test_gem_package_tar_reader.rb +32 -0
- data/test/rubygems/test_gem_package_tar_writer.rb +84 -1
- data/test/rubygems/test_gem_path_support.rb +4 -30
- data/test/rubygems/test_gem_platform.rb +3 -6
- data/test/rubygems/test_gem_rdoc.rb +245 -0
- data/test/rubygems/test_gem_remote_fetcher.rb +51 -5
- data/test/rubygems/test_gem_request_set.rb +70 -0
- data/test/rubygems/test_gem_requirement.rb +53 -24
- data/test/rubygems/test_gem_security.rb +189 -43
- data/test/rubygems/test_gem_security_policy.rb +376 -0
- data/test/rubygems/test_gem_security_signer.rb +184 -0
- data/test/rubygems/test_gem_security_trust_dir.rb +94 -0
- data/test/rubygems/test_gem_server.rb +31 -36
- data/test/rubygems/test_gem_silent_ui.rb +2 -2
- data/test/rubygems/test_gem_source.rb +188 -0
- data/test/rubygems/test_gem_source_list.rb +87 -0
- data/test/rubygems/test_gem_source_local.rb +83 -0
- data/test/rubygems/test_gem_source_specific_file.rb +33 -0
- data/test/rubygems/test_gem_spec_fetcher.rb +91 -255
- data/test/rubygems/test_gem_specification.rb +293 -39
- data/test/rubygems/test_gem_uninstaller.rb +136 -13
- data/test/rubygems/test_gem_validator.rb +14 -41
- data/test/rubygems/test_gem_version.rb +15 -21
- data/test/rubygems/test_require.rb +193 -0
- data/test/rubygems/wrong_key_cert.pem +9 -0
- data/test/rubygems/wrong_key_cert_32.pem +9 -0
- metadata +171 -83
- metadata.gz.sig +1 -0
- data/CVE-2013-4287.txt +0 -36
- data/CVE-2013-4363.txt +0 -45
- data/ci_build.sh +0 -27
- data/cruise_config.rb +0 -32
- data/lib/rbconfig/datadir.rb +0 -13
- data/lib/rubygems/builder.rb +0 -99
- data/lib/rubygems/custom_require.rb +0 -69
- data/lib/rubygems/doc_manager.rb +0 -243
- data/lib/rubygems/format.rb +0 -82
- data/lib/rubygems/gem_openssl.rb +0 -90
- data/lib/rubygems/gem_path_searcher.rb +0 -172
- data/lib/rubygems/old_format.rb +0 -153
- data/lib/rubygems/package/f_sync_dir.rb +0 -23
- data/lib/rubygems/package/tar_input.rb +0 -234
- data/lib/rubygems/package/tar_output.rb +0 -146
- data/lib/rubygems/require_paths_builder.rb +0 -18
- data/lib/rubygems/source_index.rb +0 -406
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem +0 -25
- data/lib/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +0 -14
- data/lib/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +0 -28
- data/lib/rubygems/ssl_certs/GeoTrustGlobalCA.pem +0 -20
- data/test/rubygems/test_bundled_ca.rb +0 -59
- data/test/rubygems/test_gem_builder.rb +0 -44
- data/test/rubygems/test_gem_doc_manager.rb +0 -32
- data/test/rubygems/test_gem_ext_builder.rb +0 -58
- data/test/rubygems/test_gem_format.rb +0 -88
- data/test/rubygems/test_gem_gem_path_searcher.rb +0 -94
- data/test/rubygems/test_gem_package_tar_input.rb +0 -129
- data/test/rubygems/test_gem_package_tar_output.rb +0 -101
- data/test/rubygems/test_gem_source_index.rb +0 -250
- data/util/update_bundled_ca_certificates.rb +0 -103
data/lib/rubygems/deprecate.rb
CHANGED
@@ -20,51 +20,51 @@
|
|
20
20
|
# end
|
21
21
|
# end
|
22
22
|
|
23
|
-
module Gem
|
24
|
-
module Deprecate
|
23
|
+
module Gem::Deprecate
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
def self.skip= v # :nodoc:
|
31
|
-
@skip = v
|
32
|
-
end
|
25
|
+
def self.skip # :nodoc:
|
26
|
+
@skip ||= false
|
27
|
+
end
|
33
28
|
|
34
|
-
|
35
|
-
|
29
|
+
def self.skip= v # :nodoc:
|
30
|
+
@skip = v
|
31
|
+
end
|
36
32
|
|
37
|
-
|
38
|
-
|
39
|
-
yield
|
40
|
-
ensure
|
41
|
-
Gem::Deprecate.skip = original
|
42
|
-
end
|
33
|
+
##
|
34
|
+
# Temporarily turn off warnings. Intended for tests only.
|
43
35
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
36
|
+
def skip_during
|
37
|
+
Gem::Deprecate.skip, original = true, Gem::Deprecate.skip
|
38
|
+
yield
|
39
|
+
ensure
|
40
|
+
Gem::Deprecate.skip = original
|
41
|
+
end
|
49
42
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
klass = self.kind_of? Module
|
56
|
-
target = klass ? "#{self}." : "#{self.class}#"
|
57
|
-
msg = [ "NOTE: #{target}#{name} is deprecated",
|
58
|
-
repl == :none ? " with no replacement" : ", use #{repl}",
|
59
|
-
". It will be removed on or after %4d-%02d-01." % [year, month],
|
60
|
-
"\n#{target}#{name} called from #{Gem.location_of_caller.join(":")}",
|
61
|
-
]
|
62
|
-
warn "#{msg.join}." unless Gem::Deprecate.skip
|
63
|
-
send old, *args, &block
|
64
|
-
end
|
65
|
-
}
|
66
|
-
end
|
43
|
+
##
|
44
|
+
# Simple deprecation method that deprecates +name+ by wrapping it up
|
45
|
+
# in a dummy method. It warns on each call to the dummy method
|
46
|
+
# telling the user of +repl+ (unless +repl+ is :none) and the
|
47
|
+
# year/month that it is planned to go away.
|
67
48
|
|
68
|
-
|
49
|
+
def deprecate name, repl, year, month
|
50
|
+
class_eval {
|
51
|
+
old = "_deprecated_#{name}"
|
52
|
+
alias_method old, name
|
53
|
+
define_method name do |*args, &block| # TODO: really works on 1.8.7?
|
54
|
+
klass = self.kind_of? Module
|
55
|
+
target = klass ? "#{self}." : "#{self.class}#"
|
56
|
+
msg = [ "NOTE: #{target}#{name} is deprecated",
|
57
|
+
repl == :none ? " with no replacement" : "; use #{repl} instead",
|
58
|
+
". It will be removed on or after %4d-%02d-01." % [year, month],
|
59
|
+
"\n#{target}#{name} called from #{Gem.location_of_caller.join(":")}",
|
60
|
+
]
|
61
|
+
warn "#{msg.join}." unless Gem::Deprecate.skip
|
62
|
+
send old, *args, &block
|
63
|
+
end
|
64
|
+
}
|
69
65
|
end
|
66
|
+
|
67
|
+
module_function :deprecate, :skip_during
|
68
|
+
|
70
69
|
end
|
70
|
+
|
data/lib/rubygems/errors.rb
CHANGED
@@ -1,35 +1,88 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
# was found, but that it isn't usable on the current platform.
|
5
|
-
#
|
6
|
-
# fetch and install read these and report them to the user to aid
|
7
|
-
# in figuring out why a gem couldn't be installed.
|
1
|
+
##
|
2
|
+
# This file contains all the various exceptions and other errors that are used
|
3
|
+
# inside of RubyGems.
|
8
4
|
#
|
9
|
-
|
5
|
+
# DOC: Confirm _all_
|
10
6
|
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
module Gem
|
8
|
+
##
|
9
|
+
# Raised when RubyGems is unable to load or activate a gem. Contains the
|
10
|
+
# name and version requirements of the gem that either conflicts with
|
11
|
+
# already activated gems or that RubyGems is otherwise unable to activate.
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
@platforms = []
|
19
|
-
end
|
13
|
+
class LoadError < ::LoadError
|
14
|
+
# Name of gem
|
15
|
+
attr_accessor :name
|
20
16
|
|
21
|
-
|
22
|
-
|
17
|
+
# Version requirement of gem
|
18
|
+
attr_accessor :requirement
|
23
19
|
end
|
24
20
|
|
25
|
-
|
26
|
-
|
21
|
+
# FIX: does this need to exist? The subclass is the only other reference
|
22
|
+
# I can find.
|
23
|
+
class ErrorReason; end
|
24
|
+
|
25
|
+
# Generated when trying to lookup a gem to indicate that the gem
|
26
|
+
# was found, but that it isn't usable on the current platform.
|
27
|
+
#
|
28
|
+
# fetch and install read these and report them to the user to aid
|
29
|
+
# in figuring out why a gem couldn't be installed.
|
30
|
+
#
|
31
|
+
class PlatformMismatch < ErrorReason
|
32
|
+
|
33
|
+
##
|
34
|
+
# the name of the gem
|
35
|
+
attr_reader :name
|
36
|
+
|
37
|
+
##
|
38
|
+
# the version
|
39
|
+
attr_reader :version
|
40
|
+
|
41
|
+
##
|
42
|
+
# The platforms that are mismatched
|
43
|
+
attr_reader :platforms
|
44
|
+
|
45
|
+
def initialize(name, version)
|
46
|
+
@name = name
|
47
|
+
@version = version
|
48
|
+
@platforms = []
|
49
|
+
end
|
27
50
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
51
|
+
##
|
52
|
+
# append a platform to the list of mismatched platforms.
|
53
|
+
#
|
54
|
+
# Platforms are added via this instead of injected via the constructor
|
55
|
+
# so that we can loop over a list of mismatches and just add them rather
|
56
|
+
# than perform some kind of calculation mismatch summary before creation.
|
57
|
+
def add_platform(platform)
|
58
|
+
@platforms << platform
|
59
|
+
end
|
60
|
+
|
61
|
+
##
|
62
|
+
# A wordy description of the error.
|
63
|
+
def wordy
|
64
|
+
"Found %s (%), but was for platform%s %s" %
|
65
|
+
[@name,
|
66
|
+
@version,
|
67
|
+
@platforms.size == 1 ? 's' : '',
|
68
|
+
@platforms.join(' ,')]
|
32
69
|
end
|
33
70
|
end
|
34
71
|
|
72
|
+
##
|
73
|
+
# An error that indicates we weren't able to fetch some
|
74
|
+
# data from a source
|
75
|
+
|
76
|
+
class SourceFetchProblem < ErrorReason
|
77
|
+
def initialize(source, error)
|
78
|
+
@source = source
|
79
|
+
@error = error
|
80
|
+
end
|
81
|
+
|
82
|
+
attr_reader :source, :error
|
83
|
+
|
84
|
+
def wordy
|
85
|
+
"Unable to download data from #{@source.uri} - #{@error.message}"
|
86
|
+
end
|
87
|
+
end
|
35
88
|
end
|
data/lib/rubygems/exceptions.rb
CHANGED
@@ -1,7 +1,14 @@
|
|
1
|
+
# TODO: the documentation in here is terrible.
|
2
|
+
#
|
3
|
+
# Each exception needs a brief description and the scenarios where it is
|
4
|
+
# likely to be raised
|
5
|
+
|
1
6
|
##
|
2
7
|
# Base exception class for RubyGems. All exception raised by RubyGems are a
|
3
8
|
# subclass of this one.
|
4
|
-
class Gem::Exception < RuntimeError
|
9
|
+
class Gem::Exception < RuntimeError
|
10
|
+
attr_accessor :source_exception
|
11
|
+
end
|
5
12
|
|
6
13
|
class Gem::CommandLineError < Gem::Exception; end
|
7
14
|
|
@@ -24,11 +31,18 @@ class Gem::EndOfYAMLException < Gem::Exception; end
|
|
24
31
|
|
25
32
|
##
|
26
33
|
# Signals that a file permission error is preventing the user from
|
27
|
-
#
|
34
|
+
# operating on the given directory.
|
35
|
+
|
28
36
|
class Gem::FilePermissionError < Gem::Exception
|
29
|
-
|
30
|
-
|
37
|
+
|
38
|
+
attr_reader :directory
|
39
|
+
|
40
|
+
def initialize directory
|
41
|
+
@directory = directory
|
42
|
+
|
43
|
+
super "You don't have write permissions for the #{directory} directory."
|
31
44
|
end
|
45
|
+
|
32
46
|
end
|
33
47
|
|
34
48
|
##
|
@@ -37,9 +51,12 @@ class Gem::FormatException < Gem::Exception
|
|
37
51
|
attr_accessor :file_path
|
38
52
|
end
|
39
53
|
|
40
|
-
class Gem::GemNotFoundException < Gem::Exception
|
41
|
-
|
42
|
-
|
54
|
+
class Gem::GemNotFoundException < Gem::Exception; end
|
55
|
+
|
56
|
+
class Gem::SpecificGemNotFoundException < Gem::GemNotFoundException
|
57
|
+
def initialize(name, version, errors=nil)
|
58
|
+
super "Could not find a valid gem '#{name}' (#{version}) locally or in a repository"
|
59
|
+
|
43
60
|
@name = name
|
44
61
|
@version = version
|
45
62
|
@errors = errors
|
@@ -89,3 +106,4 @@ class Gem::SystemExitException < SystemExit
|
|
89
106
|
end
|
90
107
|
|
91
108
|
end
|
109
|
+
|
data/lib/rubygems/ext/builder.rb
CHANGED
@@ -4,18 +4,8 @@
|
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
6
6
|
|
7
|
-
require 'thread'
|
8
|
-
|
9
7
|
class Gem::Ext::Builder
|
10
8
|
|
11
|
-
##
|
12
|
-
# The builder shells-out to run various commands after changing the
|
13
|
-
# directory. This means multiple installations cannot be allowed to build
|
14
|
-
# extensions in parallel as they may change each other's directories leading
|
15
|
-
# to broken extensions or failed installations.
|
16
|
-
|
17
|
-
CHDIR_MUTEX = Mutex.new # :nodoc:
|
18
|
-
|
19
9
|
def self.class_name
|
20
10
|
name =~ /Ext::(.*)Builder/
|
21
11
|
$1.downcase
|
@@ -26,23 +16,22 @@ class Gem::Ext::Builder
|
|
26
16
|
raise Gem::InstallError, "Makefile not found:\n\n#{results.join "\n"}"
|
27
17
|
end
|
28
18
|
|
19
|
+
mf = Gem.read_binary 'Makefile'
|
20
|
+
mf = mf.gsub(/^RUBYARCHDIR\s*=\s*\$[^$]*/, "RUBYARCHDIR = #{dest_path}")
|
21
|
+
mf = mf.gsub(/^RUBYLIBDIR\s*=\s*\$[^$]*/, "RUBYLIBDIR = #{dest_path}")
|
22
|
+
|
23
|
+
File.open('Makefile', 'wb') {|f| f.print mf}
|
24
|
+
|
29
25
|
# try to find make program from Ruby configure arguments first
|
30
26
|
RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/
|
31
|
-
make_program = $1 || ENV['make']
|
27
|
+
make_program = $1 || ENV['MAKE'] || ENV['make']
|
32
28
|
unless make_program then
|
33
29
|
make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
|
34
30
|
end
|
35
31
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
# Pass DESTDIR via command line to override what's in MAKEFLAGS
|
40
|
-
cmd = [
|
41
|
-
make_program,
|
42
|
-
destdir,
|
43
|
-
target
|
44
|
-
].join(' ').rstrip
|
45
|
-
run(cmd, results, "make #{target}".rstrip)
|
32
|
+
['', ' install'].each do |target|
|
33
|
+
cmd = "#{make_program}#{target}"
|
34
|
+
run(cmd, results, "make#{target}")
|
46
35
|
end
|
47
36
|
end
|
48
37
|
|
@@ -51,10 +40,18 @@ class Gem::Ext::Builder
|
|
51
40
|
end
|
52
41
|
|
53
42
|
def self.run(command, results, command_name = nil)
|
54
|
-
|
55
|
-
|
43
|
+
verbose = Gem.configuration.really_verbose
|
44
|
+
|
45
|
+
if verbose
|
46
|
+
puts(command)
|
47
|
+
system(command)
|
48
|
+
else
|
49
|
+
results << command
|
50
|
+
results << `#{command} #{redirector}`
|
51
|
+
end
|
56
52
|
|
57
53
|
unless $?.success? then
|
54
|
+
results << "Building has failed. See above output for more information on the failure." if verbose
|
58
55
|
raise Gem::InstallError, "#{command_name || class_name} failed:\n\n#{results.join "\n"}"
|
59
56
|
end
|
60
57
|
end
|
@@ -8,10 +8,10 @@ require 'rubygems/ext/builder'
|
|
8
8
|
|
9
9
|
class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder
|
10
10
|
|
11
|
-
def self.build(extension, directory, dest_path, results)
|
11
|
+
def self.build(extension, directory, dest_path, results, args=[])
|
12
12
|
unless File.exist?('Makefile') then
|
13
13
|
cmd = "sh ./configure --prefix=#{dest_path}"
|
14
|
-
cmd << " #{
|
14
|
+
cmd << " #{args.join ' '}" unless args.empty?
|
15
15
|
|
16
16
|
run cmd, results
|
17
17
|
end
|
@@ -6,58 +6,18 @@
|
|
6
6
|
|
7
7
|
require 'rubygems/ext/builder'
|
8
8
|
require 'rubygems/command'
|
9
|
-
require 'fileutils'
|
10
|
-
require 'tempfile'
|
11
9
|
|
12
10
|
class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
13
|
-
FileEntry = FileUtils::Entry_ # :nodoc:
|
14
11
|
|
15
|
-
def self.build(extension, directory, dest_path, results)
|
16
|
-
|
12
|
+
def self.build(extension, directory, dest_path, results, args=[])
|
13
|
+
cmd = "#{Gem.ruby} #{File.basename extension}"
|
14
|
+
cmd << " #{args.join ' '}" unless args.empty?
|
17
15
|
|
18
|
-
|
19
|
-
Tempfile.open %w"siteconf .rb", "." do |siteconf|
|
20
|
-
t = siteconf
|
21
|
-
siteconf.puts "require 'rbconfig'"
|
22
|
-
siteconf.puts "dest_path = #{(tmp_dest || dest_path).dump}"
|
23
|
-
%w[sitearchdir sitelibdir].each do |dir|
|
24
|
-
siteconf.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path"
|
25
|
-
siteconf.puts "RbConfig::CONFIG['#{dir}'] = dest_path"
|
26
|
-
end
|
16
|
+
run cmd, results
|
27
17
|
|
28
|
-
|
29
|
-
|
30
|
-
rubyopt = ENV["RUBYOPT"]
|
31
|
-
destdir = ENV["DESTDIR"]
|
32
|
-
|
33
|
-
begin
|
34
|
-
ENV["RUBYOPT"] = ["-r#{siteconf.path}", rubyopt].compact.join(' ')
|
35
|
-
cmd = [Gem.ruby, File.basename(extension), *Gem::Command.build_args].join ' '
|
36
|
-
|
37
|
-
run cmd, results
|
38
|
-
|
39
|
-
ENV["DESTDIR"] = nil
|
40
|
-
ENV["RUBYOPT"] = rubyopt
|
41
|
-
siteconf.unlink
|
42
|
-
|
43
|
-
make dest_path, results
|
44
|
-
|
45
|
-
if tmp_dest
|
46
|
-
FileEntry.new(tmp_dest).traverse do |ent|
|
47
|
-
destent = ent.class.new(dest_path, ent.rel)
|
48
|
-
destent.exist? or File.rename(ent.path, destent.path)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
ensure
|
52
|
-
ENV["RUBYOPT"] = rubyopt
|
53
|
-
ENV["DESTDIR"] = destdir
|
54
|
-
end
|
55
|
-
end
|
56
|
-
t.unlink if t and t.path
|
18
|
+
make dest_path, results
|
57
19
|
|
58
20
|
results
|
59
|
-
ensure
|
60
|
-
FileUtils.rm_rf tmp_dest if tmp_dest
|
61
21
|
end
|
62
22
|
|
63
23
|
end
|
@@ -9,10 +9,10 @@ require 'rubygems/command'
|
|
9
9
|
|
10
10
|
class Gem::Ext::RakeBuilder < Gem::Ext::Builder
|
11
11
|
|
12
|
-
def self.build(extension, directory, dest_path, results)
|
12
|
+
def self.build(extension, directory, dest_path, results, args=[])
|
13
13
|
if File.basename(extension) =~ /mkrf_conf/i then
|
14
14
|
cmd = "#{Gem.ruby} #{File.basename extension}"
|
15
|
-
cmd << " #{
|
15
|
+
cmd << " #{args.join " "}" unless args.empty?
|
16
16
|
run cmd, results
|
17
17
|
end
|
18
18
|
|
data/lib/rubygems/gem_runner.rb
CHANGED
@@ -4,10 +4,9 @@
|
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
6
6
|
|
7
|
-
require
|
7
|
+
require 'rubygems'
|
8
8
|
require 'rubygems/command_manager'
|
9
9
|
require 'rubygems/config_file'
|
10
|
-
require 'rubygems/doc_manager'
|
11
10
|
|
12
11
|
##
|
13
12
|
# Load additional plugins from $LOAD_PATH
|
@@ -29,25 +28,21 @@ class Gem::GemRunner
|
|
29
28
|
# TODO: nuke these options
|
30
29
|
@command_manager_class = options[:command_manager] || Gem::CommandManager
|
31
30
|
@config_file_class = options[:config_file] || Gem::ConfigFile
|
32
|
-
@doc_manager_class = options[:doc_manager] || Gem::DocManager
|
33
31
|
end
|
34
32
|
|
35
33
|
##
|
36
34
|
# Run the gem command with the following arguments.
|
37
35
|
|
38
36
|
def run(args)
|
39
|
-
start_time = Time.now
|
40
|
-
|
41
37
|
if args.include?('--')
|
42
38
|
# We need to preserve the original ARGV to use for passing gem options
|
43
39
|
# to source gems. If there is a -- in the line, strip all options after
|
44
40
|
# it...its for the source building process.
|
41
|
+
# TODO use slice!
|
45
42
|
build_args = args[args.index("--") + 1...args.length]
|
46
43
|
args = args[0...args.index("--")]
|
47
44
|
end
|
48
45
|
|
49
|
-
Gem::Command.build_args = build_args if build_args
|
50
|
-
|
51
46
|
do_configuration args
|
52
47
|
cmd = @command_manager_class.instance
|
53
48
|
|
@@ -62,14 +57,7 @@ class Gem::GemRunner
|
|
62
57
|
Gem::Command.add_specific_extra_args command_name, config_args
|
63
58
|
end
|
64
59
|
|
65
|
-
cmd.run Gem.configuration.args
|
66
|
-
end_time = Time.now
|
67
|
-
|
68
|
-
if Gem.configuration.benchmark then
|
69
|
-
printf "\nExecution time: %0.2f seconds.\n", end_time - start_time
|
70
|
-
puts "Press Enter to finish"
|
71
|
-
STDIN.gets
|
72
|
-
end
|
60
|
+
cmd.run Gem.configuration.args, build_args
|
73
61
|
end
|
74
62
|
|
75
63
|
private
|
@@ -78,7 +66,6 @@ class Gem::GemRunner
|
|
78
66
|
Gem.configuration = @config_file_class.new(args)
|
79
67
|
Gem.use_paths Gem.configuration[:gemhome], Gem.configuration[:gempath]
|
80
68
|
Gem::Command.extra_args = Gem.configuration[:gem]
|
81
|
-
@doc_manager_class.configured_args = Gem.configuration[:rdoc]
|
82
69
|
end
|
83
70
|
|
84
71
|
end
|