bundler 1.11.2 → 1.12.0.pre.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/.codeclimate.yml +24 -0
- data/.gitignore +2 -2
- data/.rubocop.yml +17 -2
- data/.rubocop_todo.yml +145 -18
- data/.travis.yml +9 -2
- data/CHANGELOG.md +42 -0
- data/Rakefile +20 -13
- data/bin/rake +5 -0
- data/bin/rspec +5 -0
- data/bin/rubocop +7 -1
- data/bundler.gemspec +2 -1
- data/exe/bundle +10 -2
- data/exe/bundle_ruby +2 -1
- data/exe/bundler +3 -1
- data/lib/bundler.rb +54 -51
- data/lib/bundler/capistrano.rb +1 -0
- data/lib/bundler/cli.rb +26 -4
- data/lib/bundler/cli/binstubs.rb +1 -0
- data/lib/bundler/cli/cache.rb +1 -0
- data/lib/bundler/cli/check.rb +4 -1
- data/lib/bundler/cli/clean.rb +1 -0
- data/lib/bundler/cli/common.rb +1 -0
- data/lib/bundler/cli/config.rb +5 -5
- data/lib/bundler/cli/console.rb +1 -0
- data/lib/bundler/cli/exec.rb +4 -9
- data/lib/bundler/cli/gem.rb +12 -9
- data/lib/bundler/cli/init.rb +1 -0
- data/lib/bundler/cli/inject.rb +1 -0
- data/lib/bundler/cli/install.rb +8 -5
- data/lib/bundler/cli/lock.rb +2 -0
- data/lib/bundler/cli/open.rb +1 -0
- data/lib/bundler/cli/outdated.rb +36 -9
- data/lib/bundler/cli/package.rb +1 -0
- data/lib/bundler/cli/platform.rb +4 -1
- data/lib/bundler/cli/show.rb +1 -0
- data/lib/bundler/cli/update.rb +6 -6
- data/lib/bundler/cli/viz.rb +4 -6
- data/lib/bundler/constants.rb +1 -0
- data/lib/bundler/current_ruby.rb +34 -168
- data/lib/bundler/definition.rb +41 -15
- data/lib/bundler/dep_proxy.rb +1 -0
- data/lib/bundler/dependency.rb +10 -0
- data/lib/bundler/deployment.rb +1 -0
- data/lib/bundler/deprecate.rb +1 -0
- data/lib/bundler/dsl.rb +19 -9
- data/lib/bundler/endpoint_specification.rb +37 -8
- data/lib/bundler/env.rb +4 -3
- data/lib/bundler/environment.rb +1 -0
- data/lib/bundler/errors.rb +51 -32
- data/lib/bundler/fetcher.rb +44 -30
- data/lib/bundler/fetcher/base.rb +3 -2
- data/lib/bundler/fetcher/compact_index.rb +98 -0
- data/lib/bundler/fetcher/dependency.rb +36 -36
- data/lib/bundler/fetcher/downloader.rb +14 -8
- data/lib/bundler/fetcher/index.rb +28 -5
- data/lib/bundler/friendly_errors.rb +93 -85
- data/lib/bundler/gem_helper.rb +20 -21
- data/lib/bundler/gem_helpers.rb +9 -2
- data/lib/bundler/gem_remote_fetcher.rb +1 -0
- data/lib/bundler/gem_tasks.rb +1 -0
- data/lib/bundler/graph.rb +16 -17
- data/lib/bundler/index.rb +4 -6
- data/lib/bundler/injector.rb +1 -0
- data/lib/bundler/inline.rb +8 -2
- data/lib/bundler/installer.rb +4 -4
- data/lib/bundler/installer/gem_installer.rb +1 -0
- data/lib/bundler/installer/parallel_installer.rb +3 -2
- data/lib/bundler/installer/standalone.rb +5 -1
- data/lib/bundler/lazy_specification.rb +5 -2
- data/lib/bundler/lockfile_parser.rb +22 -15
- data/lib/bundler/match_platform.rb +1 -0
- data/lib/bundler/mirror.rb +218 -0
- data/lib/bundler/path_preserver.rb +12 -0
- data/lib/bundler/psyched_yaml.rb +1 -0
- data/lib/bundler/remote_specification.rb +4 -1
- data/lib/bundler/resolver.rb +17 -16
- data/lib/bundler/retry.rb +1 -0
- data/lib/bundler/ruby_dsl.rb +8 -2
- data/lib/bundler/ruby_version.rb +58 -61
- data/lib/bundler/rubygems_ext.rb +4 -3
- data/lib/bundler/rubygems_gem_installer.rb +1 -0
- data/lib/bundler/rubygems_integration.rb +9 -14
- data/lib/bundler/runtime.rb +17 -22
- data/lib/bundler/settings.rb +17 -21
- data/lib/bundler/setup.rb +1 -0
- data/lib/bundler/shared_helpers.rb +47 -17
- data/lib/bundler/similarity_detector.rb +1 -0
- data/lib/bundler/source.rb +2 -1
- data/lib/bundler/source/git.rb +2 -1
- data/lib/bundler/source/git/git_proxy.rb +33 -7
- data/lib/bundler/source/path.rb +17 -10
- data/lib/bundler/source/path/installer.rb +1 -0
- data/lib/bundler/source/rubygems.rb +4 -3
- data/lib/bundler/source/rubygems/remote.rb +16 -0
- data/lib/bundler/source_list.rb +1 -0
- data/lib/bundler/spec_set.rb +1 -0
- data/lib/bundler/ssl_certs/certificate_manager.rb +1 -0
- data/lib/bundler/stub_specification.rb +1 -0
- data/lib/bundler/templates/Executable +1 -0
- data/lib/bundler/templates/Gemfile +1 -0
- data/lib/bundler/templates/newgem/.travis.yml.tt +1 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -2
- data/lib/bundler/ui.rb +1 -0
- data/lib/bundler/ui/rg_proxy.rb +1 -0
- data/lib/bundler/ui/shell.rb +2 -1
- data/lib/bundler/ui/silent.rb +1 -0
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +78 -0
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +97 -0
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +55 -0
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +3 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +4 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +13 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +5 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +2 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +37 -14
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +7 -7
- data/lib/bundler/vendored_molinillo.rb +1 -0
- data/lib/bundler/vendored_persistent.rb +1 -0
- data/lib/bundler/vendored_thor.rb +1 -0
- data/lib/bundler/version.rb +6 -1
- data/lib/bundler/vlad.rb +1 -0
- data/lib/bundler/worker.rb +12 -2
- data/man/bundle-config.ronn +6 -0
- data/man/bundle-gem.ronn +5 -5
- metadata +14 -6
- data/lib/bundler/gem_path_manipulation.rb +0 -8
data/lib/bundler/resolver.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Bundler
|
2
3
|
class Resolver
|
3
4
|
require "bundler/vendored_molinillo"
|
@@ -12,7 +13,7 @@ module Bundler
|
|
12
13
|
end
|
13
14
|
|
14
15
|
def message
|
15
|
-
conflicts.sort.reduce(
|
16
|
+
conflicts.sort.reduce(String.new) do |o, (name, conflict)|
|
16
17
|
o << %(Bundler could not find compatible versions for gem "#{name}":\n)
|
17
18
|
if conflict.locked_requirement
|
18
19
|
o << %( In snapshot (#{Bundler.default_lockfile.basename}):\n)
|
@@ -21,7 +22,7 @@ module Bundler
|
|
21
22
|
end
|
22
23
|
o << %( In Gemfile:\n)
|
23
24
|
o << conflict.requirement_trees.sort_by {|t| t.reverse.map(&:name) }.map do |tree|
|
24
|
-
t =
|
25
|
+
t = String.new
|
25
26
|
depth = 2
|
26
27
|
tree.each do |req|
|
27
28
|
t << " " * depth << req.to_s
|
@@ -130,7 +131,7 @@ module Bundler
|
|
130
131
|
def for?(platform, required_ruby_version)
|
131
132
|
if spec = @specs[platform]
|
132
133
|
if required_ruby_version && spec.respond_to?(:required_ruby_version) && spec_required_ruby_version = spec.required_ruby_version
|
133
|
-
spec_required_ruby_version.satisfied_by?(required_ruby_version)
|
134
|
+
spec_required_ruby_version.satisfied_by?(required_ruby_version.gem_version)
|
134
135
|
else
|
135
136
|
true
|
136
137
|
end
|
@@ -192,7 +193,7 @@ module Bundler
|
|
192
193
|
@search_for = {}
|
193
194
|
@base_dg = Molinillo::DependencyGraph.new
|
194
195
|
@base.each {|ls| @base_dg.add_vertex(ls.name, Dependency.new(ls.name, ls.version), true) }
|
195
|
-
@ruby_version = ruby_version
|
196
|
+
@ruby_version = ruby_version
|
196
197
|
end
|
197
198
|
|
198
199
|
def start(requirements)
|
@@ -216,15 +217,15 @@ module Bundler
|
|
216
217
|
# @param [Integer] depth the current depth of the resolution process.
|
217
218
|
# @return [void]
|
218
219
|
def debug(depth = 0)
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
end
|
220
|
+
return unless debug?
|
221
|
+
debug_info = yield
|
222
|
+
debug_info = debug_info.inspect unless debug_info.is_a?(String)
|
223
|
+
STDERR.puts debug_info.split("\n").map {|s| " " * depth + s }
|
224
224
|
end
|
225
225
|
|
226
226
|
def debug?
|
227
|
-
|
227
|
+
return @debug_mode if defined?(@debug_mode)
|
228
|
+
@debug_mode = ENV["DEBUG_RESOLVER"] || ENV["DEBUG_RESOLVER_TREE"]
|
228
229
|
end
|
229
230
|
|
230
231
|
def before_resolution
|
@@ -341,12 +342,12 @@ module Bundler
|
|
341
342
|
elsif requirement.source
|
342
343
|
name = requirement.name
|
343
344
|
versions = @source_requirements[name][name].map(&:version)
|
344
|
-
message = "Could not find gem '#{requirement}' in #{requirement.source}.\n"
|
345
|
-
if versions.any?
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
345
|
+
message = String.new("Could not find gem '#{requirement}' in #{requirement.source}.\n")
|
346
|
+
message << if versions.any?
|
347
|
+
"Source contains '#{name}' at: #{versions.join(", ")}"
|
348
|
+
else
|
349
|
+
"Source does not contain any versions of '#{requirement}'"
|
350
|
+
end
|
350
351
|
else
|
351
352
|
message = "Could not find gem '#{requirement}' in any of the gem sources " \
|
352
353
|
"listed in your Gemfile or available on this machine."
|
data/lib/bundler/retry.rb
CHANGED
data/lib/bundler/ruby_dsl.rb
CHANGED
@@ -1,10 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Bundler
|
2
3
|
module RubyDsl
|
3
|
-
def ruby(ruby_version
|
4
|
+
def ruby(*ruby_version)
|
5
|
+
options = ruby_version.last.is_a?(Hash) ? ruby_version.pop : {}
|
6
|
+
ruby_version.flatten!
|
4
7
|
raise GemfileError, "Please define :engine_version" if options[:engine] && options[:engine_version].nil?
|
5
8
|
raise GemfileError, "Please define :engine" if options[:engine_version] && options[:engine].nil?
|
6
9
|
|
7
|
-
|
10
|
+
if options[:engine] == "ruby" && options[:engine_version] &&
|
11
|
+
ruby_version != Array(options[:engine_version])
|
12
|
+
raise GemfileEvalError, "ruby_version must match the :engine_version for MRI"
|
13
|
+
end
|
8
14
|
@ruby_version = RubyVersion.new(ruby_version, options[:patchlevel], options[:engine], options[:engine_version])
|
9
15
|
end
|
10
16
|
end
|
data/lib/bundler/ruby_version.rb
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Bundler
|
2
3
|
class RubyVersion
|
3
|
-
attr_reader :
|
4
|
+
attr_reader :versions,
|
5
|
+
:patchlevel,
|
6
|
+
:engine,
|
7
|
+
:engine_versions,
|
8
|
+
:gem_version,
|
9
|
+
:engine_gem_version
|
4
10
|
|
5
|
-
def initialize(
|
11
|
+
def initialize(versions, patchlevel, engine, engine_version)
|
6
12
|
# The parameters to this method must satisfy the
|
7
13
|
# following constraints, which are verified in
|
8
14
|
# the DSL:
|
@@ -15,29 +21,42 @@ module Bundler
|
|
15
21
|
# must not be specified, or the engine version
|
16
22
|
# specified must match the version.
|
17
23
|
|
18
|
-
@
|
19
|
-
@
|
20
|
-
|
21
|
-
@
|
22
|
-
@engine_version
|
23
|
-
@
|
24
|
+
@versions = Array(versions)
|
25
|
+
@gem_version = Gem::Requirement.create(@versions.first).requirements.first.last
|
26
|
+
@input_engine = engine
|
27
|
+
@engine = engine || "ruby"
|
28
|
+
@engine_versions = (engine_version && Array(engine_version)) || @versions
|
29
|
+
@engine_gem_version = Gem::Requirement.create(@engine_versions.first).requirements.first.last
|
30
|
+
@patchlevel = patchlevel
|
24
31
|
end
|
25
32
|
|
26
|
-
def to_s
|
27
|
-
output = "ruby #{
|
33
|
+
def to_s(versions = self.versions)
|
34
|
+
output = String.new("ruby #{versions_string(versions)}")
|
28
35
|
output << "p#{patchlevel}" if patchlevel
|
29
|
-
output << " (#{engine} #{
|
36
|
+
output << " (#{engine} #{versions_string(engine_versions)})" unless engine == "ruby"
|
30
37
|
|
31
38
|
output
|
32
39
|
end
|
33
40
|
|
41
|
+
def single_version_string
|
42
|
+
to_s(gem_version)
|
43
|
+
end
|
44
|
+
|
34
45
|
def ==(other)
|
35
|
-
|
46
|
+
versions == other.versions &&
|
36
47
|
engine == other.engine &&
|
37
|
-
|
48
|
+
engine_versions == other.engine_versions &&
|
38
49
|
patchlevel == other.patchlevel
|
39
50
|
end
|
40
51
|
|
52
|
+
def host
|
53
|
+
@host ||= [
|
54
|
+
RbConfig::CONFIG["host_cpu"],
|
55
|
+
RbConfig::CONFIG["host_vendor"],
|
56
|
+
RbConfig::CONFIG["host_os"]
|
57
|
+
].join("-")
|
58
|
+
end
|
59
|
+
|
41
60
|
# Returns a tuple of these things:
|
42
61
|
# [diff, this, other]
|
43
62
|
# The priority of attributes are
|
@@ -45,70 +64,48 @@ module Bundler
|
|
45
64
|
# 2. ruby_version
|
46
65
|
# 3. engine_version
|
47
66
|
def diff(other)
|
67
|
+
raise ArgumentError, "Can only diff with a RubyVersion" unless other.is_a?(RubyVersion)
|
48
68
|
if engine != other.engine && @input_engine
|
49
69
|
[:engine, engine, other.engine]
|
50
|
-
elsif
|
51
|
-
[:version,
|
52
|
-
elsif
|
53
|
-
[:engine_version,
|
54
|
-
elsif patchlevel
|
70
|
+
elsif versions.empty? || !matches?(versions, other.gem_version)
|
71
|
+
[:version, versions_string(versions), versions_string(other.versions)]
|
72
|
+
elsif @input_engine && !matches?(engine_versions, other.engine_gem_version)
|
73
|
+
[:engine_version, versions_string(engine_versions), versions_string(other.engine_versions)]
|
74
|
+
elsif patchlevel && (!patchlevel.is_a?(String) || !other.patchlevel.is_a?(String) || !matches?(patchlevel, other.patchlevel))
|
55
75
|
[:patchlevel, patchlevel, other.patchlevel]
|
56
76
|
end
|
57
77
|
end
|
58
78
|
|
59
|
-
def
|
60
|
-
|
61
|
-
RbConfig::CONFIG["host_cpu"],
|
62
|
-
RbConfig::CONFIG["host_vendor"],
|
63
|
-
RbConfig::CONFIG["host_os"]
|
64
|
-
].join("-")
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
# A subclass of RubyVersion that implements version,
|
69
|
-
# engine and engine_version based upon the current
|
70
|
-
# information in the system. It can be used anywhere
|
71
|
-
# a RubyVersion object is expected, and can be
|
72
|
-
# compared with a RubyVersion object.
|
73
|
-
class SystemRubyVersion < RubyVersion
|
74
|
-
def initialize(*)
|
75
|
-
# override the default initialize, because
|
76
|
-
# we will implement version, engine and
|
77
|
-
# engine_version dynamically
|
78
|
-
end
|
79
|
-
|
80
|
-
def version
|
81
|
-
RUBY_VERSION.dup
|
79
|
+
def versions_string(versions)
|
80
|
+
Array(versions).join(", ")
|
82
81
|
end
|
83
82
|
|
84
|
-
def
|
85
|
-
|
86
|
-
end
|
87
|
-
|
88
|
-
def engine
|
89
|
-
if defined?(RUBY_ENGINE)
|
83
|
+
def self.system
|
84
|
+
ruby_engine = if defined?(RUBY_ENGINE) && !RUBY_ENGINE.nil?
|
90
85
|
RUBY_ENGINE.dup
|
91
86
|
else
|
92
87
|
# not defined in ruby 1.8.7
|
93
88
|
"ruby"
|
94
89
|
end
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
JRUBY_VERSION.dup
|
105
|
-
else
|
106
|
-
raise BundlerError, "RUBY_ENGINE value #{RUBY_ENGINE} is not recognized"
|
90
|
+
ruby_engine_version = case ruby_engine
|
91
|
+
when "ruby"
|
92
|
+
RUBY_VERSION.dup
|
93
|
+
when "rbx"
|
94
|
+
Rubinius::VERSION.dup
|
95
|
+
when "jruby"
|
96
|
+
JRUBY_VERSION.dup
|
97
|
+
else
|
98
|
+
raise BundlerError, "RUBY_ENGINE value #{RUBY_ENGINE} is not recognized"
|
107
99
|
end
|
100
|
+
@ruby_version ||= RubyVersion.new(RUBY_VERSION.dup, RUBY_PATCHLEVEL.to_s, ruby_engine, ruby_engine_version)
|
108
101
|
end
|
109
102
|
|
110
|
-
|
111
|
-
|
103
|
+
private
|
104
|
+
|
105
|
+
def matches?(requirements, version)
|
106
|
+
Array(requirements).all? do |requirement|
|
107
|
+
Gem::Requirement.create(requirement).satisfied_by?(Gem::Version.create(version))
|
108
|
+
end
|
112
109
|
end
|
113
110
|
end
|
114
111
|
end
|
data/lib/bundler/rubygems_ext.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "pathname"
|
2
3
|
|
3
4
|
if defined?(Gem::QuickLoader)
|
@@ -78,7 +79,7 @@ module Gem
|
|
78
79
|
end
|
79
80
|
|
80
81
|
def to_gemfile(path = nil)
|
81
|
-
gemfile = "source 'https://rubygems.org'\n"
|
82
|
+
gemfile = String.new("source 'https://rubygems.org'\n")
|
82
83
|
gemfile << dependencies_to_gemfile(nondevelopment_dependencies)
|
83
84
|
unless development_dependencies.empty?
|
84
85
|
gemfile << "\n"
|
@@ -94,7 +95,7 @@ module Gem
|
|
94
95
|
private
|
95
96
|
|
96
97
|
def dependencies_to_gemfile(dependencies, group = nil)
|
97
|
-
gemfile =
|
98
|
+
gemfile = String.new
|
98
99
|
if dependencies.any?
|
99
100
|
gemfile << "group :#{group} do\n" if group
|
100
101
|
dependencies.each do |dependency|
|
@@ -126,7 +127,7 @@ module Gem
|
|
126
127
|
end
|
127
128
|
|
128
129
|
def to_lock
|
129
|
-
out = " #{name}"
|
130
|
+
out = String.new(" #{name}")
|
130
131
|
unless requirement == Gem::Requirement.default
|
131
132
|
reqs = requirement.requirements.map {|o, v| "#{o} #{v}" }.sort.reverse
|
132
133
|
out << " (#{reqs.join(", ")})"
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "monitor"
|
2
3
|
require "rubygems"
|
3
4
|
require "rubygems/config_file"
|
@@ -64,7 +65,7 @@ module Bundler
|
|
64
65
|
def configuration
|
65
66
|
require "bundler/psyched_yaml"
|
66
67
|
Gem.configuration
|
67
|
-
rescue Gem::SystemExitException => e
|
68
|
+
rescue Gem::SystemExitException, LoadError => e
|
68
69
|
Bundler.ui.error "#{e.class}: #{e.message}"
|
69
70
|
Bundler.ui.trace e
|
70
71
|
raise
|
@@ -181,7 +182,7 @@ module Bundler
|
|
181
182
|
def fetch_prerelease_specs
|
182
183
|
fetch_specs(false, true)
|
183
184
|
rescue Gem::RemoteFetcher::FetchError
|
184
|
-
|
185
|
+
{} # if we can't download them, there aren't any
|
185
186
|
end
|
186
187
|
|
187
188
|
# TODO: This is for older versions of Rubygems... should we support the
|
@@ -194,9 +195,9 @@ module Bundler
|
|
194
195
|
# Fetch all specs, minus prerelease specs
|
195
196
|
spec_list = fetch_specs(true, false)
|
196
197
|
# Then fetch the prerelease specs
|
197
|
-
fetch_prerelease_specs.each {|k, v| spec_list[k]
|
198
|
+
fetch_prerelease_specs.each {|k, v| spec_list[k].push(*v) }
|
198
199
|
|
199
|
-
spec_list
|
200
|
+
spec_list.values.first
|
200
201
|
ensure
|
201
202
|
Bundler.rubygems.sources = old_sources
|
202
203
|
end
|
@@ -578,18 +579,12 @@ module Bundler
|
|
578
579
|
end
|
579
580
|
|
580
581
|
def fetch_all_remote_specs(remote)
|
581
|
-
|
582
|
-
# and unmarshal the array ourselves.
|
583
|
-
hash = {}
|
582
|
+
source = remote.uri.is_a?(URI) ? remote.uri : URI.parse(source.to_s)
|
584
583
|
|
585
|
-
|
586
|
-
|
587
|
-
hash[source] = fetch_specs(source, remote, "specs")
|
584
|
+
specs = fetch_specs(source, remote, "specs")
|
585
|
+
pres = fetch_specs(source, remote, "prerelease_specs") || []
|
588
586
|
|
589
|
-
pres
|
590
|
-
hash[source].push(*pres) if pres && !pres.empty?
|
591
|
-
|
592
|
-
hash
|
587
|
+
specs.push(*pres)
|
593
588
|
end
|
594
589
|
|
595
590
|
def download_gem(spec, uri, path)
|
data/lib/bundler/runtime.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "digest/sha1"
|
2
3
|
|
3
4
|
module Bundler
|
@@ -12,7 +13,7 @@ module Bundler
|
|
12
13
|
|
13
14
|
specs = groups.any? ? @definition.specs_for(groups) : requested_specs
|
14
15
|
|
15
|
-
|
16
|
+
SharedHelpers.set_bundle_environment
|
16
17
|
Bundler.rubygems.replace_entrypoints(specs)
|
17
18
|
|
18
19
|
# Activate the specs
|
@@ -52,7 +53,7 @@ module Bundler
|
|
52
53
|
/^Missing API definition file in (.+)$/i,
|
53
54
|
/^cannot load such file -- (.+)$/i,
|
54
55
|
/^dlopen\([^)]*\): Library not loaded: (.+)$/i,
|
55
|
-
]
|
56
|
+
].freeze
|
56
57
|
|
57
58
|
def require(*groups)
|
58
59
|
groups.map!(&:to_sym)
|
@@ -189,26 +190,21 @@ module Bundler
|
|
189
190
|
|
190
191
|
unless dry_run
|
191
192
|
stale_files = stale_gem_bins + stale_gem_files + stale_gemspec_files
|
192
|
-
stale_files.each
|
193
|
-
|
193
|
+
stale_files.each do |file|
|
194
|
+
SharedHelpers.filesystem_access(File.dirname(file)) do |_p|
|
195
|
+
FileUtils.rm(file) if File.exist?(file)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
stale_git_cache_dirs.each do |cache_dir|
|
199
|
+
SharedHelpers.filesystem_access(cache_dir) do |dir|
|
200
|
+
FileUtils.rm_rf(dir) if File.exist?(dir)
|
201
|
+
end
|
202
|
+
end
|
194
203
|
end
|
195
204
|
|
196
205
|
output
|
197
206
|
end
|
198
207
|
|
199
|
-
def setup_environment
|
200
|
-
begin
|
201
|
-
ENV["BUNDLE_BIN_PATH"] = Bundler.rubygems.bin_path("bundler", "bundle", VERSION)
|
202
|
-
rescue Gem::GemNotFoundException
|
203
|
-
ENV["BUNDLE_BIN_PATH"] = File.expand_path("../../../exe/bundle", __FILE__)
|
204
|
-
end
|
205
|
-
|
206
|
-
# Set BUNDLE_GEMFILE
|
207
|
-
ENV["BUNDLE_GEMFILE"] = default_gemfile.to_s
|
208
|
-
|
209
|
-
SharedHelpers.set_bundle_environment
|
210
|
-
end
|
211
|
-
|
212
208
|
private
|
213
209
|
|
214
210
|
def prune_gem_cache(resolve, cache_path)
|
@@ -265,11 +261,10 @@ module Bundler
|
|
265
261
|
man_subdir unless Dir[man_subdir + "/man?/"].empty?
|
266
262
|
end.compact
|
267
263
|
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
end
|
264
|
+
return if manuals.empty?
|
265
|
+
ENV["MANPATH"] = manuals.concat(
|
266
|
+
ENV["MANPATH"].to_s.split(File::PATH_SEPARATOR)
|
267
|
+
).uniq.join(File::PATH_SEPARATOR)
|
273
268
|
end
|
274
269
|
|
275
270
|
def remove_dir(dir, dry_run)
|
data/lib/bundler/settings.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "uri"
|
2
3
|
|
3
4
|
module Bundler
|
4
5
|
class Settings
|
5
|
-
BOOL_KEYS = %w(frozen cache_all no_prune disable_local_branch_check ignore_messages gem.mit gem.coc silence_root_warning).freeze
|
6
|
+
BOOL_KEYS = %w(frozen cache_all no_prune disable_local_branch_check disable_shared_gems ignore_messages gem.mit gem.coc silence_root_warning).freeze
|
6
7
|
NUMBER_KEYS = %w(retry timeout redirect ssl_verify_mode).freeze
|
7
|
-
DEFAULT_CONFIG = { :retry => 3, :timeout => 10, :redirect => 5 }
|
8
|
+
DEFAULT_CONFIG = { :retry => 3, :timeout => 10, :redirect => 5 }.freeze
|
8
9
|
|
9
10
|
def initialize(root = nil)
|
10
11
|
@root = root
|
@@ -63,10 +64,7 @@ module Bundler
|
|
63
64
|
|
64
65
|
def mirror_for(uri)
|
65
66
|
uri = URI(uri.to_s) unless uri.is_a?(URI)
|
66
|
-
|
67
|
-
# Settings keys are all downcased
|
68
|
-
normalized_key = normalize_uri(uri.to_s.downcase)
|
69
|
-
gem_mirrors[normalized_key] || uri
|
67
|
+
gem_mirrors.for(uri.to_s).uri
|
70
68
|
end
|
71
69
|
|
72
70
|
def credentials_for(uri)
|
@@ -74,12 +72,9 @@ module Bundler
|
|
74
72
|
end
|
75
73
|
|
76
74
|
def gem_mirrors
|
77
|
-
all.inject(
|
78
|
-
if k =~ /^mirror\./
|
79
|
-
|
80
|
-
h[uri] = normalize_uri(self[k])
|
81
|
-
end
|
82
|
-
h
|
75
|
+
all.inject(Mirrors.new) do |mirrors, k|
|
76
|
+
mirrors.parse(k, self[k]) if k =~ /^mirror\./
|
77
|
+
mirrors
|
83
78
|
end
|
84
79
|
end
|
85
80
|
|
@@ -161,7 +156,7 @@ module Bundler
|
|
161
156
|
private
|
162
157
|
|
163
158
|
def key_for(key)
|
164
|
-
key = normalize_uri(key).to_s if key.is_a?(String) && /https?:/ =~ key
|
159
|
+
key = Settings.normalize_uri(key).to_s if key.is_a?(String) && /https?:/ =~ key
|
165
160
|
key = key.to_s.gsub(".", "__").upcase
|
166
161
|
"BUNDLE_#{key}"
|
167
162
|
end
|
@@ -215,8 +210,11 @@ module Bundler
|
|
215
210
|
end
|
216
211
|
|
217
212
|
def global_config_file
|
218
|
-
|
219
|
-
|
213
|
+
if ENV["BUNDLE_CONFIG"] && !ENV["BUNDLE_CONFIG"].empty?
|
214
|
+
Pathname.new(ENV["BUNDLE_CONFIG"])
|
215
|
+
else
|
216
|
+
Bundler.user_bundle_path.join("config")
|
217
|
+
end
|
220
218
|
end
|
221
219
|
|
222
220
|
def local_config_file
|
@@ -224,17 +222,15 @@ module Bundler
|
|
224
222
|
end
|
225
223
|
|
226
224
|
def load_config(config_file)
|
227
|
-
|
228
|
-
|
225
|
+
SharedHelpers.filesystem_access(config_file, :read) do
|
226
|
+
valid_file = config_file && config_file.exist? && !config_file.size.zero?
|
227
|
+
return {} if ignore_config? || !valid_file
|
229
228
|
config_regex = /^(BUNDLE_.+): (['"]?)(.*(?:\n(?!BUNDLE).+)?)\2$/
|
230
|
-
raise PermissionError.new(config_file, :read) unless config_file.readable?
|
231
229
|
config_pairs = config_file.read.scan(config_regex).map do |m|
|
232
230
|
key, _, value = m
|
233
231
|
[convert_to_backward_compatible_key(key), value.gsub(/\s+/, " ").tr('"', "'")]
|
234
232
|
end
|
235
233
|
Hash[config_pairs]
|
236
|
-
else
|
237
|
-
{}
|
238
234
|
end
|
239
235
|
end
|
240
236
|
|
@@ -246,7 +242,7 @@ module Bundler
|
|
246
242
|
|
247
243
|
# TODO: duplicates Rubygems#normalize_uri
|
248
244
|
# TODO: is this the correct place to validate mirror URIs?
|
249
|
-
def normalize_uri(uri)
|
245
|
+
def self.normalize_uri(uri)
|
250
246
|
uri = uri.to_s
|
251
247
|
uri = "#{uri}/" unless uri =~ %r{/\Z}
|
252
248
|
uri = URI(uri)
|