rubygems-update 3.2.30 → 3.2.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/Manifest.txt +18 -0
- data/bundler/CHANGELOG.md +17 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/gem.rb +68 -7
- data/bundler/lib/bundler/cli.rb +3 -1
- data/bundler/lib/bundler/definition.rb +5 -4
- data/bundler/lib/bundler/lockfile_parser.rb +1 -0
- data/bundler/lib/bundler/man/bundle-add.1 +1 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
- data/bundler/lib/bundler/man/bundle-check.1 +1 -1
- data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +3 -3
- data/bundler/lib/bundler/man/bundle-config.1.ronn +2 -2
- data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
- data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +14 -1
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +16 -0
- data/bundler/lib/bundler/man/bundle-info.1 +1 -1
- data/bundler/lib/bundler/man/bundle-init.1 +1 -1
- data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
- data/bundler/lib/bundler/man/bundle-install.1 +1 -1
- data/bundler/lib/bundler/man/bundle-list.1 +1 -1
- data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
- data/bundler/lib/bundler/man/bundle-open.1 +1 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
- data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
- data/bundler/lib/bundler/man/bundle-show.1 +1 -1
- data/bundler/lib/bundler/man/bundle-update.1 +1 -1
- data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
- data/bundler/lib/bundler/man/bundle.1 +1 -1
- data/bundler/lib/bundler/man/gemfile.5 +1 -1
- data/bundler/lib/bundler/runtime.rb +1 -1
- data/bundler/lib/bundler/source/git/git_proxy.rb +5 -2
- data/bundler/lib/bundler/source/rubygems.rb +1 -1
- data/bundler/lib/bundler/spec_set.rb +1 -1
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +5 -2
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +5 -1
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +12 -12
- data/bundler/lib/bundler/templates/newgem/standard.yml.tt +4 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
- data/bundler/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
- data/bundler/lib/bundler/vendored_tsort.rb +4 -0
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems/command.rb +4 -4
- data/lib/rubygems/commands/cert_command.rb +6 -6
- data/lib/rubygems/commands/fetch_command.rb +1 -1
- data/lib/rubygems/commands/server_command.rb +3 -3
- data/lib/rubygems/commands/setup_command.rb +64 -55
- data/lib/rubygems/commands/uninstall_command.rb +1 -1
- data/lib/rubygems/commands/update_command.rb +1 -1
- data/lib/rubygems/dependency_list.rb +2 -2
- data/lib/rubygems/ext/builder.rb +6 -5
- data/lib/rubygems/ext/cmake_builder.rb +1 -1
- data/lib/rubygems/install_update_options.rb +2 -2
- data/lib/rubygems/installer.rb +30 -5
- data/lib/rubygems/local_remote_options.rb +3 -3
- data/lib/rubygems/optparse/COPYING +56 -0
- data/lib/rubygems/optparse/lib/optionparser.rb +2 -0
- data/lib/rubygems/optparse/lib/optparse/ac.rb +54 -0
- data/lib/rubygems/optparse/lib/optparse/date.rb +18 -0
- data/lib/rubygems/optparse/lib/optparse/kwargs.rb +22 -0
- data/lib/rubygems/optparse/lib/optparse/shellwords.rb +7 -0
- data/lib/rubygems/optparse/lib/optparse/time.rb +11 -0
- data/lib/rubygems/optparse/lib/optparse/uri.rb +7 -0
- data/lib/rubygems/optparse/lib/optparse/version.rb +71 -0
- data/lib/rubygems/optparse/lib/optparse.rb +2230 -0
- data/lib/rubygems/optparse.rb +3 -0
- data/lib/rubygems/request_set.rb +2 -2
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +2 -2
- data/lib/rubygems/security_option.rb +3 -3
- data/lib/rubygems/specification.rb +9 -5
- data/lib/rubygems/tsort/LICENSE.txt +22 -0
- data/lib/rubygems/tsort/lib/tsort.rb +454 -0
- data/lib/rubygems/tsort.rb +3 -0
- data/lib/rubygems/util/licenses.rb +2 -0
- data/lib/rubygems/version_option.rb +2 -2
- data/lib/rubygems.rb +1 -1
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/encrypted_private_key.pem +26 -26
- data/test/rubygems/helper.rb +22 -18
- data/test/rubygems/test_gem_command.rb +1 -1
- data/test/rubygems/test_gem_commands_cert_command.rb +8 -8
- data/test/rubygems/test_gem_commands_fetch_command.rb +36 -0
- data/test/rubygems/test_gem_commands_server_command.rb +3 -3
- data/test/rubygems/test_gem_commands_setup_command.rb +50 -19
- data/test/rubygems/test_gem_commands_signin_command.rb +1 -1
- data/test/rubygems/test_gem_commands_uninstall_command.rb +1 -1
- data/test/rubygems/test_gem_commands_yank_command.rb +1 -1
- data/test/rubygems/test_gem_install_update_options.rb +2 -2
- data/test/rubygems/test_gem_request.rb +10 -4
- data/test/rubygems/test_gem_resolver.rb +7 -7
- data/test/rubygems/test_gem_specification.rb +11 -0
- metadata +21 -3
data/lib/rubygems/request_set.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
require_relative 'tsort'
|
3
3
|
|
4
4
|
##
|
5
5
|
# A RequestSet groups a request to activate a set of dependencies.
|
@@ -15,7 +15,7 @@ require 'tsort'
|
|
15
15
|
# #=> ["nokogiri-1.6.0", "mini_portile-0.5.1", "pg-0.17.0"]
|
16
16
|
|
17
17
|
class Gem::RequestSet
|
18
|
-
include TSort
|
18
|
+
include Gem::TSort
|
19
19
|
|
20
20
|
##
|
21
21
|
# Array of gems to install even if already installed
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative '../../../../tsort'
|
4
4
|
|
5
5
|
require_relative 'dependency_graph/log'
|
6
6
|
require_relative 'dependency_graph/vertex'
|
@@ -17,7 +17,7 @@ module Gem::Resolver::Molinillo
|
|
17
17
|
vertices.values.each { |v| yield v }
|
18
18
|
end
|
19
19
|
|
20
|
-
include TSort
|
20
|
+
include Gem::TSort
|
21
21
|
|
22
22
|
# @!visibility private
|
23
23
|
alias tsort_each_node each
|
@@ -19,16 +19,16 @@ end
|
|
19
19
|
|
20
20
|
module Gem::SecurityOption
|
21
21
|
def add_security_option
|
22
|
-
OptionParser.accept Gem::Security::Policy do |value|
|
22
|
+
Gem::OptionParser.accept Gem::Security::Policy do |value|
|
23
23
|
require_relative 'security'
|
24
24
|
|
25
|
-
raise OptionParser::InvalidArgument, 'OpenSSL not installed' unless
|
25
|
+
raise Gem::OptionParser::InvalidArgument, 'OpenSSL not installed' unless
|
26
26
|
defined?(Gem::Security::HighSecurity)
|
27
27
|
|
28
28
|
policy = Gem::Security::Policies[value]
|
29
29
|
unless policy
|
30
30
|
valid = Gem::Security::Policies.keys.sort
|
31
|
-
raise OptionParser::InvalidArgument, "#{value} (#{valid.join ', '} are valid)"
|
31
|
+
raise Gem::OptionParser::InvalidArgument, "#{value} (#{valid.join ', '} are valid)"
|
32
32
|
end
|
33
33
|
policy
|
34
34
|
end
|
@@ -324,17 +324,21 @@ class Gem::Specification < Gem::BasicSpecification
|
|
324
324
|
# This should just be the name of your license. The full text of the license
|
325
325
|
# should be inside of the gem (at the top level) when you build it.
|
326
326
|
#
|
327
|
-
# The simplest way
|
327
|
+
# The simplest way is to specify the standard SPDX ID
|
328
328
|
# https://spdx.org/licenses/ for the license.
|
329
|
-
# Ideally you should pick one that is OSI (Open Source Initiative)
|
329
|
+
# Ideally, you should pick one that is OSI (Open Source Initiative)
|
330
330
|
# http://opensource.org/licenses/alphabetical approved.
|
331
331
|
#
|
332
|
-
# The most commonly used OSI
|
332
|
+
# The most commonly used OSI-approved licenses are MIT and Apache-2.0.
|
333
333
|
# GitHub also provides a license picker at http://choosealicense.com/.
|
334
334
|
#
|
335
|
+
# You can also use a custom license file along with your gemspec and specify
|
336
|
+
# a LicenseRef-<idstring>, where idstring is the name of the file containing
|
337
|
+
# the license text.
|
338
|
+
#
|
335
339
|
# You should specify a license for your gem so that people know how they are
|
336
|
-
# permitted to use it
|
337
|
-
# specifying a license means all rights are reserved; others have no
|
340
|
+
# permitted to use it and any restrictions you're placing on it. Not
|
341
|
+
# specifying a license means all rights are reserved; others have no right
|
338
342
|
# to use the code for any purpose.
|
339
343
|
#
|
340
344
|
# You can set multiple licenses with #licenses=
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
4
|
+
modification, are permitted provided that the following conditions
|
5
|
+
are met:
|
6
|
+
1. Redistributions of source code must retain the above copyright
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
|
+
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
13
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
16
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
17
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
18
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
19
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
20
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
21
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
22
|
+
SUCH DAMAGE.
|
@@ -0,0 +1,454 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#--
|
4
|
+
# tsort.rb - provides a module for topological sorting and strongly connected components.
|
5
|
+
#++
|
6
|
+
#
|
7
|
+
|
8
|
+
#
|
9
|
+
# Gem::TSort implements topological sorting using Tarjan's algorithm for
|
10
|
+
# strongly connected components.
|
11
|
+
#
|
12
|
+
# Gem::TSort is designed to be able to be used with any object which can be
|
13
|
+
# interpreted as a directed graph.
|
14
|
+
#
|
15
|
+
# Gem::TSort requires two methods to interpret an object as a graph,
|
16
|
+
# tsort_each_node and tsort_each_child.
|
17
|
+
#
|
18
|
+
# * tsort_each_node is used to iterate for all nodes over a graph.
|
19
|
+
# * tsort_each_child is used to iterate for child nodes of a given node.
|
20
|
+
#
|
21
|
+
# The equality of nodes are defined by eql? and hash since
|
22
|
+
# Gem::TSort uses Hash internally.
|
23
|
+
#
|
24
|
+
# == A Simple Example
|
25
|
+
#
|
26
|
+
# The following example demonstrates how to mix the Gem::TSort module into an
|
27
|
+
# existing class (in this case, Hash). Here, we're treating each key in
|
28
|
+
# the hash as a node in the graph, and so we simply alias the required
|
29
|
+
# #tsort_each_node method to Hash's #each_key method. For each key in the
|
30
|
+
# hash, the associated value is an array of the node's child nodes. This
|
31
|
+
# choice in turn leads to our implementation of the required #tsort_each_child
|
32
|
+
# method, which fetches the array of child nodes and then iterates over that
|
33
|
+
# array using the user-supplied block.
|
34
|
+
#
|
35
|
+
# require 'rubygems/tsort/lib/tsort'
|
36
|
+
#
|
37
|
+
# class Hash
|
38
|
+
# include Gem::TSort
|
39
|
+
# alias tsort_each_node each_key
|
40
|
+
# def tsort_each_child(node, &block)
|
41
|
+
# fetch(node).each(&block)
|
42
|
+
# end
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
# {1=>[2, 3], 2=>[3], 3=>[], 4=>[]}.tsort
|
46
|
+
# #=> [3, 2, 1, 4]
|
47
|
+
#
|
48
|
+
# {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}.strongly_connected_components
|
49
|
+
# #=> [[4], [2, 3], [1]]
|
50
|
+
#
|
51
|
+
# == A More Realistic Example
|
52
|
+
#
|
53
|
+
# A very simple `make' like tool can be implemented as follows:
|
54
|
+
#
|
55
|
+
# require 'rubygems/tsort/lib/tsort'
|
56
|
+
#
|
57
|
+
# class Make
|
58
|
+
# def initialize
|
59
|
+
# @dep = {}
|
60
|
+
# @dep.default = []
|
61
|
+
# end
|
62
|
+
#
|
63
|
+
# def rule(outputs, inputs=[], &block)
|
64
|
+
# triple = [outputs, inputs, block]
|
65
|
+
# outputs.each {|f| @dep[f] = [triple]}
|
66
|
+
# @dep[triple] = inputs
|
67
|
+
# end
|
68
|
+
#
|
69
|
+
# def build(target)
|
70
|
+
# each_strongly_connected_component_from(target) {|ns|
|
71
|
+
# if ns.length != 1
|
72
|
+
# fs = ns.delete_if {|n| Array === n}
|
73
|
+
# raise Gem::TSort::Cyclic.new("cyclic dependencies: #{fs.join ', '}")
|
74
|
+
# end
|
75
|
+
# n = ns.first
|
76
|
+
# if Array === n
|
77
|
+
# outputs, inputs, block = n
|
78
|
+
# inputs_time = inputs.map {|f| File.mtime f}.max
|
79
|
+
# begin
|
80
|
+
# outputs_time = outputs.map {|f| File.mtime f}.min
|
81
|
+
# rescue Errno::ENOENT
|
82
|
+
# outputs_time = nil
|
83
|
+
# end
|
84
|
+
# if outputs_time == nil ||
|
85
|
+
# inputs_time != nil && outputs_time <= inputs_time
|
86
|
+
# sleep 1 if inputs_time != nil && inputs_time.to_i == Time.now.to_i
|
87
|
+
# block.call
|
88
|
+
# end
|
89
|
+
# end
|
90
|
+
# }
|
91
|
+
# end
|
92
|
+
#
|
93
|
+
# def tsort_each_child(node, &block)
|
94
|
+
# @dep[node].each(&block)
|
95
|
+
# end
|
96
|
+
# include Gem::TSort
|
97
|
+
# end
|
98
|
+
#
|
99
|
+
# def command(arg)
|
100
|
+
# print arg, "\n"
|
101
|
+
# system arg
|
102
|
+
# end
|
103
|
+
#
|
104
|
+
# m = Make.new
|
105
|
+
# m.rule(%w[t1]) { command 'date > t1' }
|
106
|
+
# m.rule(%w[t2]) { command 'date > t2' }
|
107
|
+
# m.rule(%w[t3]) { command 'date > t3' }
|
108
|
+
# m.rule(%w[t4], %w[t1 t3]) { command 'cat t1 t3 > t4' }
|
109
|
+
# m.rule(%w[t5], %w[t4 t2]) { command 'cat t4 t2 > t5' }
|
110
|
+
# m.build('t5')
|
111
|
+
#
|
112
|
+
# == Bugs
|
113
|
+
#
|
114
|
+
# * 'tsort.rb' is wrong name because this library uses
|
115
|
+
# Tarjan's algorithm for strongly connected components.
|
116
|
+
# Although 'strongly_connected_components.rb' is correct but too long.
|
117
|
+
#
|
118
|
+
# == References
|
119
|
+
#
|
120
|
+
# R. E. Tarjan, "Depth First Search and Linear Graph Algorithms",
|
121
|
+
# <em>SIAM Journal on Computing</em>, Vol. 1, No. 2, pp. 146-160, June 1972.
|
122
|
+
#
|
123
|
+
|
124
|
+
module Gem
|
125
|
+
module TSort
|
126
|
+
class Cyclic < StandardError
|
127
|
+
end
|
128
|
+
|
129
|
+
# Returns a topologically sorted array of nodes.
|
130
|
+
# The array is sorted from children to parents, i.e.
|
131
|
+
# the first element has no child and the last node has no parent.
|
132
|
+
#
|
133
|
+
# If there is a cycle, Gem::TSort::Cyclic is raised.
|
134
|
+
#
|
135
|
+
# class G
|
136
|
+
# include Gem::TSort
|
137
|
+
# def initialize(g)
|
138
|
+
# @g = g
|
139
|
+
# end
|
140
|
+
# def tsort_each_child(n, &b) @g[n].each(&b) end
|
141
|
+
# def tsort_each_node(&b) @g.each_key(&b) end
|
142
|
+
# end
|
143
|
+
#
|
144
|
+
# graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
|
145
|
+
# p graph.tsort #=> [4, 2, 3, 1]
|
146
|
+
#
|
147
|
+
# graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
|
148
|
+
# p graph.tsort # raises Gem::TSort::Cyclic
|
149
|
+
#
|
150
|
+
def tsort
|
151
|
+
each_node = method(:tsort_each_node)
|
152
|
+
each_child = method(:tsort_each_child)
|
153
|
+
Gem::TSort.tsort(each_node, each_child)
|
154
|
+
end
|
155
|
+
|
156
|
+
# Returns a topologically sorted array of nodes.
|
157
|
+
# The array is sorted from children to parents, i.e.
|
158
|
+
# the first element has no child and the last node has no parent.
|
159
|
+
#
|
160
|
+
# The graph is represented by _each_node_ and _each_child_.
|
161
|
+
# _each_node_ should have +call+ method which yields for each node in the graph.
|
162
|
+
# _each_child_ should have +call+ method which takes a node argument and yields for each child node.
|
163
|
+
#
|
164
|
+
# If there is a cycle, Gem::TSort::Cyclic is raised.
|
165
|
+
#
|
166
|
+
# g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
|
167
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
168
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
169
|
+
# p Gem::TSort.tsort(each_node, each_child) #=> [4, 2, 3, 1]
|
170
|
+
#
|
171
|
+
# g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
|
172
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
173
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
174
|
+
# p Gem::TSort.tsort(each_node, each_child) # raises Gem::TSort::Cyclic
|
175
|
+
#
|
176
|
+
def TSort.tsort(each_node, each_child)
|
177
|
+
Gem::TSort.tsort_each(each_node, each_child).to_a
|
178
|
+
end
|
179
|
+
|
180
|
+
# The iterator version of the #tsort method.
|
181
|
+
# <tt><em>obj</em>.tsort_each</tt> is similar to <tt><em>obj</em>.tsort.each</tt>, but
|
182
|
+
# modification of _obj_ during the iteration may lead to unexpected results.
|
183
|
+
#
|
184
|
+
# #tsort_each returns +nil+.
|
185
|
+
# If there is a cycle, Gem::TSort::Cyclic is raised.
|
186
|
+
#
|
187
|
+
# class G
|
188
|
+
# include Gem::TSort
|
189
|
+
# def initialize(g)
|
190
|
+
# @g = g
|
191
|
+
# end
|
192
|
+
# def tsort_each_child(n, &b) @g[n].each(&b) end
|
193
|
+
# def tsort_each_node(&b) @g.each_key(&b) end
|
194
|
+
# end
|
195
|
+
#
|
196
|
+
# graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
|
197
|
+
# graph.tsort_each {|n| p n }
|
198
|
+
# #=> 4
|
199
|
+
# # 2
|
200
|
+
# # 3
|
201
|
+
# # 1
|
202
|
+
#
|
203
|
+
def tsort_each(&block) # :yields: node
|
204
|
+
each_node = method(:tsort_each_node)
|
205
|
+
each_child = method(:tsort_each_child)
|
206
|
+
Gem::TSort.tsort_each(each_node, each_child, &block)
|
207
|
+
end
|
208
|
+
|
209
|
+
# The iterator version of the Gem::TSort.tsort method.
|
210
|
+
#
|
211
|
+
# The graph is represented by _each_node_ and _each_child_.
|
212
|
+
# _each_node_ should have +call+ method which yields for each node in the graph.
|
213
|
+
# _each_child_ should have +call+ method which takes a node argument and yields for each child node.
|
214
|
+
#
|
215
|
+
# g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
|
216
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
217
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
218
|
+
# Gem::TSort.tsort_each(each_node, each_child) {|n| p n }
|
219
|
+
# #=> 4
|
220
|
+
# # 2
|
221
|
+
# # 3
|
222
|
+
# # 1
|
223
|
+
#
|
224
|
+
def TSort.tsort_each(each_node, each_child) # :yields: node
|
225
|
+
return to_enum(__method__, each_node, each_child) unless block_given?
|
226
|
+
|
227
|
+
Gem::TSort.each_strongly_connected_component(each_node, each_child) {|component|
|
228
|
+
if component.size == 1
|
229
|
+
yield component.first
|
230
|
+
else
|
231
|
+
raise Cyclic.new("topological sort failed: #{component.inspect}")
|
232
|
+
end
|
233
|
+
}
|
234
|
+
end
|
235
|
+
|
236
|
+
# Returns strongly connected components as an array of arrays of nodes.
|
237
|
+
# The array is sorted from children to parents.
|
238
|
+
# Each elements of the array represents a strongly connected component.
|
239
|
+
#
|
240
|
+
# class G
|
241
|
+
# include Gem::TSort
|
242
|
+
# def initialize(g)
|
243
|
+
# @g = g
|
244
|
+
# end
|
245
|
+
# def tsort_each_child(n, &b) @g[n].each(&b) end
|
246
|
+
# def tsort_each_node(&b) @g.each_key(&b) end
|
247
|
+
# end
|
248
|
+
#
|
249
|
+
# graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
|
250
|
+
# p graph.strongly_connected_components #=> [[4], [2], [3], [1]]
|
251
|
+
#
|
252
|
+
# graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
|
253
|
+
# p graph.strongly_connected_components #=> [[4], [2, 3], [1]]
|
254
|
+
#
|
255
|
+
def strongly_connected_components
|
256
|
+
each_node = method(:tsort_each_node)
|
257
|
+
each_child = method(:tsort_each_child)
|
258
|
+
Gem::TSort.strongly_connected_components(each_node, each_child)
|
259
|
+
end
|
260
|
+
|
261
|
+
# Returns strongly connected components as an array of arrays of nodes.
|
262
|
+
# The array is sorted from children to parents.
|
263
|
+
# Each elements of the array represents a strongly connected component.
|
264
|
+
#
|
265
|
+
# The graph is represented by _each_node_ and _each_child_.
|
266
|
+
# _each_node_ should have +call+ method which yields for each node in the graph.
|
267
|
+
# _each_child_ should have +call+ method which takes a node argument and yields for each child node.
|
268
|
+
#
|
269
|
+
# g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
|
270
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
271
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
272
|
+
# p Gem::TSort.strongly_connected_components(each_node, each_child)
|
273
|
+
# #=> [[4], [2], [3], [1]]
|
274
|
+
#
|
275
|
+
# g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
|
276
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
277
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
278
|
+
# p Gem::TSort.strongly_connected_components(each_node, each_child)
|
279
|
+
# #=> [[4], [2, 3], [1]]
|
280
|
+
#
|
281
|
+
def TSort.strongly_connected_components(each_node, each_child)
|
282
|
+
Gem::TSort.each_strongly_connected_component(each_node, each_child).to_a
|
283
|
+
end
|
284
|
+
|
285
|
+
# The iterator version of the #strongly_connected_components method.
|
286
|
+
# <tt><em>obj</em>.each_strongly_connected_component</tt> is similar to
|
287
|
+
# <tt><em>obj</em>.strongly_connected_components.each</tt>, but
|
288
|
+
# modification of _obj_ during the iteration may lead to unexpected results.
|
289
|
+
#
|
290
|
+
# #each_strongly_connected_component returns +nil+.
|
291
|
+
#
|
292
|
+
# class G
|
293
|
+
# include Gem::TSort
|
294
|
+
# def initialize(g)
|
295
|
+
# @g = g
|
296
|
+
# end
|
297
|
+
# def tsort_each_child(n, &b) @g[n].each(&b) end
|
298
|
+
# def tsort_each_node(&b) @g.each_key(&b) end
|
299
|
+
# end
|
300
|
+
#
|
301
|
+
# graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
|
302
|
+
# graph.each_strongly_connected_component {|scc| p scc }
|
303
|
+
# #=> [4]
|
304
|
+
# # [2]
|
305
|
+
# # [3]
|
306
|
+
# # [1]
|
307
|
+
#
|
308
|
+
# graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
|
309
|
+
# graph.each_strongly_connected_component {|scc| p scc }
|
310
|
+
# #=> [4]
|
311
|
+
# # [2, 3]
|
312
|
+
# # [1]
|
313
|
+
#
|
314
|
+
def each_strongly_connected_component(&block) # :yields: nodes
|
315
|
+
each_node = method(:tsort_each_node)
|
316
|
+
each_child = method(:tsort_each_child)
|
317
|
+
Gem::TSort.each_strongly_connected_component(each_node, each_child, &block)
|
318
|
+
end
|
319
|
+
|
320
|
+
# The iterator version of the Gem::TSort.strongly_connected_components method.
|
321
|
+
#
|
322
|
+
# The graph is represented by _each_node_ and _each_child_.
|
323
|
+
# _each_node_ should have +call+ method which yields for each node in the graph.
|
324
|
+
# _each_child_ should have +call+ method which takes a node argument and yields for each child node.
|
325
|
+
#
|
326
|
+
# g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
|
327
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
328
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
329
|
+
# Gem::TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
|
330
|
+
# #=> [4]
|
331
|
+
# # [2]
|
332
|
+
# # [3]
|
333
|
+
# # [1]
|
334
|
+
#
|
335
|
+
# g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
|
336
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
337
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
338
|
+
# Gem::TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
|
339
|
+
# #=> [4]
|
340
|
+
# # [2, 3]
|
341
|
+
# # [1]
|
342
|
+
#
|
343
|
+
def TSort.each_strongly_connected_component(each_node, each_child) # :yields: nodes
|
344
|
+
return to_enum(__method__, each_node, each_child) unless block_given?
|
345
|
+
|
346
|
+
id_map = {}
|
347
|
+
stack = []
|
348
|
+
each_node.call {|node|
|
349
|
+
unless id_map.include? node
|
350
|
+
Gem::TSort.each_strongly_connected_component_from(node, each_child, id_map, stack) {|c|
|
351
|
+
yield c
|
352
|
+
}
|
353
|
+
end
|
354
|
+
}
|
355
|
+
nil
|
356
|
+
end
|
357
|
+
|
358
|
+
# Iterates over strongly connected component in the subgraph reachable from
|
359
|
+
# _node_.
|
360
|
+
#
|
361
|
+
# Return value is unspecified.
|
362
|
+
#
|
363
|
+
# #each_strongly_connected_component_from doesn't call #tsort_each_node.
|
364
|
+
#
|
365
|
+
# class G
|
366
|
+
# include Gem::TSort
|
367
|
+
# def initialize(g)
|
368
|
+
# @g = g
|
369
|
+
# end
|
370
|
+
# def tsort_each_child(n, &b) @g[n].each(&b) end
|
371
|
+
# def tsort_each_node(&b) @g.each_key(&b) end
|
372
|
+
# end
|
373
|
+
#
|
374
|
+
# graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
|
375
|
+
# graph.each_strongly_connected_component_from(2) {|scc| p scc }
|
376
|
+
# #=> [4]
|
377
|
+
# # [2]
|
378
|
+
#
|
379
|
+
# graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
|
380
|
+
# graph.each_strongly_connected_component_from(2) {|scc| p scc }
|
381
|
+
# #=> [4]
|
382
|
+
# # [2, 3]
|
383
|
+
#
|
384
|
+
def each_strongly_connected_component_from(node, id_map={}, stack=[], &block) # :yields: nodes
|
385
|
+
Gem::TSort.each_strongly_connected_component_from(node, method(:tsort_each_child), id_map, stack, &block)
|
386
|
+
end
|
387
|
+
|
388
|
+
# Iterates over strongly connected components in a graph.
|
389
|
+
# The graph is represented by _node_ and _each_child_.
|
390
|
+
#
|
391
|
+
# _node_ is the first node.
|
392
|
+
# _each_child_ should have +call+ method which takes a node argument
|
393
|
+
# and yields for each child node.
|
394
|
+
#
|
395
|
+
# Return value is unspecified.
|
396
|
+
#
|
397
|
+
# #Gem::TSort.each_strongly_connected_component_from is a class method and
|
398
|
+
# it doesn't need a class to represent a graph which includes Gem::TSort.
|
399
|
+
#
|
400
|
+
# graph = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
|
401
|
+
# each_child = lambda {|n, &b| graph[n].each(&b) }
|
402
|
+
# Gem::TSort.each_strongly_connected_component_from(1, each_child) {|scc|
|
403
|
+
# p scc
|
404
|
+
# }
|
405
|
+
# #=> [4]
|
406
|
+
# # [2, 3]
|
407
|
+
# # [1]
|
408
|
+
#
|
409
|
+
def TSort.each_strongly_connected_component_from(node, each_child, id_map={}, stack=[]) # :yields: nodes
|
410
|
+
return to_enum(__method__, node, each_child, id_map, stack) unless block_given?
|
411
|
+
|
412
|
+
minimum_id = node_id = id_map[node] = id_map.size
|
413
|
+
stack_length = stack.length
|
414
|
+
stack << node
|
415
|
+
|
416
|
+
each_child.call(node) {|child|
|
417
|
+
if id_map.include? child
|
418
|
+
child_id = id_map[child]
|
419
|
+
minimum_id = child_id if child_id && child_id < minimum_id
|
420
|
+
else
|
421
|
+
sub_minimum_id =
|
422
|
+
Gem::TSort.each_strongly_connected_component_from(child, each_child, id_map, stack) {|c|
|
423
|
+
yield c
|
424
|
+
}
|
425
|
+
minimum_id = sub_minimum_id if sub_minimum_id < minimum_id
|
426
|
+
end
|
427
|
+
}
|
428
|
+
|
429
|
+
if node_id == minimum_id
|
430
|
+
component = stack.slice!(stack_length .. -1)
|
431
|
+
component.each {|n| id_map[n] = nil}
|
432
|
+
yield component
|
433
|
+
end
|
434
|
+
|
435
|
+
minimum_id
|
436
|
+
end
|
437
|
+
|
438
|
+
# Should be implemented by a extended class.
|
439
|
+
#
|
440
|
+
# #tsort_each_node is used to iterate for all nodes over a graph.
|
441
|
+
#
|
442
|
+
def tsort_each_node # :yields: node
|
443
|
+
raise NotImplementedError.new
|
444
|
+
end
|
445
|
+
|
446
|
+
# Should be implemented by a extended class.
|
447
|
+
#
|
448
|
+
# #tsort_each_child is used to iterate for child nodes of _node_.
|
449
|
+
#
|
450
|
+
def tsort_each_child(node) # :yields: child
|
451
|
+
raise NotImplementedError.new
|
452
|
+
end
|
453
|
+
end
|
454
|
+
end
|
@@ -5,6 +5,7 @@ class Gem::Licenses
|
|
5
5
|
extend Gem::Text
|
6
6
|
|
7
7
|
NONSTANDARD = 'Nonstandard'.freeze
|
8
|
+
LICENSE_REF = 'LicenseRef-.+'.freeze
|
8
9
|
|
9
10
|
# Software Package Data Exchange (SPDX) standard open-source software
|
10
11
|
# license identifiers
|
@@ -523,6 +524,7 @@ class Gem::Licenses
|
|
523
524
|
\+?
|
524
525
|
(?:\s WITH \s #{Regexp.union(EXCEPTION_IDENTIFIERS)})?
|
525
526
|
| #{NONSTANDARD}
|
527
|
+
| #{LICENSE_REF}
|
526
528
|
)
|
527
529
|
\Z
|
528
530
|
}ox.freeze
|
@@ -16,7 +16,7 @@ module Gem::VersionOption
|
|
16
16
|
# Add the --platform option to the option parser.
|
17
17
|
|
18
18
|
def add_platform_option(task = command, *wrap)
|
19
|
-
OptionParser.accept Gem::Platform do |value|
|
19
|
+
Gem::OptionParser.accept Gem::Platform do |value|
|
20
20
|
if value == Gem::Platform::RUBY
|
21
21
|
value
|
22
22
|
else
|
@@ -51,7 +51,7 @@ module Gem::VersionOption
|
|
51
51
|
# Add the --version option to the option parser.
|
52
52
|
|
53
53
|
def add_version_option(task = command, *wrap)
|
54
|
-
OptionParser.accept Gem::Requirement do |value|
|
54
|
+
Gem::OptionParser.accept Gem::Requirement do |value|
|
55
55
|
Gem::Requirement.new(*value.split(/\s*,\s*/))
|
56
56
|
end
|
57
57
|
|
data/lib/rubygems.rb
CHANGED
data/rubygems-update.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "rubygems-update"
|
5
|
-
s.version = "3.2.
|
5
|
+
s.version = "3.2.31"
|
6
6
|
s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"]
|
7
7
|
s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"]
|
8
8
|
|
@@ -1,30 +1,30 @@
|
|
1
1
|
-----BEGIN RSA PRIVATE KEY-----
|
2
2
|
Proc-Type: 4,ENCRYPTED
|
3
|
-
DEK-Info:
|
3
|
+
DEK-Info: AES-256-CBC,CB6FD0B173EF450C6EE21A01DD785C1D
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
5
|
+
KqHn2Df8hSuwNE+W+60MnGtc6xpoXmF3iN25iVwcN67krYn+N6cBhjFeXwXccYwJ
|
6
|
+
2gHSu4iEK9Qe32vK0yuv8N9h/fmsabZl0TotnEem/pqO5T8W4LxyK+Rw0s6RB30S
|
7
|
+
C+mUisRADTanAxyBxsNU8xR8OAUNMAAxV1me6It0W2lfNE3t5jg/Kr0NWMoRUNRx
|
8
|
+
dkE6WlD5D8jBeC3QdZ6OuE7QXOCEAWAjcFMc0d1WJq2t2r3TrLVfTH7EOoRyvL1H
|
9
|
+
rrFRx/dEW1UJfM6P11wB5R0nhg3rDXF7oDFszjwO/3tzARke0NZuN37l301lYRl1
|
10
|
+
aolO6sShJLa0Ml/TgNcJw0S6rc6a1Z52gTfQKztKcL1UX4HLZg75zKmn6qfatMBC
|
11
|
+
iXn+pQRYNsOPQ5h4r7lBBqvuV+gBw+rN768tYpZ2/YVDaygxETHcZAFCdAw/JNbP
|
12
|
+
d0XPIbP79NRrCgzSo58LKQGuOQf3Hh0vp1YS+MilMtm/eogoj1enSPM+ymStHRwG
|
13
|
+
i+D00xCQ6blSOZ2eUUBJXt11YzP22GYnv+XTR/5kGKkTIvoRMfd+39bQyR32IEv2
|
14
|
+
Z+yweAGQInD94eifT9ObbIayJ47y01KP0+Vj6hz4RCFsmJKsYiai5JiKlmf7lV9w
|
15
|
+
7zH3TtCOx/xSyomesXVRkqvFkdyeguU72kXc5tiMPaDXGCOeV0GWyR1GU1DUX9/K
|
16
|
+
60E7ym0Wx77WGMKk2fkirZzBdOeliyCRUXd7ccN2rBCjTwtjAUIk27lwzdUaTUv7
|
17
|
+
EmjauDvSMFtir58c+zjlLmBaSQOzKcj0KXMp0Oucls9bD85WGGbGyzGhTa0AZ+/+
|
18
|
+
cCEJt7RAwW0kTEO/uO+BAZe/zBoi9ek+QBn54FK3E7CXfS4Oi9Qbc3fwlVyTlVmz
|
19
|
+
ZGrCncO0TIVGErFWK24Z7lX8rBnk8enfnamrPfKtwn4LG9aDfhSj8DtisjlRUVT5
|
20
|
+
chDQ+CCi9rh3wXh28lyS+nXJ3yFidCzRgcsc3PpN/c4DNRggZc+C/KDw+J2FW+8Y
|
21
|
+
p65OliBQHQcG0PnCa2xRyCGevytPG0rfNDgyaY33dPEo90mBLVcwLbzGiSGBHgFl
|
22
|
+
pr8A/rqbnFpRO39NYbACeRFCqPpzyzfARCCcjcDoFrENdIaJui0fjlBkoV3B/KiK
|
23
|
+
EVjDcgwt1HAtz8bV2YJ+OpQbhD7E90e2vTRMuXAH21Ygo32VOS0LRlCRc9ZyZW4z
|
24
|
+
PTyO/6a+FbXZ1zhVJxu/0bmBERZ14WVmWq56oxQav8knpxYeYPgpEmIZnrHnJ1Ko
|
25
|
+
UoXcc8Hy4NKtaBmDcaF8TCobNsRZTxO/htqpdyNsOrBSsnX2kP5D/O1l1vuVYi1/
|
26
|
+
RYfUqL9dvGzvfsFuuDDjDlQ/fIA6pFzJV3fy4KJHlF1r33qaE/lNMdpKljBwvUII
|
27
|
+
Vog4cGmzxssqK5q9kuogcuyeOuFODjBNW4qt0WylSi9bwwy3ZwaZLRqhngz6+tCV
|
28
|
+
Jp45Gk881XiVe3aVU0l+4DmJJ9/5vwqjH5Vo/GJqFU6gzB+Zv/0plYeNkuE0Xo2z
|
29
|
+
ecdxnGKVPl42q44lvczjDw2KX0ahxQrfrbcl48//zR295u9POzCL97d6zpioI2NR
|
30
30
|
-----END RSA PRIVATE KEY-----
|