bundler 2.1.0 → 2.2.0.rc.1
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 +832 -738
- data/README.md +6 -8
- data/bundler.gemspec +3 -3
- data/exe/bundle +3 -0
- data/lib/bundler.rb +15 -4
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli.rb +32 -11
- data/lib/bundler/cli/console.rb +1 -1
- data/lib/bundler/cli/exec.rb +3 -12
- data/lib/bundler/cli/gem.rb +83 -10
- data/lib/bundler/cli/info.rb +13 -3
- data/lib/bundler/cli/init.rb +1 -1
- data/lib/bundler/cli/install.rb +8 -16
- data/lib/bundler/cli/issue.rb +2 -2
- data/lib/bundler/cli/list.rb +11 -9
- data/lib/bundler/cli/outdated.rb +88 -65
- data/lib/bundler/cli/plugin.rb +10 -0
- data/lib/bundler/cli/pristine.rb +5 -0
- data/lib/bundler/definition.rb +32 -32
- data/lib/bundler/dependency.rb +0 -9
- data/lib/bundler/dsl.rb +1 -5
- 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 +1 -0
- data/lib/bundler/friendly_errors.rb +4 -10
- data/lib/bundler/gem_helper.rb +18 -12
- data/lib/bundler/gem_version_promoter.rb +1 -1
- data/lib/bundler/injector.rb +14 -3
- data/lib/bundler/inline.rb +2 -2
- data/lib/bundler/installer.rb +29 -28
- data/lib/bundler/installer/gem_installer.rb +2 -2
- data/lib/bundler/installer/parallel_installer.rb +9 -9
- data/lib/bundler/lazy_specification.rb +16 -3
- data/lib/bundler/plugin.rb +26 -0
- data/lib/bundler/plugin/index.rb +9 -0
- data/lib/bundler/psyched_yaml.rb +0 -15
- data/lib/bundler/remote_specification.rb +4 -1
- data/lib/bundler/resolver.rb +31 -8
- data/lib/bundler/resolver/spec_group.rb +26 -5
- data/lib/bundler/rubygems_ext.rb +7 -8
- data/lib/bundler/rubygems_gem_installer.rb +1 -7
- data/lib/bundler/rubygems_integration.rb +13 -48
- data/lib/bundler/runtime.rb +2 -12
- data/lib/bundler/settings.rb +0 -3
- data/lib/bundler/setup.rb +5 -0
- data/lib/bundler/shared_helpers.rb +1 -1
- data/lib/bundler/source/git.rb +4 -4
- data/lib/bundler/source/git/git_proxy.rb +53 -58
- data/lib/bundler/source/path.rb +5 -1
- data/lib/bundler/source/path/installer.rb +7 -9
- data/lib/bundler/source/rubygems.rb +11 -14
- data/lib/bundler/stub_specification.rb +16 -4
- 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/Rakefile.tt +19 -5
- data/lib/bundler/templates/newgem/bin/console.tt +2 -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 +6 -4
- 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 -0
- 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/vendor/net-http-persistent/lib/net/http/persistent.rb +72 -208
- 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/version.rb +1 -1
- data/man/bundle-add.1 +1 -1
- data/man/bundle-add.1.txt +15 -15
- data/man/bundle-binstubs.1 +1 -1
- data/man/bundle-binstubs.1.txt +10 -10
- data/man/bundle-cache.1 +1 -1
- data/man/bundle-cache.1.txt +15 -15
- data/man/bundle-check.1 +1 -1
- data/man/bundle-check.1.txt +8 -8
- data/man/bundle-clean.1 +1 -1
- data/man/bundle-clean.1.txt +6 -6
- data/man/bundle-config.1 +3 -9
- data/man/bundle-config.1.txt +271 -272
- data/man/bundle-config.ronn +5 -9
- data/man/bundle-doctor.1 +1 -1
- data/man/bundle-doctor.1.txt +9 -9
- data/man/bundle-exec.1 +1 -1
- data/man/bundle-exec.1.txt +84 -81
- data/man/bundle-gem.1 +25 -3
- data/man/bundle-gem.1.txt +65 -39
- data/man/bundle-gem.ronn +30 -7
- data/man/bundle-info.1 +1 -1
- data/man/bundle-info.1.txt +2 -2
- data/man/bundle-init.1 +1 -1
- data/man/bundle-init.1.txt +9 -9
- data/man/bundle-inject.1 +1 -1
- data/man/bundle-inject.1.txt +4 -4
- data/man/bundle-install.1 +1 -1
- data/man/bundle-install.1.txt +169 -169
- data/man/bundle-list.1 +7 -7
- data/man/bundle-list.1.txt +12 -11
- data/man/bundle-list.ronn +6 -6
- data/man/bundle-lock.1 +1 -1
- data/man/bundle-lock.1.txt +28 -28
- data/man/bundle-open.1 +1 -1
- data/man/bundle-open.1.txt +3 -3
- data/man/bundle-outdated.1 +1 -1
- data/man/bundle-outdated.1.txt +34 -34
- data/man/bundle-platform.1 +1 -1
- data/man/bundle-platform.1.txt +16 -16
- data/man/bundle-pristine.1 +1 -1
- data/man/bundle-pristine.1.txt +8 -8
- data/man/bundle-remove.1 +1 -1
- data/man/bundle-remove.1.txt +9 -9
- data/man/bundle-show.1 +1 -1
- data/man/bundle-show.1.txt +8 -8
- data/man/bundle-update.1 +1 -1
- data/man/bundle-update.1.txt +149 -148
- data/man/bundle-viz.1 +1 -1
- data/man/bundle-viz.1.txt +11 -11
- data/man/bundle.1 +1 -1
- data/man/bundle.1.txt +31 -31
- data/man/gemfile.5 +1 -1
- data/man/gemfile.5.txt +218 -216
- metadata +14 -8
data/README.md
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
[![Version
|
2
|
-
[![
|
3
|
-
[![Inline docs ](https://inch-ci.org/github/bundler/bundler.svg?style=flat)](https://inch-ci.org/github/bundler/bundler)
|
4
|
-
[![Slack ](https://bundler-slackin.herokuapp.com/badge.svg)](https://bundler-slackin.herokuapp.com)
|
1
|
+
[![Version ](https://img.shields.io/gem/v/bundler.svg?style=flat)](https://rubygems.org/gems/bundler)
|
2
|
+
[![Slack ](https://bundler-slackin.herokuapp.com/badge.svg)](https://bundler-slackin.herokuapp.com)
|
5
3
|
|
6
4
|
# Bundler: a gem to bundle gems
|
7
5
|
|
@@ -44,9 +42,9 @@ To get in touch with the Bundler core team and other Bundler users, please see [
|
|
44
42
|
|
45
43
|
### Contributing
|
46
44
|
|
47
|
-
If you'd like to contribute to Bundler, that's awesome, and we <3 you. We've put together [the Bundler contributor guide](https://github.com/
|
45
|
+
If you'd like to contribute to Bundler, that's awesome, and we <3 you. We've put together [the Bundler contributor guide](https://github.com/rubygems/rubygems/blob/master/bundler/doc/contributing/README.md) with all of the information you need to get started.
|
48
46
|
|
49
|
-
If you'd like to request a substantial change to Bundler or
|
47
|
+
If you'd like to request a substantial change to Bundler or its documentation, refer to the [Bundler RFC process](https://github.com/bundler/rfcs) for more information.
|
50
48
|
|
51
49
|
While some Bundler contributors are compensated by Ruby Together, the project maintainers make decisions independent of Ruby Together. As a project, we welcome contributions regardless of the author's affiliation with Ruby Together.
|
52
50
|
|
@@ -57,8 +55,8 @@ While some Bundler contributors are compensated by Ruby Together, the project ma
|
|
57
55
|
|
58
56
|
### Code of Conduct
|
59
57
|
|
60
|
-
Everyone interacting in the Bundler project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [Bundler code of conduct](https://github.com/
|
58
|
+
Everyone interacting in the Bundler project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [Bundler code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).
|
61
59
|
|
62
60
|
### License
|
63
61
|
|
64
|
-
Bundler is available under an [MIT License](https://github.com/
|
62
|
+
Bundler is available under an [MIT License](https://github.com/rubygems/rubygems/blob/master/bundler/LICENSE.md).
|
data/bundler.gemspec
CHANGED
@@ -24,10 +24,10 @@ Gem::Specification.new do |s|
|
|
24
24
|
|
25
25
|
if s.respond_to?(:metadata=)
|
26
26
|
s.metadata = {
|
27
|
-
"bug_tracker_uri" => "https://github.com/
|
28
|
-
"changelog_uri" => "https://github.com/
|
27
|
+
"bug_tracker_uri" => "https://github.com/rubygems/rubygems/issues?q=is%3Aopen+is%3Aissue+label%3ABundler",
|
28
|
+
"changelog_uri" => "https://github.com/rubygems/rubygems/blob/master/bundler/CHANGELOG.md",
|
29
29
|
"homepage_uri" => "https://bundler.io/",
|
30
|
-
"source_code_uri" => "https://github.com/
|
30
|
+
"source_code_uri" => "https://github.com/rubygems/rubygems/",
|
31
31
|
}
|
32
32
|
end
|
33
33
|
|
data/exe/bundle
CHANGED
@@ -15,6 +15,9 @@ else
|
|
15
15
|
require "bundler"
|
16
16
|
end
|
17
17
|
|
18
|
+
# Workaround for non-activated bundler spec due to missing https://github.com/rubygems/rubygems/commit/4e306d7bcdee924b8d80ca9db6125aa59ee4e5a3
|
19
|
+
gem "bundler", Bundler::VERSION if Gem.rubygems_version < Gem::Version.new("2.6.2")
|
20
|
+
|
18
21
|
# Check if an older version of bundler is installed
|
19
22
|
$LOAD_PATH.each do |path|
|
20
23
|
next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9
|
data/lib/bundler.rb
CHANGED
@@ -34,9 +34,9 @@ require_relative "bundler/build_metadata"
|
|
34
34
|
# of loaded and required modules.
|
35
35
|
#
|
36
36
|
module Bundler
|
37
|
-
environment_preserver = EnvironmentPreserver.
|
37
|
+
environment_preserver = EnvironmentPreserver.from_env
|
38
38
|
ORIGINAL_ENV = environment_preserver.restore
|
39
|
-
|
39
|
+
environment_preserver.replace_with_backup
|
40
40
|
SUDO_MUTEX = Mutex.new
|
41
41
|
|
42
42
|
autoload :Definition, File.expand_path("bundler/definition", __dir__)
|
@@ -285,7 +285,13 @@ module Bundler
|
|
285
285
|
|
286
286
|
def app_config_path
|
287
287
|
if app_config = ENV["BUNDLE_APP_CONFIG"]
|
288
|
-
Pathname.new(app_config)
|
288
|
+
app_config_pathname = Pathname.new(app_config)
|
289
|
+
|
290
|
+
if app_config_pathname.absolute?
|
291
|
+
app_config_pathname
|
292
|
+
else
|
293
|
+
app_config_pathname.expand_path(root)
|
294
|
+
end
|
289
295
|
else
|
290
296
|
root.join(".bundle")
|
291
297
|
end
|
@@ -451,6 +457,10 @@ EOF
|
|
451
457
|
Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
|
452
458
|
end
|
453
459
|
|
460
|
+
def preferred_gemfile_name
|
461
|
+
Bundler.settings[:init_gems_rb] ? "gems.rb" : "Gemfile"
|
462
|
+
end
|
463
|
+
|
454
464
|
def use_system_gems?
|
455
465
|
configured_bundle_path.use_system_gems?
|
456
466
|
end
|
@@ -512,7 +522,8 @@ EOF
|
|
512
522
|
Your user account isn't allowed to install to the system RubyGems.
|
513
523
|
You can cancel this installation and run:
|
514
524
|
|
515
|
-
bundle
|
525
|
+
bundle config set --local path 'vendor/bundle'
|
526
|
+
bundle install
|
516
527
|
|
517
528
|
to install the gems into ./vendor/bundle/, or you can enter your password
|
518
529
|
and install the bundled gems to RubyGems using sudo.
|
@@ -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 = "
|
8
|
-
@git_commit_sha = "
|
7
|
+
@built_at = "2020-07-02".freeze
|
8
|
+
@git_commit_sha = "d15da3db73".freeze
|
9
9
|
@release = true
|
10
10
|
# end ivars
|
11
11
|
|
data/lib/bundler/cli.rb
CHANGED
@@ -122,16 +122,19 @@ module Bundler
|
|
122
122
|
else command = "bundle-#{cli}"
|
123
123
|
end
|
124
124
|
|
125
|
-
man_path
|
126
|
-
|
125
|
+
man_path = File.expand_path("../../../man", __FILE__)
|
126
|
+
# man files are located under ruby's mandir with the default gems of bundler
|
127
|
+
man_path = RbConfig::CONFIG["mandir"] unless File.directory?(man_path)
|
128
|
+
man_pages = Hash[Dir.glob(File.join(man_path, "**", "*")).grep(/.*\.\d*\Z/).collect do |f|
|
127
129
|
[File.basename(f, ".*"), f]
|
128
130
|
end]
|
129
131
|
|
130
132
|
if man_pages.include?(command)
|
133
|
+
man_page = man_pages[command]
|
131
134
|
if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
|
132
|
-
Kernel.exec "man #{
|
135
|
+
Kernel.exec "man #{man_page}"
|
133
136
|
else
|
134
|
-
puts File.read("#{
|
137
|
+
puts File.read("#{File.dirname(man_page)}/#{File.basename(man_page)}.txt")
|
135
138
|
end
|
136
139
|
elsif command_path = Bundler.which("bundler-#{cli}")
|
137
140
|
Kernel.exec(command_path, "--help")
|
@@ -247,10 +250,12 @@ module Bundler
|
|
247
250
|
def install
|
248
251
|
SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
|
249
252
|
|
250
|
-
%w[clean deployment frozen no-
|
253
|
+
%w[clean deployment frozen no-prune path shebang system without with].each do |option|
|
251
254
|
remembered_flag_deprecation(option)
|
252
255
|
end
|
253
256
|
|
257
|
+
remembered_negative_flag_deprecation("no-deployment")
|
258
|
+
|
254
259
|
require_relative "cli/install"
|
255
260
|
Bundler.settings.temporary(:no_install => false) do
|
256
261
|
Install.new(options.dup).run
|
@@ -342,8 +347,8 @@ module Bundler
|
|
342
347
|
|
343
348
|
desc "list", "List all gems in the bundle"
|
344
349
|
method_option "name-only", :type => :boolean, :banner => "print only the gem names"
|
345
|
-
method_option "only-group", :type => :
|
346
|
-
method_option "without-group", :type => :
|
350
|
+
method_option "only-group", :type => :array, :default => [], :banner => "print gems from a given set of groups"
|
351
|
+
method_option "without-group", :type => :array, :default => [], :banner => "print all gems except from a given set of groups"
|
347
352
|
method_option "paths", :type => :boolean, :banner => "print the path to each gem in the bundle"
|
348
353
|
def list
|
349
354
|
require_relative "cli/list"
|
@@ -567,8 +572,12 @@ module Bundler
|
|
567
572
|
method_option :ext, :type => :boolean, :default => false, :desc => "Generate the boilerplate for C extension code"
|
568
573
|
method_option :git, :type => :boolean, :default => true, :desc => "Initialize a git repo inside your library."
|
569
574
|
method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set gem.mit true`."
|
570
|
-
method_option :
|
571
|
-
|
575
|
+
method_option :rubocop, :type => :boolean, :desc => "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set gem.rubocop true`."
|
576
|
+
method_option :test, :type => :string, :lazy_default => Bundler.settings["gem.test"] || "", :aliases => "-t", :banner => "Use the specified test framework for your library",
|
577
|
+
:desc => "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set gem.test (rspec|minitest|test-unit)`."
|
578
|
+
method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "",
|
579
|
+
:desc => "Generate CI configuration, either GitHub Actions, Travis CI, GitLab CI or CircleCI. Set a default with `bundle config set gem.ci (github|travis|gitlab|circle)`"
|
580
|
+
|
572
581
|
def gem(name)
|
573
582
|
end
|
574
583
|
|
@@ -808,11 +817,23 @@ module Bundler
|
|
808
817
|
nil
|
809
818
|
end
|
810
819
|
|
820
|
+
def remembered_negative_flag_deprecation(name)
|
821
|
+
positive_name = name.gsub(/\Ano-/, "")
|
822
|
+
option = current_command.options[positive_name]
|
823
|
+
flag_name = "--no-" + option.switch_name.gsub(/\A--/, "")
|
824
|
+
|
825
|
+
flag_deprecation(positive_name, flag_name, option)
|
826
|
+
end
|
827
|
+
|
811
828
|
def remembered_flag_deprecation(name)
|
812
829
|
option = current_command.options[name]
|
813
830
|
flag_name = option.switch_name
|
814
831
|
|
815
|
-
|
832
|
+
flag_deprecation(name, flag_name, option)
|
833
|
+
end
|
834
|
+
|
835
|
+
def flag_deprecation(name, flag_name, option)
|
836
|
+
name_index = ARGV.find {|arg| flag_name == arg.split("=")[0] }
|
816
837
|
return unless name_index
|
817
838
|
|
818
839
|
value = options[name]
|
@@ -821,7 +842,7 @@ module Bundler
|
|
821
842
|
Bundler::SharedHelpers.major_deprecation 2,\
|
822
843
|
"The `#{flag_name}` flag is deprecated because it relies on being " \
|
823
844
|
"remembered across bundler invocations, which bundler will no longer " \
|
824
|
-
"do in future versions. Instead please use `bundle config set #{name} " \
|
845
|
+
"do in future versions. Instead please use `bundle config set #{name.tr("-", "_")} " \
|
825
846
|
"'#{value}'`, and stop using this flag"
|
826
847
|
end
|
827
848
|
end
|
data/lib/bundler/cli/console.rb
CHANGED
@@ -12,7 +12,7 @@ module Bundler
|
|
12
12
|
Bundler::SharedHelpers.major_deprecation 2, "bundle console will be replaced " \
|
13
13
|
"by `bin/console` generated by `bundle gem <name>`"
|
14
14
|
|
15
|
-
group ? Bundler.require(:default, *group.split.map!(&:to_sym)) : Bundler.require
|
15
|
+
group ? Bundler.require(:default, *group.split(" ").map!(&:to_sym)) : Bundler.require
|
16
16
|
ARGV.clear
|
17
17
|
|
18
18
|
console = get_console(Bundler.settings[:console] || "irb")
|
data/lib/bundler/cli/exec.rb
CHANGED
@@ -25,12 +25,12 @@ module Bundler
|
|
25
25
|
SharedHelpers.set_bundle_environment
|
26
26
|
if bin_path = Bundler.which(cmd)
|
27
27
|
if !Bundler.settings[:disable_exec_load] && ruby_shebang?(bin_path)
|
28
|
-
return
|
28
|
+
return kernel_load(bin_path, *args)
|
29
29
|
end
|
30
|
-
|
30
|
+
kernel_exec(bin_path, *args)
|
31
31
|
else
|
32
32
|
# exec using the given command
|
33
|
-
|
33
|
+
kernel_exec(cmd, *args)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -89,14 +89,5 @@ module Bundler
|
|
89
89
|
first_line = File.open(file, "rb") {|f| f.read(possibilities.map(&:size).max) }
|
90
90
|
possibilities.any? {|shebang| first_line.start_with?(shebang) }
|
91
91
|
end
|
92
|
-
|
93
|
-
def with_verbose_rubygems
|
94
|
-
old_ui = Gem::DefaultUserInteraction.ui
|
95
|
-
Gem::DefaultUserInteraction.ui = nil
|
96
|
-
|
97
|
-
yield
|
98
|
-
ensure
|
99
|
-
Gem::DefaultUserInteraction.ui = old_ui
|
100
|
-
end
|
101
92
|
end
|
102
93
|
end
|
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]
|
@@ -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
@@ -40,20 +40,30 @@ 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 << "\tWiki: #{metadata["wiki_uri"]}\n" if metadata.key?("wiki_uri")
|
64
|
+
gem_info << "\tChangelog: #{metadata["changelog_uri"]}\n" if metadata.key?("changelog_uri")
|
65
|
+
gem_info << "\tBug Tracker: #{metadata["bug_tracker_uri"]}\n" if metadata.key?("bug_tracker_uri")
|
66
|
+
gem_info << "\tMailing List: #{metadata["mailing_list_uri"]}\n" if metadata.key?("mailing_list_uri")
|
57
67
|
gem_info << "\tPath: #{spec.full_gem_path}\n"
|
58
68
|
gem_info << "\tDefault Gem: yes" if spec.respond_to?(:default_gem?) && spec.default_gem?
|
59
69
|
Bundler.ui.info gem_info
|
data/lib/bundler/cli/init.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
|
|
@@ -151,25 +150,24 @@ module Bundler
|
|
151
150
|
|
152
151
|
check_for_group_conflicts_in_cli_options
|
153
152
|
|
154
|
-
Bundler.settings.set_command_option :with, nil if options[:with] == []
|
155
|
-
Bundler.settings.set_command_option :without, nil if options[:without] == []
|
156
|
-
|
157
153
|
with = options.fetch(:with, [])
|
158
154
|
with |= Bundler.settings[:with].map(&:to_s)
|
159
155
|
with -= options[:without] if options[:without]
|
156
|
+
with = nil if options[:with] == []
|
160
157
|
|
161
158
|
without = options.fetch(:without, [])
|
162
159
|
without |= Bundler.settings[:without].map(&:to_s)
|
163
160
|
without -= options[:with] if options[:with]
|
161
|
+
without = nil if options[:without] == []
|
164
162
|
|
165
|
-
|
166
|
-
|
163
|
+
Bundler.settings.set_command_option :without, without
|
164
|
+
Bundler.settings.set_command_option :with, with
|
167
165
|
end
|
168
166
|
|
169
167
|
def normalize_settings
|
170
168
|
Bundler.settings.set_command_option :path, nil if options[:system]
|
171
169
|
Bundler.settings.temporary(:path_relative_to_cwd => false) do
|
172
|
-
Bundler.settings.set_command_option :path, "vendor/bundle" if
|
170
|
+
Bundler.settings.set_command_option :path, "vendor/bundle" if Bundler.settings[:deployment] && Bundler.settings[:path].nil?
|
173
171
|
end
|
174
172
|
Bundler.settings.set_command_option_if_given :path, options[:path]
|
175
173
|
Bundler.settings.temporary(:path_relative_to_cwd => false) do
|
@@ -190,13 +188,7 @@ module Bundler
|
|
190
188
|
|
191
189
|
Bundler.settings.set_command_option_if_given :clean, options["clean"]
|
192
190
|
|
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
|
191
|
+
normalize_groups if options[:without] || options[:with]
|
200
192
|
|
201
193
|
options[:force] = options[:redownload]
|
202
194
|
end
|