bundler 2.2.3 → 2.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +503 -7
- 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 +2 -1
- data/lib/bundler/cli/check.rb +4 -2
- data/lib/bundler/cli/common.rb +15 -2
- data/lib/bundler/cli/doctor.rb +15 -4
- data/lib/bundler/cli/exec.rb +1 -6
- data/lib/bundler/cli/gem.rb +132 -24
- 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/remove.rb +1 -2
- data/lib/bundler/cli/update.rb +17 -8
- data/lib/bundler/cli.rb +44 -60
- data/lib/bundler/compact_index_client/cache.rb +0 -9
- data/lib/bundler/compact_index_client/updater.rb +10 -19
- data/lib/bundler/compact_index_client.rb +2 -8
- data/lib/bundler/current_ruby.rb +5 -4
- data/lib/bundler/definition.rb +158 -316
- data/lib/bundler/dep_proxy.rb +15 -8
- 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/environment_preserver.rb +4 -1
- data/lib/bundler/errors.rb +19 -3
- data/lib/bundler/feature_flag.rb +0 -5
- 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 -17
- data/lib/bundler/friendly_errors.rb +5 -32
- data/lib/bundler/gem_helper.rb +28 -21
- data/lib/bundler/gem_version_promoter.rb +2 -2
- data/lib/bundler/index.rb +8 -12
- 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 +29 -9
- data/lib/bundler/installer.rb +8 -34
- data/lib/bundler/lazy_specification.rb +32 -20
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +16 -45
- data/{man → lib/bundler/man}/bundle-add.1 +10 -2
- data/lib/bundler/man/bundle-add.1.ronn +7 -1
- data/{man → lib/bundler/man}/bundle-binstubs.1 +1 -1
- data/{man → lib/bundler/man}/bundle-cache.1 +1 -1
- data/{man → lib/bundler/man}/bundle-check.1 +1 -1
- data/{man → lib/bundler/man}/bundle-clean.1 +1 -1
- data/{man → lib/bundler/man}/bundle-config.1 +27 -19
- data/lib/bundler/man/bundle-config.1.ronn +33 -25
- data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
- data/{man → lib/bundler/man}/bundle-exec.1 +1 -1
- data/{man → lib/bundler/man}/bundle-gem.1 +14 -1
- data/lib/bundler/man/bundle-gem.1.ronn +16 -0
- data/{man → lib/bundler/man}/bundle-info.1 +1 -1
- data/{man → lib/bundler/man}/bundle-init.1 +1 -1
- data/{man → lib/bundler/man}/bundle-inject.1 +1 -1
- data/{man → lib/bundler/man}/bundle-install.1 +2 -2
- data/lib/bundler/man/bundle-install.1.ronn +2 -2
- data/{man → lib/bundler/man}/bundle-list.1 +1 -1
- data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
- data/{man → lib/bundler/man}/bundle-open.1 +1 -1
- data/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
- data/{man → lib/bundler/man}/bundle-platform.1 +1 -1
- data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
- data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
- data/{man → lib/bundler/man}/bundle-show.1 +1 -1
- data/{man → lib/bundler/man}/bundle-update.1 +5 -5
- data/lib/bundler/man/bundle-update.1.ronn +5 -4
- data/{man → lib/bundler/man}/bundle-viz.1 +1 -1
- data/{man → lib/bundler/man}/bundle.1 +1 -1
- data/{man → lib/bundler/man}/gemfile.5 +28 -2
- data/lib/bundler/man/gemfile.5.ronn +9 -1
- data/{man → lib/bundler/man}/index.txt +0 -0
- 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/resolver/spec_group.rb +36 -48
- data/lib/bundler/resolver.rb +97 -151
- data/lib/bundler/retry.rb +1 -1
- data/lib/bundler/ruby_version.rb +1 -1
- data/lib/bundler/rubygems_ext.rb +46 -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 +97 -21
- data/lib/bundler/setup.rb +2 -2
- data/lib/bundler/shared_helpers.rb +6 -21
- data/lib/bundler/source/git/git_proxy.rb +60 -53
- data/lib/bundler/source/git.rb +38 -18
- data/lib/bundler/source/metadata.rb +1 -5
- data/lib/bundler/source/path/installer.rb +3 -1
- data/lib/bundler/source/path.rb +3 -1
- data/lib/bundler/source/rubygems.rb +113 -100
- data/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/lib/bundler/source.rb +21 -0
- data/lib/bundler/source_list.rb +100 -62
- data/lib/bundler/source_map.rb +58 -0
- data/lib/bundler/spec_set.rb +21 -34
- 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/CHANGELOG.md.tt +5 -0
- 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/rubocop.yml.tt +3 -0
- data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/lib/bundler/templates/newgem/standard.yml.tt +2 -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/delegates/specification_provider.rb +7 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -5
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -3
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +12 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +11 -7
- 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 +9 -7
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +7 -3
- 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 +10 -5
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +28 -9
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +27 -6
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
- 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/thor/lib/thor.rb +5 -6
- 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 +29 -33
- metadata +54 -35
- 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/cache.rb
CHANGED
|
@@ -9,7 +9,7 @@ module Bundler
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def run
|
|
12
|
-
Bundler.ui.level = "
|
|
12
|
+
Bundler.ui.level = "warn" if options[:quiet]
|
|
13
13
|
Bundler.settings.set_command_option_if_given :path, options[:path]
|
|
14
14
|
Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"]
|
|
15
15
|
|
|
@@ -30,6 +30,7 @@ module Bundler
|
|
|
30
30
|
require_relative "install"
|
|
31
31
|
options = self.options.dup
|
|
32
32
|
options["local"] = false if Bundler.settings[:cache_all_platforms]
|
|
33
|
+
options["no-cache"] = true
|
|
33
34
|
Bundler::CLI::Install.new(options).run
|
|
34
35
|
end
|
|
35
36
|
|
data/lib/bundler/cli/check.rb
CHANGED
|
@@ -11,9 +11,11 @@ module Bundler
|
|
|
11
11
|
def run
|
|
12
12
|
Bundler.settings.set_command_option_if_given :path, options[:path]
|
|
13
13
|
|
|
14
|
+
definition = Bundler.definition
|
|
15
|
+
definition.validate_runtime!
|
|
16
|
+
|
|
14
17
|
begin
|
|
15
|
-
definition
|
|
16
|
-
definition.validate_runtime!
|
|
18
|
+
definition.resolve_only_locally!
|
|
17
19
|
not_installed = definition.missing_specs
|
|
18
20
|
rescue GemNotFound, VersionConflict
|
|
19
21
|
Bundler.ui.error "Bundler can't satisfy your Gemfile's dependencies."
|
data/lib/bundler/cli/common.rb
CHANGED
|
@@ -36,10 +36,15 @@ module Bundler
|
|
|
36
36
|
def self.without_groups_message(command)
|
|
37
37
|
command_in_past_tense = command == :install ? "installed" : "updated"
|
|
38
38
|
groups = Bundler.settings[:without]
|
|
39
|
+
"Gems in the #{verbalize_groups(groups)} were not #{command_in_past_tense}."
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self.verbalize_groups(groups)
|
|
43
|
+
groups.map!{|g| "'#{g}'" }
|
|
39
44
|
group_list = [groups[0...-1].join(", "), groups[-1..-1]].
|
|
40
45
|
reject {|s| s.to_s.empty? }.join(" and ")
|
|
41
46
|
group_str = groups.size == 1 ? "group" : "groups"
|
|
42
|
-
"
|
|
47
|
+
"#{group_str} #{group_list}"
|
|
43
48
|
end
|
|
44
49
|
|
|
45
50
|
def self.select_spec(name, regex_match = nil)
|
|
@@ -53,7 +58,13 @@ module Bundler
|
|
|
53
58
|
|
|
54
59
|
case specs.count
|
|
55
60
|
when 0
|
|
56
|
-
|
|
61
|
+
dep_in_other_group = Bundler.definition.current_dependencies.find {|dep|dep.name == name }
|
|
62
|
+
|
|
63
|
+
if dep_in_other_group
|
|
64
|
+
raise GemNotFound, "Could not find gem '#{name}', because it's in the #{verbalize_groups(dep_in_other_group.groups)}, configured to be ignored."
|
|
65
|
+
else
|
|
66
|
+
raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
|
|
67
|
+
end
|
|
57
68
|
when 1
|
|
58
69
|
specs.first
|
|
59
70
|
else
|
|
@@ -83,6 +94,8 @@ module Bundler
|
|
|
83
94
|
end
|
|
84
95
|
|
|
85
96
|
def self.ensure_all_gems_in_lockfile!(names, locked_gems = Bundler.locked_gems)
|
|
97
|
+
return unless locked_gems
|
|
98
|
+
|
|
86
99
|
locked_names = locked_gems.specs.map(&:name).uniq
|
|
87
100
|
names.-(locked_names).each do |g|
|
|
88
101
|
raise GemNotFound, gem_not_found_message(g, locked_names)
|
data/lib/bundler/cli/doctor.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "rbconfig"
|
|
4
|
+
require "shellwords"
|
|
4
5
|
|
|
5
6
|
module Bundler
|
|
6
7
|
class CLI::Doctor
|
|
@@ -22,14 +23,14 @@ module Bundler
|
|
|
22
23
|
end
|
|
23
24
|
|
|
24
25
|
def dylibs_darwin(path)
|
|
25
|
-
output = `/usr/bin/otool -L
|
|
26
|
+
output = `/usr/bin/otool -L #{path.shellescape}`.chomp
|
|
26
27
|
dylibs = output.split("\n")[1..-1].map {|l| l.match(DARWIN_REGEX).captures[0] }.uniq
|
|
27
28
|
# ignore @rpath and friends
|
|
28
29
|
dylibs.reject {|dylib| dylib.start_with? "@" }
|
|
29
30
|
end
|
|
30
31
|
|
|
31
32
|
def dylibs_ldd(path)
|
|
32
|
-
output = `/usr/bin/ldd
|
|
33
|
+
output = `/usr/bin/ldd #{path.shellescape}`.chomp
|
|
33
34
|
output.split("\n").map do |l|
|
|
34
35
|
match = l.match(LDD_REGEX)
|
|
35
36
|
next if match.nil?
|
|
@@ -61,7 +62,7 @@ module Bundler
|
|
|
61
62
|
end
|
|
62
63
|
|
|
63
64
|
def run
|
|
64
|
-
Bundler.ui.level = "
|
|
65
|
+
Bundler.ui.level = "warn" if options[:quiet]
|
|
65
66
|
Bundler.settings.validate!
|
|
66
67
|
check!
|
|
67
68
|
|
|
@@ -100,8 +101,11 @@ module Bundler
|
|
|
100
101
|
files_not_readable_or_writable = []
|
|
101
102
|
files_not_rw_and_owned_by_different_user = []
|
|
102
103
|
files_not_owned_by_current_user_but_still_rw = []
|
|
104
|
+
broken_symlinks = []
|
|
103
105
|
Find.find(Bundler.bundle_path.to_s).each do |f|
|
|
104
|
-
if !File.
|
|
106
|
+
if !File.exist?(f)
|
|
107
|
+
broken_symlinks << f
|
|
108
|
+
elsif !File.writable?(f) || !File.readable?(f)
|
|
105
109
|
if File.stat(f).uid != Process.uid
|
|
106
110
|
files_not_rw_and_owned_by_different_user << f
|
|
107
111
|
else
|
|
@@ -113,6 +117,13 @@ module Bundler
|
|
|
113
117
|
end
|
|
114
118
|
|
|
115
119
|
ok = true
|
|
120
|
+
|
|
121
|
+
if broken_symlinks.any?
|
|
122
|
+
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 - ")}"
|
|
123
|
+
|
|
124
|
+
ok = false
|
|
125
|
+
end
|
|
126
|
+
|
|
116
127
|
if files_not_owned_by_current_user_but_still_rw.any?
|
|
117
128
|
Bundler.ui.warn "Files exist in the Bundler home that are owned by another " \
|
|
118
129
|
"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
|
@@ -39,11 +39,19 @@ module Bundler
|
|
|
39
39
|
constant_name = name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }
|
|
40
40
|
constant_array = constant_name.split("::")
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
use_git = Bundler.git_present? && options[:git]
|
|
43
43
|
|
|
44
|
-
git_author_name =
|
|
45
|
-
|
|
46
|
-
git_user_email =
|
|
44
|
+
git_author_name = use_git ? `git config user.name`.chomp : ""
|
|
45
|
+
git_username = use_git ? `git config github.user`.chomp : ""
|
|
46
|
+
git_user_email = use_git ? `git config user.email`.chomp : ""
|
|
47
|
+
|
|
48
|
+
github_username = if options[:github_username].nil?
|
|
49
|
+
git_username
|
|
50
|
+
elsif options[:github_username] == false
|
|
51
|
+
""
|
|
52
|
+
else
|
|
53
|
+
options[:github_username]
|
|
54
|
+
end
|
|
47
55
|
|
|
48
56
|
config = {
|
|
49
57
|
:name => name,
|
|
@@ -58,7 +66,9 @@ module Bundler
|
|
|
58
66
|
:ext => options[:ext],
|
|
59
67
|
:exe => options[:exe],
|
|
60
68
|
:bundler_version => bundler_dependency_version,
|
|
69
|
+
:git => use_git,
|
|
61
70
|
:github_username => github_username.empty? ? "[USERNAME]" : github_username,
|
|
71
|
+
:required_ruby_version => required_ruby_version,
|
|
62
72
|
}
|
|
63
73
|
ensure_safe_gem_name(name, constant_array)
|
|
64
74
|
|
|
@@ -66,6 +76,7 @@ module Bundler
|
|
|
66
76
|
"#{Bundler.preferred_gemfile_name}.tt" => Bundler.preferred_gemfile_name,
|
|
67
77
|
"lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb",
|
|
68
78
|
"lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb",
|
|
79
|
+
"sig/newgem.rbs.tt" => "sig/#{namespaced_path}.rbs",
|
|
69
80
|
"newgem.gemspec.tt" => "#{name}.gemspec",
|
|
70
81
|
"Rakefile.tt" => "Rakefile",
|
|
71
82
|
"README.md.tt" => "README.md",
|
|
@@ -78,7 +89,7 @@ module Bundler
|
|
|
78
89
|
bin/setup
|
|
79
90
|
]
|
|
80
91
|
|
|
81
|
-
templates.merge!("gitignore.tt" => ".gitignore") if
|
|
92
|
+
templates.merge!("gitignore.tt" => ".gitignore") if use_git
|
|
82
93
|
|
|
83
94
|
if test_framework = ask_and_set_test_framework
|
|
84
95
|
config[:test] = test_framework
|
|
@@ -95,7 +106,7 @@ module Bundler
|
|
|
95
106
|
when "minitest"
|
|
96
107
|
templates.merge!(
|
|
97
108
|
"test/minitest/test_helper.rb.tt" => "test/test_helper.rb",
|
|
98
|
-
"test/minitest/
|
|
109
|
+
"test/minitest/test_newgem.rb.tt" => "test/test_#{namespaced_path}.rb"
|
|
99
110
|
)
|
|
100
111
|
config[:test_task] = :test
|
|
101
112
|
when "test-unit"
|
|
@@ -141,14 +152,28 @@ module Bundler
|
|
|
141
152
|
templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md")
|
|
142
153
|
end
|
|
143
154
|
|
|
144
|
-
if ask_and_set(:
|
|
145
|
-
"
|
|
146
|
-
"of
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
|
|
155
|
+
if ask_and_set(:changelog, "Do you want to include a changelog?",
|
|
156
|
+
"A changelog is a file which contains a curated, chronologically ordered list of notable " \
|
|
157
|
+
"changes for each version of a project. To make it easier for users and contributors to" \
|
|
158
|
+
" see precisely what notable changes have been made between each release (or version) of" \
|
|
159
|
+
" the project. Whether consumers or developers, the end users of software are" \
|
|
160
|
+
" human beings who care about what's in the software. When the software changes, people " \
|
|
161
|
+
"want to know why and how. see https://keepachangelog.com")
|
|
162
|
+
config[:changelog] = true
|
|
163
|
+
Bundler.ui.info "Changelog enabled in config"
|
|
164
|
+
templates.merge!("CHANGELOG.md.tt" => "CHANGELOG.md")
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
config[:linter] = ask_and_set_linter
|
|
168
|
+
case config[:linter]
|
|
169
|
+
when "rubocop"
|
|
170
|
+
config[:linter_version] = rubocop_version
|
|
150
171
|
Bundler.ui.info "RuboCop enabled in config"
|
|
151
172
|
templates.merge!("rubocop.yml.tt" => ".rubocop.yml")
|
|
173
|
+
when "standard"
|
|
174
|
+
config[:linter_version] = standard_version
|
|
175
|
+
Bundler.ui.info "Standard enabled in config"
|
|
176
|
+
templates.merge!("standard.yml.tt" => ".standard.yml")
|
|
152
177
|
end
|
|
153
178
|
|
|
154
179
|
templates.merge!("exe/newgem.tt" => "exe/#{name}") if config[:exe]
|
|
@@ -161,24 +186,32 @@ module Bundler
|
|
|
161
186
|
)
|
|
162
187
|
end
|
|
163
188
|
|
|
189
|
+
if target.exist? && !target.directory?
|
|
190
|
+
Bundler.ui.error "Couldn't create a new gem named `#{gem_name}` because there's an existing file named `#{gem_name}`."
|
|
191
|
+
exit Bundler::BundlerError.all_errors[Bundler::GenericSystemCallError]
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
if use_git
|
|
195
|
+
Bundler.ui.info "Initializing git repo in #{target}"
|
|
196
|
+
require "shellwords"
|
|
197
|
+
`git init #{target.to_s.shellescape}`
|
|
198
|
+
|
|
199
|
+
config[:git_default_branch] = File.read("#{target}/.git/HEAD").split("/").last.chomp
|
|
200
|
+
end
|
|
201
|
+
|
|
164
202
|
templates.each do |src, dst|
|
|
165
203
|
destination = target.join(dst)
|
|
166
|
-
|
|
167
|
-
thor.template("newgem/#{src}", destination, config)
|
|
168
|
-
end
|
|
204
|
+
thor.template("newgem/#{src}", destination, config)
|
|
169
205
|
end
|
|
170
206
|
|
|
171
207
|
executables.each do |file|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
end
|
|
208
|
+
path = target.join(file)
|
|
209
|
+
executable = (path.stat.mode | 0o111)
|
|
210
|
+
path.chmod(executable)
|
|
176
211
|
end
|
|
177
212
|
|
|
178
|
-
if
|
|
179
|
-
Bundler.ui.info "Initializing git repo in #{target}"
|
|
213
|
+
if use_git
|
|
180
214
|
Dir.chdir(target) do
|
|
181
|
-
`git init`
|
|
182
215
|
`git add .`
|
|
183
216
|
end
|
|
184
217
|
end
|
|
@@ -188,8 +221,6 @@ module Bundler
|
|
|
188
221
|
|
|
189
222
|
Bundler.ui.info "Gem '#{name}' was successfully created. " \
|
|
190
223
|
"For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html"
|
|
191
|
-
rescue Errno::EEXIST => e
|
|
192
|
-
raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.")
|
|
193
224
|
end
|
|
194
225
|
|
|
195
226
|
private
|
|
@@ -288,6 +319,58 @@ module Bundler
|
|
|
288
319
|
ci_template
|
|
289
320
|
end
|
|
290
321
|
|
|
322
|
+
def ask_and_set_linter
|
|
323
|
+
linter_template = options[:linter] || Bundler.settings["gem.linter"]
|
|
324
|
+
linter_template = deprecated_rubocop_option if linter_template.nil?
|
|
325
|
+
|
|
326
|
+
if linter_template.to_s.empty?
|
|
327
|
+
Bundler.ui.confirm "Do you want to add a code linter and formatter to your gem? " \
|
|
328
|
+
"Supported Linters:\n" \
|
|
329
|
+
"* RuboCop: https://rubocop.org\n" \
|
|
330
|
+
"* Standard: https://github.com/testdouble/standard\n" \
|
|
331
|
+
"\n"
|
|
332
|
+
Bundler.ui.info hint_text("linter")
|
|
333
|
+
|
|
334
|
+
result = Bundler.ui.ask "Enter a linter. rubocop/standard/(none):"
|
|
335
|
+
if result =~ /rubocop|standard/
|
|
336
|
+
linter_template = result
|
|
337
|
+
else
|
|
338
|
+
linter_template = false
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
if Bundler.settings["gem.linter"].nil?
|
|
343
|
+
Bundler.settings.set_global("gem.linter", linter_template)
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
# Once gem.linter safely set, unset the deprecated gem.rubocop
|
|
347
|
+
unless Bundler.settings["gem.rubocop"].nil?
|
|
348
|
+
Bundler.settings.set_global("gem.rubocop", nil)
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
if options[:linter] == Bundler.settings["gem.linter"]
|
|
352
|
+
Bundler.ui.info "#{options[:linter]} is already configured, ignoring --linter flag."
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
linter_template
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
def deprecated_rubocop_option
|
|
359
|
+
if !options[:rubocop].nil?
|
|
360
|
+
if options[:rubocop]
|
|
361
|
+
Bundler::SharedHelpers.major_deprecation 2, "--rubocop is deprecated, use --linter=rubocop"
|
|
362
|
+
"rubocop"
|
|
363
|
+
else
|
|
364
|
+
Bundler::SharedHelpers.major_deprecation 2, "--no-rubocop is deprecated, use --linter"
|
|
365
|
+
false
|
|
366
|
+
end
|
|
367
|
+
elsif !Bundler.settings["gem.rubocop"].nil?
|
|
368
|
+
Bundler::SharedHelpers.major_deprecation 2,
|
|
369
|
+
"config gem.rubocop is deprecated; we've updated your config to use gem.linter instead"
|
|
370
|
+
Bundler.settings["gem.rubocop"] ? "rubocop" : false
|
|
371
|
+
end
|
|
372
|
+
end
|
|
373
|
+
|
|
291
374
|
def bundler_dependency_version
|
|
292
375
|
v = Gem::Version.new(Bundler::VERSION)
|
|
293
376
|
req = v.segments[0..1]
|
|
@@ -321,5 +404,30 @@ module Bundler
|
|
|
321
404
|
def open_editor(editor, file)
|
|
322
405
|
thor.run(%(#{editor} "#{file}"))
|
|
323
406
|
end
|
|
407
|
+
|
|
408
|
+
def required_ruby_version
|
|
409
|
+
if Gem.ruby_version < Gem::Version.new("2.4.a") then "2.3.0"
|
|
410
|
+
elsif Gem.ruby_version < Gem::Version.new("2.5.a") then "2.4.0"
|
|
411
|
+
elsif Gem.ruby_version < Gem::Version.new("2.6.a") then "2.5.0"
|
|
412
|
+
else
|
|
413
|
+
"2.6.0"
|
|
414
|
+
end
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
def rubocop_version
|
|
418
|
+
if Gem.ruby_version < Gem::Version.new("2.4.a") then "0.81.0"
|
|
419
|
+
elsif Gem.ruby_version < Gem::Version.new("2.5.a") then "1.12"
|
|
420
|
+
else
|
|
421
|
+
"1.21"
|
|
422
|
+
end
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
def standard_version
|
|
426
|
+
if Gem.ruby_version < Gem::Version.new("2.4.a") then "0.2.5"
|
|
427
|
+
elsif Gem.ruby_version < Gem::Version.new("2.5.a") then "1.0"
|
|
428
|
+
else
|
|
429
|
+
"1.3"
|
|
430
|
+
end
|
|
431
|
+
end
|
|
324
432
|
end
|
|
325
433
|
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/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
|