bundler 2.2.11 → 2.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +414 -5
- data/README.md +1 -1
- data/bundler.gemspec +2 -3
- data/exe/bundle +7 -8
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/cache.rb +1 -1
- data/lib/bundler/cli/check.rb +4 -2
- data/lib/bundler/cli/common.rb +15 -2
- data/lib/bundler/cli/doctor.rb +24 -5
- data/lib/bundler/cli/exec.rb +1 -6
- data/lib/bundler/cli/gem.rb +130 -26
- data/lib/bundler/cli/info.rb +16 -4
- data/lib/bundler/cli/install.rb +12 -27
- data/lib/bundler/cli/issue.rb +4 -3
- data/lib/bundler/cli/list.rb +7 -1
- data/lib/bundler/cli/lock.rb +5 -1
- data/lib/bundler/cli/open.rb +1 -2
- data/lib/bundler/cli/outdated.rb +10 -11
- data/lib/bundler/cli/platform.rb +1 -1
- data/lib/bundler/cli/remove.rb +1 -2
- data/lib/bundler/cli/update.rb +17 -8
- data/lib/bundler/cli.rb +41 -55
- data/lib/bundler/compact_index_client/cache.rb +0 -9
- data/lib/bundler/compact_index_client/updater.rb +10 -11
- data/lib/bundler/compact_index_client.rb +2 -8
- data/lib/bundler/current_ruby.rb +5 -4
- data/lib/bundler/definition.rb +147 -290
- data/lib/bundler/dependency.rb +5 -7
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +67 -66
- data/lib/bundler/endpoint_specification.rb +21 -11
- data/lib/bundler/env.rb +1 -1
- data/lib/bundler/environment_preserver.rb +4 -1
- data/lib/bundler/errors.rb +19 -3
- data/lib/bundler/feature_flag.rb +0 -4
- data/lib/bundler/fetcher/compact_index.rb +10 -15
- data/lib/bundler/fetcher/downloader.rb +9 -6
- data/lib/bundler/fetcher/index.rb +0 -27
- data/lib/bundler/fetcher.rb +10 -16
- data/lib/bundler/friendly_errors.rb +5 -32
- data/lib/bundler/gem_helper.rb +21 -16
- data/lib/bundler/index.rb +2 -7
- data/lib/bundler/injector.rb +12 -3
- data/lib/bundler/inline.rb +2 -1
- data/lib/bundler/installer/gem_installer.rb +4 -22
- data/lib/bundler/installer/parallel_installer.rb +36 -15
- data/lib/bundler/installer/standalone.rb +14 -9
- data/lib/bundler/installer.rb +8 -17
- data/lib/bundler/lazy_specification.rb +23 -2
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +16 -45
- data/lib/bundler/man/bundle-add.1 +10 -2
- data/lib/bundler/man/bundle-add.1.ronn +7 -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 +23 -15
- data/lib/bundler/man/bundle-config.1.ronn +24 -17
- 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 +2 -2
- data/lib/bundler/man/bundle-install.1.ronn +2 -2
- 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 +5 -5
- data/lib/bundler/man/bundle-update.1.ronn +5 -4
- data/lib/bundler/man/bundle-viz.1 +1 -1
- data/lib/bundler/man/bundle.1 +1 -1
- data/lib/bundler/man/gemfile.5 +28 -2
- data/lib/bundler/man/gemfile.5.ronn +9 -1
- data/lib/bundler/plugin/api/source.rb +22 -0
- data/lib/bundler/plugin/index.rb +4 -1
- data/lib/bundler/plugin/installer.rb +10 -10
- data/lib/bundler/plugin/source_list.rb +4 -0
- data/lib/bundler/plugin.rb +28 -8
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/psyched_yaml.rb +1 -13
- data/lib/bundler/remote_specification.rb +7 -0
- data/lib/bundler/resolver/spec_group.rb +1 -25
- data/lib/bundler/resolver.rb +55 -147
- data/lib/bundler/retry.rb +1 -1
- data/lib/bundler/ruby_version.rb +1 -1
- data/lib/bundler/rubygems_ext.rb +30 -8
- data/lib/bundler/rubygems_gem_installer.rb +68 -1
- data/lib/bundler/rubygems_integration.rb +43 -60
- data/lib/bundler/runtime.rb +18 -11
- data/lib/bundler/self_manager.rb +168 -0
- data/lib/bundler/settings.rb +96 -20
- data/lib/bundler/setup.rb +2 -2
- data/lib/bundler/shared_helpers.rb +4 -19
- data/lib/bundler/source/git/git_proxy.rb +8 -6
- data/lib/bundler/source/git.rb +22 -4
- data/lib/bundler/source/metadata.rb +1 -5
- data/lib/bundler/source/path/installer.rb +1 -1
- data/lib/bundler/source/path.rb +3 -1
- data/lib/bundler/source/rubygems.rb +111 -106
- data/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/lib/bundler/source.rb +21 -0
- data/lib/bundler/source_list.rb +100 -60
- data/lib/bundler/source_map.rb +58 -0
- data/lib/bundler/spec_set.rb +17 -31
- data/lib/bundler/stub_specification.rb +8 -0
- data/lib/bundler/templates/Executable.bundler +7 -7
- data/lib/bundler/templates/Gemfile +0 -2
- data/lib/bundler/templates/gems.rb +0 -3
- data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
- data/lib/bundler/templates/newgem/README.md.tt +5 -3
- data/lib/bundler/templates/newgem/Rakefile.tt +15 -2
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +15 -6
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +18 -16
- data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
- data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
- data/lib/bundler/ui/shell.rb +1 -1
- data/lib/bundler/vendor/.document +1 -0
- data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
- data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/lib/bundler/vendor/molinillo/LICENSE +9 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -1
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +5 -5
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
- data/lib/bundler/vendor/thor/lib/thor/error.rb +9 -4
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +22 -4
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +1 -1
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
- data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
- data/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
- data/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +0 -1
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +19 -4
- data/lib/bundler.rb +28 -31
- metadata +27 -9
- data/lib/bundler/gemdeps.rb +0 -29
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
data/lib/bundler/cli/doctor.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "rbconfig"
|
4
|
+
require "shellwords"
|
5
|
+
require "fiddle"
|
4
6
|
|
5
7
|
module Bundler
|
6
8
|
class CLI::Doctor
|
@@ -22,14 +24,14 @@ module Bundler
|
|
22
24
|
end
|
23
25
|
|
24
26
|
def dylibs_darwin(path)
|
25
|
-
output = `/usr/bin/otool -L
|
27
|
+
output = `/usr/bin/otool -L #{path.shellescape}`.chomp
|
26
28
|
dylibs = output.split("\n")[1..-1].map {|l| l.match(DARWIN_REGEX).captures[0] }.uniq
|
27
29
|
# ignore @rpath and friends
|
28
30
|
dylibs.reject {|dylib| dylib.start_with? "@" }
|
29
31
|
end
|
30
32
|
|
31
33
|
def dylibs_ldd(path)
|
32
|
-
output = `/usr/bin/ldd
|
34
|
+
output = `/usr/bin/ldd #{path.shellescape}`.chomp
|
33
35
|
output.split("\n").map do |l|
|
34
36
|
match = l.match(LDD_REGEX)
|
35
37
|
next if match.nil?
|
@@ -61,7 +63,7 @@ module Bundler
|
|
61
63
|
end
|
62
64
|
|
63
65
|
def run
|
64
|
-
Bundler.ui.level = "
|
66
|
+
Bundler.ui.level = "warn" if options[:quiet]
|
65
67
|
Bundler.settings.validate!
|
66
68
|
check!
|
67
69
|
|
@@ -70,7 +72,14 @@ module Bundler
|
|
70
72
|
|
71
73
|
definition.specs.each do |spec|
|
72
74
|
bundles_for_gem(spec).each do |bundle|
|
73
|
-
bad_paths = dylibs(bundle).select
|
75
|
+
bad_paths = dylibs(bundle).select do |f|
|
76
|
+
begin
|
77
|
+
Fiddle.dlopen(f)
|
78
|
+
false
|
79
|
+
rescue Fiddle::DLError
|
80
|
+
true
|
81
|
+
end
|
82
|
+
end
|
74
83
|
if bad_paths.any?
|
75
84
|
broken_links[spec] ||= []
|
76
85
|
broken_links[spec].concat(bad_paths)
|
@@ -100,8 +109,11 @@ module Bundler
|
|
100
109
|
files_not_readable_or_writable = []
|
101
110
|
files_not_rw_and_owned_by_different_user = []
|
102
111
|
files_not_owned_by_current_user_but_still_rw = []
|
112
|
+
broken_symlinks = []
|
103
113
|
Find.find(Bundler.bundle_path.to_s).each do |f|
|
104
|
-
if !File.
|
114
|
+
if !File.exist?(f)
|
115
|
+
broken_symlinks << f
|
116
|
+
elsif !File.writable?(f) || !File.readable?(f)
|
105
117
|
if File.stat(f).uid != Process.uid
|
106
118
|
files_not_rw_and_owned_by_different_user << f
|
107
119
|
else
|
@@ -113,6 +125,13 @@ module Bundler
|
|
113
125
|
end
|
114
126
|
|
115
127
|
ok = true
|
128
|
+
|
129
|
+
if broken_symlinks.any?
|
130
|
+
Bundler.ui.warn "Broken links exist in the Bundler home. Please report them to the offending gem's upstream repo. These files are:\n - #{broken_symlinks.join("\n - ")}"
|
131
|
+
|
132
|
+
ok = false
|
133
|
+
end
|
134
|
+
|
116
135
|
if files_not_owned_by_current_user_but_still_rw.any?
|
117
136
|
Bundler.ui.warn "Files exist in the Bundler home that are owned by another " \
|
118
137
|
"user, but are still readable/writable. These files are:\n - #{files_not_owned_by_current_user_but_still_rw.join("\n - ")}"
|
data/lib/bundler/cli/exec.rb
CHANGED
@@ -12,12 +12,7 @@ module Bundler
|
|
12
12
|
@options = options
|
13
13
|
@cmd = args.shift
|
14
14
|
@args = args
|
15
|
-
|
16
|
-
if !Bundler.current_ruby.jruby?
|
17
|
-
@args << { :close_others => !options.keep_file_descriptors? }
|
18
|
-
elsif options.keep_file_descriptors?
|
19
|
-
Bundler.ui.warn "Ruby version #{RUBY_VERSION} defaults to keeping non-standard file descriptors on Kernel#exec."
|
20
|
-
end
|
15
|
+
@args << { :close_others => !options.keep_file_descriptors? } unless Bundler.current_ruby.jruby?
|
21
16
|
end
|
22
17
|
|
23
18
|
def run
|
data/lib/bundler/cli/gem.rb
CHANGED
@@ -38,12 +38,21 @@ module Bundler
|
|
38
38
|
namespaced_path = name.tr("-", "/")
|
39
39
|
constant_name = name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }
|
40
40
|
constant_array = constant_name.split("::")
|
41
|
+
minitest_constant_name = constant_array.clone.tap {|a| a[-1] = "Test#{a[-1]}" }.join("::") # Foo::Bar => Foo::TestBar
|
41
42
|
|
42
|
-
|
43
|
+
use_git = Bundler.git_present? && options[:git]
|
43
44
|
|
44
|
-
git_author_name =
|
45
|
-
|
46
|
-
git_user_email =
|
45
|
+
git_author_name = use_git ? `git config user.name`.chomp : ""
|
46
|
+
git_username = use_git ? `git config github.user`.chomp : ""
|
47
|
+
git_user_email = use_git ? `git config user.email`.chomp : ""
|
48
|
+
|
49
|
+
github_username = if options[:github_username].nil?
|
50
|
+
git_username
|
51
|
+
elsif options[:github_username] == false
|
52
|
+
""
|
53
|
+
else
|
54
|
+
options[:github_username]
|
55
|
+
end
|
47
56
|
|
48
57
|
config = {
|
49
58
|
:name => name,
|
@@ -58,8 +67,10 @@ module Bundler
|
|
58
67
|
:ext => options[:ext],
|
59
68
|
:exe => options[:exe],
|
60
69
|
:bundler_version => bundler_dependency_version,
|
70
|
+
:git => use_git,
|
61
71
|
:github_username => github_username.empty? ? "[USERNAME]" : github_username,
|
62
|
-
:required_ruby_version =>
|
72
|
+
:required_ruby_version => required_ruby_version,
|
73
|
+
:minitest_constant_name => minitest_constant_name,
|
63
74
|
}
|
64
75
|
ensure_safe_gem_name(name, constant_array)
|
65
76
|
|
@@ -67,6 +78,7 @@ module Bundler
|
|
67
78
|
"#{Bundler.preferred_gemfile_name}.tt" => Bundler.preferred_gemfile_name,
|
68
79
|
"lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb",
|
69
80
|
"lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb",
|
81
|
+
"sig/newgem.rbs.tt" => "sig/#{namespaced_path}.rbs",
|
70
82
|
"newgem.gemspec.tt" => "#{name}.gemspec",
|
71
83
|
"Rakefile.tt" => "Rakefile",
|
72
84
|
"README.md.tt" => "README.md",
|
@@ -79,7 +91,7 @@ module Bundler
|
|
79
91
|
bin/setup
|
80
92
|
]
|
81
93
|
|
82
|
-
templates.merge!("gitignore.tt" => ".gitignore") if
|
94
|
+
templates.merge!("gitignore.tt" => ".gitignore") if use_git
|
83
95
|
|
84
96
|
if test_framework = ask_and_set_test_framework
|
85
97
|
config[:test] = test_framework
|
@@ -94,9 +106,17 @@ module Bundler
|
|
94
106
|
)
|
95
107
|
config[:test_task] = :spec
|
96
108
|
when "minitest"
|
109
|
+
# Generate path for minitest target file (FileList["test/**/test_*.rb"])
|
110
|
+
# foo => test/test_foo.rb
|
111
|
+
# foo-bar => test/foo/test_bar.rb
|
112
|
+
# foo_bar => test/test_foo_bar.rb
|
113
|
+
paths = namespaced_path.rpartition("/")
|
114
|
+
paths[2] = "test_#{paths[2]}"
|
115
|
+
minitest_namespaced_path = paths.join("")
|
116
|
+
|
97
117
|
templates.merge!(
|
98
118
|
"test/minitest/test_helper.rb.tt" => "test/test_helper.rb",
|
99
|
-
"test/minitest/
|
119
|
+
"test/minitest/test_newgem.rb.tt" => "test/#{minitest_namespaced_path}.rb"
|
100
120
|
)
|
101
121
|
config[:test_task] = :test
|
102
122
|
when "test-unit"
|
@@ -154,15 +174,16 @@ module Bundler
|
|
154
174
|
templates.merge!("CHANGELOG.md.tt" => "CHANGELOG.md")
|
155
175
|
end
|
156
176
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
"and the Ruby Style Guides (https://github.com/rubocop-hq/ruby-style-guide).")
|
162
|
-
config[:rubocop] = true
|
163
|
-
config[:rubocop_version] = Gem.ruby_version < Gem::Version.new("2.4.a") ? "0.81.0" : "1.7"
|
177
|
+
config[:linter] = ask_and_set_linter
|
178
|
+
case config[:linter]
|
179
|
+
when "rubocop"
|
180
|
+
config[:linter_version] = rubocop_version
|
164
181
|
Bundler.ui.info "RuboCop enabled in config"
|
165
182
|
templates.merge!("rubocop.yml.tt" => ".rubocop.yml")
|
183
|
+
when "standard"
|
184
|
+
config[:linter_version] = standard_version
|
185
|
+
Bundler.ui.info "Standard enabled in config"
|
186
|
+
templates.merge!("standard.yml.tt" => ".standard.yml")
|
166
187
|
end
|
167
188
|
|
168
189
|
templates.merge!("exe/newgem.tt" => "exe/#{name}") if config[:exe]
|
@@ -175,24 +196,32 @@ module Bundler
|
|
175
196
|
)
|
176
197
|
end
|
177
198
|
|
199
|
+
if target.exist? && !target.directory?
|
200
|
+
Bundler.ui.error "Couldn't create a new gem named `#{gem_name}` because there's an existing file named `#{gem_name}`."
|
201
|
+
exit Bundler::BundlerError.all_errors[Bundler::GenericSystemCallError]
|
202
|
+
end
|
203
|
+
|
204
|
+
if use_git
|
205
|
+
Bundler.ui.info "Initializing git repo in #{target}"
|
206
|
+
require "shellwords"
|
207
|
+
`git init #{target.to_s.shellescape}`
|
208
|
+
|
209
|
+
config[:git_default_branch] = File.read("#{target}/.git/HEAD").split("/").last.chomp
|
210
|
+
end
|
211
|
+
|
178
212
|
templates.each do |src, dst|
|
179
213
|
destination = target.join(dst)
|
180
|
-
|
181
|
-
thor.template("newgem/#{src}", destination, config)
|
182
|
-
end
|
214
|
+
thor.template("newgem/#{src}", destination, config)
|
183
215
|
end
|
184
216
|
|
185
217
|
executables.each do |file|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
end
|
218
|
+
path = target.join(file)
|
219
|
+
executable = (path.stat.mode | 0o111)
|
220
|
+
path.chmod(executable)
|
190
221
|
end
|
191
222
|
|
192
|
-
if
|
193
|
-
Bundler.ui.info "Initializing git repo in #{target}"
|
223
|
+
if use_git
|
194
224
|
Dir.chdir(target) do
|
195
|
-
`git init`
|
196
225
|
`git add .`
|
197
226
|
end
|
198
227
|
end
|
@@ -202,8 +231,6 @@ module Bundler
|
|
202
231
|
|
203
232
|
Bundler.ui.info "Gem '#{name}' was successfully created. " \
|
204
233
|
"For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html"
|
205
|
-
rescue Errno::EEXIST => e
|
206
|
-
raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.")
|
207
234
|
end
|
208
235
|
|
209
236
|
private
|
@@ -302,6 +329,58 @@ module Bundler
|
|
302
329
|
ci_template
|
303
330
|
end
|
304
331
|
|
332
|
+
def ask_and_set_linter
|
333
|
+
linter_template = options[:linter] || Bundler.settings["gem.linter"]
|
334
|
+
linter_template = deprecated_rubocop_option if linter_template.nil?
|
335
|
+
|
336
|
+
if linter_template.to_s.empty?
|
337
|
+
Bundler.ui.confirm "Do you want to add a code linter and formatter to your gem? " \
|
338
|
+
"Supported Linters:\n" \
|
339
|
+
"* RuboCop: https://rubocop.org\n" \
|
340
|
+
"* Standard: https://github.com/testdouble/standard\n" \
|
341
|
+
"\n"
|
342
|
+
Bundler.ui.info hint_text("linter")
|
343
|
+
|
344
|
+
result = Bundler.ui.ask "Enter a linter. rubocop/standard/(none):"
|
345
|
+
if result =~ /rubocop|standard/
|
346
|
+
linter_template = result
|
347
|
+
else
|
348
|
+
linter_template = false
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
if Bundler.settings["gem.linter"].nil?
|
353
|
+
Bundler.settings.set_global("gem.linter", linter_template)
|
354
|
+
end
|
355
|
+
|
356
|
+
# Once gem.linter safely set, unset the deprecated gem.rubocop
|
357
|
+
unless Bundler.settings["gem.rubocop"].nil?
|
358
|
+
Bundler.settings.set_global("gem.rubocop", nil)
|
359
|
+
end
|
360
|
+
|
361
|
+
if options[:linter] == Bundler.settings["gem.linter"]
|
362
|
+
Bundler.ui.info "#{options[:linter]} is already configured, ignoring --linter flag."
|
363
|
+
end
|
364
|
+
|
365
|
+
linter_template
|
366
|
+
end
|
367
|
+
|
368
|
+
def deprecated_rubocop_option
|
369
|
+
if !options[:rubocop].nil?
|
370
|
+
if options[:rubocop]
|
371
|
+
Bundler::SharedHelpers.major_deprecation 2, "--rubocop is deprecated, use --linter=rubocop"
|
372
|
+
"rubocop"
|
373
|
+
else
|
374
|
+
Bundler::SharedHelpers.major_deprecation 2, "--no-rubocop is deprecated, use --linter"
|
375
|
+
false
|
376
|
+
end
|
377
|
+
elsif !Bundler.settings["gem.rubocop"].nil?
|
378
|
+
Bundler::SharedHelpers.major_deprecation 2,
|
379
|
+
"config gem.rubocop is deprecated; we've updated your config to use gem.linter instead"
|
380
|
+
Bundler.settings["gem.rubocop"] ? "rubocop" : false
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
305
384
|
def bundler_dependency_version
|
306
385
|
v = Gem::Version.new(Bundler::VERSION)
|
307
386
|
req = v.segments[0..1]
|
@@ -335,5 +414,30 @@ module Bundler
|
|
335
414
|
def open_editor(editor, file)
|
336
415
|
thor.run(%(#{editor} "#{file}"))
|
337
416
|
end
|
417
|
+
|
418
|
+
def required_ruby_version
|
419
|
+
if Gem.ruby_version < Gem::Version.new("2.4.a") then "2.3.0"
|
420
|
+
elsif Gem.ruby_version < Gem::Version.new("2.5.a") then "2.4.0"
|
421
|
+
elsif Gem.ruby_version < Gem::Version.new("2.6.a") then "2.5.0"
|
422
|
+
else
|
423
|
+
"2.6.0"
|
424
|
+
end
|
425
|
+
end
|
426
|
+
|
427
|
+
def rubocop_version
|
428
|
+
if Gem.ruby_version < Gem::Version.new("2.4.a") then "0.81.0"
|
429
|
+
elsif Gem.ruby_version < Gem::Version.new("2.5.a") then "1.12"
|
430
|
+
else
|
431
|
+
"1.21"
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
435
|
+
def standard_version
|
436
|
+
if Gem.ruby_version < Gem::Version.new("2.4.a") then "0.2.5"
|
437
|
+
elsif Gem.ruby_version < Gem::Version.new("2.5.a") then "1.0"
|
438
|
+
else
|
439
|
+
"1.3"
|
440
|
+
end
|
441
|
+
end
|
338
442
|
end
|
339
443
|
end
|
data/lib/bundler/cli/info.rb
CHANGED
@@ -18,6 +18,7 @@ module Bundler
|
|
18
18
|
|
19
19
|
if spec
|
20
20
|
return print_gem_path(spec) if @options[:path]
|
21
|
+
return print_gem_version(spec) if @options[:version]
|
21
22
|
print_gem_info(spec)
|
22
23
|
end
|
23
24
|
end
|
@@ -39,13 +40,18 @@ module Bundler
|
|
39
40
|
raise GemNotFound, Bundler::CLI::Common.gem_not_found_message(gem_name, Bundler.definition.dependencies)
|
40
41
|
end
|
41
42
|
|
43
|
+
def print_gem_version(spec)
|
44
|
+
Bundler.ui.info spec.version.to_s
|
45
|
+
end
|
46
|
+
|
42
47
|
def print_gem_path(spec)
|
43
|
-
|
48
|
+
name = spec.name
|
49
|
+
if name == "bundler"
|
44
50
|
path = File.expand_path("../../../..", __FILE__)
|
45
51
|
else
|
46
52
|
path = spec.full_gem_path
|
47
|
-
|
48
|
-
return Bundler.ui.warn "The gem #{
|
53
|
+
if spec.deleted_gem?
|
54
|
+
return Bundler.ui.warn "The gem #{name} has been deleted. It was installed at: #{path}"
|
49
55
|
end
|
50
56
|
end
|
51
57
|
|
@@ -54,8 +60,9 @@ module Bundler
|
|
54
60
|
|
55
61
|
def print_gem_info(spec)
|
56
62
|
metadata = spec.metadata
|
63
|
+
name = spec.name
|
57
64
|
gem_info = String.new
|
58
|
-
gem_info << " * #{
|
65
|
+
gem_info << " * #{name} (#{spec.version}#{spec.git_version})\n"
|
59
66
|
gem_info << "\tSummary: #{spec.summary}\n" if spec.summary
|
60
67
|
gem_info << "\tHomepage: #{spec.homepage}\n" if spec.homepage
|
61
68
|
gem_info << "\tDocumentation: #{metadata["documentation_uri"]}\n" if metadata.key?("documentation_uri")
|
@@ -67,6 +74,11 @@ module Bundler
|
|
67
74
|
gem_info << "\tMailing List: #{metadata["mailing_list_uri"]}\n" if metadata.key?("mailing_list_uri")
|
68
75
|
gem_info << "\tPath: #{spec.full_gem_path}\n"
|
69
76
|
gem_info << "\tDefault Gem: yes" if spec.respond_to?(:default_gem?) && spec.default_gem?
|
77
|
+
|
78
|
+
if name != "bundler" && spec.deleted_gem?
|
79
|
+
return Bundler.ui.warn "The gem #{name} has been deleted. Gemspec information is still available though:\n#{gem_info}"
|
80
|
+
end
|
81
|
+
|
70
82
|
Bundler.ui.info gem_info
|
71
83
|
end
|
72
84
|
end
|
data/lib/bundler/cli/install.rb
CHANGED
@@ -8,10 +8,12 @@ module Bundler
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def run
|
11
|
-
Bundler.ui.level = "
|
11
|
+
Bundler.ui.level = "warn" if options[:quiet]
|
12
12
|
|
13
13
|
warn_if_root
|
14
14
|
|
15
|
+
Bundler.self_manager.install_locked_bundler_and_restart_with_it_if_needed
|
16
|
+
|
15
17
|
Bundler::SharedHelpers.set_env "RB_USER_INSTALL", "1" if Bundler::FREEBSD
|
16
18
|
|
17
19
|
# Disable color in deployment mode
|
@@ -33,12 +35,8 @@ module Bundler
|
|
33
35
|
|
34
36
|
options[:local] = true if Bundler.app_cache.exist?
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
-
else
|
39
|
-
Bundler.settings.set_command_option :deployment, true if options[:deployment]
|
40
|
-
Bundler.settings.set_command_option :frozen, true if options[:frozen]
|
41
|
-
end
|
38
|
+
Bundler.settings.set_command_option :deployment, true if options[:deployment]
|
39
|
+
Bundler.settings.set_command_option :frozen, true if options[:frozen]
|
42
40
|
end
|
43
41
|
|
44
42
|
# When install is called with --no-deployment, disable deployment mode
|
@@ -62,7 +60,10 @@ module Bundler
|
|
62
60
|
definition.validate_runtime!
|
63
61
|
|
64
62
|
installer = Installer.install(Bundler.root, definition, options)
|
65
|
-
|
63
|
+
|
64
|
+
Bundler.settings.temporary(:cache_all_platforms => options[:local] ? false : Bundler.settings[:cache_all_platforms]) do
|
65
|
+
Bundler.load.cache(nil, options[:local]) if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
|
66
|
+
end
|
66
67
|
|
67
68
|
Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
|
68
69
|
Bundler::CLI::Common.output_without_groups_message(:install)
|
@@ -84,28 +85,15 @@ module Bundler
|
|
84
85
|
end
|
85
86
|
|
86
87
|
Bundler::CLI::Common.output_fund_metadata_summary
|
87
|
-
rescue
|
88
|
-
if options[:local] && Bundler.app_cache.exist?
|
89
|
-
Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory."
|
90
|
-
end
|
91
|
-
|
92
|
-
unless Bundler.definition.has_rubygems_remotes?
|
93
|
-
Bundler.ui.warn <<-WARN, :wrap => true
|
94
|
-
Your Gemfile has no gem server sources. If you need gems that are \
|
95
|
-
not already on your machine, add a line like this to your Gemfile:
|
96
|
-
source 'https://rubygems.org'
|
97
|
-
WARN
|
98
|
-
end
|
99
|
-
raise e
|
100
|
-
rescue Gem::InvalidSpecificationException => e
|
88
|
+
rescue Gem::InvalidSpecificationException
|
101
89
|
Bundler.ui.warn "You have one or more invalid gemspecs that need to be fixed."
|
102
|
-
raise
|
90
|
+
raise
|
103
91
|
end
|
104
92
|
|
105
93
|
private
|
106
94
|
|
107
95
|
def warn_if_root
|
108
|
-
return if Bundler.settings[:silence_root_warning] ||
|
96
|
+
return if Bundler.settings[:silence_root_warning] || Gem.win_platform? || !Process.uid.zero?
|
109
97
|
Bundler.ui.warn "Don't run Bundler as root. Bundler can ask for sudo " \
|
110
98
|
"if it is needed, and installing your bundle as root will break this " \
|
111
99
|
"application for all non-root users on this machine.", :wrap => true
|
@@ -177,9 +165,6 @@ module Bundler
|
|
177
165
|
|
178
166
|
def normalize_settings
|
179
167
|
Bundler.settings.set_command_option :path, nil if options[:system]
|
180
|
-
Bundler.settings.temporary(:path_relative_to_cwd => false) do
|
181
|
-
Bundler.settings.set_command_option :path, "vendor/bundle" if Bundler.settings[:deployment] && Bundler.settings[:path].nil?
|
182
|
-
end
|
183
168
|
Bundler.settings.set_command_option_if_given :path, options[:path]
|
184
169
|
Bundler.settings.temporary(:path_relative_to_cwd => false) do
|
185
170
|
Bundler.settings.set_command_option :path, "bundle" if options["standalone"] && Bundler.settings[:path].nil?
|
data/lib/bundler/cli/issue.rb
CHANGED
@@ -20,9 +20,10 @@ module Bundler
|
|
20
20
|
|
21
21
|
Hopefully the troubleshooting steps above resolved your problem! If things
|
22
22
|
still aren't working the way you expect them to, please let us know so
|
23
|
-
that we can diagnose and help fix the problem you're having
|
24
|
-
|
25
|
-
https://github.com/rubygems/rubygems/
|
23
|
+
that we can diagnose and help fix the problem you're having, by filling
|
24
|
+
in the new issue form located at
|
25
|
+
https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md,
|
26
|
+
and copy and pasting the information below.
|
26
27
|
|
27
28
|
EOS
|
28
29
|
|
data/lib/bundler/cli/list.rb
CHANGED
@@ -16,7 +16,13 @@ module Bundler
|
|
16
16
|
specs = if @only_group.any? || @without_group.any?
|
17
17
|
filtered_specs_by_groups
|
18
18
|
else
|
19
|
-
|
19
|
+
begin
|
20
|
+
Bundler.load.specs
|
21
|
+
rescue GemNotFound => e
|
22
|
+
Bundler.ui.error e.message
|
23
|
+
Bundler.ui.warn "Install missing gems with `bundle install`."
|
24
|
+
exit 1
|
25
|
+
end
|
20
26
|
end.reject {|s| s.name == "bundler" }.sort_by(&:name)
|
21
27
|
|
22
28
|
return Bundler.ui.info "No gems in the Gemfile" if specs.empty?
|
data/lib/bundler/cli/lock.rb
CHANGED
@@ -21,9 +21,13 @@ module Bundler
|
|
21
21
|
Bundler::Fetcher.disable_endpoint = options["full-index"]
|
22
22
|
|
23
23
|
update = options[:update]
|
24
|
+
conservative = options[:conservative]
|
25
|
+
|
24
26
|
if update.is_a?(Array) # unlocking specific gems
|
25
27
|
Bundler::CLI::Common.ensure_all_gems_in_lockfile!(update)
|
26
|
-
update = { :gems => update, :
|
28
|
+
update = { :gems => update, :conservative => conservative }
|
29
|
+
elsif update
|
30
|
+
update = { :conservative => conservative } if conservative
|
27
31
|
end
|
28
32
|
definition = Bundler.definition(update)
|
29
33
|
|
data/lib/bundler/cli/open.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "shellwords"
|
4
|
-
|
5
3
|
module Bundler
|
6
4
|
class CLI::Open
|
7
5
|
attr_reader :options, :name
|
@@ -19,6 +17,7 @@ module Bundler
|
|
19
17
|
else
|
20
18
|
path = spec.full_gem_path
|
21
19
|
Dir.chdir(path) do
|
20
|
+
require "shellwords"
|
22
21
|
command = Shellwords.split(editor) + [path]
|
23
22
|
Bundler.with_original_env do
|
24
23
|
system(*command)
|
data/lib/bundler/cli/outdated.rb
CHANGED
@@ -72,7 +72,7 @@ module Bundler
|
|
72
72
|
gemfile_specs + dependency_specs
|
73
73
|
end
|
74
74
|
|
75
|
-
specs.sort_by(&:name).each do |current_spec|
|
75
|
+
specs.sort_by(&:name).uniq(&:name).each do |current_spec|
|
76
76
|
next unless gems.empty? || gems.include?(current_spec.name)
|
77
77
|
|
78
78
|
active_spec = retrieve_active_spec(definition, current_spec)
|
@@ -146,17 +146,16 @@ module Bundler
|
|
146
146
|
end
|
147
147
|
|
148
148
|
def retrieve_active_spec(definition, current_spec)
|
149
|
-
|
150
|
-
|
151
|
-
else
|
152
|
-
active_specs = definition.find_indexed_specs(current_spec)
|
153
|
-
if !current_spec.version.prerelease? && !options[:pre] && active_specs.size > 1
|
154
|
-
active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
|
155
|
-
end
|
156
|
-
active_spec = active_specs.last
|
157
|
-
end
|
149
|
+
active_spec = definition.resolve.find_by_name_and_platform(current_spec.name, current_spec.platform)
|
150
|
+
return unless active_spec
|
158
151
|
|
159
|
-
active_spec
|
152
|
+
return active_spec if strict
|
153
|
+
|
154
|
+
active_specs = active_spec.source.specs.search(current_spec.name).select {|spec| spec.match_platform(current_spec.platform) }.sort_by(&:version)
|
155
|
+
if !current_spec.version.prerelease? && !options[:pre] && active_specs.size > 1
|
156
|
+
active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
|
157
|
+
end
|
158
|
+
active_specs.last
|
160
159
|
end
|
161
160
|
|
162
161
|
def print_gems(gems_list)
|
data/lib/bundler/cli/platform.rb
CHANGED
@@ -23,7 +23,7 @@ module Bundler
|
|
23
23
|
output << "No ruby version specified"
|
24
24
|
end
|
25
25
|
else
|
26
|
-
output << "Your platform is: #{
|
26
|
+
output << "Your platform is: #{Gem::Platform.local}"
|
27
27
|
output << "Your app has gems that work on these platforms:\n#{platforms.join("\n")}"
|
28
28
|
|
29
29
|
if ruby_version
|
data/lib/bundler/cli/remove.rb
CHANGED
@@ -11,8 +11,7 @@ module Bundler
|
|
11
11
|
raise InvalidOption, "Please specify gems to remove." if @gems.empty?
|
12
12
|
|
13
13
|
Injector.remove(@gems, {})
|
14
|
-
|
15
|
-
Installer.install(Bundler.root, Bundler.definition) if @options["install"]
|
14
|
+
Installer.install(Bundler.root, Bundler.definition)
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
data/lib/bundler/cli/update.rb
CHANGED
@@ -9,14 +9,18 @@ module Bundler
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def run
|
12
|
-
Bundler.ui.level = "
|
12
|
+
Bundler.ui.level = "warn" if options[:quiet]
|
13
|
+
|
14
|
+
update_bundler = options[:bundler]
|
15
|
+
|
16
|
+
Bundler.self_manager.update_bundler_and_restart_with_it_if_needed(update_bundler) if update_bundler
|
13
17
|
|
14
18
|
Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
|
15
19
|
|
16
20
|
sources = Array(options[:source])
|
17
21
|
groups = Array(options[:group]).map(&:to_sym)
|
18
22
|
|
19
|
-
full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !
|
23
|
+
full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !update_bundler
|
20
24
|
|
21
25
|
if full_update && !options[:all]
|
22
26
|
if Bundler.feature_flag.update_requires_all_flag?
|
@@ -27,9 +31,14 @@ module Bundler
|
|
27
31
|
raise InvalidOption, "Cannot specify --all along with specific options."
|
28
32
|
end
|
29
33
|
|
34
|
+
conservative = options[:conservative]
|
35
|
+
|
30
36
|
if full_update
|
31
|
-
|
32
|
-
|
37
|
+
if conservative
|
38
|
+
Bundler.definition(:conservative => conservative)
|
39
|
+
else
|
40
|
+
Bundler.definition(true)
|
41
|
+
end
|
33
42
|
else
|
34
43
|
unless Bundler.default_lockfile.exist?
|
35
44
|
raise GemfileLockNotFound, "This Bundle hasn't been installed yet. " \
|
@@ -43,8 +52,8 @@ module Bundler
|
|
43
52
|
end
|
44
53
|
|
45
54
|
Bundler.definition(:gems => gems, :sources => sources, :ruby => options[:ruby],
|
46
|
-
:
|
47
|
-
:bundler =>
|
55
|
+
:conservative => conservative,
|
56
|
+
:bundler => update_bundler)
|
48
57
|
end
|
49
58
|
|
50
59
|
Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options)
|
@@ -61,7 +70,7 @@ module Bundler
|
|
61
70
|
|
62
71
|
if locked_gems = Bundler.definition.locked_gems
|
63
72
|
previous_locked_info = locked_gems.specs.reduce({}) do |h, s|
|
64
|
-
h[s.name] = { :spec => s, :version => s.version, :source => s.source.
|
73
|
+
h[s.name] = { :spec => s, :version => s.version, :source => s.source.identifier }
|
65
74
|
h
|
66
75
|
end
|
67
76
|
end
|
@@ -90,7 +99,7 @@ module Bundler
|
|
90
99
|
end
|
91
100
|
|
92
101
|
locked_source = locked_info[:source]
|
93
|
-
new_source = new_spec.source.
|
102
|
+
new_source = new_spec.source.identifier
|
94
103
|
next if locked_source != new_source
|
95
104
|
|
96
105
|
new_version = new_spec.version
|