bundler 2.7.1 → 4.0.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1001 -902
- data/README.md +4 -4
- data/bundler.gemspec +3 -3
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/capistrano.rb +1 -19
- data/lib/bundler/checksum.rb +6 -0
- data/lib/bundler/cli/cache.rb +1 -12
- data/lib/bundler/cli/common.rb +21 -4
- data/lib/bundler/cli/config.rb +1 -2
- data/lib/bundler/cli/console.rb +5 -0
- data/lib/bundler/cli/exec.rb +29 -4
- data/lib/bundler/cli/gem.rb +19 -33
- data/lib/bundler/cli/install.rb +7 -84
- data/lib/bundler/cli/issue.rb +2 -2
- data/lib/bundler/cli/list.rb +33 -2
- data/lib/bundler/cli/lock.rb +5 -5
- data/lib/bundler/cli/plugin.rb +5 -1
- data/lib/bundler/cli/show.rb +3 -7
- data/lib/bundler/cli/update.rb +3 -3
- data/lib/bundler/cli.rb +97 -95
- data/lib/bundler/compact_index_client.rb +0 -1
- data/lib/bundler/current_ruby.rb +3 -15
- data/lib/bundler/definition.rb +122 -95
- data/lib/bundler/deployment.rb +1 -64
- data/lib/bundler/digest.rb +1 -1
- data/lib/bundler/dsl.rb +14 -36
- data/lib/bundler/endpoint_specification.rb +0 -22
- data/lib/bundler/errors.rb +1 -5
- data/lib/bundler/feature_flag.rb +0 -33
- data/lib/bundler/fetcher/compact_index.rb +1 -1
- data/lib/bundler/friendly_errors.rb +2 -2
- data/lib/bundler/index.rb +0 -7
- data/lib/bundler/inline.rb +1 -1
- data/lib/bundler/installer/gem_installer.rb +0 -11
- data/lib/bundler/installer.rb +0 -6
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +2 -12
- data/lib/bundler/man/bundle-add.1 +1 -1
- data/lib/bundler/man/bundle-binstubs.1 +3 -6
- data/lib/bundler/man/bundle-binstubs.1.ronn +4 -6
- data/lib/bundler/man/bundle-cache.1 +2 -14
- data/lib/bundler/man/bundle-cache.1.ronn +1 -14
- data/lib/bundler/man/bundle-check.1 +2 -5
- data/lib/bundler/man/bundle-check.1.ronn +0 -5
- data/lib/bundler/man/bundle-clean.1 +1 -1
- data/lib/bundler/man/bundle-config.1 +36 -46
- data/lib/bundler/man/bundle-config.1.ronn +69 -75
- data/lib/bundler/man/bundle-console.1 +1 -1
- data/lib/bundler/man/bundle-doctor.1 +4 -4
- data/lib/bundler/man/bundle-doctor.1.ronn +4 -4
- data/lib/bundler/man/bundle-env.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +2 -5
- data/lib/bundler/man/bundle-exec.1.ronn +1 -5
- data/lib/bundler/man/bundle-fund.1 +1 -1
- data/lib/bundler/man/bundle-gem.1 +3 -6
- data/lib/bundler/man/bundle-gem.1.ronn +2 -5
- data/lib/bundler/man/bundle-help.1 +1 -1
- data/lib/bundler/man/bundle-info.1 +1 -1
- data/lib/bundler/man/bundle-init.1 +1 -1
- data/lib/bundler/man/bundle-install.1 +8 -59
- data/lib/bundler/man/bundle-install.1.ronn +12 -107
- data/lib/bundler/man/bundle-issue.1 +1 -1
- data/lib/bundler/man/bundle-licenses.1 +1 -1
- data/lib/bundler/man/bundle-list.1 +6 -1
- data/lib/bundler/man/bundle-list.1.ronn +5 -0
- 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-plugin.1 +33 -15
- data/lib/bundler/man/bundle-plugin.1.ronn +36 -15
- data/lib/bundler/man/bundle-pristine.1 +1 -1
- data/lib/bundler/man/bundle-remove.1 +2 -8
- data/lib/bundler/man/bundle-remove.1.ronn +1 -8
- data/lib/bundler/man/bundle-show.1 +2 -5
- data/lib/bundler/man/bundle-show.1.ronn +0 -4
- data/lib/bundler/man/bundle-update.1 +1 -1
- data/lib/bundler/man/bundle-version.1 +1 -1
- data/lib/bundler/man/bundle.1 +1 -10
- data/lib/bundler/man/bundle.1.ronn +0 -9
- data/lib/bundler/man/gemfile.5 +1 -1
- data/lib/bundler/man/index.txt +0 -2
- data/lib/bundler/materialization.rb +1 -1
- data/lib/bundler/plugin/installer.rb +0 -10
- data/lib/bundler/plugin/source_list.rb +1 -1
- data/lib/bundler/plugin.rb +1 -1
- data/lib/bundler/resolver/package.rb +1 -0
- data/lib/bundler/resolver.rb +1 -1
- data/lib/bundler/ruby_dsl.rb +2 -0
- data/lib/bundler/ruby_version.rb +1 -3
- data/lib/bundler/rubygems_ext.rb +1 -1
- data/lib/bundler/rubygems_gem_installer.rb +1 -1
- data/lib/bundler/rubygems_integration.rb +1 -5
- data/lib/bundler/self_manager.rb +1 -1
- data/lib/bundler/settings.rb +8 -27
- data/lib/bundler/shared_helpers.rb +8 -20
- data/lib/bundler/source/gemspec.rb +4 -0
- data/lib/bundler/source/git/git_proxy.rb +3 -11
- data/lib/bundler/source/git.rb +2 -3
- data/lib/bundler/source/path.rb +5 -7
- data/lib/bundler/source/rubygems.rb +11 -17
- data/lib/bundler/source.rb +1 -1
- data/lib/bundler/source_list.rb +4 -45
- data/lib/bundler/source_map.rb +2 -5
- data/lib/bundler/spec_set.rb +6 -15
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +7 -129
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
- data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
- data/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
- data/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +6 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +7 -4
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +26 -23
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +50 -6
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +57 -52
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +5 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +42 -6
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +3 -7
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/common.rb +57 -15
- data/lib/bundler/vendor/uri/lib/uri/file.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +34 -21
- data/lib/bundler/vendor/uri/lib/uri/http.rb +12 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
- data/lib/bundler/vendor/uri/lib/uri/version.rb +2 -2
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/vlad.rb +1 -14
- data/lib/bundler.rb +6 -28
- metadata +9 -13
- data/lib/bundler/cli/inject.rb +0 -60
- data/lib/bundler/cli/viz.rb +0 -31
- data/lib/bundler/graph.rb +0 -152
- data/lib/bundler/man/bundle-inject.1 +0 -31
- data/lib/bundler/man/bundle-inject.1.ronn +0 -32
- data/lib/bundler/man/bundle-viz.1 +0 -30
- data/lib/bundler/man/bundle-viz.1.ronn +0 -36
- data/lib/bundler/similarity_detector.rb +0 -63
data/lib/bundler/graph.rb
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "set"
|
|
4
|
-
module Bundler
|
|
5
|
-
class Graph
|
|
6
|
-
GRAPH_NAME = :Gemfile
|
|
7
|
-
|
|
8
|
-
def initialize(env, output_file, show_version = false, show_requirements = false, output_format = "png", without = [])
|
|
9
|
-
@env = env
|
|
10
|
-
@output_file = output_file
|
|
11
|
-
@show_version = show_version
|
|
12
|
-
@show_requirements = show_requirements
|
|
13
|
-
@output_format = output_format
|
|
14
|
-
@without_groups = without.map(&:to_sym)
|
|
15
|
-
|
|
16
|
-
@groups = []
|
|
17
|
-
@relations = Hash.new {|h, k| h[k] = Set.new }
|
|
18
|
-
@node_options = {}
|
|
19
|
-
@edge_options = {}
|
|
20
|
-
|
|
21
|
-
_populate_relations
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
attr_reader :groups, :relations, :node_options, :edge_options, :output_file, :output_format
|
|
25
|
-
|
|
26
|
-
def viz
|
|
27
|
-
GraphVizClient.new(self).run
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
private
|
|
31
|
-
|
|
32
|
-
def _populate_relations
|
|
33
|
-
parent_dependencies = _groups.values.to_set.flatten
|
|
34
|
-
loop do
|
|
35
|
-
break if parent_dependencies.empty?
|
|
36
|
-
|
|
37
|
-
tmp = Set.new
|
|
38
|
-
parent_dependencies.each do |dependency|
|
|
39
|
-
child_dependencies = spec_for_dependency(dependency).runtime_dependencies.to_set
|
|
40
|
-
@relations[dependency.name] += child_dependencies.map(&:name).to_set
|
|
41
|
-
tmp += child_dependencies
|
|
42
|
-
|
|
43
|
-
@node_options[dependency.name] = _make_label(dependency, :node)
|
|
44
|
-
child_dependencies.each do |c_dependency|
|
|
45
|
-
@edge_options["#{dependency.name}_#{c_dependency.name}"] = _make_label(c_dependency, :edge)
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
parent_dependencies = tmp
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def _groups
|
|
53
|
-
relations = Hash.new {|h, k| h[k] = Set.new }
|
|
54
|
-
@env.current_dependencies.each do |dependency|
|
|
55
|
-
dependency.groups.each do |group|
|
|
56
|
-
next if @without_groups.include?(group)
|
|
57
|
-
|
|
58
|
-
relations[group.to_s].add(dependency)
|
|
59
|
-
@relations[group.to_s].add(dependency.name)
|
|
60
|
-
|
|
61
|
-
@node_options[group.to_s] ||= _make_label(group, :node)
|
|
62
|
-
@edge_options["#{group}_#{dependency.name}"] = _make_label(dependency, :edge)
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
@groups = relations.keys
|
|
66
|
-
relations
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def _make_label(symbol_or_string_or_dependency, element_type)
|
|
70
|
-
case element_type.to_sym
|
|
71
|
-
when :node
|
|
72
|
-
if symbol_or_string_or_dependency.is_a?(Gem::Dependency)
|
|
73
|
-
label = symbol_or_string_or_dependency.name.dup
|
|
74
|
-
label << "\n#{spec_for_dependency(symbol_or_string_or_dependency).version}" if @show_version
|
|
75
|
-
else
|
|
76
|
-
label = symbol_or_string_or_dependency.to_s
|
|
77
|
-
end
|
|
78
|
-
when :edge
|
|
79
|
-
label = nil
|
|
80
|
-
if symbol_or_string_or_dependency.respond_to?(:requirements_list) && @show_requirements
|
|
81
|
-
tmp = symbol_or_string_or_dependency.requirements_list.join(", ")
|
|
82
|
-
label = tmp if tmp != ">= 0"
|
|
83
|
-
end
|
|
84
|
-
else
|
|
85
|
-
raise ArgumentError, "2nd argument is invalid"
|
|
86
|
-
end
|
|
87
|
-
label.nil? ? {} : { label: label }
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def spec_for_dependency(dependency)
|
|
91
|
-
@env.requested_specs.find {|s| s.name == dependency.name }
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
class GraphVizClient
|
|
95
|
-
def initialize(graph_instance)
|
|
96
|
-
@graph_name = graph_instance.class::GRAPH_NAME
|
|
97
|
-
@groups = graph_instance.groups
|
|
98
|
-
@relations = graph_instance.relations
|
|
99
|
-
@node_options = graph_instance.node_options
|
|
100
|
-
@edge_options = graph_instance.edge_options
|
|
101
|
-
@output_file = graph_instance.output_file
|
|
102
|
-
@output_format = graph_instance.output_format
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
def g
|
|
106
|
-
@g ||= ::GraphViz.digraph(@graph_name, concentrate: true, normalize: true, nodesep: 0.55) do |g|
|
|
107
|
-
g.edge[:weight] = 2
|
|
108
|
-
g.edge[:fontname] = g.node[:fontname] = "Arial, Helvetica, SansSerif"
|
|
109
|
-
g.edge[:fontsize] = 12
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
def run
|
|
114
|
-
@groups.each do |group|
|
|
115
|
-
g.add_nodes(
|
|
116
|
-
group, {
|
|
117
|
-
style: "filled",
|
|
118
|
-
fillcolor: "#B9B9D5",
|
|
119
|
-
shape: "box3d",
|
|
120
|
-
fontsize: 16,
|
|
121
|
-
}.merge(@node_options[group])
|
|
122
|
-
)
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
@relations.each do |parent, children|
|
|
126
|
-
children.each do |child|
|
|
127
|
-
if @groups.include?(parent)
|
|
128
|
-
g.add_nodes(child, { style: "filled", fillcolor: "#B9B9D5" }.merge(@node_options[child]))
|
|
129
|
-
g.add_edges(parent, child, { constraint: false }.merge(@edge_options["#{parent}_#{child}"]))
|
|
130
|
-
else
|
|
131
|
-
g.add_nodes(child, @node_options[child])
|
|
132
|
-
g.add_edges(parent, child, @edge_options["#{parent}_#{child}"])
|
|
133
|
-
end
|
|
134
|
-
end
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
if @output_format.to_s == "debug"
|
|
138
|
-
$stdout.puts g.output none: String
|
|
139
|
-
Bundler.ui.info "debugging bundle viz..."
|
|
140
|
-
else
|
|
141
|
-
begin
|
|
142
|
-
g.output @output_format.to_sym => "#{@output_file}.#{@output_format}"
|
|
143
|
-
Bundler.ui.info "#{@output_file}.#{@output_format}"
|
|
144
|
-
rescue ArgumentError => e
|
|
145
|
-
warn "Unsupported output format. See Ruby-Graphviz/lib/graphviz/constants.rb"
|
|
146
|
-
raise e
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
end
|
|
150
|
-
end
|
|
151
|
-
end
|
|
152
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
.\" generated with Ronn-NG/v0.10.1
|
|
2
|
-
.\" http://github.com/apjanke/ronn-ng/tree/0.10.1
|
|
3
|
-
.TH "BUNDLE\-INJECT" "1" "July 2025" ""
|
|
4
|
-
.SH "NAME"
|
|
5
|
-
\fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile
|
|
6
|
-
.SH "SYNOPSIS"
|
|
7
|
-
\fBbundle inject\fR [GEM] [VERSION] [\-\-source=SOURCE] [\-\-group=GROUP]
|
|
8
|
-
.SH "DESCRIPTION"
|
|
9
|
-
Adds the named gem(s) with their version requirements to the resolved [\fBGemfile(5)\fR][Gemfile(5)]\.
|
|
10
|
-
.P
|
|
11
|
-
This command will add the gem to both your [\fBGemfile(5)\fR][Gemfile(5)] and Gemfile\.lock if it isn't listed yet\.
|
|
12
|
-
.P
|
|
13
|
-
Example:
|
|
14
|
-
.IP "" 4
|
|
15
|
-
.nf
|
|
16
|
-
bundle install
|
|
17
|
-
bundle inject 'rack' '> 0'
|
|
18
|
-
.fi
|
|
19
|
-
.IP "" 0
|
|
20
|
-
.P
|
|
21
|
-
This will inject the 'rack' gem with a version greater than 0 in your [\fBGemfile(5)\fR][Gemfile(5)] and Gemfile\.lock\.
|
|
22
|
-
.P
|
|
23
|
-
The \fBbundle inject\fR command was deprecated in Bundler 2\.1 and will be removed in Bundler 4\.0\.
|
|
24
|
-
.SH "OPTIONS"
|
|
25
|
-
.TP
|
|
26
|
-
\fB\-\-source=SOURCE\fR
|
|
27
|
-
Install gem from the given source\.
|
|
28
|
-
.TP
|
|
29
|
-
\fB\-\-group=GROUP\fR
|
|
30
|
-
Install gem into a bundler group\.
|
|
31
|
-
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
bundle-inject(1) -- Add named gem(s) with version requirements to Gemfile
|
|
2
|
-
=========================================================================
|
|
3
|
-
|
|
4
|
-
## SYNOPSIS
|
|
5
|
-
|
|
6
|
-
`bundle inject` [GEM] [VERSION] [--source=SOURCE] [--group=GROUP]
|
|
7
|
-
|
|
8
|
-
## DESCRIPTION
|
|
9
|
-
|
|
10
|
-
Adds the named gem(s) with their version requirements to the resolved
|
|
11
|
-
[`Gemfile(5)`][Gemfile(5)].
|
|
12
|
-
|
|
13
|
-
This command will add the gem to both your [`Gemfile(5)`][Gemfile(5)] and Gemfile.lock if it
|
|
14
|
-
isn't listed yet.
|
|
15
|
-
|
|
16
|
-
Example:
|
|
17
|
-
|
|
18
|
-
bundle install
|
|
19
|
-
bundle inject 'rack' '> 0'
|
|
20
|
-
|
|
21
|
-
This will inject the 'rack' gem with a version greater than 0 in your
|
|
22
|
-
[`Gemfile(5)`][Gemfile(5)] and Gemfile.lock.
|
|
23
|
-
|
|
24
|
-
The `bundle inject` command was deprecated in Bundler 2.1 and will be removed in Bundler 4.0.
|
|
25
|
-
|
|
26
|
-
## OPTIONS
|
|
27
|
-
|
|
28
|
-
* `--source=SOURCE`:
|
|
29
|
-
Install gem from the given source.
|
|
30
|
-
|
|
31
|
-
* `--group=GROUP`:
|
|
32
|
-
Install gem into a bundler group.
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
.\" generated with Ronn-NG/v0.10.1
|
|
2
|
-
.\" http://github.com/apjanke/ronn-ng/tree/0.10.1
|
|
3
|
-
.TH "BUNDLE\-VIZ" "1" "July 2025" ""
|
|
4
|
-
.SH "NAME"
|
|
5
|
-
\fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
|
|
6
|
-
.SH "SYNOPSIS"
|
|
7
|
-
\fBbundle viz\fR [\-\-file=FILE] [\-\-format=FORMAT] [\-\-requirements] [\-\-version] [\-\-without=GROUP GROUP]
|
|
8
|
-
.SH "DESCRIPTION"
|
|
9
|
-
\fBviz\fR generates a PNG file of the current \fBGemfile(5)\fR as a dependency graph\. \fBviz\fR requires the ruby\-graphviz gem (and its dependencies)\.
|
|
10
|
-
.P
|
|
11
|
-
The associated gems must also be installed via \fBbundle install(1)\fR \fIbundle\-install\.1\.html\fR\.
|
|
12
|
-
.P
|
|
13
|
-
\fBviz\fR command was deprecated in Bundler 2\.2\. Use bundler\-graph plugin \fIhttps://github\.com/rubygems/bundler\-graph\fR instead\.
|
|
14
|
-
.SH "OPTIONS"
|
|
15
|
-
.TP
|
|
16
|
-
\fB\-\-file=FILE\fR, \fB\-f=FILE\fR
|
|
17
|
-
The name to use for the generated file\. See \fB\-\-format\fR option
|
|
18
|
-
.TP
|
|
19
|
-
\fB\-\-format=FORMAT\fR, \fB\-F=FORMAT\fR
|
|
20
|
-
This is output format option\. Supported format is png, jpg, svg, dot \|\.\|\.\|\.
|
|
21
|
-
.TP
|
|
22
|
-
\fB\-\-requirements\fR, \fB\-R\fR
|
|
23
|
-
Set to show the version of each required dependency\.
|
|
24
|
-
.TP
|
|
25
|
-
\fB\-\-version\fR, \fB\-v\fR
|
|
26
|
-
Set to show each gem version\.
|
|
27
|
-
.TP
|
|
28
|
-
\fB\-\-without=<list>\fR, \fB\-W=<list>\fR
|
|
29
|
-
Exclude gems that are part of the specified named group\.
|
|
30
|
-
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
bundle-viz(1) -- Generates a visual dependency graph for your Gemfile
|
|
2
|
-
=====================================================================
|
|
3
|
-
|
|
4
|
-
## SYNOPSIS
|
|
5
|
-
|
|
6
|
-
`bundle viz` [--file=FILE]
|
|
7
|
-
[--format=FORMAT]
|
|
8
|
-
[--requirements]
|
|
9
|
-
[--version]
|
|
10
|
-
[--without=GROUP GROUP]
|
|
11
|
-
|
|
12
|
-
## DESCRIPTION
|
|
13
|
-
|
|
14
|
-
`viz` generates a PNG file of the current `Gemfile(5)` as a dependency graph.
|
|
15
|
-
`viz` requires the ruby-graphviz gem (and its dependencies).
|
|
16
|
-
|
|
17
|
-
The associated gems must also be installed via [`bundle install(1)`](bundle-install.1.html).
|
|
18
|
-
|
|
19
|
-
`viz` command was deprecated in Bundler 2.2. Use [bundler-graph plugin](https://github.com/rubygems/bundler-graph) instead.
|
|
20
|
-
|
|
21
|
-
## OPTIONS
|
|
22
|
-
|
|
23
|
-
* `--file=FILE`, `-f=FILE`:
|
|
24
|
-
The name to use for the generated file. See `--format` option
|
|
25
|
-
|
|
26
|
-
* `--format=FORMAT`, `-F=FORMAT`:
|
|
27
|
-
This is output format option. Supported format is png, jpg, svg, dot ...
|
|
28
|
-
|
|
29
|
-
* `--requirements`, `-R`:
|
|
30
|
-
Set to show the version of each required dependency.
|
|
31
|
-
|
|
32
|
-
* `--version`, `-v`:
|
|
33
|
-
Set to show each gem version.
|
|
34
|
-
|
|
35
|
-
* `--without=<list>`, `-W=<list>`:
|
|
36
|
-
Exclude gems that are part of the specified named group.
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Bundler
|
|
4
|
-
class SimilarityDetector
|
|
5
|
-
SimilarityScore = Struct.new(:string, :distance)
|
|
6
|
-
|
|
7
|
-
# initialize with an array of words to be matched against
|
|
8
|
-
def initialize(corpus)
|
|
9
|
-
@corpus = corpus
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
# return an array of words similar to 'word' from the corpus
|
|
13
|
-
def similar_words(word, limit = 3)
|
|
14
|
-
words_by_similarity = @corpus.map {|w| SimilarityScore.new(w, levenshtein_distance(word, w)) }
|
|
15
|
-
words_by_similarity.select {|s| s.distance <= limit }.sort_by(&:distance).map(&:string)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# return the result of 'similar_words', concatenated into a list
|
|
19
|
-
# (eg "a, b, or c")
|
|
20
|
-
def similar_word_list(word, limit = 3)
|
|
21
|
-
words = similar_words(word, limit)
|
|
22
|
-
if words.length == 1
|
|
23
|
-
words[0]
|
|
24
|
-
elsif words.length > 1
|
|
25
|
-
[words[0..-2].join(", "), words[-1]].join(" or ")
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
protected
|
|
30
|
-
|
|
31
|
-
# https://www.informit.com/articles/article.aspx?p=683059&seqNum=36
|
|
32
|
-
def levenshtein_distance(this, that, ins = 2, del = 2, sub = 1)
|
|
33
|
-
# ins, del, sub are weighted costs
|
|
34
|
-
return nil if this.nil?
|
|
35
|
-
return nil if that.nil?
|
|
36
|
-
dm = [] # distance matrix
|
|
37
|
-
|
|
38
|
-
# Initialize first row values
|
|
39
|
-
dm[0] = (0..this.length).collect {|i| i * ins }
|
|
40
|
-
fill = [0] * (this.length - 1)
|
|
41
|
-
|
|
42
|
-
# Initialize first column values
|
|
43
|
-
(1..that.length).each do |i|
|
|
44
|
-
dm[i] = [i * del, fill.flatten]
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
# populate matrix
|
|
48
|
-
(1..that.length).each do |i|
|
|
49
|
-
(1..this.length).each do |j|
|
|
50
|
-
# critical comparison
|
|
51
|
-
dm[i][j] = [
|
|
52
|
-
dm[i - 1][j - 1] + (this[j - 1] == that[i - 1] ? 0 : sub),
|
|
53
|
-
dm[i][j - 1] + ins,
|
|
54
|
-
dm[i - 1][j] + del,
|
|
55
|
-
].min
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
# The last value in matrix is the Levenshtein distance between the strings
|
|
60
|
-
dm[that.length][this.length]
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|