rubygems-update 1.7.2 → 1.8.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/.autotest +5 -1
- data/History.txt +101 -4
- data/LICENSE.txt +42 -37
- data/MIT.txt +20 -0
- data/Manifest.txt +5 -4
- data/Rakefile +6 -7
- data/lib/rubygems.rb +175 -278
- data/lib/rubygems/builder.rb +7 -6
- data/lib/rubygems/command_manager.rb +16 -2
- data/lib/rubygems/commands/build_command.rb +13 -11
- data/lib/rubygems/commands/cert_command.rb +1 -1
- data/lib/rubygems/commands/cleanup_command.rb +10 -19
- data/lib/rubygems/commands/contents_command.rb +5 -5
- data/lib/rubygems/commands/dependency_command.rb +17 -40
- data/lib/rubygems/commands/fetch_command.rb +1 -1
- data/lib/rubygems/commands/install_command.rb +2 -1
- data/lib/rubygems/commands/lock_command.rb +4 -4
- data/lib/rubygems/commands/outdated_command.rb +18 -6
- data/lib/rubygems/commands/pristine_command.rb +25 -15
- data/lib/rubygems/commands/query_command.rb +9 -6
- data/lib/rubygems/commands/setup_command.rb +1 -1
- data/lib/rubygems/commands/specification_command.rb +8 -23
- data/lib/rubygems/commands/stale_command.rb +2 -1
- data/lib/rubygems/commands/unpack_command.rb +7 -5
- data/lib/rubygems/commands/update_command.rb +2 -4
- data/lib/rubygems/commands/which_command.rb +5 -9
- data/lib/rubygems/config_file.rb +9 -7
- data/lib/rubygems/custom_require.rb +6 -4
- data/lib/rubygems/defaults.rb +30 -14
- data/lib/rubygems/dependency.rb +44 -1
- data/lib/rubygems/dependency_installer.rb +37 -41
- data/lib/rubygems/dependency_list.rb +20 -9
- data/lib/rubygems/deprecate.rb +3 -3
- data/lib/rubygems/doc_manager.rb +10 -11
- data/lib/rubygems/ext/rake_builder.rb +1 -1
- data/lib/rubygems/gem_path_searcher.rb +19 -4
- data/lib/rubygems/gem_runner.rb +1 -1
- data/lib/rubygems/indexer.rb +117 -123
- data/lib/rubygems/installer.rb +101 -94
- data/lib/rubygems/installer_test_case.rb +28 -30
- data/lib/rubygems/local_remote_options.rb +1 -1
- data/lib/rubygems/mock_gem_ui.rb +10 -3
- data/lib/rubygems/package.rb +0 -26
- data/lib/rubygems/package/tar_input.rb +5 -6
- data/lib/rubygems/package_task.rb +1 -1
- data/lib/rubygems/path_support.rb +72 -0
- data/lib/rubygems/platform.rb +12 -2
- data/lib/rubygems/remote_fetcher.rb +7 -6
- data/lib/rubygems/requirement.rb +3 -0
- data/lib/rubygems/security.rb +1 -1
- data/lib/rubygems/server.rb +67 -67
- data/lib/rubygems/source_index.rb +58 -29
- data/lib/rubygems/spec_fetcher.rb +5 -1
- data/lib/rubygems/specification.rb +1422 -877
- data/lib/rubygems/test_case.rb +114 -64
- data/lib/rubygems/test_utilities.rb +4 -3
- data/lib/rubygems/text.rb +1 -1
- data/lib/rubygems/uninstaller.rb +37 -44
- data/test/rubygems/test_gem.rb +131 -102
- data/test/rubygems/test_gem_builder.rb +18 -1
- data/test/rubygems/test_gem_command_manager.rb +2 -0
- data/test/rubygems/test_gem_commands_build_command.rb +31 -3
- data/test/rubygems/test_gem_commands_cleanup_command.rb +51 -0
- data/test/rubygems/test_gem_commands_dependency_command.rb +1 -10
- data/test/rubygems/test_gem_commands_fetch_command.rb +5 -4
- data/test/rubygems/test_gem_commands_help_command.rb +58 -0
- data/test/rubygems/test_gem_commands_install_command.rb +25 -24
- data/test/rubygems/test_gem_commands_list_command.rb +1 -4
- data/test/rubygems/test_gem_commands_outdated_command.rb +10 -9
- data/test/rubygems/test_gem_commands_pristine_command.rb +63 -22
- data/test/rubygems/test_gem_commands_push_command.rb +1 -1
- data/test/rubygems/test_gem_commands_query_command.rb +15 -82
- data/test/rubygems/test_gem_commands_sources_command.rb +8 -9
- data/test/rubygems/test_gem_commands_specification_command.rb +10 -6
- data/test/rubygems/test_gem_commands_stale_command.rb +4 -4
- data/test/rubygems/test_gem_commands_unpack_command.rb +20 -21
- data/test/rubygems/test_gem_commands_update_command.rb +19 -23
- data/test/rubygems/test_gem_commands_which_command.rb +7 -4
- data/test/rubygems/test_gem_dependency.rb +14 -8
- data/test/rubygems/test_gem_dependency_installer.rb +87 -33
- data/test/rubygems/test_gem_dependency_list.rb +7 -3
- data/test/rubygems/test_gem_doc_manager.rb +3 -3
- data/test/rubygems/test_gem_format.rb +1 -1
- data/test/rubygems/test_gem_gem_path_searcher.rb +45 -29
- data/test/rubygems/test_gem_indexer.rb +48 -47
- data/test/rubygems/test_gem_install_update_options.rb +6 -5
- data/test/rubygems/test_gem_installer.rb +61 -37
- data/test/rubygems/test_gem_path_support.rb +58 -0
- data/test/rubygems/test_gem_platform.rb +5 -5
- data/test/rubygems/test_gem_remote_fetcher.rb +18 -21
- data/test/rubygems/test_gem_server.rb +23 -15
- data/test/rubygems/test_gem_source_index.rb +165 -127
- data/test/rubygems/test_gem_spec_fetcher.rb +42 -49
- data/test/rubygems/test_gem_specification.rb +104 -74
- data/test/rubygems/test_gem_text.rb +15 -0
- data/test/rubygems/test_gem_uninstaller.rb +15 -26
- data/test/rubygems/test_kernel.rb +1 -2
- metadata +64 -14
- metadata.gz.sig +0 -0
- data/GPL.txt +0 -340
- data/pkgs/sources/lib/sources.rb +0 -3
- data/pkgs/sources/sources.gemspec +0 -14
- data/test/rubygems/functional.rb +0 -92
@@ -6,7 +6,7 @@ class Gem::Installer
|
|
6
6
|
##
|
7
7
|
# Available through requiring rubygems/installer_test_case
|
8
8
|
|
9
|
-
|
9
|
+
attr_writer :gem_dir
|
10
10
|
|
11
11
|
##
|
12
12
|
# Available through requiring rubygems/installer_test_case
|
@@ -57,29 +57,38 @@ class Gem::InstallerTestCase < Gem::TestCase
|
|
57
57
|
def setup
|
58
58
|
super
|
59
59
|
|
60
|
-
@
|
61
|
-
|
60
|
+
@installer_tmp = File.join @tempdir, 'installer'
|
61
|
+
FileUtils.mkdir_p @installer_tmp
|
62
62
|
|
63
|
-
|
63
|
+
Gem.use_paths @installer_tmp
|
64
|
+
Gem.ensure_gem_subdirectories @installer_tmp
|
64
65
|
|
65
|
-
@
|
66
|
+
@spec = quick_gem 'a'
|
67
|
+
util_make_exec @spec
|
68
|
+
util_build_gem @spec
|
69
|
+
@gem = @spec.cache_file
|
66
70
|
|
67
71
|
@user_spec = quick_gem 'b'
|
68
72
|
util_make_exec @user_spec
|
73
|
+
util_build_gem @user_spec
|
74
|
+
@user_gem = @user_spec.cache_file
|
75
|
+
|
76
|
+
Gem.use_paths @gemhome
|
69
77
|
|
70
|
-
@
|
78
|
+
@installer = util_installer @spec, @gemhome
|
79
|
+
@user_installer = util_installer @user_spec, Gem.user_dir, :user
|
71
80
|
|
72
|
-
|
73
|
-
@user_installer.gem_dir = File.join(Gem.user_dir, 'gems',
|
74
|
-
@user_spec.full_name)
|
81
|
+
Gem.use_paths @gemhome
|
75
82
|
end
|
76
83
|
|
77
84
|
def util_gem_bindir spec = @spec
|
78
|
-
|
85
|
+
# TODO: deprecate
|
86
|
+
spec.bin_dir
|
79
87
|
end
|
80
88
|
|
81
89
|
def util_gem_dir spec = @spec
|
82
|
-
|
90
|
+
# TODO: deprecate
|
91
|
+
spec.gem_dir
|
83
92
|
end
|
84
93
|
|
85
94
|
def util_inst_bindir
|
@@ -90,16 +99,13 @@ class Gem::InstallerTestCase < Gem::TestCase
|
|
90
99
|
spec.executables = %w[executable]
|
91
100
|
spec.files << 'bin/executable'
|
92
101
|
|
93
|
-
|
94
|
-
|
95
|
-
exec_path = File.join bindir, 'executable'
|
96
|
-
open exec_path, 'w' do |io|
|
102
|
+
exec_path = spec.bin_file "executable"
|
103
|
+
write_file exec_path do |io|
|
97
104
|
io.puts shebang
|
98
105
|
end
|
99
106
|
|
100
|
-
|
101
|
-
|
102
|
-
open File.join(temp_bin, 'executable'), 'w' do |io|
|
107
|
+
bin_path = File.join @tempdir, "bin", "executable"
|
108
|
+
write_file bin_path do |io|
|
103
109
|
io.puts shebang
|
104
110
|
end
|
105
111
|
end
|
@@ -122,23 +128,15 @@ class Gem::InstallerTestCase < Gem::TestCase
|
|
122
128
|
|
123
129
|
use_ui ui do
|
124
130
|
FileUtils.rm @gem
|
125
|
-
|
131
|
+
|
132
|
+
@gem = Gem::Builder.new(@spec).build
|
126
133
|
end
|
127
134
|
end
|
128
135
|
|
129
136
|
@installer = Gem::Installer.new @gem
|
130
137
|
end
|
131
138
|
|
132
|
-
def util_installer(spec,
|
133
|
-
|
134
|
-
FileUtils.mv Gem.cache_gem(spec.file_name), @tempdir
|
135
|
-
installer = Gem::Installer.new gem_path
|
136
|
-
installer.gem_dir = util_gem_dir
|
137
|
-
installer.gem_home = gem_home
|
138
|
-
installer.spec = spec
|
139
|
-
|
140
|
-
installer
|
139
|
+
def util_installer(spec, gem_home, user=false)
|
140
|
+
Gem::Installer.new spec.cache_file, :user_install => user
|
141
141
|
end
|
142
|
-
|
143
142
|
end
|
144
|
-
|
data/lib/rubygems/mock_gem_ui.rb
CHANGED
@@ -6,7 +6,14 @@ require 'rubygems/user_interaction'
|
|
6
6
|
# retrieval during tests.
|
7
7
|
|
8
8
|
class Gem::MockGemUi < Gem::StreamUI
|
9
|
-
class TermError < RuntimeError
|
9
|
+
class TermError < RuntimeError
|
10
|
+
attr_reader :exit_code
|
11
|
+
|
12
|
+
def initialize exit_code
|
13
|
+
super
|
14
|
+
@exit_code = exit_code
|
15
|
+
end
|
16
|
+
end
|
10
17
|
class SystemExitException < RuntimeError; end
|
11
18
|
|
12
19
|
module TTY
|
@@ -56,8 +63,8 @@ class Gem::MockGemUi < Gem::StreamUI
|
|
56
63
|
def terminate_interaction(status=0)
|
57
64
|
@terminated = true
|
58
65
|
|
59
|
-
raise TermError
|
60
|
-
raise SystemExitException
|
66
|
+
raise TermError, status if status != 0
|
67
|
+
raise SystemExitException
|
61
68
|
end
|
62
69
|
|
63
70
|
end
|
data/lib/rubygems/package.rb
CHANGED
@@ -6,32 +6,6 @@
|
|
6
6
|
|
7
7
|
require 'rubygems/specification'
|
8
8
|
|
9
|
-
##
|
10
|
-
# Wrapper for FileUtils meant to provide logging and additional operations if
|
11
|
-
# needed.
|
12
|
-
|
13
|
-
class Gem::FileOperations
|
14
|
-
|
15
|
-
def initialize(logger = nil)
|
16
|
-
require 'fileutils'
|
17
|
-
@logger = logger
|
18
|
-
end
|
19
|
-
|
20
|
-
def method_missing(meth, *args, &block)
|
21
|
-
case
|
22
|
-
when FileUtils.respond_to?(meth)
|
23
|
-
@logger.log "#{meth}: #{args}" if @logger
|
24
|
-
FileUtils.send meth, *args, &block
|
25
|
-
when Gem::FileOperations.respond_to?(meth)
|
26
|
-
@logger.log "#{meth}: #{args}" if @logger
|
27
|
-
Gem::FileOperations.send meth, *args, &block
|
28
|
-
else
|
29
|
-
super
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
9
|
module Gem::Package
|
36
10
|
|
37
11
|
class Error < StandardError; end
|
@@ -110,7 +110,6 @@ class Gem::Package::TarInput
|
|
110
110
|
end
|
111
111
|
|
112
112
|
@tarreader.rewind
|
113
|
-
@fileops = Gem::FileOperations.new
|
114
113
|
|
115
114
|
unless has_meta then
|
116
115
|
path = io.path if io.respond_to? :path
|
@@ -146,9 +145,9 @@ class Gem::Package::TarInput
|
|
146
145
|
dest = File.join destdir, entry.full_name
|
147
146
|
|
148
147
|
if File.directory? dest then
|
149
|
-
|
148
|
+
FileUtils.chmod entry.header.mode, dest, :verbose => false
|
150
149
|
else
|
151
|
-
|
150
|
+
FileUtils.mkdir_p dest, :mode => entry.header.mode, :verbose => false
|
152
151
|
end
|
153
152
|
|
154
153
|
fsync_dir dest
|
@@ -160,9 +159,9 @@ class Gem::Package::TarInput
|
|
160
159
|
# it's a file
|
161
160
|
md5 = Digest::MD5.new if expected_md5sum
|
162
161
|
destdir = File.join destdir, File.dirname(entry.full_name)
|
163
|
-
|
162
|
+
FileUtils.mkdir_p destdir, :mode => 0755, :verbose => false
|
164
163
|
destfile = File.join destdir, File.basename(entry.full_name)
|
165
|
-
|
164
|
+
FileUtils.chmod 0600, destfile, :verbose => false rescue nil # Errno::ENOENT
|
166
165
|
|
167
166
|
open destfile, "wb", entry.header.mode do |os|
|
168
167
|
loop do
|
@@ -176,7 +175,7 @@ class Gem::Package::TarInput
|
|
176
175
|
os.fsync
|
177
176
|
end
|
178
177
|
|
179
|
-
|
178
|
+
FileUtils.chmod entry.header.mode, destfile, :verbose => false
|
180
179
|
fsync_dir File.dirname(destfile)
|
181
180
|
fsync_dir File.join(File.dirname(destfile), "..")
|
182
181
|
|
@@ -100,7 +100,7 @@ class Gem::PackageTask < Rake::PackageTask
|
|
100
100
|
|
101
101
|
task :package => [:gem]
|
102
102
|
|
103
|
-
gem_file = gem_spec.
|
103
|
+
gem_file = File.basename gem_spec.cache_file
|
104
104
|
gem_path = File.join package_dir, gem_file
|
105
105
|
gem_dir = File.join package_dir, gem_spec.full_name
|
106
106
|
|
@@ -0,0 +1,72 @@
|
|
1
|
+
##
|
2
|
+
#
|
3
|
+
# Gem::PathSupport facilitates the GEM_HOME and GEM_PATH environment settings
|
4
|
+
# to the rest of RubyGems.
|
5
|
+
#
|
6
|
+
class Gem::PathSupport
|
7
|
+
##
|
8
|
+
# The default system path for managing Gems.
|
9
|
+
attr_reader :home
|
10
|
+
|
11
|
+
##
|
12
|
+
# Array of paths to search for Gems.
|
13
|
+
attr_reader :path
|
14
|
+
|
15
|
+
##
|
16
|
+
#
|
17
|
+
# Constructor. Takes a single argument which is to be treated like a
|
18
|
+
# hashtable, or defaults to ENV, the system environment.
|
19
|
+
#
|
20
|
+
def initialize(env=ENV)
|
21
|
+
@env = env
|
22
|
+
|
23
|
+
# note 'env' vs 'ENV'...
|
24
|
+
@home = env["GEM_HOME"] || ENV["GEM_HOME"] || Gem.default_dir
|
25
|
+
self.path = env["GEM_PATH"] || ENV["GEM_PATH"]
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
##
|
31
|
+
# Set the Gem home directory (as reported by Gem.dir).
|
32
|
+
|
33
|
+
def home=(home)
|
34
|
+
@home = home.to_s
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Set the Gem search path (as reported by Gem.path).
|
39
|
+
|
40
|
+
def path=(gpaths)
|
41
|
+
# FIX: it should be [home, *path], not [*path, home]
|
42
|
+
|
43
|
+
gem_path = []
|
44
|
+
|
45
|
+
# FIX: I can't tell wtf this is doing.
|
46
|
+
gpaths ||= (ENV['GEM_PATH'] || "").empty? ? nil : ENV["GEM_PATH"]
|
47
|
+
|
48
|
+
if gpaths
|
49
|
+
if gpaths.kind_of?(Array)
|
50
|
+
gem_path = gpaths.dup
|
51
|
+
else
|
52
|
+
gem_path = gpaths.split(File::PATH_SEPARATOR)
|
53
|
+
end
|
54
|
+
|
55
|
+
if File::ALT_SEPARATOR then
|
56
|
+
gem_path.map! do |this_path|
|
57
|
+
this_path.gsub File::ALT_SEPARATOR, File::SEPARATOR
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
gem_path << @home
|
62
|
+
else
|
63
|
+
gem_path = Gem.default_path + [@home]
|
64
|
+
|
65
|
+
if defined?(Gem::APPLE_GEM_HOME)
|
66
|
+
gem_path << Gem::APPLE_GEM_HOME
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
@path = gem_path.uniq
|
71
|
+
end
|
72
|
+
end
|
data/lib/rubygems/platform.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "rubygems/deprecate"
|
2
|
+
|
1
3
|
##
|
2
4
|
# Available list of platforms for targeting Gem installations.
|
3
5
|
|
@@ -115,8 +117,13 @@ class Gem::Platform
|
|
115
117
|
# the same CPU, OS and version.
|
116
118
|
|
117
119
|
def ==(other)
|
118
|
-
self.class === other and
|
119
|
-
|
120
|
+
self.class === other and to_a == other.to_a
|
121
|
+
end
|
122
|
+
|
123
|
+
alias :eql? :==
|
124
|
+
|
125
|
+
def hash # :nodoc:
|
126
|
+
to_a.hash
|
120
127
|
end
|
121
128
|
|
122
129
|
##
|
@@ -179,5 +186,8 @@ class Gem::Platform
|
|
179
186
|
|
180
187
|
CURRENT = 'current'
|
181
188
|
|
189
|
+
extend Deprecate
|
190
|
+
|
191
|
+
deprecate :empty?, :none, 2011, 11
|
182
192
|
end
|
183
193
|
|
@@ -80,7 +80,8 @@ class Gem::RemoteFetcher
|
|
80
80
|
# larger, more emcompassing effort. -erikh
|
81
81
|
|
82
82
|
def download_to_cache dependency
|
83
|
-
found = Gem::SpecFetcher.fetcher.fetch dependency
|
83
|
+
found = Gem::SpecFetcher.fetcher.fetch dependency, true, true,
|
84
|
+
dependency.prerelease?
|
84
85
|
|
85
86
|
return if found.empty?
|
86
87
|
|
@@ -98,12 +99,12 @@ class Gem::RemoteFetcher
|
|
98
99
|
Gem.ensure_gem_subdirectories(install_dir) rescue nil
|
99
100
|
|
100
101
|
if File.writable?(install_dir)
|
101
|
-
cache_dir =
|
102
|
+
cache_dir = File.join install_dir, "cache"
|
102
103
|
else
|
103
|
-
cache_dir =
|
104
|
+
cache_dir = File.join Gem.user_dir, "cache"
|
104
105
|
end
|
105
106
|
|
106
|
-
gem_file_name = spec.
|
107
|
+
gem_file_name = File.basename spec.cache_file
|
107
108
|
local_gem_path = File.join cache_dir, gem_file_name
|
108
109
|
|
109
110
|
FileUtils.mkdir_p cache_dir rescue nil unless File.exist? cache_dir
|
@@ -111,8 +112,8 @@ class Gem::RemoteFetcher
|
|
111
112
|
# Always escape URI's to deal with potential spaces and such
|
112
113
|
unless URI::Generic === source_uri
|
113
114
|
source_uri = URI.parse(URI.const_defined?(:DEFAULT_PARSER) ?
|
114
|
-
URI::DEFAULT_PARSER.escape(source_uri) :
|
115
|
-
URI.escape(source_uri))
|
115
|
+
URI::DEFAULT_PARSER.escape(source_uri.to_s) :
|
116
|
+
URI.escape(source_uri.to_s))
|
116
117
|
end
|
117
118
|
|
118
119
|
scheme = source_uri.scheme
|
data/lib/rubygems/requirement.rb
CHANGED
data/lib/rubygems/security.rb
CHANGED
@@ -387,7 +387,7 @@ module Gem::Security
|
|
387
387
|
:munge_re => Regexp.new(/[^a-z0-9_.-]+/),
|
388
388
|
|
389
389
|
# output directory for trusted certificate checksums
|
390
|
-
:trust_dir => File
|
390
|
+
:trust_dir => File.join(Gem.user_home, '.gem', 'trust'),
|
391
391
|
|
392
392
|
# default permissions for trust directory and certs
|
393
393
|
:perms => {
|
data/lib/rubygems/server.rb
CHANGED
@@ -75,47 +75,47 @@ class Gem::Server
|
|
75
75
|
|
76
76
|
<dl>
|
77
77
|
<% values["specs"].each do |spec| %>
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
78
|
+
<dt>
|
79
|
+
<% if spec["first_name_entry"] then %>
|
80
|
+
<a name="<%=spec["name"]%>"></a>
|
81
|
+
<% end %>
|
82
|
+
|
83
|
+
<b><%=spec["name"]%> <%=spec["version"]%></b>
|
84
|
+
|
85
|
+
<% if spec["rdoc_installed"] then %>
|
86
|
+
<a href="<%=spec["doc_path"]%>">[rdoc]</a>
|
87
|
+
<% else %>
|
88
|
+
<span title="rdoc not installed">[rdoc]</span>
|
89
|
+
<% end %>
|
90
|
+
|
91
|
+
<% if spec["homepage"] then %>
|
92
|
+
<a href="<%=spec["homepage"]%>" title="<%=spec["homepage"]%>">[www]</a>
|
93
|
+
<% else %>
|
94
|
+
<span title="no homepage available">[www]</span>
|
95
|
+
<% end %>
|
96
|
+
|
97
|
+
<% if spec["has_deps"] then %>
|
98
|
+
- depends on
|
99
|
+
<%= spec["dependencies"].map { |v| "<a href=\"##{v["name"]}\">#{v["name"]}</a>" }.join ', ' %>.
|
100
|
+
<% end %>
|
101
|
+
</dt>
|
102
|
+
<dd>
|
103
|
+
<%=spec["summary"]%>
|
104
|
+
<% if spec["executables"] then %>
|
105
|
+
<br/>
|
106
|
+
|
107
|
+
<% if spec["only_one_executable"] then %>
|
108
|
+
Executable is
|
109
|
+
<% else %>
|
110
|
+
Executables are
|
111
|
+
<%end%>
|
112
|
+
|
113
|
+
<%= spec["executables"].map { |v| "<span class=\"context-item-name\">#{v["executable"]}</span>"}.join ', ' %>.
|
114
|
+
|
115
|
+
<%end%>
|
116
|
+
<br/>
|
117
|
+
<br/>
|
118
|
+
</dd>
|
119
119
|
<% end %>
|
120
120
|
</dl>
|
121
121
|
|
@@ -454,15 +454,15 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
|
454
454
|
spec_dir
|
455
455
|
end
|
456
456
|
|
457
|
-
|
457
|
+
Gem::Specification.dirs = @gem_dirs
|
458
458
|
end
|
459
459
|
|
460
460
|
def Marshal(req, res)
|
461
|
-
|
461
|
+
Gem::Specification.reset
|
462
462
|
|
463
463
|
add_date res
|
464
464
|
|
465
|
-
index = Marshal.dump
|
465
|
+
index = Deprecate.skip_during { Marshal.dump Gem.source_index }
|
466
466
|
|
467
467
|
if req.request_method == 'HEAD' then
|
468
468
|
res['content-length'] = index.length
|
@@ -486,15 +486,16 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
|
486
486
|
end
|
487
487
|
|
488
488
|
def latest_specs(req, res)
|
489
|
-
|
489
|
+
Gem::Specification.reset
|
490
490
|
|
491
491
|
res['content-type'] = 'application/x-gzip'
|
492
492
|
|
493
493
|
add_date res
|
494
494
|
|
495
|
-
|
496
|
-
|
497
|
-
|
495
|
+
latest_specs = Gem::Specification.latest_specs
|
496
|
+
|
497
|
+
specs = latest_specs.sort.map do |spec|
|
498
|
+
platform = spec.original_platform || Gem::Platform::RUBY
|
498
499
|
[spec.name, spec.version, platform]
|
499
500
|
end
|
500
501
|
|
@@ -546,21 +547,20 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
|
546
547
|
end
|
547
548
|
|
548
549
|
def quick(req, res)
|
549
|
-
|
550
|
+
Gem::Specification.reset
|
550
551
|
|
551
552
|
res['content-type'] = 'text/plain'
|
552
553
|
add_date res
|
553
554
|
|
554
555
|
case req.request_uri.path
|
555
556
|
when %r|^/quick/(Marshal.#{Regexp.escape Gem.marshal_version}/)?(.*?)-([0-9.]+)(-.*?)?\.gemspec\.rz$| then
|
556
|
-
|
557
|
-
specs =
|
558
|
-
marshal_format = $1
|
557
|
+
marshal_format, name, version, platform = $1, $2, $3, $4
|
558
|
+
specs = Gem::Specification.find_all_by_name name, version
|
559
559
|
|
560
|
-
selector = [
|
560
|
+
selector = [name, version, platform].map(&:inspect).join ' '
|
561
561
|
|
562
|
-
platform = if
|
563
|
-
Gem::Platform.new
|
562
|
+
platform = if platform then
|
563
|
+
Gem::Platform.new platform.sub(/^-/, '')
|
564
564
|
else
|
565
565
|
Gem::Platform::RUBY
|
566
566
|
end
|
@@ -583,7 +583,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
|
583
583
|
end
|
584
584
|
|
585
585
|
def root(req, res)
|
586
|
-
|
586
|
+
Gem::Specification.reset
|
587
587
|
add_date res
|
588
588
|
|
589
589
|
raise WEBrick::HTTPStatus::NotFound, "`#{req.path}' not found." unless
|
@@ -592,13 +592,15 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
|
592
592
|
specs = []
|
593
593
|
total_file_count = 0
|
594
594
|
|
595
|
-
|
595
|
+
Gem::Specification.each do |spec|
|
596
596
|
total_file_count += spec.files.size
|
597
|
-
deps = spec.dependencies.map
|
598
|
-
{
|
597
|
+
deps = spec.dependencies.map { |dep|
|
598
|
+
{
|
599
|
+
"name" => dep.name,
|
599
600
|
"type" => dep.type,
|
600
|
-
"version" => dep.requirement.to_s,
|
601
|
-
|
601
|
+
"version" => dep.requirement.to_s,
|
602
|
+
}
|
603
|
+
}
|
602
604
|
|
603
605
|
deps = deps.sort_by { |dep| [dep["name"].downcase, dep["version"]] }
|
604
606
|
deps.last["is_last"] = true unless deps.empty?
|
@@ -792,13 +794,12 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
|
792
794
|
end
|
793
795
|
|
794
796
|
def specs(req, res)
|
795
|
-
|
797
|
+
Gem::Specification.reset
|
796
798
|
|
797
799
|
add_date res
|
798
800
|
|
799
|
-
specs =
|
800
|
-
platform = spec.original_platform
|
801
|
-
platform = Gem::Platform::RUBY if platform.nil?
|
801
|
+
specs = Gem::Specification.sort_by(&:sort_obj).map do |spec|
|
802
|
+
platform = spec.original_platform || Gem::Platform::RUBY
|
802
803
|
[spec.name, spec.version, platform]
|
803
804
|
end
|
804
805
|
|
@@ -821,12 +822,11 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
|
821
822
|
def launch
|
822
823
|
listeners = @server.listeners.map{|l| l.addr[2] }
|
823
824
|
|
825
|
+
# TODO: 0.0.0.0 == any, not localhost.
|
824
826
|
host = listeners.any?{|l| l == '0.0.0.0'} ? 'localhost' : listeners.first
|
825
827
|
|
826
828
|
say "Launching browser to http://#{host}:#{@port}"
|
827
829
|
|
828
830
|
system("#{@launch} http://#{host}:#{@port}")
|
829
831
|
end
|
830
|
-
|
831
832
|
end
|
832
|
-
|