bundler 2.1.1 → 2.2.0.rc.2
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 +1543 -1418
- data/README.md +6 -8
- data/bundler.gemspec +3 -3
- data/exe/bundle +3 -0
- data/lib/bundler.rb +21 -7
- data/lib/bundler/build_metadata.rb +3 -11
- data/lib/bundler/cli.rb +54 -20
- data/lib/bundler/cli/add.rb +1 -1
- data/lib/bundler/cli/cache.rb +1 -7
- data/lib/bundler/cli/clean.rb +1 -1
- data/lib/bundler/cli/common.rb +14 -0
- data/lib/bundler/cli/console.rb +1 -1
- data/lib/bundler/cli/doctor.rb +1 -1
- data/lib/bundler/cli/exec.rb +1 -1
- data/lib/bundler/cli/fund.rb +36 -0
- data/lib/bundler/cli/gem.rb +84 -11
- data/lib/bundler/cli/info.rb +15 -4
- data/lib/bundler/cli/init.rb +2 -2
- data/lib/bundler/cli/inject.rb +1 -1
- data/lib/bundler/cli/install.rb +12 -18
- data/lib/bundler/cli/issue.rb +2 -2
- data/lib/bundler/cli/list.rb +12 -10
- data/lib/bundler/cli/outdated.rb +89 -66
- data/lib/bundler/cli/plugin.rb +10 -0
- data/lib/bundler/cli/pristine.rb +5 -0
- data/lib/bundler/cli/show.rb +1 -1
- data/lib/bundler/cli/update.rb +2 -0
- data/lib/bundler/compact_index_client.rb +1 -1
- data/lib/bundler/compact_index_client/cache.rb +1 -1
- data/lib/bundler/definition.rb +51 -60
- data/lib/bundler/dep_proxy.rb +1 -1
- data/lib/bundler/dependency.rb +0 -9
- data/lib/bundler/dsl.rb +5 -9
- data/lib/bundler/endpoint_specification.rb +1 -1
- data/lib/bundler/environment_preserver.rb +26 -2
- data/lib/bundler/errors.rb +1 -0
- data/lib/bundler/feature_flag.rb +0 -2
- data/lib/bundler/fetcher.rb +4 -3
- data/lib/bundler/fetcher/base.rb +1 -1
- data/lib/bundler/fetcher/compact_index.rb +1 -1
- data/lib/bundler/fetcher/downloader.rb +1 -1
- data/lib/bundler/fetcher/index.rb +1 -1
- data/lib/bundler/friendly_errors.rb +7 -13
- data/lib/bundler/gem_helper.rb +33 -19
- data/lib/bundler/gem_helpers.rb +6 -1
- data/lib/bundler/gem_version_promoter.rb +2 -2
- data/lib/bundler/graph.rb +1 -1
- data/lib/bundler/index.rb +1 -1
- data/lib/bundler/injector.rb +15 -4
- data/lib/bundler/inline.rb +2 -2
- data/lib/bundler/installer.rb +30 -29
- data/lib/bundler/installer/gem_installer.rb +3 -3
- data/lib/bundler/installer/parallel_installer.rb +10 -10
- data/lib/bundler/installer/standalone.rb +2 -2
- data/lib/bundler/lazy_specification.rb +19 -6
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +1 -1
- data/lib/bundler/mirror.rb +2 -2
- data/lib/bundler/plugin.rb +30 -5
- data/lib/bundler/plugin/index.rb +10 -1
- data/lib/bundler/plugin/installer.rb +1 -1
- data/lib/bundler/plugin/installer/rubygems.rb +1 -1
- data/lib/bundler/plugin/source_list.rb +1 -1
- data/lib/bundler/psyched_yaml.rb +0 -15
- data/lib/bundler/remote_specification.rb +5 -2
- data/lib/bundler/resolver.rb +32 -9
- data/lib/bundler/resolver/spec_group.rb +27 -6
- data/lib/bundler/retry.rb +1 -1
- data/lib/bundler/ruby_version.rb +1 -1
- data/lib/bundler/rubygems_ext.rb +53 -9
- data/lib/bundler/rubygems_gem_installer.rb +3 -9
- data/lib/bundler/rubygems_integration.rb +23 -54
- data/lib/bundler/runtime.rb +4 -14
- data/lib/bundler/settings.rb +49 -45
- data/lib/bundler/shared_helpers.rb +2 -2
- data/lib/bundler/similarity_detector.rb +1 -1
- data/lib/bundler/source.rb +1 -1
- data/lib/bundler/source/git.rb +5 -5
- data/lib/bundler/source/git/git_proxy.rb +56 -59
- data/lib/bundler/source/path.rb +7 -3
- data/lib/bundler/source/path/installer.rb +8 -10
- data/lib/bundler/source/rubygems.rb +13 -16
- data/lib/bundler/source/rubygems/remote.rb +1 -1
- data/lib/bundler/source_list.rb +2 -2
- data/lib/bundler/spec_set.rb +1 -1
- data/lib/bundler/stub_specification.rb +17 -5
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
- data/lib/bundler/templates/newgem/Gemfile.tt +9 -1
- data/lib/bundler/templates/newgem/README.md.tt +1 -1
- data/lib/bundler/templates/newgem/Rakefile.tt +19 -5
- data/lib/bundler/templates/newgem/bin/console.tt +1 -0
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +18 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +2 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +8 -6
- data/lib/bundler/templates/newgem/rubocop.yml.tt +10 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
- data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +2 -0
- data/lib/bundler/templates/newgem/test/{test_helper.rb.tt → minitest/test_helper.rb.tt} +2 -0
- data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
- data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
- data/lib/bundler/ui/shell.rb +5 -5
- data/lib/bundler/uri_credentials_filter.rb +1 -1
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +79 -212
- data/lib/bundler/vendor/thor/lib/thor.rb +0 -7
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
- data/lib/bundler/vendor/thor/lib/thor/base.rb +9 -0
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +0 -7
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +1 -1
- data/lib/bundler/yaml_serializer.rb +1 -1
- data/man/bundle-add.1 +1 -1
- data/man/{bundle-add.ronn → bundle-add.1.ronn} +0 -0
- data/man/bundle-binstubs.1 +5 -3
- data/man/{bundle-binstubs.ronn → bundle-binstubs.1.ronn} +2 -4
- data/man/bundle-cache.1 +1 -1
- data/man/{bundle-cache.ronn → bundle-cache.1.ronn} +0 -0
- data/man/bundle-check.1 +1 -1
- data/man/{bundle-check.ronn → bundle-check.1.ronn} +0 -0
- data/man/bundle-clean.1 +1 -1
- data/man/{bundle-clean.ronn → bundle-clean.1.ronn} +0 -0
- data/man/bundle-config.1 +16 -22
- data/man/{bundle-config.ronn → bundle-config.1.ronn} +19 -22
- data/man/bundle-doctor.1 +1 -1
- data/man/{bundle-doctor.ronn → bundle-doctor.1.ronn} +0 -0
- data/man/bundle-exec.1 +1 -1
- data/man/{bundle-exec.ronn → bundle-exec.1.ronn} +0 -0
- data/man/bundle-gem.1 +25 -3
- data/man/{bundle-gem.ronn → bundle-gem.1.ronn} +30 -7
- data/man/bundle-info.1 +1 -1
- data/man/{bundle-info.ronn → bundle-info.1.ronn} +0 -0
- data/man/bundle-init.1 +1 -1
- data/man/{bundle-init.ronn → bundle-init.1.ronn} +0 -0
- data/man/bundle-inject.1 +1 -1
- data/man/{bundle-inject.ronn → bundle-inject.1.ronn} +0 -0
- data/man/bundle-install.1 +29 -2
- data/man/{bundle-install.ronn → bundle-install.1.ronn} +24 -2
- data/man/bundle-list.1 +7 -7
- data/man/{bundle-list.ronn → bundle-list.1.ronn} +6 -6
- data/man/bundle-lock.1 +1 -1
- data/man/{bundle-lock.ronn → bundle-lock.1.ronn} +0 -0
- data/man/bundle-open.1 +1 -1
- data/man/{bundle-open.ronn → bundle-open.1.ronn} +0 -0
- data/man/bundle-outdated.1 +1 -1
- data/man/{bundle-outdated.ronn → bundle-outdated.1.ronn} +0 -0
- data/man/bundle-platform.1 +1 -1
- data/man/{bundle-platform.ronn → bundle-platform.1.ronn} +0 -0
- data/man/bundle-pristine.1 +1 -1
- data/man/{bundle-pristine.ronn → bundle-pristine.1.ronn} +0 -0
- data/man/bundle-remove.1 +1 -1
- data/man/{bundle-remove.ronn → bundle-remove.1.ronn} +0 -0
- data/man/bundle-show.1 +1 -1
- data/man/{bundle-show.ronn → bundle-show.1.ronn} +0 -0
- data/man/bundle-update.1 +1 -1
- data/man/{bundle-update.ronn → bundle-update.1.ronn} +0 -0
- data/man/bundle-viz.1 +1 -1
- data/man/{bundle-viz.ronn → bundle-viz.1.ronn} +0 -0
- data/man/bundle.1 +1 -1
- data/man/{bundle.ronn → bundle.1.ronn} +0 -0
- data/man/gemfile.5 +4 -4
- data/man/gemfile.5.ronn +4 -4
- metadata +39 -58
- data/man/bundle-add.1.txt +0 -58
- data/man/bundle-binstubs.1.txt +0 -48
- data/man/bundle-cache.1.txt +0 -78
- data/man/bundle-check.1.txt +0 -33
- data/man/bundle-clean.1.txt +0 -26
- data/man/bundle-config.1.txt +0 -528
- data/man/bundle-doctor.1.txt +0 -44
- data/man/bundle-exec.1.txt +0 -178
- data/man/bundle-gem.1.txt +0 -91
- data/man/bundle-info.1.txt +0 -21
- data/man/bundle-init.1.txt +0 -34
- data/man/bundle-inject.1.txt +0 -32
- data/man/bundle-install.1.txt +0 -401
- data/man/bundle-list.1.txt +0 -43
- data/man/bundle-lock.1.txt +0 -93
- data/man/bundle-open.1.txt +0 -29
- data/man/bundle-outdated.1.txt +0 -131
- data/man/bundle-platform.1.txt +0 -57
- data/man/bundle-pristine.1.txt +0 -44
- data/man/bundle-remove.1.txt +0 -34
- data/man/bundle-show.1.txt +0 -27
- data/man/bundle-update.1.txt +0 -390
- data/man/bundle-viz.1.txt +0 -39
- data/man/bundle.1.txt +0 -116
- data/man/gemfile.5.txt +0 -649
- data/man/index.txt +0 -25
data/lib/bundler/cli/gem.rb
CHANGED
@@ -12,6 +12,7 @@ module Bundler
|
|
12
12
|
TEST_FRAMEWORK_VERSIONS = {
|
13
13
|
"rspec" => "3.0",
|
14
14
|
"minitest" => "5.0",
|
15
|
+
"test-unit" => "3.0",
|
15
16
|
}.freeze
|
16
17
|
|
17
18
|
attr_reader :options, :gem_name, :thor, :name, :target
|
@@ -62,7 +63,7 @@ module Bundler
|
|
62
63
|
ensure_safe_gem_name(name, constant_array)
|
63
64
|
|
64
65
|
templates = {
|
65
|
-
"
|
66
|
+
"#{Bundler.preferred_gemfile_name}.tt" => Bundler.preferred_gemfile_name,
|
66
67
|
"lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb",
|
67
68
|
"lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb",
|
68
69
|
"newgem.gemspec.tt" => "#{name}.gemspec",
|
@@ -83,8 +84,6 @@ module Bundler
|
|
83
84
|
config[:test] = test_framework
|
84
85
|
config[:test_framework_version] = TEST_FRAMEWORK_VERSIONS[test_framework]
|
85
86
|
|
86
|
-
templates.merge!("travis.yml.tt" => ".travis.yml")
|
87
|
-
|
88
87
|
case test_framework
|
89
88
|
when "rspec"
|
90
89
|
templates.merge!(
|
@@ -92,15 +91,33 @@ module Bundler
|
|
92
91
|
"spec/spec_helper.rb.tt" => "spec/spec_helper.rb",
|
93
92
|
"spec/newgem_spec.rb.tt" => "spec/#{namespaced_path}_spec.rb"
|
94
93
|
)
|
94
|
+
config[:test_task] = :spec
|
95
95
|
when "minitest"
|
96
96
|
templates.merge!(
|
97
|
-
"test/test_helper.rb.tt" => "test/test_helper.rb",
|
98
|
-
"test/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb"
|
97
|
+
"test/minitest/test_helper.rb.tt" => "test/test_helper.rb",
|
98
|
+
"test/minitest/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb"
|
99
|
+
)
|
100
|
+
config[:test_task] = :test
|
101
|
+
when "test-unit"
|
102
|
+
templates.merge!(
|
103
|
+
"test/test-unit/test_helper.rb.tt" => "test/test_helper.rb",
|
104
|
+
"test/test-unit/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb"
|
99
105
|
)
|
106
|
+
config[:test_task] = :test
|
100
107
|
end
|
101
108
|
end
|
102
109
|
|
103
|
-
config[:
|
110
|
+
config[:ci] = ask_and_set_ci
|
111
|
+
case config[:ci]
|
112
|
+
when "github"
|
113
|
+
templates.merge!("github/workflows/main.yml.tt" => ".github/workflows/main.yml")
|
114
|
+
when "travis"
|
115
|
+
templates.merge!("travis.yml.tt" => ".travis.yml")
|
116
|
+
when "gitlab"
|
117
|
+
templates.merge!("gitlab-ci.yml.tt" => ".gitlab-ci.yml")
|
118
|
+
when "circle"
|
119
|
+
templates.merge!("circleci/config.yml.tt" => ".circleci/config.yml")
|
120
|
+
end
|
104
121
|
|
105
122
|
if ask_and_set(:mit, "Do you want to license your code permissively under the MIT license?",
|
106
123
|
"This means that any other developer or company will be legally allowed to use your code " \
|
@@ -124,6 +141,16 @@ module Bundler
|
|
124
141
|
templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md")
|
125
142
|
end
|
126
143
|
|
144
|
+
if ask_and_set(:rubocop, "Do you want to add rubocop as a dependency for gems you generate?",
|
145
|
+
"RuboCop is a static code analyzer that has out-of-the-box rules for many " \
|
146
|
+
"of the guidelines in the community style guide. " \
|
147
|
+
"For more information, see the RuboCop docs (https://docs.rubocop.org/en/stable/) " \
|
148
|
+
"and the Ruby Style Guides (https://github.com/rubocop-hq/ruby-style-guide).")
|
149
|
+
config[:rubocop] = true
|
150
|
+
Bundler.ui.info "RuboCop enabled in config"
|
151
|
+
templates.merge!("rubocop.yml.tt" => ".rubocop.yml")
|
152
|
+
end
|
153
|
+
|
127
154
|
templates.merge!("exe/newgem.tt" => "exe/#{name}") if config[:exe]
|
128
155
|
|
129
156
|
if options[:ext]
|
@@ -165,7 +192,7 @@ module Bundler
|
|
165
192
|
raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.")
|
166
193
|
end
|
167
194
|
|
168
|
-
|
195
|
+
private
|
169
196
|
|
170
197
|
def resolve_name(name)
|
171
198
|
SharedHelpers.pwd.join(name).basename.to_s
|
@@ -197,11 +224,12 @@ module Bundler
|
|
197
224
|
def ask_and_set_test_framework
|
198
225
|
test_framework = options[:test] || Bundler.settings["gem.test"]
|
199
226
|
|
200
|
-
if test_framework.
|
227
|
+
if test_framework.to_s.empty?
|
201
228
|
Bundler.ui.confirm "Do you want to generate tests with your gem?"
|
202
|
-
|
203
|
-
|
204
|
-
|
229
|
+
Bundler.ui.info hint_text("test")
|
230
|
+
|
231
|
+
result = Bundler.ui.ask "Enter a test framework. rspec/minitest/test-unit/(none):"
|
232
|
+
if result =~ /rspec|minitest|test-unit/
|
205
233
|
test_framework = result
|
206
234
|
else
|
207
235
|
test_framework = false
|
@@ -212,9 +240,54 @@ module Bundler
|
|
212
240
|
Bundler.settings.set_global("gem.test", test_framework)
|
213
241
|
end
|
214
242
|
|
243
|
+
if options[:test] == Bundler.settings["gem.test"]
|
244
|
+
Bundler.ui.info "#{options[:test]} is already configured, ignoring --test flag."
|
245
|
+
end
|
246
|
+
|
215
247
|
test_framework
|
216
248
|
end
|
217
249
|
|
250
|
+
def hint_text(setting)
|
251
|
+
if Bundler.settings["gem.#{setting}"] == false
|
252
|
+
"Your choice will only be applied to this gem."
|
253
|
+
else
|
254
|
+
"Future `bundle gem` calls will use your choice. " \
|
255
|
+
"This setting can be changed anytime with `bundle config gem.#{setting}`."
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
def ask_and_set_ci
|
260
|
+
ci_template = options[:ci] || Bundler.settings["gem.ci"]
|
261
|
+
|
262
|
+
if ci_template.to_s.empty?
|
263
|
+
Bundler.ui.confirm "Do you want to set up continuous integration for your gem? " \
|
264
|
+
"Supported services:\n" \
|
265
|
+
"* CircleCI: https://circleci.com/\n" \
|
266
|
+
"* GitHub Actions: https://github.com/features/actions\n" \
|
267
|
+
"* GitLab CI: https://docs.gitlab.com/ee/ci/\n" \
|
268
|
+
"* Travis CI: https://travis-ci.org/\n" \
|
269
|
+
"\n"
|
270
|
+
Bundler.ui.info hint_text("ci")
|
271
|
+
|
272
|
+
result = Bundler.ui.ask "Enter a CI service. github/travis/gitlab/circle/(none):"
|
273
|
+
if result =~ /github|travis|gitlab|circle/
|
274
|
+
ci_template = result
|
275
|
+
else
|
276
|
+
ci_template = false
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
if Bundler.settings["gem.ci"].nil?
|
281
|
+
Bundler.settings.set_global("gem.ci", ci_template)
|
282
|
+
end
|
283
|
+
|
284
|
+
if options[:ci] == Bundler.settings["gem.ci"]
|
285
|
+
Bundler.ui.info "#{options[:ci]} is already configured, ignoring --ci flag."
|
286
|
+
end
|
287
|
+
|
288
|
+
ci_template
|
289
|
+
end
|
290
|
+
|
218
291
|
def bundler_dependency_version
|
219
292
|
v = Gem::Version.new(Bundler::VERSION)
|
220
293
|
req = v.segments[0..1]
|
data/lib/bundler/cli/info.rb
CHANGED
@@ -22,7 +22,7 @@ module Bundler
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
private
|
26
26
|
|
27
27
|
def spec_for_gem(gem_name)
|
28
28
|
spec = Bundler.definition.specs.find {|s| s.name == gem_name }
|
@@ -40,20 +40,31 @@ module Bundler
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def print_gem_path(spec)
|
43
|
-
|
44
|
-
File.expand_path("../../../..", __FILE__)
|
43
|
+
if spec.name == "bundler"
|
44
|
+
path = File.expand_path("../../../..", __FILE__)
|
45
45
|
else
|
46
|
-
spec.full_gem_path
|
46
|
+
path = spec.full_gem_path
|
47
|
+
unless File.directory?(path)
|
48
|
+
return Bundler.ui.warn "The gem #{gem_name} has been deleted. It was installed at: #{path}"
|
49
|
+
end
|
47
50
|
end
|
48
51
|
|
49
52
|
Bundler.ui.info path
|
50
53
|
end
|
51
54
|
|
52
55
|
def print_gem_info(spec)
|
56
|
+
metadata = spec.metadata
|
53
57
|
gem_info = String.new
|
54
58
|
gem_info << " * #{spec.name} (#{spec.version}#{spec.git_version})\n"
|
55
59
|
gem_info << "\tSummary: #{spec.summary}\n" if spec.summary
|
56
60
|
gem_info << "\tHomepage: #{spec.homepage}\n" if spec.homepage
|
61
|
+
gem_info << "\tDocumentation: #{metadata["documentation_uri"]}\n" if metadata.key?("documentation_uri")
|
62
|
+
gem_info << "\tSource Code: #{metadata["source_code_uri"]}\n" if metadata.key?("source_code_uri")
|
63
|
+
gem_info << "\tFunding: #{metadata["funding_uri"]}\n" if metadata.key?("funding_uri")
|
64
|
+
gem_info << "\tWiki: #{metadata["wiki_uri"]}\n" if metadata.key?("wiki_uri")
|
65
|
+
gem_info << "\tChangelog: #{metadata["changelog_uri"]}\n" if metadata.key?("changelog_uri")
|
66
|
+
gem_info << "\tBug Tracker: #{metadata["bug_tracker_uri"]}\n" if metadata.key?("bug_tracker_uri")
|
67
|
+
gem_info << "\tMailing List: #{metadata["mailing_list_uri"]}\n" if metadata.key?("mailing_list_uri")
|
57
68
|
gem_info << "\tPath: #{spec.full_gem_path}\n"
|
58
69
|
gem_info << "\tDefault Gem: yes" if spec.respond_to?(:default_gem?) && spec.default_gem?
|
59
70
|
Bundler.ui.info gem_info
|
data/lib/bundler/cli/init.rb
CHANGED
@@ -38,10 +38,10 @@ module Bundler
|
|
38
38
|
puts "Writing new #{gemfile} to #{SharedHelpers.pwd}/#{gemfile}"
|
39
39
|
end
|
40
40
|
|
41
|
-
|
41
|
+
private
|
42
42
|
|
43
43
|
def gemfile
|
44
|
-
@gemfile ||= Bundler.
|
44
|
+
@gemfile ||= Bundler.preferred_gemfile_name
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
data/lib/bundler/cli/inject.rb
CHANGED
data/lib/bundler/cli/install.rb
CHANGED
@@ -12,8 +12,6 @@ module Bundler
|
|
12
12
|
|
13
13
|
warn_if_root
|
14
14
|
|
15
|
-
normalize_groups
|
16
|
-
|
17
15
|
Bundler::SharedHelpers.set_env "RB_USER_INSTALL", "1" if Bundler::FREEBSD
|
18
16
|
|
19
17
|
# Disable color in deployment mode
|
@@ -38,7 +36,8 @@ module Bundler
|
|
38
36
|
if Bundler.feature_flag.deployment_means_frozen?
|
39
37
|
Bundler.settings.set_command_option :deployment, true
|
40
38
|
else
|
41
|
-
Bundler.settings.set_command_option :
|
39
|
+
Bundler.settings.set_command_option :deployment, true if options[:deployment]
|
40
|
+
Bundler.settings.set_command_option :frozen, true if options[:frozen]
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
@@ -54,7 +53,7 @@ module Bundler
|
|
54
53
|
|
55
54
|
if options["binstubs"]
|
56
55
|
Bundler::SharedHelpers.major_deprecation 2,
|
57
|
-
"The --binstubs option will be removed in favor of `bundle binstubs`"
|
56
|
+
"The --binstubs option will be removed in favor of `bundle binstubs --all`"
|
58
57
|
end
|
59
58
|
|
60
59
|
Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
|
@@ -83,6 +82,8 @@ module Bundler
|
|
83
82
|
require_relative "clean"
|
84
83
|
Bundler::CLI::Clean.new(options).run
|
85
84
|
end
|
85
|
+
|
86
|
+
Bundler::CLI::Common.output_fund_metadata_summary
|
86
87
|
rescue GemNotFound, VersionConflict => e
|
87
88
|
if options[:local] && Bundler.app_cache.exist?
|
88
89
|
Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory."
|
@@ -101,7 +102,7 @@ module Bundler
|
|
101
102
|
raise e
|
102
103
|
end
|
103
104
|
|
104
|
-
|
105
|
+
private
|
105
106
|
|
106
107
|
def warn_if_root
|
107
108
|
return if Bundler.settings[:silence_root_warning] || Bundler::WINDOWS || !Process.uid.zero?
|
@@ -151,25 +152,24 @@ module Bundler
|
|
151
152
|
|
152
153
|
check_for_group_conflicts_in_cli_options
|
153
154
|
|
154
|
-
Bundler.settings.set_command_option :with, nil if options[:with] == []
|
155
|
-
Bundler.settings.set_command_option :without, nil if options[:without] == []
|
156
|
-
|
157
155
|
with = options.fetch(:with, [])
|
158
156
|
with |= Bundler.settings[:with].map(&:to_s)
|
159
157
|
with -= options[:without] if options[:without]
|
158
|
+
with = nil if options[:with] == []
|
160
159
|
|
161
160
|
without = options.fetch(:without, [])
|
162
161
|
without |= Bundler.settings[:without].map(&:to_s)
|
163
162
|
without -= options[:with] if options[:with]
|
163
|
+
without = nil if options[:without] == []
|
164
164
|
|
165
|
-
|
166
|
-
|
165
|
+
Bundler.settings.set_command_option :without, without
|
166
|
+
Bundler.settings.set_command_option :with, with
|
167
167
|
end
|
168
168
|
|
169
169
|
def normalize_settings
|
170
170
|
Bundler.settings.set_command_option :path, nil if options[:system]
|
171
171
|
Bundler.settings.temporary(:path_relative_to_cwd => false) do
|
172
|
-
Bundler.settings.set_command_option :path, "vendor/bundle" if
|
172
|
+
Bundler.settings.set_command_option :path, "vendor/bundle" if Bundler.settings[:deployment] && Bundler.settings[:path].nil?
|
173
173
|
end
|
174
174
|
Bundler.settings.set_command_option_if_given :path, options[:path]
|
175
175
|
Bundler.settings.temporary(:path_relative_to_cwd => false) do
|
@@ -190,13 +190,7 @@ module Bundler
|
|
190
190
|
|
191
191
|
Bundler.settings.set_command_option_if_given :clean, options["clean"]
|
192
192
|
|
193
|
-
|
194
|
-
# need to nil them out first to get around validation for backwards compatibility
|
195
|
-
Bundler.settings.set_command_option :without, nil
|
196
|
-
Bundler.settings.set_command_option :with, nil
|
197
|
-
Bundler.settings.set_command_option :without, options[:without] - options[:with]
|
198
|
-
Bundler.settings.set_command_option :with, options[:with]
|
199
|
-
end
|
193
|
+
normalize_groups if options[:without] || options[:with]
|
200
194
|
|
201
195
|
options[:force] = options[:redownload]
|
202
196
|
end
|
data/lib/bundler/cli/issue.rb
CHANGED
@@ -10,7 +10,7 @@ module Bundler
|
|
10
10
|
be sure to check out these resources:
|
11
11
|
|
12
12
|
1. Check out our troubleshooting guide for quick fixes to common issues:
|
13
|
-
https://github.com/
|
13
|
+
https://github.com/rubygems/rubygems/blob/master/bundler/doc/TROUBLESHOOTING.md
|
14
14
|
|
15
15
|
2. Instructions for common Bundler uses can be found on the documentation
|
16
16
|
site: https://bundler.io/
|
@@ -22,7 +22,7 @@ module Bundler
|
|
22
22
|
still aren't working the way you expect them to, please let us know so
|
23
23
|
that we can diagnose and help fix the problem you're having. Please
|
24
24
|
view the Filing Issues guide for more information:
|
25
|
-
https://github.com/
|
25
|
+
https://github.com/rubygems/rubygems/blob/master/bundler/doc/contributing/ISSUES.md
|
26
26
|
|
27
27
|
EOS
|
28
28
|
|
data/lib/bundler/cli/list.rb
CHANGED
@@ -4,14 +4,16 @@ module Bundler
|
|
4
4
|
class CLI::List
|
5
5
|
def initialize(options)
|
6
6
|
@options = options
|
7
|
+
@without_group = options["without-group"].map(&:to_sym)
|
8
|
+
@only_group = options["only-group"].map(&:to_sym)
|
7
9
|
end
|
8
10
|
|
9
11
|
def run
|
10
|
-
raise InvalidOption, "The `--only-group` and `--without-group` options cannot be used together" if @
|
12
|
+
raise InvalidOption, "The `--only-group` and `--without-group` options cannot be used together" if @only_group.any? && @without_group.any?
|
11
13
|
|
12
14
|
raise InvalidOption, "The `--name-only` and `--paths` options cannot be used together" if @options["name-only"] && @options[:paths]
|
13
15
|
|
14
|
-
specs = if @
|
16
|
+
specs = if @only_group.any? || @without_group.any?
|
15
17
|
filtered_specs_by_groups
|
16
18
|
else
|
17
19
|
Bundler.load.specs
|
@@ -29,12 +31,12 @@ module Bundler
|
|
29
31
|
Bundler.ui.info "Use `bundle info` to print more detailed information about a gem"
|
30
32
|
end
|
31
33
|
|
32
|
-
|
34
|
+
private
|
33
35
|
|
34
36
|
def verify_group_exists(groups)
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
(@without_group + @only_group).each do |group|
|
38
|
+
raise InvalidOption, "`#{group}` group could not be found." unless groups.include?(group)
|
39
|
+
end
|
38
40
|
end
|
39
41
|
|
40
42
|
def filtered_specs_by_groups
|
@@ -44,10 +46,10 @@ module Bundler
|
|
44
46
|
verify_group_exists(groups)
|
45
47
|
|
46
48
|
show_groups =
|
47
|
-
if @
|
48
|
-
groups.reject {|g|
|
49
|
-
elsif @
|
50
|
-
groups.select {|g|
|
49
|
+
if @without_group.any?
|
50
|
+
groups.reject {|g| @without_group.include?(g) }
|
51
|
+
elsif @only_group.any?
|
52
|
+
groups.select {|g| @only_group.include?(g) }
|
51
53
|
else
|
52
54
|
groups
|
53
55
|
end.map(&:to_sym)
|
data/lib/bundler/cli/outdated.rb
CHANGED
@@ -3,18 +3,16 @@
|
|
3
3
|
module Bundler
|
4
4
|
class CLI::Outdated
|
5
5
|
attr_reader :options, :gems, :options_include_groups, :filter_options_patch, :sources, :strict
|
6
|
-
attr_accessor :
|
6
|
+
attr_accessor :outdated_gems
|
7
7
|
|
8
8
|
def initialize(options, gems)
|
9
9
|
@options = options
|
10
10
|
@gems = gems
|
11
11
|
@sources = Array(options[:source])
|
12
12
|
|
13
|
-
@filter_options_patch = options.keys &
|
14
|
-
%w[filter-major filter-minor filter-patch]
|
13
|
+
@filter_options_patch = options.keys & %w[filter-major filter-minor filter-patch]
|
15
14
|
|
16
|
-
@
|
17
|
-
@outdated_gems_list = []
|
15
|
+
@outdated_gems = []
|
18
16
|
|
19
17
|
@options_include_groups = [:group, :groups].any? do |v|
|
20
18
|
options.keys.include?(v.to_s)
|
@@ -22,8 +20,7 @@ module Bundler
|
|
22
20
|
|
23
21
|
# the patch level options imply strict is also true. It wouldn't make
|
24
22
|
# sense otherwise.
|
25
|
-
@strict = options["filter-strict"] ||
|
26
|
-
Bundler::CLI::Common.patch_level_options(options).any?
|
23
|
+
@strict = options["filter-strict"] || Bundler::CLI::Common.patch_level_options(options).any?
|
27
24
|
end
|
28
25
|
|
29
26
|
def run
|
@@ -76,86 +73,66 @@ module Bundler
|
|
76
73
|
end
|
77
74
|
|
78
75
|
specs.sort_by(&:name).each do |current_spec|
|
79
|
-
next
|
76
|
+
next unless gems.empty? || gems.include?(current_spec.name)
|
80
77
|
|
81
|
-
dependency = current_dependencies[current_spec.name]
|
82
78
|
active_spec = retrieve_active_spec(definition, current_spec)
|
79
|
+
next unless active_spec
|
83
80
|
|
84
|
-
next
|
85
|
-
next if filter_options_patch.any? &&
|
86
|
-
!update_present_via_semver_portions(current_spec, active_spec, options)
|
81
|
+
next unless filter_options_patch.empty? || update_present_via_semver_portions(current_spec, active_spec, options)
|
87
82
|
|
88
83
|
gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
|
89
84
|
next unless gem_outdated || (current_spec.git_version != active_spec.git_version)
|
90
|
-
|
85
|
+
|
86
|
+
dependency = current_dependencies[current_spec.name]
|
87
|
+
groups = ""
|
91
88
|
if dependency && !options[:parseable]
|
92
89
|
groups = dependency.groups.join(", ")
|
93
90
|
end
|
94
91
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
outdated_gems_by_groups[groups] << outdated_gems_list[-1]
|
92
|
+
outdated_gems << {
|
93
|
+
:active_spec => active_spec,
|
94
|
+
:current_spec => current_spec,
|
95
|
+
:dependency => dependency,
|
96
|
+
:groups => groups,
|
97
|
+
}
|
102
98
|
end
|
103
99
|
|
104
|
-
if
|
105
|
-
display_nothing_outdated_message
|
106
|
-
else
|
100
|
+
if outdated_gems.empty?
|
107
101
|
unless options[:parseable]
|
108
|
-
Bundler.ui.info(
|
102
|
+
Bundler.ui.info(nothing_outdated_message)
|
109
103
|
end
|
110
|
-
|
104
|
+
else
|
111
105
|
if options_include_groups
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
contains_group = if groups
|
116
|
-
groups.split(", ").include?(options[:group])
|
117
|
-
else
|
118
|
-
options[:group] == "group"
|
119
|
-
end
|
106
|
+
relevant_outdated_gems = outdated_gems.group_by {|g| g[:groups] }.sort.flat_map do |groups, gems|
|
107
|
+
contains_group = groups.split(", ").include?(options[:group])
|
108
|
+
next unless options[:groups] || contains_group
|
120
109
|
|
121
|
-
|
110
|
+
gems
|
111
|
+
end.compact
|
122
112
|
|
123
|
-
|
124
|
-
|
113
|
+
if options[:parseable]
|
114
|
+
relevant_outdated_gems.each do |gems|
|
115
|
+
print_gems(gems)
|
125
116
|
end
|
126
|
-
|
127
|
-
|
117
|
+
else
|
118
|
+
print_gems_table(relevant_outdated_gems)
|
128
119
|
end
|
120
|
+
elsif options[:parseable]
|
121
|
+
print_gems(outdated_gems)
|
129
122
|
else
|
130
|
-
|
123
|
+
print_gems_table(outdated_gems)
|
131
124
|
end
|
132
125
|
|
133
126
|
exit 1
|
134
127
|
end
|
135
128
|
end
|
136
129
|
|
137
|
-
|
130
|
+
private
|
138
131
|
|
139
132
|
def groups_text(group_text, groups)
|
140
133
|
"#{group_text}#{groups.split(",").size > 1 ? "s" : ""} \"#{groups}\""
|
141
134
|
end
|
142
135
|
|
143
|
-
def header_outdated_message
|
144
|
-
if options[:pre]
|
145
|
-
"Outdated gems included in the bundle (including pre-releases):"
|
146
|
-
else
|
147
|
-
"Outdated gems included in the bundle:"
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
def header_group_message(groups)
|
152
|
-
if groups
|
153
|
-
"===== #{groups_text("Group", groups)} ====="
|
154
|
-
else
|
155
|
-
"===== Without group ====="
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
136
|
def nothing_outdated_message
|
160
137
|
if filter_options_patch.any?
|
161
138
|
display = filter_options_patch.map do |o|
|
@@ -169,6 +146,8 @@ module Bundler
|
|
169
146
|
end
|
170
147
|
|
171
148
|
def retrieve_active_spec(definition, current_spec)
|
149
|
+
return unless current_spec.match_platform(Bundler.local_platform)
|
150
|
+
|
172
151
|
if strict
|
173
152
|
active_spec = definition.find_resolved_spec(current_spec)
|
174
153
|
else
|
@@ -182,12 +161,6 @@ module Bundler
|
|
182
161
|
active_spec
|
183
162
|
end
|
184
163
|
|
185
|
-
def display_nothing_outdated_message
|
186
|
-
unless options[:parseable]
|
187
|
-
Bundler.ui.info(nothing_outdated_message)
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
164
|
def print_gems(gems_list)
|
192
165
|
gems_list.each do |gem|
|
193
166
|
print_gem(
|
@@ -199,6 +172,19 @@ module Bundler
|
|
199
172
|
end
|
200
173
|
end
|
201
174
|
|
175
|
+
def print_gems_table(gems_list)
|
176
|
+
data = gems_list.map do |gem|
|
177
|
+
gem_column_for(
|
178
|
+
gem[:current_spec],
|
179
|
+
gem[:active_spec],
|
180
|
+
gem[:dependency],
|
181
|
+
gem[:groups],
|
182
|
+
)
|
183
|
+
end
|
184
|
+
|
185
|
+
print_indented([table_header] + data)
|
186
|
+
end
|
187
|
+
|
202
188
|
def print_gem(current_spec, active_spec, dependency, groups)
|
203
189
|
spec_version = "#{active_spec.version}#{active_spec.git_version}"
|
204
190
|
spec_version += " (from #{active_spec.loaded_from})" if Bundler.ui.debug? && active_spec.loaded_from
|
@@ -213,7 +199,7 @@ module Bundler
|
|
213
199
|
|
214
200
|
output_message = if options[:parseable]
|
215
201
|
spec_outdated_info.to_s
|
216
|
-
elsif options_include_groups ||
|
202
|
+
elsif options_include_groups || groups.empty?
|
217
203
|
" * #{spec_outdated_info}"
|
218
204
|
else
|
219
205
|
" * #{spec_outdated_info} in #{groups_text("group", groups)}"
|
@@ -222,14 +208,22 @@ module Bundler
|
|
222
208
|
Bundler.ui.info output_message.rstrip
|
223
209
|
end
|
224
210
|
|
211
|
+
def gem_column_for(current_spec, active_spec, dependency, groups)
|
212
|
+
current_version = "#{current_spec.version}#{current_spec.git_version}"
|
213
|
+
spec_version = "#{active_spec.version}#{active_spec.git_version}"
|
214
|
+
dependency = dependency.requirement if dependency
|
215
|
+
|
216
|
+
ret_val = [active_spec.name, current_version, spec_version, dependency.to_s, groups.to_s]
|
217
|
+
ret_val << active_spec.loaded_from.to_s if Bundler.ui.debug?
|
218
|
+
ret_val
|
219
|
+
end
|
220
|
+
|
225
221
|
def check_for_deployment_mode!
|
226
222
|
return unless Bundler.frozen_bundle?
|
227
|
-
suggested_command = if Bundler.settings.locations("frozen")[:global]
|
223
|
+
suggested_command = if Bundler.settings.locations("frozen").keys.&([:global, :local]).any?
|
228
224
|
"bundle config unset frozen"
|
229
225
|
elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any?
|
230
226
|
"bundle config unset deployment"
|
231
|
-
else
|
232
|
-
"bundle install --no-deployment"
|
233
227
|
end
|
234
228
|
raise ProductionError, "You are trying to check outdated gems in " \
|
235
229
|
"deployment mode. Run `bundle outdated` elsewhere.\n" \
|
@@ -266,5 +260,34 @@ module Bundler
|
|
266
260
|
version_section = spec.version.segments[version_portion_index, 1]
|
267
261
|
version_section.to_a[0].to_i
|
268
262
|
end
|
263
|
+
|
264
|
+
def print_indented(matrix)
|
265
|
+
header = matrix[0]
|
266
|
+
data = matrix[1..-1]
|
267
|
+
|
268
|
+
column_sizes = Array.new(header.size) do |index|
|
269
|
+
matrix.max_by {|row| row[index].length }[index].length
|
270
|
+
end
|
271
|
+
|
272
|
+
Bundler.ui.info justify(header, column_sizes)
|
273
|
+
|
274
|
+
data.sort_by! {|row| row[0] }
|
275
|
+
|
276
|
+
data.each do |row|
|
277
|
+
Bundler.ui.info justify(row, column_sizes)
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
def table_header
|
282
|
+
header = ["Gem", "Current", "Latest", "Requested", "Groups"]
|
283
|
+
header << "Path" if Bundler.ui.debug?
|
284
|
+
header
|
285
|
+
end
|
286
|
+
|
287
|
+
def justify(row, sizes)
|
288
|
+
row.each_with_index.map do |element, index|
|
289
|
+
element.ljust(sizes[index])
|
290
|
+
end.join(" ").strip + "\n"
|
291
|
+
end
|
269
292
|
end
|
270
293
|
end
|