rubygems-update 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- data/ChangeLog +587 -0
- data/README +0 -1
- data/Rakefile +39 -12
- data/TODO +0 -5
- data/bin/gem +7 -7
- data/bin/update_rubygems +1 -1
- data/examples/application/an-app.gemspec +1 -1
- data/gemspecs/cgikit-1.1.0.gemspec +1 -2
- data/gemspecs/jabber4r.gemspec +1 -1
- data/gemspecs/linguistics.gemspec +1 -1
- data/gemspecs/ook.gemspec +1 -1
- data/gemspecs/progressbar.gemspec +1 -1
- data/gemspecs/redcloth.gemspec +1 -1
- data/gemspecs/rublog.gemspec +1 -1
- data/gemspecs/ruby-doom.gemspec +1 -1
- data/gemspecs/rubyjdwp.gemspec +1 -1
- data/gemspecs/statistics.gemspec +1 -1
- data/lib/rubygems.rb +167 -105
- data/lib/rubygems/builder.rb +12 -10
- data/lib/rubygems/command.rb +177 -60
- data/lib/rubygems/command_manager.rb +30 -38
- data/lib/rubygems/commands/build_command.rb +42 -46
- data/lib/rubygems/commands/cert_command.rb +72 -69
- data/lib/rubygems/commands/check_command.rb +63 -63
- data/lib/rubygems/commands/cleanup_command.rb +25 -7
- data/lib/rubygems/commands/contents_command.rb +70 -62
- data/lib/rubygems/commands/dependency_command.rb +131 -86
- data/lib/rubygems/commands/environment_command.rb +67 -46
- data/lib/rubygems/commands/fetch_command.rb +62 -0
- data/lib/rubygems/commands/generate_index_command.rb +57 -0
- data/lib/rubygems/commands/help_command.rb +163 -73
- data/lib/rubygems/commands/install_command.rb +114 -128
- data/lib/rubygems/commands/list_command.rb +10 -8
- data/lib/rubygems/commands/lock_command.rb +101 -0
- data/lib/rubygems/commands/mirror_command.rb +105 -0
- data/lib/rubygems/commands/outdated_command.rb +24 -15
- data/lib/rubygems/commands/pristine_command.rb +118 -88
- data/lib/rubygems/commands/query_command.rb +109 -77
- data/lib/rubygems/commands/rdoc_command.rb +13 -10
- data/lib/rubygems/commands/search_command.rb +10 -8
- data/lib/rubygems/commands/server_command.rb +48 -0
- data/lib/rubygems/commands/sources_command.rb +104 -83
- data/lib/rubygems/commands/specification_command.rb +65 -51
- data/lib/rubygems/commands/uninstall_command.rb +17 -12
- data/lib/rubygems/commands/unpack_command.rb +68 -68
- data/lib/rubygems/commands/update_command.rb +72 -25
- data/lib/rubygems/commands/which_command.rb +86 -0
- data/lib/rubygems/config_file.rb +202 -78
- data/lib/rubygems/custom_require.rb +7 -88
- data/lib/rubygems/dependency.rb +65 -0
- data/lib/rubygems/dependency_installer.rb +232 -0
- data/lib/rubygems/dependency_list.rb +133 -105
- data/lib/rubygems/digest/md5.rb +4 -1
- data/lib/rubygems/digest/sha2.rb +1 -1
- data/lib/rubygems/doc_manager.rb +41 -19
- data/lib/rubygems/exceptions.rb +63 -0
- data/lib/rubygems/ext.rb +18 -0
- data/lib/rubygems/ext/builder.rb +56 -0
- data/lib/rubygems/ext/configure_builder.rb +24 -0
- data/lib/rubygems/ext/ext_conf_builder.rb +23 -0
- data/lib/rubygems/ext/rake_builder.rb +27 -0
- data/lib/rubygems/format.rb +16 -6
- data/lib/rubygems/gem_openssl.rb +43 -6
- data/lib/rubygems/gem_path_searcher.rb +84 -0
- data/lib/rubygems/gem_runner.rb +20 -5
- data/lib/rubygems/indexer.rb +163 -0
- data/lib/rubygems/indexer/abstract_index_builder.rb +80 -0
- data/lib/rubygems/indexer/marshal_index_builder.rb +17 -0
- data/lib/rubygems/indexer/master_index_builder.rb +53 -0
- data/lib/rubygems/indexer/quick_index_builder.rb +48 -0
- data/lib/rubygems/install_update_options.rb +87 -0
- data/lib/rubygems/installer.rb +316 -562
- data/lib/rubygems/local_remote_options.rb +106 -0
- data/lib/rubygems/old_format.rb +5 -13
- data/lib/rubygems/open-uri.rb +2 -0
- data/lib/rubygems/package.rb +28 -32
- data/lib/rubygems/platform.rb +187 -0
- data/lib/rubygems/remote_fetcher.rb +46 -29
- data/lib/rubygems/remote_installer.rb +11 -18
- data/lib/rubygems/requirement.rb +157 -0
- data/lib/rubygems/rubygems_version.rb +1 -1
- data/lib/rubygems/security.rb +715 -457
- data/lib/rubygems/server.rb +77 -59
- data/lib/rubygems/source_index.rb +154 -83
- data/lib/rubygems/source_info_cache.rb +73 -30
- data/lib/rubygems/source_info_cache_entry.rb +12 -3
- data/lib/rubygems/specification.rb +378 -145
- data/lib/rubygems/uninstaller.rb +183 -0
- data/lib/rubygems/user_interaction.rb +38 -9
- data/lib/rubygems/validator.rb +53 -24
- data/lib/rubygems/version.rb +126 -289
- data/lib/rubygems/version_option.rb +49 -0
- data/pkgs/sources/lib/sources.rb +1 -4
- data/pkgs/sources/sources.gemspec +3 -3
- data/scripts/gemdoc.rb +0 -1
- data/setup.rb +166 -1505
- data/test/bogussources.rb +0 -1
- data/test/data/gem-private_key.pem +27 -0
- data/test/data/gem-public_cert.pem +20 -0
- data/test/functional.rb +3 -105
- data/test/gemutilities.rb +145 -24
- data/test/insure_session.rb +0 -1
- data/test/{test_datadir.rb → test_config.rb} +7 -13
- data/test/test_gem.rb +360 -9
- data/test/test_gem_builder.rb +34 -0
- data/test/{test_command.rb → test_gem_command.rb} +119 -62
- data/test/{test_parse_commands.rb → test_gem_command_manager.rb} +64 -40
- data/test/test_gem_commands_build_command.rb +75 -0
- data/test/test_gem_commands_cert_command.rb +122 -0
- data/test/test_gem_commands_check_command.rb +25 -0
- data/test/test_gem_commands_contents_command.rb +92 -0
- data/test/test_gem_commands_dependency_command.rb +108 -0
- data/test/test_gem_commands_environment_command.rb +117 -0
- data/test/test_gem_commands_fetch_command.rb +34 -0
- data/test/test_gem_commands_generate_index_command.rb +32 -0
- data/test/test_gem_commands_install_command.rb +160 -0
- data/test/test_gem_commands_mirror_command.rb +56 -0
- data/test/test_gem_commands_pristine_command.rb +100 -0
- data/test/test_gem_commands_query_command.rb +82 -0
- data/test/test_gem_commands_sources_command.rb +147 -0
- data/test/test_gem_commands_specification_command.rb +93 -0
- data/test/test_gem_commands_unpack_command.rb +55 -0
- data/test/test_gem_config_file.rb +210 -0
- data/test/test_gem_dependency.rb +89 -0
- data/test/test_gem_dependency_installer.rb +542 -0
- data/test/test_gem_dependency_list.rb +212 -0
- data/test/test_gem_doc_manager.rb +32 -0
- data/test/test_gem_ext_configure_builder.rb +13 -17
- data/test/test_gem_ext_ext_conf_builder.rb +9 -9
- data/test/test_gem_ext_rake_builder.rb +23 -11
- data/test/test_gem_format.rb +69 -0
- data/test/test_gem_gem_path_searcher.rb +57 -0
- data/test/test_gem_gem_runner.rb +35 -0
- data/test/test_gem_indexer.rb +119 -0
- data/test/test_gem_install_update_options.rb +40 -0
- data/test/test_gem_installer.rb +796 -0
- data/test/test_gem_local_remote_options.rb +84 -0
- data/test/test_gem_outdated_command.rb +11 -9
- data/test/test_gem_platform.rb +240 -0
- data/test/{test_remote_fetcher.rb → test_gem_remote_fetcher.rb} +124 -55
- data/test/{test_remote_installer.rb → test_gem_remote_installer.rb} +3 -4
- data/test/test_gem_requirement.rb +223 -0
- data/test/test_gem_server.rb +71 -0
- data/test/test_gem_source_index.rb +429 -0
- data/test/test_gem_source_info_cache.rb +79 -17
- data/test/test_gem_source_info_cache_entry.rb +11 -9
- data/test/test_gem_specification.rb +738 -0
- data/test/test_gem_stream_ui.rb +117 -0
- data/test/test_gem_validator.rb +70 -0
- data/test/test_gem_version.rb +191 -0
- data/test/test_gem_version_option.rb +77 -0
- data/test/{test_require_gem.rb → test_kernel.rb} +19 -12
- data/test/test_open_uri.rb +1 -2
- data/test/test_package.rb +45 -34
- metadata +116 -141
- data/Releases +0 -127
- data/bin/gem_mirror +0 -73
- data/bin/gem_server +0 -6
- data/bin/gemlock +0 -127
- data/bin/gemri +0 -24
- data/bin/gemwhich +0 -89
- data/bin/index_gem_repository.rb +0 -302
- data/lib/gemconfigure.rb +0 -24
- data/lib/rubygems/gem_commands.rb +0 -273
- data/pkgs/sources/sources-0.0.1.gem +0 -0
- data/post-install.rb +0 -121
- data/test/brokenbuildgem.rb +0 -35
- data/test/data/PostMessage-0.0.1.gem +0 -0
- data/test/data/a-0.0.1.gem +0 -0
- data/test/data/a-0.0.2.gem +0 -0
- data/test/data/b-0.0.2.gem +0 -0
- data/test/data/broken-1.0.0.gem +0 -0
- data/test/data/broken_build/broken-build.gemspec +0 -20
- data/test/data/broken_build/ext/extconf.rb +0 -3
- data/test/data/broken_build/ext/foo.c +0 -1
- data/test/data/c-1.2.gem +0 -0
- data/test/data/gemhome/cache/a-0.0.1.gem +0 -0
- data/test/data/gemhome/cache/a-0.0.2.gem +0 -0
- data/test/data/gemhome/cache/b-0.0.2.gem +0 -0
- data/test/data/gemhome/cache/c-1.2.gem +0 -0
- data/test/data/gemhome/gems/a-0.0.1/lib/code.rb +0 -1
- data/test/data/gemhome/gems/a-0.0.2/lib/code.rb +0 -1
- data/test/data/gemhome/gems/b-0.0.2/lib/code.rb +0 -1
- data/test/data/gemhome/gems/c-1.2/lib/code.rb +0 -1
- data/test/data/gemhome/specifications/a-0.0.1.gemspec +0 -8
- data/test/data/gemhome/specifications/a-0.0.2.gemspec +0 -8
- data/test/data/gemhome/specifications/b-0.0.2.gemspec +0 -8
- data/test/data/gemhome/specifications/c-1.2.gemspec +0 -8
- data/test/data/legacy/keyedlist-0.4.0.ruby +0 -11
- data/test/data/legacy/keyedlist-0.4.0.yaml +0 -16
- data/test/data/lib/code.rb +0 -1
- data/test/data/one/README.one +0 -1
- data/test/data/one/lib/one.rb +0 -9
- data/test/data/one/one-0.0.1.gem +0 -0
- data/test/data/one/one.gemspec +0 -17
- data/test/data/one/one.yaml +0 -40
- data/test/data/post_install.gemspec +0 -19
- data/test/functional_extension_gems.rb +0 -48
- data/test/functional_generate_yaml_index.rb +0 -104
- data/test/gemenvironment.rb +0 -59
- data/test/io_capture.rb +0 -33
- data/test/mock/gems/gems/sources-0.0.1/lib/sources.rb +0 -11
- data/test/mock/gems/specifications/sources-0.0.1.gemspec +0 -8
- data/test/onegem.rb +0 -35
- data/test/test_builder.rb +0 -34
- data/test/test_check_command.rb +0 -34
- data/test/test_configfile.rb +0 -42
- data/test/test_dependency_list.rb +0 -169
- data/test/test_file_list.rb +0 -101
- data/test/test_format.rb +0 -49
- data/test/test_gem_sources_command.rb +0 -135
- data/test/test_gemloadpaths.rb +0 -51
- data/test/test_gempaths.rb +0 -170
- data/test/test_installer.rb +0 -369
- data/test/test_loadmanager.rb +0 -48
- data/test/test_process_commands.rb +0 -52
- data/test/test_source_index.rb +0 -231
- data/test/test_specific_extras.rb +0 -46
- data/test/test_specification.rb +0 -565
- data/test/test_user_interaction.rb +0 -48
- data/test/test_validator.rb +0 -59
- data/test/test_version_comparison.rb +0 -321
- data/test/testgem.rc +0 -7
- data/test/user_capture.rb +0 -7
- data/test/yaml_data.rb +0 -63
data/lib/rubygems/digest/md5.rb
CHANGED
data/lib/rubygems/digest/sha2.rb
CHANGED
data/lib/rubygems/doc_manager.rb
CHANGED
@@ -4,10 +4,10 @@
|
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
6
6
|
|
7
|
+
require 'fileutils'
|
8
|
+
|
7
9
|
module Gem
|
8
10
|
|
9
|
-
class DocumentError < Gem::Exception; end
|
10
|
-
|
11
11
|
class DocManager
|
12
12
|
|
13
13
|
include UserInteraction
|
@@ -20,7 +20,6 @@ module Gem
|
|
20
20
|
def initialize(spec, rdoc_args="")
|
21
21
|
@spec = spec
|
22
22
|
@doc_dir = File.join(spec.installation_path, "doc", spec.full_name)
|
23
|
-
Gem::FilePermissionError.new(spec.installation_path) unless File.writable?(spec.installation_path)
|
24
23
|
@rdoc_args = rdoc_args.nil? ? [] : rdoc_args.split
|
25
24
|
end
|
26
25
|
|
@@ -35,8 +34,6 @@ module Gem
|
|
35
34
|
# same process, the RI docs should be done first (a likely bug in
|
36
35
|
# RDoc will cause RI docs generation to fail if run after RDoc).
|
37
36
|
def generate_ri
|
38
|
-
require 'fileutils'
|
39
|
-
|
40
37
|
if @spec.has_rdoc then
|
41
38
|
load_rdoc
|
42
39
|
install_ri # RDoc bug, ri goes first
|
@@ -51,8 +48,6 @@ module Gem
|
|
51
48
|
# same process, the RI docs should be done first (a likely bug in
|
52
49
|
# RDoc will cause RI docs generation to fail if run after RDoc).
|
53
50
|
def generate_rdoc
|
54
|
-
require 'fileutils'
|
55
|
-
|
56
51
|
if @spec.has_rdoc then
|
57
52
|
load_rdoc
|
58
53
|
install_rdoc
|
@@ -63,26 +58,36 @@ module Gem
|
|
63
58
|
|
64
59
|
# Load the RDoc documentation generator library.
|
65
60
|
def load_rdoc
|
66
|
-
if File.exist?(@doc_dir) && !File.writable?(@doc_dir)
|
67
|
-
Gem::FilePermissionError.new(@doc_dir)
|
61
|
+
if File.exist?(@doc_dir) && !File.writable?(@doc_dir) then
|
62
|
+
raise Gem::FilePermissionError.new(@doc_dir)
|
68
63
|
end
|
64
|
+
|
69
65
|
FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir)
|
66
|
+
|
70
67
|
begin
|
71
68
|
require 'rdoc/rdoc'
|
72
69
|
rescue LoadError => e
|
73
|
-
raise DocumentError,
|
70
|
+
raise Gem::DocumentError,
|
74
71
|
"ERROR: RDoc documentation generator not installed!"
|
75
72
|
end
|
76
73
|
end
|
77
74
|
|
78
75
|
def install_rdoc
|
76
|
+
rdoc_dir = File.join @doc_dir, 'rdoc'
|
77
|
+
|
78
|
+
FileUtils.rm_rf rdoc_dir
|
79
|
+
|
79
80
|
say "Installing RDoc documentation for #{@spec.full_name}..."
|
80
|
-
run_rdoc '--op',
|
81
|
+
run_rdoc '--op', rdoc_dir
|
81
82
|
end
|
82
83
|
|
83
84
|
def install_ri
|
85
|
+
ri_dir = File.join @doc_dir, 'ri'
|
86
|
+
|
87
|
+
FileUtils.rm_rf ri_dir
|
88
|
+
|
84
89
|
say "Installing ri documentation for #{@spec.full_name}..."
|
85
|
-
run_rdoc '--ri', '--op',
|
90
|
+
run_rdoc '--ri', '--op', ri_dir
|
86
91
|
end
|
87
92
|
|
88
93
|
def run_rdoc(*args)
|
@@ -103,20 +108,37 @@ module Gem
|
|
103
108
|
dirname = File.dirname e.message.split("-")[1].strip
|
104
109
|
raise Gem::FilePermissionError.new(dirname)
|
105
110
|
rescue RuntimeError => ex
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
+
alert_error "While generating documentation for #{@spec.full_name}"
|
112
|
+
ui.errs.puts "... MESSAGE: #{ex}"
|
113
|
+
ui.errs.puts "... RDOC args: #{args.join(' ')}"
|
114
|
+
ui.errs.puts "\t#{ex.backtrace.join "\n\t"}" if
|
115
|
+
Gem.configuration.backtrace
|
116
|
+
ui.errs.puts "(continuing with the rest of the installation)"
|
111
117
|
ensure
|
112
118
|
Dir.chdir(old_pwd)
|
113
119
|
end
|
114
120
|
end
|
115
121
|
|
116
122
|
def uninstall_doc
|
117
|
-
|
123
|
+
raise Gem::FilePermissionError.new(@spec.installation_path) unless
|
124
|
+
File.writable? @spec.installation_path
|
125
|
+
|
126
|
+
original_name = [
|
127
|
+
@spec.name, @spec.version, @spec.original_platform].join '-'
|
128
|
+
|
129
|
+
doc_dir = File.join @spec.installation_path, 'doc', @spec.full_name
|
130
|
+
unless File.directory? doc_dir then
|
131
|
+
doc_dir = File.join @spec.installation_path, 'doc', original_name
|
132
|
+
end
|
133
|
+
|
118
134
|
FileUtils.rm_rf doc_dir
|
119
|
-
|
135
|
+
|
136
|
+
ri_dir = File.join @spec.installation_path, 'ri', @spec.full_name
|
137
|
+
|
138
|
+
unless File.directory? ri_dir then
|
139
|
+
ri_dir = File.join @spec.installation_path, 'ri', original_name
|
140
|
+
end
|
141
|
+
|
120
142
|
FileUtils.rm_rf ri_dir
|
121
143
|
end
|
122
144
|
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
##
|
4
|
+
# Base exception class for RubyGems. All exception raised by RubyGems are a
|
5
|
+
# subclass of this one.
|
6
|
+
class Gem::Exception < RuntimeError; end
|
7
|
+
|
8
|
+
class Gem::CommandLineError < Gem::Exception; end
|
9
|
+
|
10
|
+
class Gem::DependencyError < Gem::Exception; end
|
11
|
+
|
12
|
+
class Gem::DependencyRemovalException < Gem::Exception; end
|
13
|
+
|
14
|
+
class Gem::DocumentError < Gem::Exception; end
|
15
|
+
|
16
|
+
##
|
17
|
+
# Potentially raised when a specification is validated.
|
18
|
+
class Gem::EndOfYAMLException < Gem::Exception; end
|
19
|
+
|
20
|
+
##
|
21
|
+
# Signals that a file permission error is preventing the user from
|
22
|
+
# installing in the requested directories.
|
23
|
+
class Gem::FilePermissionError < Gem::Exception
|
24
|
+
def initialize(path)
|
25
|
+
super("You don't have write permissions into the #{path} directory.")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# Used to raise parsing and loading errors
|
31
|
+
class Gem::FormatException < Gem::Exception
|
32
|
+
attr_accessor :file_path
|
33
|
+
end
|
34
|
+
|
35
|
+
class Gem::GemNotFoundException < Gem::Exception; end
|
36
|
+
|
37
|
+
class Gem::InstallError < Gem::Exception; end
|
38
|
+
|
39
|
+
##
|
40
|
+
# Potentially raised when a specification is validated.
|
41
|
+
class Gem::InvalidSpecificationException < Gem::Exception; end
|
42
|
+
|
43
|
+
class Gem::OperationNotSupportedError < Gem::Exception; end
|
44
|
+
|
45
|
+
##
|
46
|
+
# Signals that a remote operation cannot be conducted, probably due to not
|
47
|
+
# being connected (or just not finding host).
|
48
|
+
#--
|
49
|
+
# TODO: create a method that tests connection to the preferred gems server.
|
50
|
+
# All code dealing with remote operations will want this. Failure in that
|
51
|
+
# method should raise this error.
|
52
|
+
class Gem::RemoteError < Gem::Exception; end
|
53
|
+
|
54
|
+
class Gem::RemoteInstallationCancelled < Gem::Exception; end
|
55
|
+
|
56
|
+
class Gem::RemoteInstallationSkipped < Gem::Exception; end
|
57
|
+
|
58
|
+
##
|
59
|
+
# Represents an error communicating via HTTP.
|
60
|
+
class Gem::RemoteSourceException < Gem::Exception; end
|
61
|
+
|
62
|
+
class Gem::VerificationError < Gem::Exception; end
|
63
|
+
|
data/lib/rubygems/ext.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
+
# All rights reserved.
|
4
|
+
# See LICENSE.txt for permissions.
|
5
|
+
#++
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
|
9
|
+
##
|
10
|
+
# Classes for building C extensions live here.
|
11
|
+
|
12
|
+
module Gem::Ext; end
|
13
|
+
|
14
|
+
require 'rubygems/ext/builder'
|
15
|
+
require 'rubygems/ext/configure_builder'
|
16
|
+
require 'rubygems/ext/ext_conf_builder'
|
17
|
+
require 'rubygems/ext/rake_builder'
|
18
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
+
# All rights reserved.
|
4
|
+
# See LICENSE.txt for permissions.
|
5
|
+
#++
|
6
|
+
|
7
|
+
require 'rubygems/ext'
|
8
|
+
|
9
|
+
class Gem::Ext::Builder
|
10
|
+
|
11
|
+
def self.class_name
|
12
|
+
name =~ /Ext::(.*)Builder/
|
13
|
+
$1.downcase
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.make(dest_path, results)
|
17
|
+
unless File.exist? 'Makefile' then
|
18
|
+
raise Gem::InstallError, "Makefile not found:\n\n#{results.join "\n"}"
|
19
|
+
end
|
20
|
+
|
21
|
+
mf = File.read('Makefile')
|
22
|
+
mf = mf.gsub(/^RUBYARCHDIR\s*=\s*\$[^$]*/, "RUBYARCHDIR = #{dest_path}")
|
23
|
+
mf = mf.gsub(/^RUBYLIBDIR\s*=\s*\$[^$]*/, "RUBYLIBDIR = #{dest_path}")
|
24
|
+
|
25
|
+
File.open('Makefile', 'wb') {|f| f.print mf}
|
26
|
+
|
27
|
+
make_program = ENV['make']
|
28
|
+
unless make_program then
|
29
|
+
make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
|
30
|
+
end
|
31
|
+
|
32
|
+
['', ' install'].each do |target|
|
33
|
+
cmd = "#{make_program}#{target}"
|
34
|
+
results << cmd
|
35
|
+
results << `#{cmd} #{redirector}`
|
36
|
+
|
37
|
+
raise Gem::InstallError, "make#{target} failed:\n\n#{results}" unless
|
38
|
+
$?.exitstatus.zero?
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.redirector
|
43
|
+
'2>&1'
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.run(command, results)
|
47
|
+
results << command
|
48
|
+
results << `#{command} #{redirector}`
|
49
|
+
|
50
|
+
unless $?.exitstatus.zero? then
|
51
|
+
raise Gem::InstallError, "#{class_name} failed:\n\n#{results.join "\n"}"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
+
# All rights reserved.
|
4
|
+
# See LICENSE.txt for permissions.
|
5
|
+
#++
|
6
|
+
|
7
|
+
require 'rubygems/ext/builder'
|
8
|
+
|
9
|
+
class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder
|
10
|
+
|
11
|
+
def self.build(extension, directory, dest_path, results)
|
12
|
+
unless File.exist?('Makefile') then
|
13
|
+
cmd = "sh ./configure --prefix=#{dest_path}"
|
14
|
+
|
15
|
+
run cmd, results
|
16
|
+
end
|
17
|
+
|
18
|
+
make dest_path, results
|
19
|
+
|
20
|
+
results
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
+
# All rights reserved.
|
4
|
+
# See LICENSE.txt for permissions.
|
5
|
+
#++
|
6
|
+
|
7
|
+
require 'rubygems/ext/builder'
|
8
|
+
|
9
|
+
class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
10
|
+
|
11
|
+
def self.build(extension, directory, dest_path, results)
|
12
|
+
cmd = "#{Gem.ruby} #{File.basename extension}"
|
13
|
+
cmd << " #{ARGV.join ' '}" unless ARGV.empty?
|
14
|
+
|
15
|
+
run cmd, results
|
16
|
+
|
17
|
+
make dest_path, results
|
18
|
+
|
19
|
+
results
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
+
# All rights reserved.
|
4
|
+
# See LICENSE.txt for permissions.
|
5
|
+
#++
|
6
|
+
|
7
|
+
require 'rubygems/ext/builder'
|
8
|
+
|
9
|
+
class Gem::Ext::RakeBuilder < Gem::Ext::Builder
|
10
|
+
|
11
|
+
def self.build(extension, directory, dest_path, results)
|
12
|
+
if File.basename(extension) =~ /mkrf_conf/i then
|
13
|
+
cmd = "#{Gem.ruby} #{File.basename extension}"
|
14
|
+
cmd << " #{ARGV.join " "}" unless ARGV.empty?
|
15
|
+
run cmd, results
|
16
|
+
end
|
17
|
+
|
18
|
+
cmd = ENV['rake'] || 'rake'
|
19
|
+
cmd << " RUBYARCHDIR=#{dest_path} RUBYLIBDIR=#{dest_path}"
|
20
|
+
|
21
|
+
run cmd, results
|
22
|
+
|
23
|
+
results
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
data/lib/rubygems/format.rb
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
6
6
|
|
7
|
+
require 'fileutils'
|
8
|
+
|
7
9
|
require 'rubygems/package'
|
8
10
|
|
9
11
|
module Gem
|
@@ -33,19 +35,27 @@ module Gem
|
|
33
35
|
# file_path:: [String] Path to the gem file
|
34
36
|
#
|
35
37
|
def self.from_file_by_path(file_path, security_policy = nil)
|
38
|
+
format = nil
|
39
|
+
|
36
40
|
unless File.exist?(file_path)
|
37
41
|
raise Gem::Exception, "Cannot load gem at [#{file_path}] in #{Dir.pwd}"
|
38
42
|
end
|
39
|
-
|
43
|
+
|
40
44
|
# check for old version gem
|
41
45
|
if File.read(file_path, 20).include?("MD5SUM =")
|
42
46
|
#alert_warning "Gem #{file_path} is in old format."
|
43
47
|
require 'rubygems/old_format'
|
44
|
-
|
48
|
+
format = OldFormat.from_file_by_path(file_path)
|
45
49
|
else
|
46
|
-
|
47
|
-
|
50
|
+
begin
|
51
|
+
f = File.open(file_path, 'rb')
|
52
|
+
format = from_io(f, file_path, security_policy)
|
53
|
+
ensure
|
54
|
+
f.close unless f.closed?
|
55
|
+
end
|
48
56
|
end
|
57
|
+
|
58
|
+
return format
|
49
59
|
end
|
50
60
|
|
51
61
|
##
|
@@ -60,8 +70,8 @@ module Gem
|
|
60
70
|
format.spec = pkg.metadata
|
61
71
|
format.file_entries = []
|
62
72
|
pkg.each do |entry|
|
63
|
-
format.file_entries << [{"size"
|
64
|
-
"path"
|
73
|
+
format.file_entries << [{"size" => entry.size, "mode" => entry.mode,
|
74
|
+
"path" => entry.full_name}, entry.read]
|
65
75
|
end
|
66
76
|
end
|
67
77
|
format
|
data/lib/rubygems/gem_openssl.rb
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
# See LICENSE.txt for permissions.
|
5
5
|
#++
|
6
6
|
|
7
|
-
|
8
7
|
# Some system might not have OpenSSL installed, therefore the core
|
9
8
|
# library file openssl might not be available. We localize testing
|
10
9
|
# for the presence of OpenSSL in this file.
|
@@ -17,10 +16,10 @@ module Gem
|
|
17
16
|
require 'rubygems/gem_openssl'
|
18
17
|
@ssl_available
|
19
18
|
end
|
20
|
-
|
19
|
+
|
21
20
|
# Set the value of the ssl_avilable flag.
|
22
21
|
attr_writer :ssl_available
|
23
|
-
|
22
|
+
|
24
23
|
# Ensure that SSL is available. Throw an exception if it is not.
|
25
24
|
def ensure_ssl_available
|
26
25
|
unless ssl_available?
|
@@ -39,8 +38,46 @@ begin
|
|
39
38
|
dummy = OpenSSL::Digest::SHA1
|
40
39
|
|
41
40
|
Gem.ssl_available = true
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
|
42
|
+
class OpenSSL::X509::Certificate # :nodoc:
|
43
|
+
# Check the validity of this certificate.
|
44
|
+
def check_validity(issuer_cert = nil, time = Time.now)
|
45
|
+
ret = if @not_before && @not_before > time
|
46
|
+
[false, :expired, "not valid before '#@not_before'"]
|
47
|
+
elsif @not_after && @not_after < time
|
48
|
+
[false, :expired, "not valid after '#@not_after'"]
|
49
|
+
elsif issuer_cert && !verify(issuer_cert.public_key)
|
50
|
+
[false, :issuer, "#{issuer_cert.subject} is not issuer"]
|
51
|
+
else
|
52
|
+
[true, :ok, 'Valid certificate']
|
53
|
+
end
|
54
|
+
|
55
|
+
# return hash
|
56
|
+
{ :is_valid => ret[0], :error => ret[1], :desc => ret[2] }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
rescue LoadError, StandardError
|
45
61
|
Gem.ssl_available = false
|
46
62
|
end
|
63
|
+
|
64
|
+
module Gem::SSL
|
65
|
+
|
66
|
+
# We make our own versions of the constants here. This allows us
|
67
|
+
# to reference the constants, even though some systems might not
|
68
|
+
# have SSL installed in the Ruby core package.
|
69
|
+
#
|
70
|
+
# These constants are only used during load time. At runtime, any
|
71
|
+
# method that makes a direct reference to SSL software must be
|
72
|
+
# protected with a Gem.ensure_ssl_available call.
|
73
|
+
#
|
74
|
+
if Gem.ssl_available? then
|
75
|
+
PKEY_RSA = OpenSSL::PKey::RSA
|
76
|
+
DIGEST_SHA1 = OpenSSL::Digest::SHA1
|
77
|
+
else
|
78
|
+
PKEY_RSA = :rsa
|
79
|
+
DIGEST_SHA1 = :sha1
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|