bundler 1.10.6 → 1.11.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/.rubocop.yml +105 -0
- data/.rubocop_todo.yml +120 -0
- data/.travis.yml +8 -23
- data/CHANGELOG.md +69 -0
- data/CODE_OF_CONDUCT.md +6 -4
- data/DEVELOPMENT.md +4 -5
- data/README.md +2 -2
- data/Rakefile +70 -87
- data/bin/rake +14 -0
- data/bin/rspec +10 -0
- data/bin/rubocop +11 -0
- data/bundler.gemspec +17 -15
- data/exe/bundle +20 -0
- data/{bin → exe}/bundle_ruby +6 -4
- data/exe/bundler +20 -0
- data/lib/bundler.rb +98 -119
- data/lib/bundler/capistrano.rb +2 -2
- data/lib/bundler/cli.rb +85 -74
- data/lib/bundler/cli/binstubs.rb +1 -2
- data/lib/bundler/cli/cache.rb +0 -1
- data/lib/bundler/cli/check.rb +7 -5
- data/lib/bundler/cli/clean.rb +0 -1
- data/lib/bundler/cli/common.rb +6 -7
- data/lib/bundler/cli/config.rb +69 -56
- data/lib/bundler/cli/console.rb +8 -8
- data/lib/bundler/cli/exec.rb +4 -3
- data/lib/bundler/cli/gem.rb +50 -39
- data/lib/bundler/cli/init.rb +5 -6
- data/lib/bundler/cli/inject.rb +1 -2
- data/lib/bundler/cli/install.rb +18 -21
- data/lib/bundler/cli/lock.rb +8 -3
- data/lib/bundler/cli/open.rb +4 -5
- data/lib/bundler/cli/outdated.rb +7 -8
- data/lib/bundler/cli/package.rb +1 -1
- data/lib/bundler/cli/platform.rb +2 -3
- data/lib/bundler/cli/show.rb +9 -9
- data/lib/bundler/cli/update.rb +2 -3
- data/lib/bundler/cli/viz.rb +1 -2
- data/lib/bundler/constants.rb +1 -1
- data/lib/bundler/current_ruby.rb +38 -3
- data/lib/bundler/definition.rb +83 -88
- data/lib/bundler/dep_proxy.rb +11 -9
- data/lib/bundler/dependency.rb +26 -11
- data/lib/bundler/deployment.rb +2 -2
- data/lib/bundler/deprecate.rb +3 -3
- data/lib/bundler/dsl.rb +63 -44
- data/lib/bundler/env.rb +19 -12
- data/lib/bundler/environment.rb +1 -2
- data/lib/bundler/errors.rb +82 -0
- data/lib/bundler/fetcher.rb +45 -39
- data/lib/bundler/fetcher/base.rb +20 -7
- data/lib/bundler/fetcher/dependency.rb +5 -5
- data/lib/bundler/fetcher/downloader.rb +1 -2
- data/lib/bundler/fetcher/index.rb +4 -7
- data/lib/bundler/friendly_errors.rb +15 -8
- data/lib/bundler/gem_helper.rb +44 -35
- data/lib/bundler/gem_helpers.rb +7 -8
- data/lib/bundler/gem_remote_fetcher.rb +41 -0
- data/lib/bundler/gem_tasks.rb +4 -1
- data/lib/bundler/graph.rb +25 -24
- data/lib/bundler/index.rb +21 -18
- data/lib/bundler/injector.rb +2 -4
- data/lib/bundler/inline.rb +3 -3
- data/lib/bundler/installer.rb +57 -144
- data/lib/bundler/installer/gem_installer.rb +76 -0
- data/lib/bundler/installer/parallel_installer.rb +22 -13
- data/lib/bundler/installer/standalone.rb +48 -0
- data/lib/bundler/lazy_specification.rb +3 -4
- data/lib/bundler/lockfile_parser.rb +21 -19
- data/lib/bundler/match_platform.rb +4 -4
- data/lib/bundler/psyched_yaml.rb +3 -3
- data/lib/bundler/remote_specification.rb +1 -1
- data/lib/bundler/resolver.rb +93 -88
- data/lib/bundler/retry.rb +9 -10
- data/lib/bundler/ruby_dsl.rb +1 -1
- data/lib/bundler/ruby_version.rb +7 -10
- data/lib/bundler/rubygems_ext.rb +32 -27
- data/lib/bundler/{gem_installer.rb → rubygems_gem_installer.rb} +2 -2
- data/lib/bundler/rubygems_integration.rb +85 -70
- data/lib/bundler/runtime.rb +57 -61
- data/lib/bundler/settings.rb +27 -26
- data/lib/bundler/setup.rb +3 -3
- data/lib/bundler/shared_helpers.rb +45 -20
- data/lib/bundler/similarity_detector.rb +19 -21
- data/lib/bundler/source.rb +4 -5
- data/lib/bundler/source/git.rb +29 -31
- data/lib/bundler/source/git/git_proxy.rb +52 -26
- data/lib/bundler/source/path.rb +25 -28
- data/lib/bundler/source/path/installer.rb +4 -4
- data/lib/bundler/source/rubygems.rb +62 -48
- data/lib/bundler/source/rubygems/remote.rb +3 -3
- data/lib/bundler/source_list.rb +4 -4
- data/lib/bundler/spec_set.rb +17 -15
- data/lib/bundler/ssl_certs/certificate_manager.rb +5 -6
- data/lib/bundler/stub_specification.rb +2 -2
- data/lib/bundler/templates/Executable +5 -5
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +42 -6
- data/lib/bundler/templates/newgem/README.md.tt +1 -1
- data/lib/bundler/templates/newgem/Rakefile.tt +4 -2
- data/lib/bundler/templates/newgem/bin/setup.tt +2 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -2
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/ui/rg_proxy.rb +2 -2
- data/lib/bundler/ui/shell.rb +10 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +82 -71
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +9 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +40 -21
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -0
- data/lib/bundler/vendored_molinillo.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +3 -3
- data/lib/bundler/vendored_thor.rb +2 -2
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/vlad.rb +1 -1
- data/lib/bundler/worker.rb +4 -5
- data/man/bundle-config.ronn +4 -2
- data/man/bundle-gem.ronn +77 -0
- data/man/bundle-install.ronn +13 -6
- data/man/bundle-lock.ronn +47 -0
- data/man/bundle.ronn +1 -1
- data/man/gemfile.5.ronn +8 -0
- data/man/index.txt +1 -0
- metadata +37 -8
- data/bin/bundle +0 -21
- data/bin/bundler +0 -21
@@ -0,0 +1,48 @@
|
|
1
|
+
module Bundler
|
2
|
+
class Standalone
|
3
|
+
def initialize(groups, definition)
|
4
|
+
@specs = groups.empty? ? definition.requested_specs : definition.specs_for(groups.map(&:to_sym))
|
5
|
+
end
|
6
|
+
|
7
|
+
def generate
|
8
|
+
SharedHelpers.filesystem_access(bundler_path) do |p|
|
9
|
+
FileUtils.mkdir_p(p)
|
10
|
+
end
|
11
|
+
File.open File.join(bundler_path, "setup.rb"), "w" do |file|
|
12
|
+
file.puts "require 'rbconfig'"
|
13
|
+
file.puts "# ruby 1.8.7 doesn't define RUBY_ENGINE"
|
14
|
+
file.puts "ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'"
|
15
|
+
file.puts "ruby_version = RbConfig::CONFIG[\"ruby_version\"]"
|
16
|
+
file.puts "path = File.expand_path('..', __FILE__)"
|
17
|
+
paths.each do |path|
|
18
|
+
file.puts %($:.unshift "\#{path}/#{path}")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def paths
|
26
|
+
@specs.map do |spec|
|
27
|
+
next if spec.name == "bundler"
|
28
|
+
Array(spec.require_paths).map do |path|
|
29
|
+
gem_path(path, spec).sub(version_dir, '#{ruby_engine}/#{ruby_version}')
|
30
|
+
# This is a static string intentionally. It's interpolated at a later time.
|
31
|
+
end
|
32
|
+
end.flatten
|
33
|
+
end
|
34
|
+
|
35
|
+
def version_dir
|
36
|
+
"#{Bundler.ruby_version.engine}/#{RbConfig::CONFIG["ruby_version"]}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def bundler_path
|
40
|
+
File.join(Bundler.settings[:path], "bundler")
|
41
|
+
end
|
42
|
+
|
43
|
+
def gem_path(path, spec)
|
44
|
+
full_path = Pathname.new(path).absolute? ? path : File.join(spec.full_gem_path, path)
|
45
|
+
Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path)).to_s
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -19,7 +19,7 @@ module Bundler
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def full_name
|
22
|
-
if platform == Gem::Platform::RUBY
|
22
|
+
if platform == Gem::Platform::RUBY || platform.nil?
|
23
23
|
"#{@name}-#{@version}"
|
24
24
|
else
|
25
25
|
"#{@name}-#{@version}-#{platform}"
|
@@ -35,13 +35,13 @@ module Bundler
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def to_lock
|
38
|
-
if platform == Gem::Platform::RUBY
|
38
|
+
if platform == Gem::Platform::RUBY || platform.nil?
|
39
39
|
out = " #{name} (#{version})\n"
|
40
40
|
else
|
41
41
|
out = " #{name} (#{version}-#{platform})\n"
|
42
42
|
end
|
43
43
|
|
44
|
-
dependencies.sort_by
|
44
|
+
dependencies.sort_by(&:to_s).uniq.each do |dep|
|
45
45
|
next if dep.type == :development
|
46
46
|
out << " #{dep.to_lock}\n"
|
47
47
|
end
|
@@ -78,6 +78,5 @@ module Bundler
|
|
78
78
|
|
79
79
|
@specification.send(method, *args, &blk)
|
80
80
|
end
|
81
|
-
|
82
81
|
end
|
83
82
|
end
|
@@ -34,8 +34,8 @@ module Bundler
|
|
34
34
|
@rubygems_aggregate = Source::Rubygems.new
|
35
35
|
|
36
36
|
if lockfile.match(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/)
|
37
|
-
raise LockfileError, "Your
|
38
|
-
"Run `git checkout HEAD --
|
37
|
+
raise LockfileError, "Your #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} contains merge conflicts.\n" \
|
38
|
+
"Run `git checkout HEAD -- #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` first to get a clean lock."
|
39
39
|
end
|
40
40
|
|
41
41
|
lockfile.split(/(?:\r?\n)+/).each do |line|
|
@@ -59,7 +59,7 @@ module Bundler
|
|
59
59
|
warn_for_outdated_bundler_version
|
60
60
|
rescue ArgumentError => e
|
61
61
|
Bundler.ui.debug(e)
|
62
|
-
raise LockfileError, "Your lockfile is unreadable. Run `rm
|
62
|
+
raise LockfileError, "Your lockfile is unreadable. Run `rm #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` " \
|
63
63
|
"and then `bundle install` to generate a new lockfile."
|
64
64
|
end
|
65
65
|
|
@@ -92,7 +92,8 @@ module Bundler
|
|
92
92
|
case line
|
93
93
|
when GIT, GEM, PATH
|
94
94
|
@current_source = nil
|
95
|
-
@opts
|
95
|
+
@opts = {}
|
96
|
+
@type = line
|
96
97
|
when SPECS
|
97
98
|
case @type
|
98
99
|
when PATH
|
@@ -102,7 +103,7 @@ module Bundler
|
|
102
103
|
@current_source = TYPES[@type].from_lock(@opts)
|
103
104
|
# Strip out duplicate GIT sections
|
104
105
|
if @sources.include?(@current_source)
|
105
|
-
@current_source = @sources.find {
|
106
|
+
@current_source = @sources.find {|s| s == @current_source }
|
106
107
|
else
|
107
108
|
@sources << @current_source
|
108
109
|
end
|
@@ -131,19 +132,21 @@ module Bundler
|
|
131
132
|
end
|
132
133
|
|
133
134
|
NAME_VERSION = '(?! )(.*?)(?: \(([^-]*)(?:-(.*))?\))?'
|
134
|
-
NAME_VERSION_2 =
|
135
|
-
NAME_VERSION_4 =
|
136
|
-
NAME_VERSION_6 =
|
135
|
+
NAME_VERSION_2 = /^ {2}#{NAME_VERSION}(!)?$/
|
136
|
+
NAME_VERSION_4 = /^ {4}#{NAME_VERSION}$/
|
137
|
+
NAME_VERSION_6 = /^ {6}#{NAME_VERSION}$/
|
137
138
|
|
138
139
|
def parse_dependency(line)
|
139
140
|
if line =~ NAME_VERSION_2
|
140
|
-
name
|
141
|
-
version =
|
141
|
+
name = $1
|
142
|
+
version = $2
|
143
|
+
pinned = $4
|
144
|
+
version = version.split(",").map(&:strip) if version
|
142
145
|
|
143
146
|
dep = Bundler::Dependency.new(name, version)
|
144
147
|
|
145
|
-
if pinned && dep.name !=
|
146
|
-
spec = @specs.find {|
|
148
|
+
if pinned && dep.name != "bundler"
|
149
|
+
spec = @specs.find {|_, v| v.name == dep.name }
|
147
150
|
dep.source = spec.last.source if spec
|
148
151
|
|
149
152
|
# Path sources need to know what the default name / version
|
@@ -162,7 +165,8 @@ module Bundler
|
|
162
165
|
|
163
166
|
def parse_spec(line)
|
164
167
|
if line =~ NAME_VERSION_4
|
165
|
-
name
|
168
|
+
name = $1
|
169
|
+
version = Gem::Version.new($2)
|
166
170
|
platform = $3 ? Gem::Platform.new($3) : Gem::Platform::RUBY
|
167
171
|
@current_spec = LazySpecification.new(name, version, platform)
|
168
172
|
@current_spec.source = @current_source
|
@@ -171,17 +175,16 @@ module Bundler
|
|
171
175
|
# duplicate GIT sections)
|
172
176
|
@specs[@current_spec.identifier] ||= @current_spec
|
173
177
|
elsif line =~ NAME_VERSION_6
|
174
|
-
name
|
175
|
-
version =
|
178
|
+
name = $1
|
179
|
+
version = $2
|
180
|
+
version = version.split(",").map(&:strip) if version
|
176
181
|
dep = Gem::Dependency.new(name, version)
|
177
182
|
@current_spec.dependencies << dep
|
178
183
|
end
|
179
184
|
end
|
180
185
|
|
181
186
|
def parse_platform(line)
|
182
|
-
if line =~ /^ (.*)$/
|
183
|
-
@platforms << Gem::Platform.new($1)
|
184
|
-
end
|
187
|
+
@platforms << Gem::Platform.new($1) if line =~ /^ (.*)$/
|
185
188
|
end
|
186
189
|
|
187
190
|
def parse_bundled_with(line)
|
@@ -190,6 +193,5 @@ module Bundler
|
|
190
193
|
@bundler_version = Gem::Version.create(line)
|
191
194
|
end
|
192
195
|
end
|
193
|
-
|
194
196
|
end
|
195
197
|
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
require
|
1
|
+
require "bundler/gem_helpers"
|
2
2
|
|
3
3
|
module Bundler
|
4
4
|
module MatchPlatform
|
5
5
|
include GemHelpers
|
6
6
|
|
7
7
|
def match_platform(p)
|
8
|
-
Gem::Platform::RUBY == platform
|
9
|
-
|
10
|
-
|
8
|
+
Gem::Platform::RUBY == platform ||
|
9
|
+
platform.nil? || p == platform ||
|
10
|
+
generic(Gem::Platform.new(platform)) === p
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
data/lib/bundler/psyched_yaml.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
# Psych could be a gem, so try to ask for it
|
2
2
|
begin
|
3
|
-
gem
|
3
|
+
gem "psych"
|
4
4
|
rescue LoadError
|
5
5
|
end if defined?(gem)
|
6
6
|
|
7
7
|
# Psych could just be in the stdlib
|
8
8
|
# but it's too late if Syck is already loaded
|
9
9
|
begin
|
10
|
-
require
|
10
|
+
require "psych" unless defined?(Syck)
|
11
11
|
rescue LoadError
|
12
12
|
# Apparently Psych wasn't available. Oh well.
|
13
13
|
end
|
14
14
|
|
15
15
|
# At least load the YAML stdlib, whatever that may be
|
16
|
-
require
|
16
|
+
require "yaml" unless defined?(YAML.dump)
|
17
17
|
|
18
18
|
module Bundler
|
19
19
|
# On encountering invalid YAML,
|
data/lib/bundler/resolver.rb
CHANGED
@@ -1,52 +1,48 @@
|
|
1
|
-
require 'set'
|
2
|
-
|
3
|
-
# This is the latest iteration of the gem dependency resolving algorithm. As of now,
|
4
|
-
# it can resolve (as a success or failure) any set of gem dependencies we throw at it
|
5
|
-
# in a reasonable amount of time. The most iterations I've seen it take is about 150.
|
6
|
-
# The actual implementation of the algorithm is not as good as it could be yet, but that
|
7
|
-
# can come later.
|
8
|
-
|
9
1
|
module Bundler
|
10
2
|
class Resolver
|
11
|
-
|
12
|
-
require 'bundler/vendored_molinillo'
|
3
|
+
require "bundler/vendored_molinillo"
|
13
4
|
|
14
5
|
class Molinillo::VersionConflict
|
15
|
-
def
|
16
|
-
if
|
17
|
-
|
6
|
+
def printable_dep(dep)
|
7
|
+
if dep.is_a?(Bundler::Dependency)
|
8
|
+
DepProxy.new(dep, dep.platforms.join(", ")).to_s.strip
|
18
9
|
else
|
19
|
-
|
10
|
+
dep.to_s
|
20
11
|
end
|
21
12
|
end
|
22
13
|
|
23
14
|
def message
|
24
|
-
conflicts.
|
25
|
-
o << %(Bundler could not find compatible versions for gem "#{
|
15
|
+
conflicts.sort.reduce("") do |o, (name, conflict)|
|
16
|
+
o << %(Bundler could not find compatible versions for gem "#{name}":\n)
|
26
17
|
if conflict.locked_requirement
|
27
|
-
o << %( In snapshot (
|
28
|
-
o << %( #{
|
18
|
+
o << %( In snapshot (#{Bundler.default_lockfile.basename}):\n)
|
19
|
+
o << %( #{printable_dep(conflict.locked_requirement)}\n)
|
29
20
|
o << %(\n)
|
30
21
|
end
|
31
22
|
o << %( In Gemfile:\n)
|
32
|
-
o << conflict.requirement_trees.map do |tree|
|
33
|
-
t =
|
23
|
+
o << conflict.requirement_trees.sort_by {|t| t.reverse.map(&:name) }.map do |tree|
|
24
|
+
t = ""
|
34
25
|
depth = 2
|
35
26
|
tree.each do |req|
|
36
|
-
t <<
|
37
|
-
|
27
|
+
t << " " * depth << req.to_s
|
28
|
+
unless tree.last == req
|
29
|
+
if spec = conflict.activated_by_name[req.name]
|
30
|
+
t << %( was resolved to #{spec.version}, which)
|
31
|
+
end
|
32
|
+
t << %( depends on)
|
33
|
+
end
|
38
34
|
t << %(\n)
|
39
35
|
depth += 1
|
40
36
|
end
|
41
37
|
t
|
42
38
|
end.join("\n")
|
43
39
|
|
44
|
-
if
|
40
|
+
if name == "bundler"
|
45
41
|
o << %(\n Current Bundler version:\n bundler (#{Bundler::VERSION}))
|
46
42
|
other_bundler_required = !conflict.requirement.requirement.satisfied_by?(Gem::Version.new Bundler::VERSION)
|
47
43
|
end
|
48
44
|
|
49
|
-
if
|
45
|
+
if name == "bundler" && other_bundler_required
|
50
46
|
o << "\n"
|
51
47
|
o << "This Gemfile requires a different version of Bundler.\n"
|
52
48
|
o << "Perhaps you need to update Bundler by running `gem install bundler`?\n"
|
@@ -56,11 +52,12 @@ module Bundler
|
|
56
52
|
o << %(Running `bundle update` will rebuild your snapshot from scratch, using only\n)
|
57
53
|
o << %(the gems in your Gemfile, which may resolve the conflict.\n)
|
58
54
|
elsif !conflict.existing
|
55
|
+
o << "\n"
|
59
56
|
if conflict.requirement_trees.first.size > 1
|
60
|
-
o << "Could not find gem '#{
|
61
|
-
o << "gem '#{
|
57
|
+
o << "Could not find gem '#{conflict.requirement}', which is required by "
|
58
|
+
o << "gem '#{conflict.requirement_trees.first[-2]}', in any of the sources."
|
62
59
|
else
|
63
|
-
o << "Could not find gem '#{
|
60
|
+
o << "Could not find gem '#{conflict.requirement}' in any of the sources\n"
|
64
61
|
end
|
65
62
|
end
|
66
63
|
o
|
@@ -83,7 +80,7 @@ module Bundler
|
|
83
80
|
@specs = {}
|
84
81
|
|
85
82
|
ALL.each do |p|
|
86
|
-
@specs[p] = reverse.find {
|
83
|
+
@specs[p] = reverse.find {|s| s.match_platform(p) }
|
87
84
|
end
|
88
85
|
end
|
89
86
|
|
@@ -97,21 +94,20 @@ module Bundler
|
|
97
94
|
specs = {}
|
98
95
|
|
99
96
|
@activated.each do |p|
|
100
|
-
|
101
|
-
|
102
|
-
|
97
|
+
next unless s = @specs[p]
|
98
|
+
platform = generic(Gem::Platform.new(s.platform))
|
99
|
+
next if specs[platform]
|
103
100
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
end
|
101
|
+
lazy_spec = LazySpecification.new(name, version, platform, source)
|
102
|
+
lazy_spec.dependencies.replace s.dependencies
|
103
|
+
specs[platform] = lazy_spec
|
108
104
|
end
|
109
105
|
specs.values
|
110
106
|
end
|
111
107
|
|
112
108
|
def activate_platform(platform)
|
113
109
|
unless @activated.include?(platform)
|
114
|
-
if for?(platform)
|
110
|
+
if for?(platform, nil)
|
115
111
|
@activated << platform
|
116
112
|
return __dependencies[platform] || []
|
117
113
|
end
|
@@ -131,8 +127,14 @@ module Bundler
|
|
131
127
|
@source ||= first.source
|
132
128
|
end
|
133
129
|
|
134
|
-
def for?(platform)
|
135
|
-
@specs[platform]
|
130
|
+
def for?(platform, required_ruby_version)
|
131
|
+
if spec = @specs[platform]
|
132
|
+
if required_ruby_version && spec_required_ruby_version = spec.required_ruby_version
|
133
|
+
spec_required_ruby_version.satisfied_by?(required_ruby_version)
|
134
|
+
else
|
135
|
+
true
|
136
|
+
end
|
137
|
+
end
|
136
138
|
end
|
137
139
|
|
138
140
|
def to_s
|
@@ -140,11 +142,11 @@ module Bundler
|
|
140
142
|
end
|
141
143
|
|
142
144
|
def dependencies_for_activated_platforms
|
143
|
-
@activated.map {
|
145
|
+
@activated.map {|p| __dependencies[p] }.flatten
|
144
146
|
end
|
145
147
|
|
146
148
|
def platforms_for_dependency_named(dependency)
|
147
|
-
__dependencies.select {
|
149
|
+
__dependencies.select {|_, deps| deps.map(&:name).include? dependency }.keys
|
148
150
|
end
|
149
151
|
|
150
152
|
private
|
@@ -153,12 +155,11 @@ module Bundler
|
|
153
155
|
@dependencies ||= begin
|
154
156
|
dependencies = {}
|
155
157
|
ALL.each do |p|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
end
|
158
|
+
next unless spec = @specs[p]
|
159
|
+
dependencies[p] = []
|
160
|
+
spec.dependencies.each do |dep|
|
161
|
+
next if dep.type == :development
|
162
|
+
dependencies[p] << DepProxy.new(dep, p)
|
162
163
|
end
|
163
164
|
end
|
164
165
|
dependencies
|
@@ -176,22 +177,22 @@ module Bundler
|
|
176
177
|
# ==== Returns
|
177
178
|
# <GemBundle>,nil:: If the list of dependencies can be resolved, a
|
178
179
|
# collection of gemspecs is returned. Otherwise, nil is returned.
|
179
|
-
def self.resolve(requirements, index, source_requirements = {}, base = [])
|
180
|
+
def self.resolve(requirements, index, source_requirements = {}, base = [], ruby_version = nil)
|
180
181
|
base = SpecSet.new(base) unless base.is_a?(SpecSet)
|
181
|
-
resolver = new(index, source_requirements, base)
|
182
|
+
resolver = new(index, source_requirements, base, ruby_version)
|
182
183
|
result = resolver.start(requirements)
|
183
184
|
SpecSet.new(result)
|
184
185
|
end
|
185
186
|
|
186
|
-
|
187
|
-
def initialize(index, source_requirements, base)
|
187
|
+
def initialize(index, source_requirements, base, ruby_version)
|
188
188
|
@index = index
|
189
189
|
@source_requirements = source_requirements
|
190
190
|
@base = base
|
191
191
|
@resolver = Molinillo::Resolver.new(self, self)
|
192
192
|
@search_for = {}
|
193
193
|
@base_dg = Molinillo::DependencyGraph.new
|
194
|
-
@base.each {
|
194
|
+
@base.each {|ls| @base_dg.add_vertex(ls.name, Dependency.new(ls.name, ls.version), true) }
|
195
|
+
@ruby_version = ruby_version ? Gem::Version.create(ruby_version) : nil
|
195
196
|
end
|
196
197
|
|
197
198
|
def start(requirements)
|
@@ -201,10 +202,10 @@ module Bundler
|
|
201
202
|
rescue Molinillo::VersionConflict => e
|
202
203
|
raise VersionConflict.new(e.conflicts.keys.uniq, e.message)
|
203
204
|
rescue Molinillo::CircularDependencyError => e
|
204
|
-
names = e.dependencies.sort_by(&:name).map {
|
205
|
-
raise CyclicDependencyError, "Your
|
205
|
+
names = e.dependencies.sort_by(&:name).map {|d| "gem '#{d.name}'" }
|
206
|
+
raise CyclicDependencyError, "Your bundle requires gems that depend" \
|
206
207
|
" on each other, creating an infinite loop. Please remove" \
|
207
|
-
" #{names.count > 1 ?
|
208
|
+
" #{names.count > 1 ? "either " : ""}#{names.join(" or ")}" \
|
208
209
|
" and try again."
|
209
210
|
end
|
210
211
|
|
@@ -218,27 +219,27 @@ module Bundler
|
|
218
219
|
if debug?
|
219
220
|
debug_info = yield
|
220
221
|
debug_info = debug_info.inspect unless debug_info.is_a?(String)
|
221
|
-
STDERR.puts debug_info.split("\n").map {
|
222
|
+
STDERR.puts debug_info.split("\n").map {|s| " " * depth + s }
|
222
223
|
end
|
223
224
|
end
|
224
225
|
|
225
226
|
def debug?
|
226
|
-
ENV[
|
227
|
+
ENV["DEBUG_RESOLVER"] || ENV["DEBUG_RESOLVER_TREE"]
|
227
228
|
end
|
228
229
|
|
229
230
|
def before_resolution
|
230
|
-
Bundler.ui.info
|
231
|
+
Bundler.ui.info "Resolving dependencies...", false
|
231
232
|
end
|
232
233
|
|
233
234
|
def after_resolution
|
234
|
-
Bundler.ui.info
|
235
|
+
Bundler.ui.info ""
|
235
236
|
end
|
236
237
|
|
237
238
|
def indicate_progress
|
238
|
-
Bundler.ui.info
|
239
|
+
Bundler.ui.info ".", false
|
239
240
|
end
|
240
241
|
|
241
|
-
|
242
|
+
private
|
242
243
|
|
243
244
|
include Molinillo::SpecificationProvider
|
244
245
|
|
@@ -265,13 +266,13 @@ module Bundler
|
|
265
266
|
end
|
266
267
|
nested.last << spec
|
267
268
|
end
|
268
|
-
groups = nested.map {
|
269
|
-
!locked_requirement ? groups : groups.select {
|
269
|
+
groups = nested.map {|a| SpecGroup.new(a) }
|
270
|
+
!locked_requirement ? groups : groups.select {|sg| locked_requirement.satisfied_by? sg.version }
|
270
271
|
else
|
271
272
|
[]
|
272
273
|
end
|
273
274
|
end
|
274
|
-
search.select {
|
275
|
+
search.select {|sg| sg.for?(platform, @ruby_version) }.each {|sg| sg.activate_platform(platform) }
|
275
276
|
end
|
276
277
|
|
277
278
|
def name_for(dependency)
|
@@ -279,11 +280,15 @@ module Bundler
|
|
279
280
|
end
|
280
281
|
|
281
282
|
def name_for_explicit_dependency_source
|
282
|
-
|
283
|
+
Bundler.default_gemfile.basename.to_s
|
284
|
+
rescue
|
285
|
+
"Gemfile"
|
283
286
|
end
|
284
287
|
|
285
288
|
def name_for_locking_dependency_source
|
286
|
-
|
289
|
+
Bundler.default_lockfile.basename.to_s
|
290
|
+
rescue
|
291
|
+
"Gemfile.lock"
|
287
292
|
end
|
288
293
|
|
289
294
|
def requirement_satisfied_by?(requirement, activated, spec)
|
@@ -305,10 +310,10 @@ module Bundler
|
|
305
310
|
def amount_constrained(dependency)
|
306
311
|
@amount_constrained ||= {}
|
307
312
|
@amount_constrained[dependency.name] ||= begin
|
308
|
-
if base = @base[dependency.name]
|
313
|
+
if (base = @base[dependency.name]) && !base.empty?
|
309
314
|
dependency.requirement.satisfied_by?(base.first.version) ? 0 : 1
|
310
315
|
else
|
311
|
-
base_dep = Dependency.new dependency.name,
|
316
|
+
base_dep = Dependency.new dependency.name, ">= 0.a"
|
312
317
|
all = search_for(DepProxy.new base_dep, dependency.__platform).size.to_f
|
313
318
|
if all.zero?
|
314
319
|
0
|
@@ -323,31 +328,31 @@ module Bundler
|
|
323
328
|
|
324
329
|
def verify_gemfile_dependencies_are_found!(requirements)
|
325
330
|
requirements.each do |requirement|
|
326
|
-
next if requirement.name ==
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
end
|
331
|
+
next if requirement.name == "bundler"
|
332
|
+
next unless search_for(requirement).empty?
|
333
|
+
if (base = @base[requirement.name]) && !base.empty?
|
334
|
+
version = base.first.version
|
335
|
+
message = "You have requested:\n" \
|
336
|
+
" #{requirement.name} #{requirement.requirement}\n\n" \
|
337
|
+
"The bundle currently has #{requirement.name} locked at #{version}.\n" \
|
338
|
+
"Try running `bundle update #{requirement.name}`\n\n" \
|
339
|
+
"If you are updating multiple gems in your Gemfile at once,\n" \
|
340
|
+
"try passing them all to `bundle update`"
|
341
|
+
elsif requirement.source
|
342
|
+
name = requirement.name
|
343
|
+
versions = @source_requirements[name][name].map(&:version)
|
344
|
+
message = "Could not find gem '#{requirement}' in #{requirement.source}.\n"
|
345
|
+
if versions.any?
|
346
|
+
message << "Source contains '#{name}' at: #{versions.join(", ")}"
|
343
347
|
else
|
344
|
-
message
|
345
|
-
"listed in your Gemfile or available on this machine."
|
348
|
+
message << "Source does not contain any versions of '#{requirement}'"
|
346
349
|
end
|
347
|
-
|
350
|
+
else
|
351
|
+
message = "Could not find gem '#{requirement}' in any of the gem sources " \
|
352
|
+
"listed in your Gemfile or available on this machine."
|
348
353
|
end
|
354
|
+
raise GemNotFound, message
|
349
355
|
end
|
350
356
|
end
|
351
|
-
|
352
357
|
end
|
353
358
|
end
|