bundler 2.2.30 → 2.2.31
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/gem.rb +68 -7
- data/lib/bundler/cli.rb +3 -1
- data/lib/bundler/definition.rb +5 -4
- data/lib/bundler/lockfile_parser.rb +1 -0
- data/lib/bundler/man/bundle-add.1 +1 -1
- data/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/lib/bundler/man/bundle-cache.1 +1 -1
- data/lib/bundler/man/bundle-check.1 +1 -1
- data/lib/bundler/man/bundle-clean.1 +1 -1
- data/lib/bundler/man/bundle-config.1 +3 -3
- data/lib/bundler/man/bundle-config.1.ronn +2 -2
- data/lib/bundler/man/bundle-doctor.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +1 -1
- data/lib/bundler/man/bundle-gem.1 +14 -1
- data/lib/bundler/man/bundle-gem.1.ronn +16 -0
- data/lib/bundler/man/bundle-info.1 +1 -1
- data/lib/bundler/man/bundle-init.1 +1 -1
- data/lib/bundler/man/bundle-inject.1 +1 -1
- data/lib/bundler/man/bundle-install.1 +1 -1
- data/lib/bundler/man/bundle-list.1 +1 -1
- data/lib/bundler/man/bundle-lock.1 +1 -1
- data/lib/bundler/man/bundle-open.1 +1 -1
- data/lib/bundler/man/bundle-outdated.1 +1 -1
- data/lib/bundler/man/bundle-platform.1 +1 -1
- data/lib/bundler/man/bundle-pristine.1 +1 -1
- data/lib/bundler/man/bundle-remove.1 +1 -1
- data/lib/bundler/man/bundle-show.1 +1 -1
- data/lib/bundler/man/bundle-update.1 +1 -1
- data/lib/bundler/man/bundle-viz.1 +1 -1
- data/lib/bundler/man/bundle.1 +1 -1
- data/lib/bundler/man/gemfile.5 +1 -1
- data/lib/bundler/runtime.rb +1 -1
- data/lib/bundler/source/git/git_proxy.rb +5 -2
- data/lib/bundler/source/rubygems.rb +1 -1
- data/lib/bundler/spec_set.rb +1 -1
- data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
- data/lib/bundler/templates/newgem/Rakefile.tt +5 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +12 -12
- data/lib/bundler/templates/newgem/standard.yml.tt +4 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f37ed81265b4005a7aa68cf2ed66ccae92c7b53298d15f7881e88703666ffee5
|
4
|
+
data.tar.gz: 9f18b35034d82ae88c044595ea977e194cc815ce248e95ae7d5ae0cf0f66704b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 800285d9a12c9d99c01f3418128f4913a96e7e739f9f4fc054c58014eca019d39b9fc3a15455f685db3a0510a523a8c2defa8d0df888ca30a7603e04910bae5f
|
7
|
+
data.tar.gz: 2407199f530007e4cd4eac12b339438074d9ac327a4aef3b96b7fc62e33abaed79da79e5b0d7b2604b6f58857097026c926635a083c2e830cec1ab67f7c97ca0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
# 2.2.31 (November 8, 2021)
|
2
|
+
|
3
|
+
## Enhancements:
|
4
|
+
|
5
|
+
- Link to working `bundler-graph` plugin in `bundle viz` deprecation message [#5061](https://github.com/rubygems/rubygems/pull/5061)
|
6
|
+
- Memoize materialized specs when requiring `bundler/setup` [#5033](https://github.com/rubygems/rubygems/pull/5033)
|
7
|
+
- Allow custom LicenseRef [#5013](https://github.com/rubygems/rubygems/pull/5013)
|
8
|
+
- Better error when installing a lockfile with git sources and git is not installed [#5036](https://github.com/rubygems/rubygems/pull/5036)
|
9
|
+
- Only delete cached gem when it's corrupted [#5031](https://github.com/rubygems/rubygems/pull/5031)
|
10
|
+
- Support gemified `tsort` [#5032](https://github.com/rubygems/rubygems/pull/5032)
|
11
|
+
- Add standard option alongside rubocop to `bundle gem` [#4411](https://github.com/rubygems/rubygems/pull/4411)
|
12
|
+
|
13
|
+
## Bug fixes:
|
14
|
+
|
15
|
+
- Fix system man pages no longer working after bundler overrides `MANPATH` [#5039](https://github.com/rubygems/rubygems/pull/5039)
|
16
|
+
- Don't warn when a lockfile is locked to a dev version [#5018](https://github.com/rubygems/rubygems/pull/5018)
|
17
|
+
|
1
18
|
# 2.2.30 (October 26, 2021)
|
2
19
|
|
3
20
|
## Enhancements:
|
@@ -4,8 +4,8 @@ module Bundler
|
|
4
4
|
# Represents metadata from when the Bundler gem was built.
|
5
5
|
module BuildMetadata
|
6
6
|
# begin ivars
|
7
|
-
@built_at = "2021-
|
8
|
-
@git_commit_sha = "
|
7
|
+
@built_at = "2021-11-08".freeze
|
8
|
+
@git_commit_sha = "2505ef8972".freeze
|
9
9
|
@release = true
|
10
10
|
# end ivars
|
11
11
|
|
data/lib/bundler/cli/gem.rb
CHANGED
@@ -163,15 +163,16 @@ module Bundler
|
|
163
163
|
templates.merge!("CHANGELOG.md.tt" => "CHANGELOG.md")
|
164
164
|
end
|
165
165
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
"and the Ruby Style Guides (https://github.com/rubocop-hq/ruby-style-guide).")
|
171
|
-
config[:rubocop] = true
|
172
|
-
config[:rubocop_version] = rubocop_version
|
166
|
+
config[:linter] = ask_and_set_linter
|
167
|
+
case config[:linter]
|
168
|
+
when "rubocop"
|
169
|
+
config[:linter_version] = rubocop_version
|
173
170
|
Bundler.ui.info "RuboCop enabled in config"
|
174
171
|
templates.merge!("rubocop.yml.tt" => ".rubocop.yml")
|
172
|
+
when "standard"
|
173
|
+
config[:linter_version] = standard_version
|
174
|
+
Bundler.ui.info "Standard enabled in config"
|
175
|
+
templates.merge!("standard.yml.tt" => ".standard.yml")
|
175
176
|
end
|
176
177
|
|
177
178
|
templates.merge!("exe/newgem.tt" => "exe/#{name}") if config[:exe]
|
@@ -317,6 +318,58 @@ module Bundler
|
|
317
318
|
ci_template
|
318
319
|
end
|
319
320
|
|
321
|
+
def ask_and_set_linter
|
322
|
+
linter_template = options[:linter] || Bundler.settings["gem.linter"]
|
323
|
+
linter_template = deprecated_rubocop_option if linter_template.nil?
|
324
|
+
|
325
|
+
if linter_template.to_s.empty?
|
326
|
+
Bundler.ui.confirm "Do you want to add a code linter and formatter to your gem? " \
|
327
|
+
"Supported Linters:\n" \
|
328
|
+
"* RuboCop: https://rubocop.org\n" \
|
329
|
+
"* Standard: https://github.com/testdouble/standard\n" \
|
330
|
+
"\n"
|
331
|
+
Bundler.ui.info hint_text("linter")
|
332
|
+
|
333
|
+
result = Bundler.ui.ask "Enter a linter. rubocop/standard/(none):"
|
334
|
+
if result =~ /rubocop|standard/
|
335
|
+
linter_template = result
|
336
|
+
else
|
337
|
+
linter_template = false
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
if Bundler.settings["gem.linter"].nil?
|
342
|
+
Bundler.settings.set_global("gem.linter", linter_template)
|
343
|
+
end
|
344
|
+
|
345
|
+
# Once gem.linter safely set, unset the deprecated gem.rubocop
|
346
|
+
unless Bundler.settings["gem.rubocop"].nil?
|
347
|
+
Bundler.settings.set_global("gem.rubocop", nil)
|
348
|
+
end
|
349
|
+
|
350
|
+
if options[:linter] == Bundler.settings["gem.linter"]
|
351
|
+
Bundler.ui.info "#{options[:linter]} is already configured, ignoring --linter flag."
|
352
|
+
end
|
353
|
+
|
354
|
+
linter_template
|
355
|
+
end
|
356
|
+
|
357
|
+
def deprecated_rubocop_option
|
358
|
+
if !options[:rubocop].nil?
|
359
|
+
if options[:rubocop]
|
360
|
+
Bundler::SharedHelpers.major_deprecation 2, "--rubocop is deprecated, use --linter=rubocop"
|
361
|
+
"rubocop"
|
362
|
+
else
|
363
|
+
Bundler::SharedHelpers.major_deprecation 2, "--no-rubocop is deprecated, use --linter"
|
364
|
+
false
|
365
|
+
end
|
366
|
+
elsif !Bundler.settings["gem.rubocop"].nil?
|
367
|
+
Bundler::SharedHelpers.major_deprecation 2,
|
368
|
+
"config gem.rubocop is deprecated; we've updated your config to use gem.linter instead"
|
369
|
+
Bundler.settings["gem.rubocop"] ? "rubocop" : false
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
320
373
|
def bundler_dependency_version
|
321
374
|
v = Gem::Version.new(Bundler::VERSION)
|
322
375
|
req = v.segments[0..1]
|
@@ -367,5 +420,13 @@ module Bundler
|
|
367
420
|
"1.21"
|
368
421
|
end
|
369
422
|
end
|
423
|
+
|
424
|
+
def standard_version
|
425
|
+
if Gem.ruby_version < Gem::Version.new("2.4.a") then "0.2.5"
|
426
|
+
elsif Gem.ruby_version < Gem::Version.new("2.5.a") then "1.0"
|
427
|
+
else
|
428
|
+
"1.3"
|
429
|
+
end
|
430
|
+
end
|
370
431
|
end
|
371
432
|
end
|
data/lib/bundler/cli.rb
CHANGED
@@ -552,7 +552,7 @@ module Bundler
|
|
552
552
|
method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
|
553
553
|
method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
|
554
554
|
def viz
|
555
|
-
SharedHelpers.major_deprecation 2, "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/
|
555
|
+
SharedHelpers.major_deprecation 2, "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/rubygems/bundler-graph"
|
556
556
|
require_relative "cli/viz"
|
557
557
|
Viz.new(options.dup).run
|
558
558
|
end
|
@@ -575,6 +575,8 @@ module Bundler
|
|
575
575
|
:desc => "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`."
|
576
576
|
method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "",
|
577
577
|
:desc => "Generate CI configuration, either GitHub Actions, Travis CI, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|travis|gitlab|circle)`"
|
578
|
+
method_option :linter, :type => :string, :lazy_default => Bundler.settings["gem.linter"] || "",
|
579
|
+
:desc => "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
|
578
580
|
method_option :github_username, :type => :string, :default => Bundler.settings["gem.github_username"], :banner => "Set your username on GitHub", :desc => "Fill in GitHub username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem.github_username <your_username>`."
|
579
581
|
|
580
582
|
def gem(name)
|
data/lib/bundler/definition.rb
CHANGED
@@ -138,7 +138,7 @@ module Bundler
|
|
138
138
|
@dependency_changes = converge_dependencies
|
139
139
|
@local_changes = converge_locals
|
140
140
|
|
141
|
-
@locked_specs_incomplete_for_platform = !@locked_specs.for(
|
141
|
+
@locked_specs_incomplete_for_platform = !@locked_specs.for(requested_dependencies & expand_dependencies(locked_dependencies), true, true)
|
142
142
|
|
143
143
|
@requires = compute_requires
|
144
144
|
end
|
@@ -234,16 +234,17 @@ module Bundler
|
|
234
234
|
end
|
235
235
|
|
236
236
|
def specs_for(groups)
|
237
|
-
|
237
|
+
return specs if groups.empty?
|
238
238
|
deps = dependencies_for(groups)
|
239
|
-
materialize(
|
239
|
+
materialize(deps)
|
240
240
|
end
|
241
241
|
|
242
242
|
def dependencies_for(groups)
|
243
243
|
groups.map!(&:to_sym)
|
244
|
-
current_dependencies.reject do |d|
|
244
|
+
deps = current_dependencies.reject do |d|
|
245
245
|
(d.groups & groups).empty?
|
246
246
|
end
|
247
|
+
expand_dependencies(deps)
|
247
248
|
end
|
248
249
|
|
249
250
|
# Resolve all the dependencies specified in Gemfile. It ensures that
|
@@ -86,6 +86,7 @@ module Bundler
|
|
86
86
|
|
87
87
|
def warn_for_outdated_bundler_version
|
88
88
|
return unless bundler_version
|
89
|
+
return if bundler_version.segments.last == "dev"
|
89
90
|
prerelease_text = bundler_version.prerelease? ? " --pre" : ""
|
90
91
|
current_version = Gem::Version.create(Bundler::VERSION)
|
91
92
|
return unless current_version < bundler_version
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-BINSTUBS" "1" "
|
4
|
+
.TH "BUNDLE\-BINSTUBS" "1" "November 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-CACHE" "1" "
|
4
|
+
.TH "BUNDLE\-CACHE" "1" "November 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-CHECK" "1" "
|
4
|
+
.TH "BUNDLE\-CHECK" "1" "November 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-CONFIG" "1" "
|
4
|
+
.TH "BUNDLE\-CONFIG" "1" "November 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-config\fR \- Set bundler configuration options
|
@@ -462,13 +462,13 @@ export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x\-oauth\-basic
|
|
462
462
|
.IP "" 0
|
463
463
|
.
|
464
464
|
.P
|
465
|
-
Note that any configured credentials will be redacted by informative commands such as \fBbundle config list\fR or \fBbundle config get\fR, unless you use the \fB\-\-parseable\fR flag\. This is to avoid
|
465
|
+
Note that any configured credentials will be redacted by informative commands such as \fBbundle config list\fR or \fBbundle config get\fR, unless you use the \fB\-\-parseable\fR flag\. This is to avoid unintentionally leaking credentials when copy\-pasting bundler output\.
|
466
466
|
.
|
467
467
|
.P
|
468
468
|
Also note that to guarantee a sane mapping between valid environment variable names and valid host names, bundler makes the following transformations:
|
469
469
|
.
|
470
470
|
.IP "\(bu" 4
|
471
|
-
Any \fB\-\fR characters in a host name are mapped to a triple dash (\fB___\fR) in the corresponding
|
471
|
+
Any \fB\-\fR characters in a host name are mapped to a triple dash (\fB___\fR) in the corresponding environment variable\.
|
472
472
|
.
|
473
473
|
.IP "\(bu" 4
|
474
474
|
Any \fB\.\fR characters in a host name are mapped to a double dash (\fB__\fR) in the corresponding environment variable\.
|
@@ -367,14 +367,14 @@ where you can use personal OAuth tokens:
|
|
367
367
|
|
368
368
|
Note that any configured credentials will be redacted by informative commands
|
369
369
|
such as `bundle config list` or `bundle config get`, unless you use the
|
370
|
-
`--parseable` flag. This is to avoid
|
370
|
+
`--parseable` flag. This is to avoid unintentionally leaking credentials when
|
371
371
|
copy-pasting bundler output.
|
372
372
|
|
373
373
|
Also note that to guarantee a sane mapping between valid environment variable
|
374
374
|
names and valid host names, bundler makes the following transformations:
|
375
375
|
|
376
376
|
* Any `-` characters in a host name are mapped to a triple dash (`___`) in the
|
377
|
-
corresponding
|
377
|
+
corresponding environment variable.
|
378
378
|
|
379
379
|
* Any `.` characters in a host name are mapped to a double dash (`__`) in the
|
380
380
|
corresponding environment variable.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-GEM" "1" "
|
4
|
+
.TH "BUNDLE\-GEM" "1" "November 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem
|
@@ -90,6 +90,19 @@ When Bundler is configured to not generate CI files, an interactive prompt will
|
|
90
90
|
When Bundler is unconfigured, an interactive prompt will be displayed and the answer will be saved in Bundler\'s global config for future \fBbundle gem\fR use\.
|
91
91
|
.
|
92
92
|
.TP
|
93
|
+
\fB\-\-linter\fR, \fB\-\-linter=rubocop\fR, \fB\-\-linter=standard\fR
|
94
|
+
Specify the linter and code formatter that Bundler should add to the project\'s development dependencies\. Acceptable values are \fBrubocop\fR and \fBstandard\fR\. A configuration file will be generated in the project directory\. Given no option is specified:
|
95
|
+
.
|
96
|
+
.IP
|
97
|
+
When Bundler is configured to add a linter, this defaults to Bundler\'s global config setting \fBgem\.linter\fR\.
|
98
|
+
.
|
99
|
+
.IP
|
100
|
+
When Bundler is configured not to add a linter, an interactive prompt will be displayed and the answer will be used for the current rubygem project\.
|
101
|
+
.
|
102
|
+
.IP
|
103
|
+
When Bundler is unconfigured, an interactive prompt will be displayed and the answer will be saved in Bundler\'s global config for future \fBbundle gem\fR use\.
|
104
|
+
.
|
105
|
+
.TP
|
93
106
|
\fB\-e\fR, \fB\-\-edit[=EDITOR]\fR
|
94
107
|
Open the resulting GEM_NAME\.gemspec in EDITOR, or the default editor if not specified\. The default is \fB$BUNDLER_EDITOR\fR, \fB$VISUAL\fR, or \fB$EDITOR\fR\.
|
95
108
|
.
|
@@ -92,6 +92,22 @@ configuration file using the following names:
|
|
92
92
|
the answer will be saved in Bundler's global config for future `bundle gem`
|
93
93
|
use.
|
94
94
|
|
95
|
+
* `--linter`, `--linter=rubocop`, `--linter=standard`:
|
96
|
+
Specify the linter and code formatter that Bundler should add to the
|
97
|
+
project's development dependencies. Acceptable values are `rubocop` and
|
98
|
+
`standard`. A configuration file will be generated in the project directory.
|
99
|
+
Given no option is specified:
|
100
|
+
|
101
|
+
When Bundler is configured to add a linter, this defaults to Bundler's
|
102
|
+
global config setting `gem.linter`.
|
103
|
+
|
104
|
+
When Bundler is configured not to add a linter, an interactive prompt
|
105
|
+
will be displayed and the answer will be used for the current rubygem project.
|
106
|
+
|
107
|
+
When Bundler is unconfigured, an interactive prompt will be displayed and
|
108
|
+
the answer will be saved in Bundler's global config for future `bundle gem`
|
109
|
+
use.
|
110
|
+
|
95
111
|
* `-e`, `--edit[=EDITOR]`:
|
96
112
|
Open the resulting GEM_NAME.gemspec in EDITOR, or the default editor if not
|
97
113
|
specified. The default is `$BUNDLER_EDITOR`, `$VISUAL`, or `$EDITOR`.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-INIT" "1" "
|
4
|
+
.TH "BUNDLE\-INIT" "1" "November 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-init\fR \- Generates a Gemfile into the current working directory
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-INJECT" "1" "
|
4
|
+
.TH "BUNDLE\-INJECT" "1" "November 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-INSTALL" "1" "
|
4
|
+
.TH "BUNDLE\-INSTALL" "1" "November 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-install\fR \- Install the dependencies specified in your Gemfile
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-OPEN" "1" "
|
4
|
+
.TH "BUNDLE\-OPEN" "1" "November 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-open\fR \- Opens the source directory for a gem in your bundle
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-OUTDATED" "1" "
|
4
|
+
.TH "BUNDLE\-OUTDATED" "1" "November 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-outdated\fR \- List installed gems with newer versions available
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-PLATFORM" "1" "
|
4
|
+
.TH "BUNDLE\-PLATFORM" "1" "November 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-platform\fR \- Displays platform compatibility information
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-PRISTINE" "1" "
|
4
|
+
.TH "BUNDLE\-PRISTINE" "1" "November 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-pristine\fR \- Restores installed gems to their pristine condition
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-SHOW" "1" "
|
4
|
+
.TH "BUNDLE\-SHOW" "1" "November 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "BUNDLE\-UPDATE" "1" "
|
4
|
+
.TH "BUNDLE\-UPDATE" "1" "November 2021" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBbundle\-update\fR \- Update your gems to the latest available versions
|
data/lib/bundler/man/bundle.1
CHANGED
data/lib/bundler/man/gemfile.5
CHANGED
data/lib/bundler/runtime.rb
CHANGED
@@ -265,7 +265,7 @@ module Bundler
|
|
265
265
|
|
266
266
|
return if manuals.empty?
|
267
267
|
Bundler::SharedHelpers.set_env "MANPATH", manuals.concat(
|
268
|
-
ENV["MANPATH"].to_s.split(File::PATH_SEPARATOR)
|
268
|
+
ENV["MANPATH"] ? ENV["MANPATH"].to_s.split(File::PATH_SEPARATOR) : [""]
|
269
269
|
).uniq.join(File::PATH_SEPARATOR)
|
270
270
|
end
|
271
271
|
|
@@ -56,7 +56,6 @@ module Bundler
|
|
56
56
|
@ref = ref
|
57
57
|
@revision = revision
|
58
58
|
@git = git
|
59
|
-
raise GitNotInstalledError.new if allow? && !Bundler.git_present?
|
60
59
|
end
|
61
60
|
|
62
61
|
def revision
|
@@ -208,7 +207,11 @@ module Bundler
|
|
208
207
|
end
|
209
208
|
|
210
209
|
def allow?
|
211
|
-
@git ? @git.allow_git_ops? : true
|
210
|
+
allowed = @git ? @git.allow_git_ops? : true
|
211
|
+
|
212
|
+
raise GitNotInstalledError.new if allowed && !Bundler.git_present?
|
213
|
+
|
214
|
+
allowed
|
212
215
|
end
|
213
216
|
|
214
217
|
def with_path(&blk)
|
data/lib/bundler/spec_set.rb
CHANGED
@@ -14,7 +14,10 @@ gem "rake-compiler"
|
|
14
14
|
|
15
15
|
gem "<%= config[:test] %>", "~> <%= config[:test_framework_version] %>"
|
16
16
|
<%- end -%>
|
17
|
-
<%- if config[:
|
17
|
+
<%- if config[:linter] == "rubocop" -%>
|
18
18
|
|
19
|
-
gem "rubocop", "~> <%= config[:
|
19
|
+
gem "rubocop", "~> <%= config[:linter_version] %>"
|
20
|
+
<%- elsif config[:linter] == "standard" -%>
|
21
|
+
|
22
|
+
gem "standard", "~> <%= config[:linter_version] %>"
|
20
23
|
<%- end -%>
|
@@ -18,12 +18,16 @@ require "rspec/core/rake_task"
|
|
18
18
|
RSpec::Core::RakeTask.new(:spec)
|
19
19
|
|
20
20
|
<% end -%>
|
21
|
-
<% if config[:
|
21
|
+
<% if config[:linter] == "rubocop" -%>
|
22
22
|
<% default_task_names << :rubocop -%>
|
23
23
|
require "rubocop/rake_task"
|
24
24
|
|
25
25
|
RuboCop::RakeTask.new
|
26
26
|
|
27
|
+
<% elsif config[:linter] == "standard" -%>
|
28
|
+
<% default_task_names << :standard -%>
|
29
|
+
require "standard/rake"
|
30
|
+
|
27
31
|
<% end -%>
|
28
32
|
<% if config[:ext] -%>
|
29
33
|
<% default_task_names.unshift(:clobber, :compile) -%>
|
@@ -3,16 +3,16 @@
|
|
3
3
|
require_relative "lib/<%=config[:namespaced_path]%>/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
7
|
-
spec.version
|
8
|
-
spec.authors
|
9
|
-
spec.email
|
10
|
-
|
11
|
-
spec.summary
|
12
|
-
spec.description
|
13
|
-
spec.homepage
|
6
|
+
spec.name = <%= config[:name].inspect %>
|
7
|
+
spec.version = <%= config[:constant_name] %>::VERSION
|
8
|
+
spec.authors = [<%= config[:author].inspect %>]
|
9
|
+
spec.email = [<%= config[:email].inspect %>]
|
10
|
+
|
11
|
+
spec.summary = "TODO: Write a short summary, because RubyGems requires one."
|
12
|
+
spec.description = "TODO: Write a longer description or delete this line."
|
13
|
+
spec.homepage = "TODO: Put your gem's website or public repo URL here."
|
14
14
|
<%- if config[:mit] -%>
|
15
|
-
spec.license
|
15
|
+
spec.license = "MIT"
|
16
16
|
<%- end -%>
|
17
17
|
spec.required_ruby_version = ">= <%= config[:required_ruby_version] %>"
|
18
18
|
|
@@ -29,11 +29,11 @@ Gem::Specification.new do |spec|
|
|
29
29
|
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
30
30
|
end
|
31
31
|
end
|
32
|
-
spec.bindir
|
33
|
-
spec.executables
|
32
|
+
spec.bindir = "exe"
|
33
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
34
34
|
spec.require_paths = ["lib"]
|
35
35
|
<%- if config[:ext] -%>
|
36
|
-
spec.extensions
|
36
|
+
spec.extensions = ["ext/<%= config[:underscored_name] %>/extconf.rb"]
|
37
37
|
<%- end -%>
|
38
38
|
|
39
39
|
# Uncomment to register a new dependency of your gem
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative '../../../../vendored_tsort'
|
4
4
|
|
5
5
|
require_relative 'dependency_graph/log'
|
6
6
|
require_relative 'dependency_graph/vertex'
|
@@ -17,7 +17,7 @@ module Bundler::Molinillo
|
|
17
17
|
vertices.values.each { |v| yield v }
|
18
18
|
end
|
19
19
|
|
20
|
-
include TSort
|
20
|
+
include Bundler::TSort
|
21
21
|
|
22
22
|
# @!visibility private
|
23
23
|
alias tsort_each_node each
|
@@ -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,453 @@
|
|
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
|
+
# TSort implements topological sorting using Tarjan's algorithm for
|
10
|
+
# strongly connected components.
|
11
|
+
#
|
12
|
+
# TSort is designed to be able to be used with any object which can be
|
13
|
+
# interpreted as a directed graph.
|
14
|
+
#
|
15
|
+
# 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
|
+
# TSort uses Hash internally.
|
23
|
+
#
|
24
|
+
# == A Simple Example
|
25
|
+
#
|
26
|
+
# The following example demonstrates how to mix the 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 'tsort'
|
36
|
+
#
|
37
|
+
# class Hash
|
38
|
+
# include 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 '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 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 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
|
+
module Bundler
|
124
|
+
module TSort
|
125
|
+
class Cyclic < StandardError
|
126
|
+
end
|
127
|
+
|
128
|
+
# Returns a topologically sorted array of nodes.
|
129
|
+
# The array is sorted from children to parents, i.e.
|
130
|
+
# the first element has no child and the last node has no parent.
|
131
|
+
#
|
132
|
+
# If there is a cycle, TSort::Cyclic is raised.
|
133
|
+
#
|
134
|
+
# class G
|
135
|
+
# include TSort
|
136
|
+
# def initialize(g)
|
137
|
+
# @g = g
|
138
|
+
# end
|
139
|
+
# def tsort_each_child(n, &b) @g[n].each(&b) end
|
140
|
+
# def tsort_each_node(&b) @g.each_key(&b) end
|
141
|
+
# end
|
142
|
+
#
|
143
|
+
# graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
|
144
|
+
# p graph.tsort #=> [4, 2, 3, 1]
|
145
|
+
#
|
146
|
+
# graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
|
147
|
+
# p graph.tsort # raises TSort::Cyclic
|
148
|
+
#
|
149
|
+
def tsort
|
150
|
+
each_node = method(:tsort_each_node)
|
151
|
+
each_child = method(:tsort_each_child)
|
152
|
+
TSort.tsort(each_node, each_child)
|
153
|
+
end
|
154
|
+
|
155
|
+
# Returns a topologically sorted array of nodes.
|
156
|
+
# The array is sorted from children to parents, i.e.
|
157
|
+
# the first element has no child and the last node has no parent.
|
158
|
+
#
|
159
|
+
# The graph is represented by _each_node_ and _each_child_.
|
160
|
+
# _each_node_ should have +call+ method which yields for each node in the graph.
|
161
|
+
# _each_child_ should have +call+ method which takes a node argument and yields for each child node.
|
162
|
+
#
|
163
|
+
# If there is a cycle, TSort::Cyclic is raised.
|
164
|
+
#
|
165
|
+
# g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
|
166
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
167
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
168
|
+
# p TSort.tsort(each_node, each_child) #=> [4, 2, 3, 1]
|
169
|
+
#
|
170
|
+
# g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
|
171
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
172
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
173
|
+
# p TSort.tsort(each_node, each_child) # raises TSort::Cyclic
|
174
|
+
#
|
175
|
+
def TSort.tsort(each_node, each_child)
|
176
|
+
TSort.tsort_each(each_node, each_child).to_a
|
177
|
+
end
|
178
|
+
|
179
|
+
# The iterator version of the #tsort method.
|
180
|
+
# <tt><em>obj</em>.tsort_each</tt> is similar to <tt><em>obj</em>.tsort.each</tt>, but
|
181
|
+
# modification of _obj_ during the iteration may lead to unexpected results.
|
182
|
+
#
|
183
|
+
# #tsort_each returns +nil+.
|
184
|
+
# If there is a cycle, TSort::Cyclic is raised.
|
185
|
+
#
|
186
|
+
# class G
|
187
|
+
# include TSort
|
188
|
+
# def initialize(g)
|
189
|
+
# @g = g
|
190
|
+
# end
|
191
|
+
# def tsort_each_child(n, &b) @g[n].each(&b) end
|
192
|
+
# def tsort_each_node(&b) @g.each_key(&b) end
|
193
|
+
# end
|
194
|
+
#
|
195
|
+
# graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
|
196
|
+
# graph.tsort_each {|n| p n }
|
197
|
+
# #=> 4
|
198
|
+
# # 2
|
199
|
+
# # 3
|
200
|
+
# # 1
|
201
|
+
#
|
202
|
+
def tsort_each(&block) # :yields: node
|
203
|
+
each_node = method(:tsort_each_node)
|
204
|
+
each_child = method(:tsort_each_child)
|
205
|
+
TSort.tsort_each(each_node, each_child, &block)
|
206
|
+
end
|
207
|
+
|
208
|
+
# The iterator version of the TSort.tsort method.
|
209
|
+
#
|
210
|
+
# The graph is represented by _each_node_ and _each_child_.
|
211
|
+
# _each_node_ should have +call+ method which yields for each node in the graph.
|
212
|
+
# _each_child_ should have +call+ method which takes a node argument and yields for each child node.
|
213
|
+
#
|
214
|
+
# g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
|
215
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
216
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
217
|
+
# TSort.tsort_each(each_node, each_child) {|n| p n }
|
218
|
+
# #=> 4
|
219
|
+
# # 2
|
220
|
+
# # 3
|
221
|
+
# # 1
|
222
|
+
#
|
223
|
+
def TSort.tsort_each(each_node, each_child) # :yields: node
|
224
|
+
return to_enum(__method__, each_node, each_child) unless block_given?
|
225
|
+
|
226
|
+
TSort.each_strongly_connected_component(each_node, each_child) {|component|
|
227
|
+
if component.size == 1
|
228
|
+
yield component.first
|
229
|
+
else
|
230
|
+
raise Cyclic.new("topological sort failed: #{component.inspect}")
|
231
|
+
end
|
232
|
+
}
|
233
|
+
end
|
234
|
+
|
235
|
+
# Returns strongly connected components as an array of arrays of nodes.
|
236
|
+
# The array is sorted from children to parents.
|
237
|
+
# Each elements of the array represents a strongly connected component.
|
238
|
+
#
|
239
|
+
# class G
|
240
|
+
# include TSort
|
241
|
+
# def initialize(g)
|
242
|
+
# @g = g
|
243
|
+
# end
|
244
|
+
# def tsort_each_child(n, &b) @g[n].each(&b) end
|
245
|
+
# def tsort_each_node(&b) @g.each_key(&b) end
|
246
|
+
# end
|
247
|
+
#
|
248
|
+
# graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
|
249
|
+
# p graph.strongly_connected_components #=> [[4], [2], [3], [1]]
|
250
|
+
#
|
251
|
+
# graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
|
252
|
+
# p graph.strongly_connected_components #=> [[4], [2, 3], [1]]
|
253
|
+
#
|
254
|
+
def strongly_connected_components
|
255
|
+
each_node = method(:tsort_each_node)
|
256
|
+
each_child = method(:tsort_each_child)
|
257
|
+
TSort.strongly_connected_components(each_node, each_child)
|
258
|
+
end
|
259
|
+
|
260
|
+
# Returns strongly connected components as an array of arrays of nodes.
|
261
|
+
# The array is sorted from children to parents.
|
262
|
+
# Each elements of the array represents a strongly connected component.
|
263
|
+
#
|
264
|
+
# The graph is represented by _each_node_ and _each_child_.
|
265
|
+
# _each_node_ should have +call+ method which yields for each node in the graph.
|
266
|
+
# _each_child_ should have +call+ method which takes a node argument and yields for each child node.
|
267
|
+
#
|
268
|
+
# g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
|
269
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
270
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
271
|
+
# p TSort.strongly_connected_components(each_node, each_child)
|
272
|
+
# #=> [[4], [2], [3], [1]]
|
273
|
+
#
|
274
|
+
# g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
|
275
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
276
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
277
|
+
# p TSort.strongly_connected_components(each_node, each_child)
|
278
|
+
# #=> [[4], [2, 3], [1]]
|
279
|
+
#
|
280
|
+
def TSort.strongly_connected_components(each_node, each_child)
|
281
|
+
TSort.each_strongly_connected_component(each_node, each_child).to_a
|
282
|
+
end
|
283
|
+
|
284
|
+
# The iterator version of the #strongly_connected_components method.
|
285
|
+
# <tt><em>obj</em>.each_strongly_connected_component</tt> is similar to
|
286
|
+
# <tt><em>obj</em>.strongly_connected_components.each</tt>, but
|
287
|
+
# modification of _obj_ during the iteration may lead to unexpected results.
|
288
|
+
#
|
289
|
+
# #each_strongly_connected_component returns +nil+.
|
290
|
+
#
|
291
|
+
# class G
|
292
|
+
# include TSort
|
293
|
+
# def initialize(g)
|
294
|
+
# @g = g
|
295
|
+
# end
|
296
|
+
# def tsort_each_child(n, &b) @g[n].each(&b) end
|
297
|
+
# def tsort_each_node(&b) @g.each_key(&b) end
|
298
|
+
# end
|
299
|
+
#
|
300
|
+
# graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
|
301
|
+
# graph.each_strongly_connected_component {|scc| p scc }
|
302
|
+
# #=> [4]
|
303
|
+
# # [2]
|
304
|
+
# # [3]
|
305
|
+
# # [1]
|
306
|
+
#
|
307
|
+
# graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
|
308
|
+
# graph.each_strongly_connected_component {|scc| p scc }
|
309
|
+
# #=> [4]
|
310
|
+
# # [2, 3]
|
311
|
+
# # [1]
|
312
|
+
#
|
313
|
+
def each_strongly_connected_component(&block) # :yields: nodes
|
314
|
+
each_node = method(:tsort_each_node)
|
315
|
+
each_child = method(:tsort_each_child)
|
316
|
+
TSort.each_strongly_connected_component(each_node, each_child, &block)
|
317
|
+
end
|
318
|
+
|
319
|
+
# The iterator version of the TSort.strongly_connected_components method.
|
320
|
+
#
|
321
|
+
# The graph is represented by _each_node_ and _each_child_.
|
322
|
+
# _each_node_ should have +call+ method which yields for each node in the graph.
|
323
|
+
# _each_child_ should have +call+ method which takes a node argument and yields for each child node.
|
324
|
+
#
|
325
|
+
# g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
|
326
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
327
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
328
|
+
# TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
|
329
|
+
# #=> [4]
|
330
|
+
# # [2]
|
331
|
+
# # [3]
|
332
|
+
# # [1]
|
333
|
+
#
|
334
|
+
# g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
|
335
|
+
# each_node = lambda {|&b| g.each_key(&b) }
|
336
|
+
# each_child = lambda {|n, &b| g[n].each(&b) }
|
337
|
+
# TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
|
338
|
+
# #=> [4]
|
339
|
+
# # [2, 3]
|
340
|
+
# # [1]
|
341
|
+
#
|
342
|
+
def TSort.each_strongly_connected_component(each_node, each_child) # :yields: nodes
|
343
|
+
return to_enum(__method__, each_node, each_child) unless block_given?
|
344
|
+
|
345
|
+
id_map = {}
|
346
|
+
stack = []
|
347
|
+
each_node.call {|node|
|
348
|
+
unless id_map.include? node
|
349
|
+
TSort.each_strongly_connected_component_from(node, each_child, id_map, stack) {|c|
|
350
|
+
yield c
|
351
|
+
}
|
352
|
+
end
|
353
|
+
}
|
354
|
+
nil
|
355
|
+
end
|
356
|
+
|
357
|
+
# Iterates over strongly connected component in the subgraph reachable from
|
358
|
+
# _node_.
|
359
|
+
#
|
360
|
+
# Return value is unspecified.
|
361
|
+
#
|
362
|
+
# #each_strongly_connected_component_from doesn't call #tsort_each_node.
|
363
|
+
#
|
364
|
+
# class G
|
365
|
+
# include TSort
|
366
|
+
# def initialize(g)
|
367
|
+
# @g = g
|
368
|
+
# end
|
369
|
+
# def tsort_each_child(n, &b) @g[n].each(&b) end
|
370
|
+
# def tsort_each_node(&b) @g.each_key(&b) end
|
371
|
+
# end
|
372
|
+
#
|
373
|
+
# graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
|
374
|
+
# graph.each_strongly_connected_component_from(2) {|scc| p scc }
|
375
|
+
# #=> [4]
|
376
|
+
# # [2]
|
377
|
+
#
|
378
|
+
# graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
|
379
|
+
# graph.each_strongly_connected_component_from(2) {|scc| p scc }
|
380
|
+
# #=> [4]
|
381
|
+
# # [2, 3]
|
382
|
+
#
|
383
|
+
def each_strongly_connected_component_from(node, id_map={}, stack=[], &block) # :yields: nodes
|
384
|
+
TSort.each_strongly_connected_component_from(node, method(:tsort_each_child), id_map, stack, &block)
|
385
|
+
end
|
386
|
+
|
387
|
+
# Iterates over strongly connected components in a graph.
|
388
|
+
# The graph is represented by _node_ and _each_child_.
|
389
|
+
#
|
390
|
+
# _node_ is the first node.
|
391
|
+
# _each_child_ should have +call+ method which takes a node argument
|
392
|
+
# and yields for each child node.
|
393
|
+
#
|
394
|
+
# Return value is unspecified.
|
395
|
+
#
|
396
|
+
# #TSort.each_strongly_connected_component_from is a class method and
|
397
|
+
# it doesn't need a class to represent a graph which includes TSort.
|
398
|
+
#
|
399
|
+
# graph = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
|
400
|
+
# each_child = lambda {|n, &b| graph[n].each(&b) }
|
401
|
+
# TSort.each_strongly_connected_component_from(1, each_child) {|scc|
|
402
|
+
# p scc
|
403
|
+
# }
|
404
|
+
# #=> [4]
|
405
|
+
# # [2, 3]
|
406
|
+
# # [1]
|
407
|
+
#
|
408
|
+
def TSort.each_strongly_connected_component_from(node, each_child, id_map={}, stack=[]) # :yields: nodes
|
409
|
+
return to_enum(__method__, node, each_child, id_map, stack) unless block_given?
|
410
|
+
|
411
|
+
minimum_id = node_id = id_map[node] = id_map.size
|
412
|
+
stack_length = stack.length
|
413
|
+
stack << node
|
414
|
+
|
415
|
+
each_child.call(node) {|child|
|
416
|
+
if id_map.include? child
|
417
|
+
child_id = id_map[child]
|
418
|
+
minimum_id = child_id if child_id && child_id < minimum_id
|
419
|
+
else
|
420
|
+
sub_minimum_id =
|
421
|
+
TSort.each_strongly_connected_component_from(child, each_child, id_map, stack) {|c|
|
422
|
+
yield c
|
423
|
+
}
|
424
|
+
minimum_id = sub_minimum_id if sub_minimum_id < minimum_id
|
425
|
+
end
|
426
|
+
}
|
427
|
+
|
428
|
+
if node_id == minimum_id
|
429
|
+
component = stack.slice!(stack_length .. -1)
|
430
|
+
component.each {|n| id_map[n] = nil}
|
431
|
+
yield component
|
432
|
+
end
|
433
|
+
|
434
|
+
minimum_id
|
435
|
+
end
|
436
|
+
|
437
|
+
# Should be implemented by a extended class.
|
438
|
+
#
|
439
|
+
# #tsort_each_node is used to iterate for all nodes over a graph.
|
440
|
+
#
|
441
|
+
def tsort_each_node # :yields: node
|
442
|
+
raise NotImplementedError.new
|
443
|
+
end
|
444
|
+
|
445
|
+
# Should be implemented by a extended class.
|
446
|
+
#
|
447
|
+
# #tsort_each_child is used to iterate for child nodes of _node_.
|
448
|
+
#
|
449
|
+
def tsort_each_child(node) # :yields: child
|
450
|
+
raise NotImplementedError.new
|
451
|
+
end
|
452
|
+
end
|
453
|
+
end
|
data/lib/bundler/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- André Arko
|
@@ -22,7 +22,7 @@ authors:
|
|
22
22
|
autorequire:
|
23
23
|
bindir: exe
|
24
24
|
cert_chain: []
|
25
|
-
date: 2021-
|
25
|
+
date: 2021-11-08 00:00:00.000000000 Z
|
26
26
|
dependencies: []
|
27
27
|
description: Bundler manages an application's dependencies through its entire life,
|
28
28
|
across many machines, systematically and repeatably
|
@@ -237,6 +237,7 @@ files:
|
|
237
237
|
- lib/bundler/templates/newgem/rubocop.yml.tt
|
238
238
|
- lib/bundler/templates/newgem/spec/newgem_spec.rb.tt
|
239
239
|
- lib/bundler/templates/newgem/spec/spec_helper.rb.tt
|
240
|
+
- lib/bundler/templates/newgem/standard.yml.tt
|
240
241
|
- lib/bundler/templates/newgem/test/minitest/newgem_test.rb.tt
|
241
242
|
- lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt
|
242
243
|
- lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt
|
@@ -313,6 +314,8 @@ files:
|
|
313
314
|
- lib/bundler/vendor/thor/lib/thor/util.rb
|
314
315
|
- lib/bundler/vendor/thor/lib/thor/version.rb
|
315
316
|
- lib/bundler/vendor/tmpdir/lib/tmpdir.rb
|
317
|
+
- lib/bundler/vendor/tsort/LICENSE.txt
|
318
|
+
- lib/bundler/vendor/tsort/lib/tsort.rb
|
316
319
|
- lib/bundler/vendor/uri/LICENSE.txt
|
317
320
|
- lib/bundler/vendor/uri/lib/uri.rb
|
318
321
|
- lib/bundler/vendor/uri/lib/uri/common.rb
|
@@ -332,6 +335,7 @@ files:
|
|
332
335
|
- lib/bundler/vendored_persistent.rb
|
333
336
|
- lib/bundler/vendored_thor.rb
|
334
337
|
- lib/bundler/vendored_tmpdir.rb
|
338
|
+
- lib/bundler/vendored_tsort.rb
|
335
339
|
- lib/bundler/vendored_uri.rb
|
336
340
|
- lib/bundler/version.rb
|
337
341
|
- lib/bundler/version_ranges.rb
|
@@ -361,7 +365,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
361
365
|
- !ruby/object:Gem::Version
|
362
366
|
version: 2.5.2
|
363
367
|
requirements: []
|
364
|
-
rubygems_version: 3.2.
|
368
|
+
rubygems_version: 3.2.31
|
365
369
|
signing_key:
|
366
370
|
specification_version: 4
|
367
371
|
summary: The best way to manage your application's dependencies
|