bundler 2.6.3 → 2.6.9
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 +119 -6
- data/README.md +1 -1
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/checksum.rb +22 -12
- data/lib/bundler/cli/console.rb +8 -6
- data/lib/bundler/cli/doctor/diagnose.rb +167 -0
- data/lib/bundler/cli/doctor/ssl.rb +249 -0
- data/lib/bundler/cli/doctor.rb +27 -151
- data/lib/bundler/cli/info.rb +4 -4
- data/lib/bundler/cli/inject.rb +2 -2
- data/lib/bundler/cli/issue.rb +3 -3
- data/lib/bundler/cli/lock.rb +2 -1
- data/lib/bundler/cli/show.rb +1 -1
- data/lib/bundler/cli.rb +2 -11
- data/lib/bundler/compact_index_client/cache.rb +1 -1
- data/lib/bundler/compact_index_client/parser.rb +1 -1
- data/lib/bundler/compact_index_client/updater.rb +2 -1
- data/lib/bundler/current_ruby.rb +23 -33
- data/lib/bundler/definition.rb +220 -184
- data/lib/bundler/dependency.rb +92 -47
- data/lib/bundler/dsl.rb +84 -80
- data/lib/bundler/endpoint_specification.rb +10 -3
- data/lib/bundler/errors.rb +22 -0
- data/lib/bundler/friendly_errors.rb +1 -1
- data/lib/bundler/gem_helpers.rb +4 -10
- data/lib/bundler/gem_version_promoter.rb +0 -2
- data/lib/bundler/injector.rb +9 -9
- data/lib/bundler/installer.rb +2 -2
- data/lib/bundler/lazy_specification.rb +67 -45
- data/lib/bundler/lockfile_parser.rb +8 -5
- data/lib/bundler/man/bundle-add.1 +1 -1
- data/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/lib/bundler/man/bundle-cache.1 +1 -1
- data/lib/bundler/man/bundle-check.1 +1 -1
- data/lib/bundler/man/bundle-clean.1 +1 -1
- data/lib/bundler/man/bundle-config.1 +6 -6
- data/lib/bundler/man/bundle-config.1.ronn +9 -4
- data/lib/bundler/man/bundle-console.1 +1 -1
- data/lib/bundler/man/bundle-doctor.1 +1 -1
- data/lib/bundler/man/bundle-env.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +3 -3
- data/lib/bundler/man/bundle-exec.1.ronn +2 -2
- data/lib/bundler/man/bundle-fund.1 +1 -1
- data/lib/bundler/man/bundle-gem.1 +1 -1
- data/lib/bundler/man/bundle-help.1 +1 -1
- data/lib/bundler/man/bundle-info.1 +1 -1
- data/lib/bundler/man/bundle-init.1 +1 -1
- data/lib/bundler/man/bundle-inject.1 +1 -1
- data/lib/bundler/man/bundle-install.1 +1 -1
- data/lib/bundler/man/bundle-issue.1 +1 -1
- data/lib/bundler/man/bundle-licenses.1 +1 -1
- data/lib/bundler/man/bundle-list.1 +1 -1
- data/lib/bundler/man/bundle-lock.1 +1 -1
- data/lib/bundler/man/bundle-open.1 +1 -1
- data/lib/bundler/man/bundle-outdated.1 +1 -1
- data/lib/bundler/man/bundle-platform.1 +1 -1
- data/lib/bundler/man/bundle-plugin.1 +1 -1
- data/lib/bundler/man/bundle-pristine.1 +1 -1
- data/lib/bundler/man/bundle-remove.1 +1 -1
- data/lib/bundler/man/bundle-show.1 +1 -1
- data/lib/bundler/man/bundle-update.1 +1 -1
- data/lib/bundler/man/bundle-version.1 +1 -1
- data/lib/bundler/man/bundle-viz.1 +1 -1
- data/lib/bundler/man/bundle.1 +1 -1
- data/lib/bundler/man/gemfile.5 +1 -1
- data/lib/bundler/match_metadata.rb +13 -0
- data/lib/bundler/plugin/api/source.rb +1 -1
- data/lib/bundler/plugin/index.rb +1 -1
- data/lib/bundler/plugin/installer/path.rb +8 -0
- data/lib/bundler/plugin.rb +1 -1
- data/lib/bundler/resolver/candidate.rb +12 -9
- data/lib/bundler/resolver/package.rb +7 -3
- data/lib/bundler/resolver/spec_group.rb +1 -25
- data/lib/bundler/resolver/strategy.rb +40 -0
- data/lib/bundler/resolver.rb +29 -27
- data/lib/bundler/rubygems_ext.rb +97 -81
- data/lib/bundler/rubygems_integration.rb +2 -3
- data/lib/bundler/runtime.rb +27 -29
- data/lib/bundler/shared_helpers.rb +4 -0
- data/lib/bundler/source/gemspec.rb +1 -4
- data/lib/bundler/source/git/git_proxy.rb +14 -3
- data/lib/bundler/source/git.rb +5 -1
- data/lib/bundler/source/path.rb +2 -2
- data/lib/bundler/source/rubygems/remote.rb +11 -3
- data/lib/bundler/source/rubygems.rb +19 -4
- data/lib/bundler/source.rb +2 -0
- data/lib/bundler/source_list.rb +33 -11
- data/lib/bundler/spec_set.rb +98 -40
- data/lib/bundler/templates/newgem/Gemfile.tt +1 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +53 -3
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +11 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +4 -24
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb +42 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +20 -8
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +17 -29
- data/lib/bundler/vendor/uri/lib/uri/common.rb +7 -3
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +12 -11
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +6 -6
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/bundler/version.rb +1 -1
- metadata +7 -4
- data/lib/bundler/compact_index_client/gem_parser.rb +0 -32
data/lib/bundler/dependency.rb
CHANGED
@@ -2,51 +2,92 @@
|
|
2
2
|
|
3
3
|
require "rubygems/dependency"
|
4
4
|
require_relative "shared_helpers"
|
5
|
-
require_relative "rubygems_ext"
|
6
5
|
|
7
6
|
module Bundler
|
8
7
|
class Dependency < Gem::Dependency
|
9
|
-
attr_reader :autorequire
|
10
|
-
attr_reader :groups, :platforms, :gemfile, :path, :git, :github, :branch, :ref, :glob
|
11
|
-
|
12
|
-
ALL_RUBY_VERSIONS = (18..27).to_a.concat((30..35).to_a).freeze
|
13
|
-
PLATFORM_MAP = {
|
14
|
-
ruby: [Gem::Platform::RUBY, ALL_RUBY_VERSIONS],
|
15
|
-
mri: [Gem::Platform::RUBY, ALL_RUBY_VERSIONS],
|
16
|
-
rbx: [Gem::Platform::RUBY],
|
17
|
-
truffleruby: [Gem::Platform::RUBY],
|
18
|
-
jruby: [Gem::Platform::JAVA, [18, 19]],
|
19
|
-
windows: [Gem::Platform::WINDOWS, ALL_RUBY_VERSIONS],
|
20
|
-
# deprecated
|
21
|
-
mswin: [Gem::Platform::MSWIN, ALL_RUBY_VERSIONS],
|
22
|
-
mswin64: [Gem::Platform::MSWIN64, ALL_RUBY_VERSIONS - [18]],
|
23
|
-
mingw: [Gem::Platform::MINGW, ALL_RUBY_VERSIONS],
|
24
|
-
x64_mingw: [Gem::Platform::X64_MINGW, ALL_RUBY_VERSIONS - [18, 19]],
|
25
|
-
}.each_with_object({}) do |(platform, spec), hash|
|
26
|
-
hash[platform] = spec[0]
|
27
|
-
spec[1]&.each {|version| hash[:"#{platform}_#{version}"] = spec[0] }
|
28
|
-
end.freeze
|
29
|
-
|
30
8
|
def initialize(name, version, options = {}, &blk)
|
31
9
|
type = options["type"] || :runtime
|
32
10
|
super(name, version, type)
|
33
11
|
|
34
|
-
@
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
@
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
@
|
43
|
-
|
44
|
-
@
|
45
|
-
|
46
|
-
|
47
|
-
|
12
|
+
@options = options
|
13
|
+
end
|
14
|
+
|
15
|
+
def groups
|
16
|
+
@groups ||= Array(@options["group"] || :default).map(&:to_sym)
|
17
|
+
end
|
18
|
+
|
19
|
+
def source
|
20
|
+
return @source if defined?(@source)
|
21
|
+
|
22
|
+
@source = @options["source"]
|
23
|
+
end
|
24
|
+
|
25
|
+
def path
|
26
|
+
return @path if defined?(@path)
|
27
|
+
|
28
|
+
@path = @options["path"]
|
29
|
+
end
|
30
|
+
|
31
|
+
def git
|
32
|
+
return @git if defined?(@git)
|
48
33
|
|
49
|
-
@
|
34
|
+
@git = @options["git"]
|
35
|
+
end
|
36
|
+
|
37
|
+
def github
|
38
|
+
return @github if defined?(@github)
|
39
|
+
|
40
|
+
@github = @options["github"]
|
41
|
+
end
|
42
|
+
|
43
|
+
def branch
|
44
|
+
return @branch if defined?(@branch)
|
45
|
+
|
46
|
+
@branch = @options["branch"]
|
47
|
+
end
|
48
|
+
|
49
|
+
def ref
|
50
|
+
return @ref if defined?(@ref)
|
51
|
+
|
52
|
+
@ref = @options["ref"]
|
53
|
+
end
|
54
|
+
|
55
|
+
def glob
|
56
|
+
return @glob if defined?(@glob)
|
57
|
+
|
58
|
+
@glob = @options["glob"]
|
59
|
+
end
|
60
|
+
|
61
|
+
def platforms
|
62
|
+
@platforms ||= Array(@options["platforms"])
|
63
|
+
end
|
64
|
+
|
65
|
+
def env
|
66
|
+
return @env if defined?(@env)
|
67
|
+
|
68
|
+
@env = @options["env"]
|
69
|
+
end
|
70
|
+
|
71
|
+
def should_include
|
72
|
+
@should_include ||= @options.fetch("should_include", true)
|
73
|
+
end
|
74
|
+
|
75
|
+
def gemfile
|
76
|
+
return @gemfile if defined?(@gemfile)
|
77
|
+
|
78
|
+
@gemfile = @options["gemfile"]
|
79
|
+
end
|
80
|
+
|
81
|
+
def force_ruby_platform
|
82
|
+
return @force_ruby_platform if defined?(@force_ruby_platform)
|
83
|
+
|
84
|
+
@force_ruby_platform = @options["force_ruby_platform"]
|
85
|
+
end
|
86
|
+
|
87
|
+
def autorequire
|
88
|
+
return @autorequire if defined?(@autorequire)
|
89
|
+
|
90
|
+
@autorequire = Array(@options["require"] || []) if @options.key?("require")
|
50
91
|
end
|
51
92
|
|
52
93
|
RUBY_PLATFORM_ARRAY = [Gem::Platform::RUBY].freeze
|
@@ -56,37 +97,41 @@ module Bundler
|
|
56
97
|
# passed in the `valid_platforms` parameter
|
57
98
|
def gem_platforms(valid_platforms)
|
58
99
|
return RUBY_PLATFORM_ARRAY if force_ruby_platform
|
59
|
-
return valid_platforms if
|
100
|
+
return valid_platforms if platforms.empty?
|
60
101
|
|
61
102
|
valid_platforms.select {|p| expanded_platforms.include?(GemHelpers.generic(p)) }
|
62
103
|
end
|
63
104
|
|
64
105
|
def expanded_platforms
|
65
|
-
@expanded_platforms ||=
|
106
|
+
@expanded_platforms ||= platforms.filter_map {|pl| CurrentRuby::PLATFORM_MAP[pl] }.flatten.uniq
|
66
107
|
end
|
67
108
|
|
68
109
|
def should_include?
|
69
|
-
|
110
|
+
should_include && current_env? && current_platform?
|
70
111
|
end
|
71
112
|
|
72
113
|
def gemspec_dev_dep?
|
73
|
-
|
114
|
+
@gemspec_dev_dep ||= @options.fetch("gemspec_dev_dep", false)
|
115
|
+
end
|
116
|
+
|
117
|
+
def gemfile_dep?
|
118
|
+
!gemspec_dev_dep?
|
74
119
|
end
|
75
120
|
|
76
121
|
def current_env?
|
77
|
-
return true unless
|
78
|
-
if
|
79
|
-
|
122
|
+
return true unless env
|
123
|
+
if env.is_a?(Hash)
|
124
|
+
env.all? do |key, val|
|
80
125
|
ENV[key.to_s] && (val.is_a?(String) ? ENV[key.to_s] == val : ENV[key.to_s] =~ val)
|
81
126
|
end
|
82
127
|
else
|
83
|
-
ENV[
|
128
|
+
ENV[env.to_s]
|
84
129
|
end
|
85
130
|
end
|
86
131
|
|
87
132
|
def current_platform?
|
88
|
-
return true if
|
89
|
-
|
133
|
+
return true if platforms.empty?
|
134
|
+
platforms.any? do |p|
|
90
135
|
Bundler.current_ruby.send("#{p}?")
|
91
136
|
end
|
92
137
|
end
|
data/lib/bundler/dsl.rb
CHANGED
@@ -13,10 +13,10 @@ module Bundler
|
|
13
13
|
builder.to_definition(lockfile, unlock)
|
14
14
|
end
|
15
15
|
|
16
|
-
VALID_PLATFORMS = Bundler::
|
16
|
+
VALID_PLATFORMS = Bundler::CurrentRuby::PLATFORM_MAP.keys.freeze
|
17
17
|
|
18
18
|
VALID_KEYS = %w[group groups git path glob name branch ref tag require submodules
|
19
|
-
platform platforms
|
19
|
+
platform platforms source install_if force_ruby_platform].freeze
|
20
20
|
|
21
21
|
GITHUB_PULL_REQUEST_URL = %r{\Ahttps://github\.com/([A-Za-z0-9_\-\.]+/[A-Za-z0-9_\-\.]+)/pull/(\d+)\z}
|
22
22
|
GITLAB_MERGE_REQUEST_URL = %r{\Ahttps://gitlab\.com/([A-Za-z0-9_\-\./]+)/-/merge_requests/(\d+)\z}
|
@@ -77,12 +77,12 @@ module Bundler
|
|
77
77
|
|
78
78
|
@gemspecs << spec
|
79
79
|
|
80
|
-
|
80
|
+
path path, "glob" => glob, "name" => spec.name, "gemspec" => spec do
|
81
|
+
add_dependency spec.name
|
82
|
+
end
|
81
83
|
|
82
|
-
|
83
|
-
|
84
|
-
gem dep.name, *(dep.requirement.as_list + [type: :development])
|
85
|
-
end
|
84
|
+
spec.development_dependencies.each do |dep|
|
85
|
+
add_dependency dep.name, dep.requirement.as_list, "gemspec_dev_dep" => true, "group" => development_group
|
86
86
|
end
|
87
87
|
when 0
|
88
88
|
raise InvalidOption, "There are no gemspecs at #{expanded_path}"
|
@@ -94,79 +94,11 @@ module Bundler
|
|
94
94
|
|
95
95
|
def gem(name, *args)
|
96
96
|
options = args.last.is_a?(Hash) ? args.pop.dup : {}
|
97
|
-
options["gemfile"] = @gemfile
|
98
97
|
version = args || [">= 0"]
|
99
98
|
|
100
99
|
normalize_options(name, version, options)
|
101
100
|
|
102
|
-
|
103
|
-
|
104
|
-
# if there's already a dependency with this name we try to prefer one
|
105
|
-
if current = @dependencies.find {|d| d.name == dep.name }
|
106
|
-
if current.requirement != dep.requirement
|
107
|
-
current_requirement_open = current.requirements_list.include?(">= 0")
|
108
|
-
|
109
|
-
gemspec_dep = [dep, current].find(&:gemspec_dev_dep?)
|
110
|
-
if gemspec_dep
|
111
|
-
gemfile_dep = [dep, current].find(&:runtime?)
|
112
|
-
|
113
|
-
if gemfile_dep && !current_requirement_open
|
114
|
-
Bundler.ui.warn "A gemspec development dependency (#{gemspec_dep.name}, #{gemspec_dep.requirement}) is being overridden by a Gemfile dependency (#{gemfile_dep.name}, #{gemfile_dep.requirement}).\n" \
|
115
|
-
"This behaviour may change in the future. Please remove either of them, or make sure they both have the same requirement\n"
|
116
|
-
elsif gemfile_dep.nil?
|
117
|
-
require_relative "vendor/pub_grub/lib/pub_grub/version_range"
|
118
|
-
require_relative "vendor/pub_grub/lib/pub_grub/version_constraint"
|
119
|
-
require_relative "vendor/pub_grub/lib/pub_grub/version_union"
|
120
|
-
require_relative "vendor/pub_grub/lib/pub_grub/rubygems"
|
121
|
-
|
122
|
-
current_gemspec_range = PubGrub::RubyGems.requirement_to_range(current.requirement)
|
123
|
-
next_gemspec_range = PubGrub::RubyGems.requirement_to_range(dep.requirement)
|
124
|
-
|
125
|
-
if current_gemspec_range.intersects?(next_gemspec_range)
|
126
|
-
dep = Dependency.new(name, current.requirement.as_list + dep.requirement.as_list, options)
|
127
|
-
else
|
128
|
-
raise GemfileError, "Two gemspecs have conflicting requirements on the same gem: #{dep} and #{current}"
|
129
|
-
end
|
130
|
-
end
|
131
|
-
else
|
132
|
-
update_prompt = ""
|
133
|
-
|
134
|
-
if File.basename(@gemfile) == Injector::INJECTED_GEMS
|
135
|
-
if dep.requirements_list.include?(">= 0") && !current_requirement_open
|
136
|
-
update_prompt = ". Gem already added"
|
137
|
-
else
|
138
|
-
update_prompt = ". If you want to update the gem version, run `bundle update #{current.name}`"
|
139
|
-
|
140
|
-
update_prompt += ". You may also need to change the version requirement specified in the Gemfile if it's too restrictive." unless current_requirement_open
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \
|
145
|
-
"You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" \
|
146
|
-
"#{update_prompt}"
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
unless current.gemspec_dev_dep? && dep.gemspec_dev_dep?
|
151
|
-
# Always prefer the dependency from the Gemfile
|
152
|
-
if current.gemspec_dev_dep?
|
153
|
-
@dependencies.delete(current)
|
154
|
-
elsif dep.gemspec_dev_dep?
|
155
|
-
return
|
156
|
-
elsif current.source != dep.source
|
157
|
-
raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
|
158
|
-
"You specified that #{dep.name} (#{dep.requirement}) should come from " \
|
159
|
-
"#{current.source || "an unspecified source"} and #{dep.source}\n"
|
160
|
-
else
|
161
|
-
Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
|
162
|
-
"You should probably keep only one of them.\n" \
|
163
|
-
"Remove any duplicate entries and specify the gem only once.\n" \
|
164
|
-
"While it's not a problem now, it could cause errors if you change the version of one of them later."
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
@dependencies << dep
|
101
|
+
add_dependency(name, version, options)
|
170
102
|
end
|
171
103
|
|
172
104
|
def source(source, *args, &blk)
|
@@ -209,8 +141,7 @@ module Bundler
|
|
209
141
|
def path(path, options = {}, &blk)
|
210
142
|
source_options = normalize_hash(options).merge(
|
211
143
|
"path" => Pathname.new(path),
|
212
|
-
"root_path" => gemfile_root
|
213
|
-
"gemspec" => gemspecs.find {|g| g.name == options["name"] }
|
144
|
+
"root_path" => gemfile_root
|
214
145
|
)
|
215
146
|
|
216
147
|
source_options["global"] = true unless block_given?
|
@@ -301,6 +232,81 @@ module Bundler
|
|
301
232
|
|
302
233
|
private
|
303
234
|
|
235
|
+
def add_dependency(name, version = nil, options = {})
|
236
|
+
options["gemfile"] = @gemfile
|
237
|
+
options["source"] ||= @source
|
238
|
+
options["env"] ||= @env
|
239
|
+
|
240
|
+
dep = Dependency.new(name, version, options)
|
241
|
+
|
242
|
+
# if there's already a dependency with this name we try to prefer one
|
243
|
+
if current = @dependencies.find {|d| d.name == dep.name }
|
244
|
+
if current.requirement != dep.requirement
|
245
|
+
current_requirement_open = current.requirements_list.include?(">= 0")
|
246
|
+
|
247
|
+
gemspec_dep = [dep, current].find(&:gemspec_dev_dep?)
|
248
|
+
if gemspec_dep
|
249
|
+
gemfile_dep = [dep, current].find(&:gemfile_dep?)
|
250
|
+
|
251
|
+
if gemfile_dep && !current_requirement_open
|
252
|
+
Bundler.ui.warn "A gemspec development dependency (#{gemspec_dep.name}, #{gemspec_dep.requirement}) is being overridden by a Gemfile dependency (#{gemfile_dep.name}, #{gemfile_dep.requirement}).\n" \
|
253
|
+
"This behaviour may change in the future. Please remove either of them, or make sure they both have the same requirement\n"
|
254
|
+
elsif gemfile_dep.nil?
|
255
|
+
require_relative "vendor/pub_grub/lib/pub_grub/version_range"
|
256
|
+
require_relative "vendor/pub_grub/lib/pub_grub/version_constraint"
|
257
|
+
require_relative "vendor/pub_grub/lib/pub_grub/version_union"
|
258
|
+
require_relative "vendor/pub_grub/lib/pub_grub/rubygems"
|
259
|
+
|
260
|
+
current_gemspec_range = PubGrub::RubyGems.requirement_to_range(current.requirement)
|
261
|
+
next_gemspec_range = PubGrub::RubyGems.requirement_to_range(dep.requirement)
|
262
|
+
|
263
|
+
if current_gemspec_range.intersects?(next_gemspec_range)
|
264
|
+
dep = Dependency.new(name, current.requirement.as_list + dep.requirement.as_list, options)
|
265
|
+
else
|
266
|
+
raise GemfileError, "Two gemspec development dependencies have conflicting requirements on the same gem: #{dep} and #{current}"
|
267
|
+
end
|
268
|
+
end
|
269
|
+
else
|
270
|
+
update_prompt = ""
|
271
|
+
|
272
|
+
if File.basename(@gemfile) == Injector::INJECTED_GEMS
|
273
|
+
if dep.requirements_list.include?(">= 0") && !current_requirement_open
|
274
|
+
update_prompt = ". Gem already added"
|
275
|
+
else
|
276
|
+
update_prompt = ". If you want to update the gem version, run `bundle update #{current.name}`"
|
277
|
+
|
278
|
+
update_prompt += ". You may also need to change the version requirement specified in the Gemfile if it's too restrictive." unless current_requirement_open
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \
|
283
|
+
"You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" \
|
284
|
+
"#{update_prompt}"
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
unless current.gemspec_dev_dep? && dep.gemspec_dev_dep?
|
289
|
+
# Always prefer the dependency from the Gemfile
|
290
|
+
if current.gemspec_dev_dep?
|
291
|
+
@dependencies.delete(current)
|
292
|
+
elsif dep.gemspec_dev_dep?
|
293
|
+
return
|
294
|
+
elsif current.source != dep.source
|
295
|
+
raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
|
296
|
+
"You specified that #{dep.name} (#{dep.requirement}) should come from " \
|
297
|
+
"#{current.source || "an unspecified source"} and #{dep.source}\n"
|
298
|
+
else
|
299
|
+
Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
|
300
|
+
"You should probably keep only one of them.\n" \
|
301
|
+
"Remove any duplicate entries and specify the gem only once.\n" \
|
302
|
+
"While it's not a problem now, it could cause errors if you change the version of one of them later."
|
303
|
+
end
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
@dependencies << dep
|
308
|
+
end
|
309
|
+
|
304
310
|
def with_gemfile(gemfile)
|
305
311
|
expanded_gemfile_path = Pathname.new(gemfile).expand_path(@gemfile&.parent)
|
306
312
|
original_gemfile = @gemfile
|
@@ -433,8 +439,6 @@ module Bundler
|
|
433
439
|
opts["source"] = source
|
434
440
|
end
|
435
441
|
|
436
|
-
opts["source"] ||= @source
|
437
|
-
opts["env"] ||= @env
|
438
442
|
opts["platforms"] = platforms.dup
|
439
443
|
opts["group"] = groups
|
440
444
|
opts["should_include"] = install_if
|
@@ -6,7 +6,8 @@ module Bundler
|
|
6
6
|
include MatchRemoteMetadata
|
7
7
|
|
8
8
|
attr_reader :name, :version, :platform, :checksum
|
9
|
-
|
9
|
+
attr_writer :dependencies
|
10
|
+
attr_accessor :remote, :locked_platform
|
10
11
|
|
11
12
|
def initialize(name, version, platform, spec_fetcher, dependencies, metadata = nil)
|
12
13
|
super()
|
@@ -14,7 +15,8 @@ module Bundler
|
|
14
15
|
@version = Gem::Version.create version
|
15
16
|
@platform = Gem::Platform.new(platform)
|
16
17
|
@spec_fetcher = spec_fetcher
|
17
|
-
@dependencies =
|
18
|
+
@dependencies = nil
|
19
|
+
@unbuilt_dependencies = dependencies
|
18
20
|
|
19
21
|
@loaded_from = nil
|
20
22
|
@remote_specification = nil
|
@@ -31,6 +33,11 @@ module Bundler
|
|
31
33
|
@platform
|
32
34
|
end
|
33
35
|
|
36
|
+
def dependencies
|
37
|
+
@dependencies ||= @unbuilt_dependencies.map! {|dep, reqs| build_dependency(dep, reqs) }
|
38
|
+
end
|
39
|
+
alias_method :runtime_dependencies, :dependencies
|
40
|
+
|
34
41
|
# needed for standalone, load required_paths from local gemspec
|
35
42
|
# after the gem is installed
|
36
43
|
def require_paths
|
@@ -161,7 +168,7 @@ module Bundler
|
|
161
168
|
end
|
162
169
|
|
163
170
|
def build_dependency(name, requirements)
|
164
|
-
|
171
|
+
Dependency.new(name, requirements)
|
165
172
|
end
|
166
173
|
end
|
167
174
|
end
|
data/lib/bundler/errors.rb
CHANGED
@@ -193,6 +193,24 @@ module Bundler
|
|
193
193
|
status_code(31)
|
194
194
|
end
|
195
195
|
|
196
|
+
class ReadOnlyFileSystemError < PermissionError
|
197
|
+
def message
|
198
|
+
"There was an error while trying to #{action} `#{@path}`. " \
|
199
|
+
"File system is read-only."
|
200
|
+
end
|
201
|
+
|
202
|
+
status_code(42)
|
203
|
+
end
|
204
|
+
|
205
|
+
class OperationNotPermittedError < PermissionError
|
206
|
+
def message
|
207
|
+
"There was an error while trying to #{action} `#{@path}`. " \
|
208
|
+
"Underlying OS system call raised an EPERM error."
|
209
|
+
end
|
210
|
+
|
211
|
+
status_code(43)
|
212
|
+
end
|
213
|
+
|
196
214
|
class GenericSystemCallError < BundlerError
|
197
215
|
attr_reader :underlying_error
|
198
216
|
|
@@ -254,6 +272,10 @@ module Bundler
|
|
254
272
|
@spec = spec
|
255
273
|
end
|
256
274
|
|
275
|
+
def message
|
276
|
+
"Bundler found incorrect dependencies in the lockfile for #{spec.full_name}"
|
277
|
+
end
|
278
|
+
|
257
279
|
status_code(41)
|
258
280
|
end
|
259
281
|
end
|
@@ -80,7 +80,7 @@ module Bundler
|
|
80
80
|
First, try this link to see if there are any existing issue reports for this error:
|
81
81
|
#{issues_url(e)}
|
82
82
|
|
83
|
-
If there aren't any reports for this error yet, please fill in the new issue form located at #{new_issue_url}
|
83
|
+
If there aren't any reports for this error yet, please fill in the new issue form located at #{new_issue_url}. Make sure to copy and paste the full output of this command under the "What happened instead?" section.
|
84
84
|
EOS
|
85
85
|
end
|
86
86
|
|
data/lib/bundler/gem_helpers.rb
CHANGED
@@ -4,20 +4,14 @@ module Bundler
|
|
4
4
|
module GemHelpers
|
5
5
|
GENERIC_CACHE = { Gem::Platform::RUBY => Gem::Platform::RUBY } # rubocop:disable Style/MutableConstant
|
6
6
|
GENERICS = [
|
7
|
-
|
8
|
-
|
9
|
-
[Gem::Platform.new("mswin64"), Gem::Platform.new("mswin64")],
|
10
|
-
[Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")],
|
11
|
-
[Gem::Platform.new("x64-mingw32"), Gem::Platform.new("x64-mingw32")],
|
12
|
-
[Gem::Platform.new("x86_64-mingw32"), Gem::Platform.new("x64-mingw32")],
|
13
|
-
[Gem::Platform.new("x64-mingw-ucrt"), Gem::Platform.new("x64-mingw-ucrt")],
|
14
|
-
[Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")],
|
7
|
+
Gem::Platform::JAVA,
|
8
|
+
*Gem::Platform::WINDOWS,
|
15
9
|
].freeze
|
16
10
|
|
17
11
|
def generic(p)
|
18
12
|
GENERIC_CACHE[p] ||= begin
|
19
|
-
|
20
|
-
p
|
13
|
+
found = GENERICS.find do |match|
|
14
|
+
p === match
|
21
15
|
end
|
22
16
|
found || Gem::Platform::RUBY
|
23
17
|
end
|
@@ -132,8 +132,6 @@ module Bundler
|
|
132
132
|
# Specific version moves can't always reliably be done during sorting
|
133
133
|
# as not all elements are compared against each other.
|
134
134
|
def post_sort(result, unlock, locked_version)
|
135
|
-
# default :major behavior in Bundler does not do this
|
136
|
-
return result if major?
|
137
135
|
if unlock || locked_version.nil?
|
138
136
|
result
|
139
137
|
else
|
data/lib/bundler/injector.rb
CHANGED
@@ -108,17 +108,17 @@ module Bundler
|
|
108
108
|
end
|
109
109
|
|
110
110
|
if d.groups != Array(:default)
|
111
|
-
group = d.groups.size == 1 ? ", :
|
111
|
+
group = d.groups.size == 1 ? ", group: #{d.groups.first.inspect}" : ", groups: #{d.groups.inspect}"
|
112
112
|
end
|
113
113
|
|
114
|
-
source = ", :
|
115
|
-
path = ", :
|
116
|
-
git = ", :
|
117
|
-
github = ", :
|
118
|
-
branch = ", :
|
119
|
-
ref = ", :
|
120
|
-
glob = ", :
|
121
|
-
require_path = ", :
|
114
|
+
source = ", source: \"#{d.source}\"" unless d.source.nil?
|
115
|
+
path = ", path: \"#{d.path}\"" unless d.path.nil?
|
116
|
+
git = ", git: \"#{d.git}\"" unless d.git.nil?
|
117
|
+
github = ", github: \"#{d.github}\"" unless d.github.nil?
|
118
|
+
branch = ", branch: \"#{d.branch}\"" unless d.branch.nil?
|
119
|
+
ref = ", ref: \"#{d.ref}\"" unless d.ref.nil?
|
120
|
+
glob = ", glob: \"#{d.glob}\"" unless d.glob.nil?
|
121
|
+
require_path = ", require: #{convert_autorequire(d.autorequire)}" unless d.autorequire.nil?
|
122
122
|
|
123
123
|
%(gem #{name}#{requirement}#{group}#{source}#{path}#{git}#{github}#{branch}#{ref}#{glob}#{require_path})
|
124
124
|
end.join("\n")
|
data/lib/bundler/installer.rb
CHANGED
@@ -193,7 +193,7 @@ module Bundler
|
|
193
193
|
def install(options)
|
194
194
|
standalone = options[:standalone]
|
195
195
|
force = options[:force]
|
196
|
-
local = options[:local]
|
196
|
+
local = options[:local] || options[:"prefer-local"]
|
197
197
|
jobs = installation_parallelization
|
198
198
|
spec_installations = ParallelInstaller.call(self, @definition.specs, jobs, standalone, force, local: local)
|
199
199
|
spec_installations.each do |installation|
|
@@ -212,7 +212,7 @@ module Bundler
|
|
212
212
|
def load_plugins
|
213
213
|
Gem.load_plugins
|
214
214
|
|
215
|
-
requested_path_gems = @definition.
|
215
|
+
requested_path_gems = @definition.specs.select {|s| s.source.is_a?(Source::Path) }
|
216
216
|
path_plugin_files = requested_path_gems.flat_map do |spec|
|
217
217
|
spec.matches_for_glob("rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
|
218
218
|
rescue TypeError
|