bundler 1.15.4 → 1.16.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 +5 -5
- data/CHANGELOG.md +43 -0
- data/README.md +12 -7
- data/exe/bundle +1 -1
- data/exe/bundle_ruby +4 -3
- data/lib/bundler.rb +47 -37
- data/lib/bundler/build_metadata.rb +38 -0
- data/lib/bundler/capistrano.rb +5 -0
- data/lib/bundler/cli.rb +155 -67
- data/lib/bundler/cli/add.rb +0 -1
- data/lib/bundler/cli/binstubs.rb +9 -7
- data/lib/bundler/cli/cache.rb +5 -4
- data/lib/bundler/cli/check.rb +3 -5
- data/lib/bundler/cli/clean.rb +5 -6
- data/lib/bundler/cli/common.rb +11 -2
- data/lib/bundler/cli/config.rb +2 -1
- data/lib/bundler/cli/console.rb +2 -1
- data/lib/bundler/cli/doctor.rb +1 -0
- data/lib/bundler/cli/exec.rb +2 -1
- data/lib/bundler/cli/gem.rb +3 -2
- data/lib/bundler/cli/info.rb +0 -1
- data/lib/bundler/cli/init.rb +17 -6
- data/lib/bundler/cli/inject.rb +1 -0
- data/lib/bundler/cli/install.rb +61 -61
- data/lib/bundler/cli/issue.rb +1 -1
- data/lib/bundler/cli/list.rb +22 -0
- data/lib/bundler/cli/lock.rb +0 -1
- data/lib/bundler/cli/open.rb +2 -2
- data/lib/bundler/cli/outdated.rb +13 -8
- data/lib/bundler/cli/package.rb +9 -6
- data/lib/bundler/cli/platform.rb +1 -0
- data/lib/bundler/cli/plugin.rb +1 -0
- data/lib/bundler/cli/pristine.rb +9 -2
- data/lib/bundler/cli/show.rb +0 -1
- data/lib/bundler/cli/update.rb +31 -5
- data/lib/bundler/cli/viz.rb +1 -0
- data/lib/bundler/compact_index_client.rb +1 -0
- data/lib/bundler/compact_index_client/cache.rb +1 -0
- data/lib/bundler/compact_index_client/updater.rb +3 -2
- data/lib/bundler/compatibility_guard.rb +14 -0
- data/lib/bundler/constants.rb +1 -0
- data/lib/bundler/current_ruby.rb +5 -4
- data/lib/bundler/definition.rb +140 -95
- data/lib/bundler/dep_proxy.rb +2 -0
- data/lib/bundler/dependency.rb +6 -7
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/deprecate.rb +1 -0
- data/lib/bundler/dsl.rb +97 -62
- data/lib/bundler/endpoint_specification.rb +9 -0
- data/lib/bundler/env.rb +63 -27
- data/lib/bundler/environment_preserver.rb +26 -6
- data/lib/bundler/errors.rb +1 -0
- data/lib/bundler/feature_flag.rb +39 -4
- data/lib/bundler/fetcher.rb +15 -8
- data/lib/bundler/fetcher/base.rb +1 -0
- data/lib/bundler/fetcher/compact_index.rb +2 -11
- data/lib/bundler/fetcher/dependency.rb +1 -0
- data/lib/bundler/fetcher/downloader.rb +1 -0
- data/lib/bundler/fetcher/index.rb +1 -0
- data/lib/bundler/friendly_errors.rb +2 -1
- data/lib/bundler/gem_helper.rb +14 -9
- data/lib/bundler/gem_helpers.rb +1 -0
- data/lib/bundler/gem_remote_fetcher.rb +1 -0
- data/lib/bundler/gem_tasks.rb +1 -0
- data/lib/bundler/gem_version_promoter.rb +1 -0
- data/lib/bundler/gemdeps.rb +1 -0
- data/lib/bundler/graph.rb +1 -0
- data/lib/bundler/index.rb +15 -8
- data/lib/bundler/injector.rb +25 -22
- data/lib/bundler/inline.rb +5 -7
- data/lib/bundler/installer.rb +93 -45
- data/lib/bundler/installer/gem_installer.rb +2 -0
- data/lib/bundler/installer/parallel_installer.rb +73 -42
- data/lib/bundler/installer/standalone.rb +1 -0
- data/lib/bundler/lazy_specification.rb +2 -1
- data/lib/bundler/lockfile_generator.rb +95 -0
- data/lib/bundler/lockfile_parser.rb +10 -4
- data/lib/bundler/match_platform.rb +1 -0
- data/lib/bundler/mirror.rb +6 -3
- data/lib/bundler/plugin.rb +1 -0
- data/lib/bundler/plugin/api/source.rb +8 -0
- data/lib/bundler/plugin/installer.rb +7 -6
- data/lib/bundler/plugin/source_list.rb +7 -8
- data/lib/bundler/process_lock.rb +24 -0
- data/lib/bundler/psyched_yaml.rb +1 -0
- data/lib/bundler/remote_specification.rb +1 -0
- data/lib/bundler/resolver.rb +138 -191
- data/lib/bundler/resolver/spec_group.rb +111 -0
- data/lib/bundler/retry.rb +1 -0
- data/lib/bundler/ruby_dsl.rb +1 -0
- data/lib/bundler/ruby_version.rb +1 -0
- data/lib/bundler/rubygems_ext.rb +5 -4
- data/lib/bundler/rubygems_gem_installer.rb +23 -0
- data/lib/bundler/rubygems_integration.rb +56 -27
- data/lib/bundler/runtime.rb +3 -5
- data/lib/bundler/settings.rb +177 -76
- data/lib/bundler/settings/validator.rb +79 -0
- data/lib/bundler/setup.rb +1 -0
- data/lib/bundler/shared_helpers.rb +86 -26
- data/lib/bundler/similarity_detector.rb +1 -0
- data/lib/bundler/source.rb +32 -0
- data/lib/bundler/source/gemspec.rb +1 -0
- data/lib/bundler/source/git.rb +21 -16
- data/lib/bundler/source/git/git_proxy.rb +14 -10
- data/lib/bundler/source/metadata.rb +63 -0
- data/lib/bundler/source/path.rb +8 -8
- data/lib/bundler/source/path/installer.rb +2 -0
- data/lib/bundler/source/rubygems.rb +131 -84
- data/lib/bundler/source/rubygems/remote.rb +3 -0
- data/lib/bundler/source_list.rb +75 -15
- data/lib/bundler/spec_set.rb +2 -1
- data/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
- data/lib/bundler/stub_specification.rb +1 -0
- data/lib/bundler/templates/Executable +4 -0
- data/lib/bundler/templates/Executable.bundler +105 -0
- data/lib/bundler/templates/Gemfile +1 -0
- data/lib/bundler/templates/gems.rb +8 -0
- data/lib/bundler/templates/newgem/README.md.tt +1 -1
- data/lib/bundler/templates/newgem/gitignore.tt +0 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -1
- data/lib/bundler/templates/newgem/rspec.tt +1 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +0 -2
- data/lib/bundler/ui.rb +1 -0
- data/lib/bundler/ui/rg_proxy.rb +1 -0
- data/lib/bundler/ui/shell.rb +15 -4
- data/lib/bundler/ui/silent.rb +1 -0
- data/lib/bundler/uri_credentials_filter.rb +1 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +2 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +3 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +3 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +69 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +3 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +487 -148
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -4
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
- data/lib/bundler/vendored_fileutils.rb +9 -0
- data/lib/bundler/vendored_molinillo.rb +1 -0
- data/lib/bundler/vendored_persistent.rb +34 -0
- data/lib/bundler/vendored_thor.rb +1 -0
- data/lib/bundler/version.rb +6 -2
- data/lib/bundler/version_ranges.rb +1 -0
- data/lib/bundler/vlad.rb +5 -0
- data/lib/bundler/worker.rb +1 -0
- data/lib/bundler/yaml_serializer.rb +3 -3
- data/man/bundle-add.1 +43 -0
- data/man/bundle-add.1.txt +40 -0
- data/man/bundle-binstubs.1 +40 -0
- data/man/bundle-binstubs.1.txt +48 -0
- data/man/bundle-binstubs.ronn +14 -0
- data/man/bundle-check.1 +31 -0
- data/man/bundle-check.1.txt +32 -0
- data/man/bundle-clean.1 +24 -0
- data/man/bundle-clean.1.txt +26 -0
- data/man/bundle-config.1 +455 -0
- data/man/bundle-config.1.txt +491 -0
- data/man/bundle-config.ronn +133 -79
- data/man/bundle-exec.1 +165 -0
- data/man/bundle-exec.1.txt +178 -0
- data/man/bundle-exec.ronn +7 -0
- data/man/bundle-gem.1 +80 -0
- data/man/bundle-gem.1.txt +91 -0
- data/man/bundle-gem.ronn +2 -1
- data/man/bundle-info.1 +20 -0
- data/man/bundle-info.1.txt +21 -0
- data/man/bundle-init.1 +20 -0
- data/man/bundle-init.1.txt +24 -0
- data/man/bundle-inject.1 +33 -0
- data/man/bundle-inject.1.txt +32 -0
- data/man/bundle-install.1 +305 -0
- data/man/bundle-install.1.txt +385 -0
- data/man/bundle-install.ronn +32 -32
- data/man/bundle-list.1 +20 -0
- data/man/bundle-list.1.txt +21 -0
- data/man/bundle-list.ronn +15 -0
- data/man/bundle-lock.1 +84 -0
- data/man/bundle-lock.1.txt +93 -0
- data/man/bundle-open.1 +32 -0
- data/man/bundle-open.1.txt +29 -0
- data/man/bundle-outdated.1 +151 -0
- data/man/bundle-outdated.1.txt +127 -0
- data/man/bundle-outdated.ronn +1 -1
- data/man/bundle-package.1 +55 -0
- data/man/bundle-package.1.txt +79 -0
- data/man/bundle-package.ronn +5 -0
- data/man/bundle-platform.1 +61 -0
- data/man/bundle-platform.1.txt +57 -0
- data/man/bundle-pristine.1 +34 -0
- data/man/bundle-pristine.1.txt +44 -0
- data/man/bundle-pristine.ronn +24 -3
- data/man/bundle-show.1 +23 -0
- data/man/bundle-show.1.txt +25 -0
- data/man/bundle-update.1 +390 -0
- data/man/bundle-update.1.txt +386 -0
- data/man/bundle-update.ronn +2 -2
- data/man/bundle-viz.1 +39 -0
- data/man/bundle-viz.1.txt +38 -0
- data/man/bundle-viz.ronn +5 -5
- data/man/bundle.1 +132 -0
- data/man/bundle.1.txt +113 -0
- data/man/bundle.ronn +5 -2
- data/man/gemfile.5 +679 -0
- data/man/gemfile.5.ronn +31 -0
- data/man/gemfile.5.txt +636 -0
- data/man/index.txt +23 -0
- metadata +21 -36
- data/.codeclimate.yml +0 -25
- data/.gitignore +0 -18
- data/.rspec +0 -3
- data/.rubocop.yml +0 -131
- data/.rubocop_todo.yml +0 -418
- data/.travis.yml +0 -122
- data/CODE_OF_CONDUCT.md +0 -42
- data/CONTRIBUTING.md +0 -17
- data/Rakefile +0 -338
- data/bin/rake +0 -19
- data/bin/rspec +0 -15
- data/bin/rubocop +0 -17
- data/bin/with_rubygems +0 -39
- data/bundler.gemspec +0 -48
- data/doc/README.md +0 -30
- data/doc/TROUBLESHOOTING.md +0 -64
- data/doc/contributing/BUG_TRIAGE.md +0 -36
- data/doc/contributing/COMMUNITY.md +0 -13
- data/doc/contributing/GETTING_HELP.md +0 -11
- data/doc/contributing/HOW_YOU_CAN_HELP.md +0 -27
- data/doc/contributing/ISSUES.md +0 -51
- data/doc/contributing/README.md +0 -38
- data/doc/development/NEW_FEATURES.md +0 -10
- data/doc/development/PULL_REQUESTS.md +0 -40
- data/doc/development/README.md +0 -19
- data/doc/development/RELEASING.md +0 -9
- data/doc/development/SETUP.md +0 -27
- data/doc/documentation/README.md +0 -29
- data/doc/documentation/VISION.md +0 -26
- data/doc/documentation/WRITING.md +0 -54
- data/task/release.rake +0 -116
data/lib/bundler/inline.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/compatibility_guard"
|
4
|
+
|
2
5
|
# Allows for declaring a Gemfile inline in a ruby script, optionally installing
|
3
6
|
# any gems that aren't already installed on the user's system.
|
4
7
|
#
|
@@ -39,7 +42,7 @@ def gemfile(install = false, options = {}, &gemfile)
|
|
39
42
|
def Bundler.root
|
40
43
|
Bundler::SharedHelpers.pwd.expand_path
|
41
44
|
end
|
42
|
-
|
45
|
+
Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", "Gemfile"
|
43
46
|
|
44
47
|
Bundler::Plugin.gemfile_install(&gemfile) if Bundler.feature_flag.plugins?
|
45
48
|
builder = Bundler::Dsl.new
|
@@ -50,12 +53,7 @@ def gemfile(install = false, options = {}, &gemfile)
|
|
50
53
|
definition.validate_runtime!
|
51
54
|
|
52
55
|
missing_specs = proc do
|
53
|
-
|
54
|
-
!definition.missing_specs.empty?
|
55
|
-
rescue Bundler::GemNotFound, Bundler::GitError
|
56
|
-
definition.instance_variable_set(:@index, nil)
|
57
|
-
true
|
58
|
-
end
|
56
|
+
definition.missing_specs?
|
59
57
|
end
|
60
58
|
|
61
59
|
Bundler.ui = ui if install
|
data/lib/bundler/installer.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "erb"
|
3
4
|
require "rubygems/dependency_installer"
|
4
5
|
require "bundler/worker"
|
@@ -33,25 +34,26 @@ module Bundler
|
|
33
34
|
|
34
35
|
# Runs the install procedures for a specific Gemfile.
|
35
36
|
#
|
36
|
-
# Firstly, this method will check to see if Bundler.bundle_path exists
|
37
|
-
# and if not then will create
|
38
|
-
#
|
37
|
+
# Firstly, this method will check to see if `Bundler.bundle_path` exists
|
38
|
+
# and if not then Bundler will create the directory. This is usually the same
|
39
|
+
# location as RubyGems which typically is the `~/.gem` directory
|
40
|
+
# unless other specified.
|
39
41
|
#
|
40
|
-
# Secondly, it checks if Bundler has been configured to be "frozen"
|
42
|
+
# Secondly, it checks if Bundler has been configured to be "frozen".
|
41
43
|
# Frozen ensures that the Gemfile and the Gemfile.lock file are matching.
|
42
44
|
# This stops a situation where a developer may update the Gemfile but may not run
|
43
45
|
# `bundle install`, which leads to the Gemfile.lock file not being correctly updated.
|
44
46
|
# If this file is not correctly updated then any other developer running
|
45
47
|
# `bundle install` will potentially not install the correct gems.
|
46
48
|
#
|
47
|
-
# Thirdly, Bundler checks if there are any dependencies specified in the Gemfile
|
48
|
-
#
|
49
|
-
#
|
49
|
+
# Thirdly, Bundler checks if there are any dependencies specified in the Gemfile.
|
50
|
+
# If there are no dependencies specified then Bundler returns a warning message stating
|
51
|
+
# so and this method returns.
|
50
52
|
#
|
51
|
-
# Fourthly, Bundler checks if the
|
52
|
-
# then proceeds to set up a definition based on the
|
53
|
-
#
|
54
|
-
#
|
53
|
+
# Fourthly, Bundler checks if the Gemfile.lock exists, and if so
|
54
|
+
# then proceeds to set up a definition based on the Gemfile and the Gemfile.lock.
|
55
|
+
# During this step Bundler will also download infomrmation about any new gems
|
56
|
+
# that are not in the Gemfile.lock and resolve any dependencies if needed.
|
55
57
|
#
|
56
58
|
# Fifthly, Bundler resolves the dependencies either through a cache of gems or by remote.
|
57
59
|
# This then leads into the gems being installed, along with stubs for their executables,
|
@@ -61,26 +63,36 @@ module Bundler
|
|
61
63
|
# Sixthly, a new Gemfile.lock is created from the installed gems to ensure that the next time
|
62
64
|
# that a user runs `bundle install` they will receive any updates from this process.
|
63
65
|
#
|
64
|
-
# Finally
|
66
|
+
# Finally, if the user has specified the standalone flag, Bundler will generate the needed
|
67
|
+
# require paths and save them in a `setup.rb` file. See `bundle standalone --help` for more
|
68
|
+
# information.
|
65
69
|
def run(options)
|
66
70
|
create_bundle_path
|
67
71
|
|
68
|
-
|
69
|
-
|
70
|
-
|
72
|
+
ProcessLock.lock do
|
73
|
+
if Bundler.frozen?
|
74
|
+
@definition.ensure_equivalent_gemfile_and_lockfile(options[:deployment])
|
75
|
+
end
|
71
76
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
+
if @definition.dependencies.empty?
|
78
|
+
Bundler.ui.warn "The Gemfile specifies no dependencies"
|
79
|
+
lock
|
80
|
+
return
|
81
|
+
end
|
77
82
|
|
78
|
-
|
79
|
-
|
80
|
-
|
83
|
+
if resolve_if_needed(options)
|
84
|
+
ensure_specs_are_compatible!
|
85
|
+
warn_on_incompatible_bundler_deps
|
86
|
+
load_plugins
|
87
|
+
options.delete(:jobs)
|
88
|
+
else
|
89
|
+
options[:jobs] = 1 # to avoid the overhead of Bundler::Worker
|
90
|
+
end
|
91
|
+
install(options)
|
81
92
|
|
82
|
-
|
83
|
-
|
93
|
+
lock unless Bundler.frozen?
|
94
|
+
Standalone.new(options[:standalone], @definition).generate if options[:standalone]
|
95
|
+
end
|
84
96
|
end
|
85
97
|
|
86
98
|
def generate_bundler_executable_stubs(spec, options = {})
|
@@ -102,14 +114,17 @@ module Bundler
|
|
102
114
|
|
103
115
|
# double-assignment to avoid warnings about variables that will be used by ERB
|
104
116
|
bin_path = bin_path = Bundler.bin_path
|
105
|
-
template = template = File.read(File.expand_path("../templates/Executable", __FILE__))
|
106
117
|
relative_gemfile_path = relative_gemfile_path = Bundler.default_gemfile.relative_path_from(bin_path)
|
107
118
|
ruby_command = ruby_command = Thor::Util.ruby_command
|
119
|
+
template_path = File.expand_path("../templates/Executable", __FILE__)
|
120
|
+
if spec.name == "bundler"
|
121
|
+
template_path += ".bundler"
|
122
|
+
spec.executables = %(bundle)
|
123
|
+
end
|
124
|
+
template = File.read(template_path)
|
108
125
|
|
109
126
|
exists = []
|
110
127
|
spec.executables.each do |executable|
|
111
|
-
next if executable == "bundle"
|
112
|
-
|
113
128
|
binstub_path = "#{bin_path}/#{executable}"
|
114
129
|
if File.exist?(binstub_path) && !options[:force]
|
115
130
|
exists << executable
|
@@ -139,7 +154,10 @@ module Bundler
|
|
139
154
|
def generate_standalone_bundler_executable_stubs(spec)
|
140
155
|
# double-assignment to avoid warnings about variables that will be used by ERB
|
141
156
|
bin_path = Bundler.bin_path
|
142
|
-
|
157
|
+
unless path = Bundler.settings[:path]
|
158
|
+
raise "Can't standalone without an explicit path set"
|
159
|
+
end
|
160
|
+
standalone_path = standalone_path = Bundler.root.join(path).relative_path_from(bin_path)
|
143
161
|
template = File.read(File.expand_path("../templates/Executable.standalone", __FILE__))
|
144
162
|
ruby_command = ruby_command = Thor::Util.ruby_command
|
145
163
|
|
@@ -159,13 +177,32 @@ module Bundler
|
|
159
177
|
# that said, it's a rare situation (other than rake), and parallel
|
160
178
|
# installation is SO MUCH FASTER. so we let people opt in.
|
161
179
|
def install(options)
|
162
|
-
Bundler.rubygems.load_plugins
|
163
180
|
force = options["force"]
|
164
|
-
jobs =
|
165
|
-
|
181
|
+
jobs = options.delete(:jobs) do
|
182
|
+
if can_install_in_parallel?
|
183
|
+
[Bundler.settings[:jobs].to_i - 1, 1].max
|
184
|
+
else
|
185
|
+
1
|
186
|
+
end
|
187
|
+
end
|
166
188
|
install_in_parallel jobs, options[:standalone], force
|
167
189
|
end
|
168
190
|
|
191
|
+
def load_plugins
|
192
|
+
Bundler.rubygems.load_plugins
|
193
|
+
|
194
|
+
requested_path_gems = @definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
|
195
|
+
path_plugin_files = requested_path_gems.map do |spec|
|
196
|
+
begin
|
197
|
+
Bundler.rubygems.spec_matches_for_glob(spec, "rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
|
198
|
+
rescue TypeError
|
199
|
+
error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
|
200
|
+
raise Gem::InvalidSpecificationException, error_message
|
201
|
+
end
|
202
|
+
end.flatten
|
203
|
+
Bundler.rubygems.load_plugin_files(path_plugin_files)
|
204
|
+
end
|
205
|
+
|
169
206
|
def ensure_specs_are_compatible!
|
170
207
|
system_ruby = Bundler::RubyVersion.system
|
171
208
|
rubygems_version = Gem::Version.create(Gem::VERSION)
|
@@ -184,12 +221,28 @@ module Bundler
|
|
184
221
|
end
|
185
222
|
end
|
186
223
|
|
224
|
+
def warn_on_incompatible_bundler_deps
|
225
|
+
bundler_version = Gem::Version.create(Bundler::VERSION)
|
226
|
+
@definition.specs.each do |spec|
|
227
|
+
spec.dependencies.each do |dep|
|
228
|
+
next if dep.type == :development
|
229
|
+
next unless dep.name == "bundler".freeze
|
230
|
+
next if dep.requirement.satisfied_by?(bundler_version)
|
231
|
+
|
232
|
+
Bundler.ui.warn "#{spec.name} (#{spec.version}) has dependency" \
|
233
|
+
" #{SharedHelpers.pretty_dependency(dep)}" \
|
234
|
+
", which is unsatisfied by the current bundler version #{VERSION}" \
|
235
|
+
", so the dependency is being ignored"
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
187
240
|
def can_install_in_parallel?
|
188
241
|
if Bundler.rubygems.provides?(">= 2.1.0")
|
189
242
|
true
|
190
243
|
else
|
191
|
-
Bundler.ui.warn "
|
192
|
-
"gems will be installed one at a time. Upgrade to
|
244
|
+
Bundler.ui.warn "RubyGems #{Gem::VERSION} is not threadsafe, so your "\
|
245
|
+
"gems will be installed one at a time. Upgrade to RubyGems 2.1.0 " \
|
193
246
|
"or higher to enable parallel gem installation."
|
194
247
|
false
|
195
248
|
end
|
@@ -207,23 +260,18 @@ module Bundler
|
|
207
260
|
Bundler.mkdir_p(p)
|
208
261
|
end unless Bundler.bundle_path.exist?
|
209
262
|
rescue Errno::EEXIST
|
210
|
-
raise PathError, "Could not install to path `#{Bundler.
|
263
|
+
raise PathError, "Could not install to path `#{Bundler.bundle_path}` " \
|
211
264
|
"because a file already exists at that path. Either remove or rename the file so the directory can be created."
|
212
265
|
end
|
213
266
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
tmpdef = Definition.build(Bundler.default_gemfile, Bundler.default_lockfile, nil)
|
219
|
-
true unless tmpdef.new_platform? || tmpdef.missing_dependencies.any?
|
220
|
-
rescue BundlerError
|
221
|
-
end
|
222
|
-
end
|
267
|
+
# returns whether or not a re-resolve was needed
|
268
|
+
def resolve_if_needed(options)
|
269
|
+
if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
|
270
|
+
return false if @definition.nothing_changed? && !@definition.missing_specs?
|
223
271
|
end
|
224
272
|
|
225
|
-
return if local
|
226
273
|
options["local"] ? @definition.resolve_with_cache! : @definition.resolve_remotely!
|
274
|
+
true
|
227
275
|
end
|
228
276
|
|
229
277
|
def lock(opts = {})
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Bundler
|
3
4
|
class GemInstaller
|
4
5
|
attr_reader :spec, :standalone, :worker, :force, :installer
|
@@ -65,6 +66,7 @@ module Bundler
|
|
65
66
|
end
|
66
67
|
|
67
68
|
def generate_executable_stubs
|
69
|
+
return if Bundler.feature_flag.forget_cli_options?
|
68
70
|
return if Bundler.settings[:inline]
|
69
71
|
if Bundler.settings[:bin] && standalone
|
70
72
|
installer.generate_standalone_bundler_executable_stubs(spec)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "bundler/worker"
|
3
4
|
require "bundler/installer/gem_installer"
|
4
5
|
|
@@ -77,11 +78,6 @@ module Bundler
|
|
77
78
|
new(*args).call
|
78
79
|
end
|
79
80
|
|
80
|
-
# Returns max number of threads machine can handle with a min of 1
|
81
|
-
def self.max_threads
|
82
|
-
[Bundler.settings[:jobs].to_i - 1, 1].max
|
83
|
-
end
|
84
|
-
|
85
81
|
attr_reader :size
|
86
82
|
|
87
83
|
def initialize(installer, all_specs, size, standalone, force)
|
@@ -99,49 +95,19 @@ module Bundler
|
|
99
95
|
require "bundler/gem_remote_fetcher" if RUBY_VERSION < "1.9"
|
100
96
|
|
101
97
|
check_for_corrupt_lockfile
|
102
|
-
|
103
|
-
|
98
|
+
|
99
|
+
if @size > 1
|
100
|
+
install_with_worker
|
101
|
+
else
|
102
|
+
install_serially
|
103
|
+
end
|
104
|
+
|
104
105
|
handle_error if @specs.any?(&:failed?)
|
105
106
|
@specs
|
106
107
|
ensure
|
107
108
|
worker_pool && worker_pool.stop
|
108
109
|
end
|
109
110
|
|
110
|
-
def worker_pool
|
111
|
-
@worker_pool ||= Bundler::Worker.new @size, "Parallel Installer", lambda { |spec_install, worker_num|
|
112
|
-
gem_installer = Bundler::GemInstaller.new(
|
113
|
-
spec_install.spec, @installer, @standalone, worker_num, @force
|
114
|
-
)
|
115
|
-
success, message = gem_installer.install_from_spec
|
116
|
-
if success && !message.nil?
|
117
|
-
spec_install.post_install_message = message
|
118
|
-
elsif !success
|
119
|
-
spec_install.state = :failed
|
120
|
-
spec_install.error = "#{message}\n\n#{require_tree_for_spec(spec_install.spec)}"
|
121
|
-
end
|
122
|
-
spec_install
|
123
|
-
}
|
124
|
-
end
|
125
|
-
|
126
|
-
# Dequeue a spec and save its post-install message and then enqueue the
|
127
|
-
# remaining specs.
|
128
|
-
# Some specs might've had to wait til this spec was installed to be
|
129
|
-
# processed so the call to `enqueue_specs` is important after every
|
130
|
-
# dequeue.
|
131
|
-
def process_specs
|
132
|
-
spec = worker_pool.deq
|
133
|
-
spec.state = :installed unless spec.failed?
|
134
|
-
enqueue_specs
|
135
|
-
end
|
136
|
-
|
137
|
-
def handle_error
|
138
|
-
errors = @specs.select(&:failed?).map(&:error)
|
139
|
-
if exception = errors.find {|e| e.is_a?(Bundler::BundlerError) }
|
140
|
-
raise exception
|
141
|
-
end
|
142
|
-
raise Bundler::InstallError, errors.map(&:to_s).join("\n\n")
|
143
|
-
end
|
144
|
-
|
145
111
|
def check_for_corrupt_lockfile
|
146
112
|
missing_dependencies = @specs.map do |s|
|
147
113
|
[
|
@@ -167,6 +133,71 @@ module Bundler
|
|
167
133
|
Bundler.ui.warn(warning.join("\n"))
|
168
134
|
end
|
169
135
|
|
136
|
+
private
|
137
|
+
|
138
|
+
def install_with_worker
|
139
|
+
enqueue_specs
|
140
|
+
process_specs until finished_installing?
|
141
|
+
end
|
142
|
+
|
143
|
+
def install_serially
|
144
|
+
until finished_installing?
|
145
|
+
raise "failed to find a spec to enqueue while installing serially" unless spec_install = @specs.find(&:ready_to_enqueue?)
|
146
|
+
spec_install.state = :enqueued
|
147
|
+
do_install(spec_install, 0)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
def worker_pool
|
152
|
+
@worker_pool ||= Bundler::Worker.new @size, "Parallel Installer", lambda { |spec_install, worker_num|
|
153
|
+
do_install(spec_install, worker_num)
|
154
|
+
}
|
155
|
+
end
|
156
|
+
|
157
|
+
def do_install(spec_install, worker_num)
|
158
|
+
gem_installer = Bundler::GemInstaller.new(
|
159
|
+
spec_install.spec, @installer, @standalone, worker_num, @force
|
160
|
+
)
|
161
|
+
success, message = begin
|
162
|
+
gem_installer.install_from_spec
|
163
|
+
rescue => e
|
164
|
+
raise e, "#{e}\n\n#{require_tree_for_spec(spec_install.spec)}"
|
165
|
+
end
|
166
|
+
if success
|
167
|
+
spec_install.state = :installed
|
168
|
+
spec_install.post_install_message = message unless message.nil?
|
169
|
+
else
|
170
|
+
spec_install.state = :failed
|
171
|
+
spec_install.error = "#{message}\n\n#{require_tree_for_spec(spec_install.spec)}"
|
172
|
+
end
|
173
|
+
spec_install
|
174
|
+
end
|
175
|
+
|
176
|
+
# Dequeue a spec and save its post-install message and then enqueue the
|
177
|
+
# remaining specs.
|
178
|
+
# Some specs might've had to wait til this spec was installed to be
|
179
|
+
# processed so the call to `enqueue_specs` is important after every
|
180
|
+
# dequeue.
|
181
|
+
def process_specs
|
182
|
+
worker_pool.deq
|
183
|
+
enqueue_specs
|
184
|
+
end
|
185
|
+
|
186
|
+
def finished_installing?
|
187
|
+
@specs.all? do |spec|
|
188
|
+
return true if spec.failed?
|
189
|
+
spec.installed?
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def handle_error
|
194
|
+
errors = @specs.select(&:failed?).map(&:error)
|
195
|
+
if exception = errors.find {|e| e.is_a?(Bundler::BundlerError) }
|
196
|
+
raise exception
|
197
|
+
end
|
198
|
+
raise Bundler::InstallError, errors.map(&:to_s).join("\n\n")
|
199
|
+
end
|
200
|
+
|
170
201
|
def require_tree_for_spec(spec)
|
171
202
|
tree = @spec_set.what_required(spec)
|
172
203
|
t = String.new("In #{File.basename(SharedHelpers.default_gemfile)}:\n")
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "uri"
|
3
4
|
require "bundler/match_platform"
|
4
5
|
|
@@ -68,7 +69,7 @@ module Bundler
|
|
68
69
|
end
|
69
70
|
|
70
71
|
def __materialize__
|
71
|
-
search_object = Bundler.
|
72
|
+
search_object = Bundler.feature_flag.specific_platform? || Bundler.settings[:force_ruby_platform] ? self : Dependency.new(name, version)
|
72
73
|
@specification = if source.is_a?(Source::Gemspec) && source.gemspec.name == name
|
73
74
|
source.gemspec.tap {|s| s.source = source }
|
74
75
|
else
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
class LockfileGenerator
|
5
|
+
attr_reader :definition
|
6
|
+
attr_reader :out
|
7
|
+
|
8
|
+
# @private
|
9
|
+
def initialize(definition)
|
10
|
+
@definition = definition
|
11
|
+
@out = String.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.generate(definition)
|
15
|
+
new(definition).generate!
|
16
|
+
end
|
17
|
+
|
18
|
+
def generate!
|
19
|
+
add_sources
|
20
|
+
add_platforms
|
21
|
+
add_dependencies
|
22
|
+
add_locked_ruby_version
|
23
|
+
add_bundled_with
|
24
|
+
|
25
|
+
out
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def add_sources
|
31
|
+
definition.send(:sources).lock_sources.each_with_index do |source, idx|
|
32
|
+
out << "\n" unless idx.zero?
|
33
|
+
|
34
|
+
# Add the source header
|
35
|
+
out << source.to_lock
|
36
|
+
|
37
|
+
# Find all specs for this source
|
38
|
+
specs = definition.resolve.select {|s| source.can_lock?(s) }
|
39
|
+
add_specs(specs)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def add_specs(specs)
|
44
|
+
# This needs to be sorted by full name so that
|
45
|
+
# gems with the same name, but different platform
|
46
|
+
# are ordered consistently
|
47
|
+
specs.sort_by(&:full_name).each do |spec|
|
48
|
+
next if spec.name == "bundler".freeze
|
49
|
+
out << spec.to_lock
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def add_platforms
|
54
|
+
add_section("PLATFORMS", definition.platforms)
|
55
|
+
end
|
56
|
+
|
57
|
+
def add_dependencies
|
58
|
+
out << "\nDEPENDENCIES\n"
|
59
|
+
|
60
|
+
handled = []
|
61
|
+
definition.dependencies.sort_by(&:to_s).each do |dep|
|
62
|
+
next if handled.include?(dep.name)
|
63
|
+
out << dep.to_lock
|
64
|
+
handled << dep.name
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def add_locked_ruby_version
|
69
|
+
return unless locked_ruby_version = definition.locked_ruby_version
|
70
|
+
add_section("RUBY VERSION", locked_ruby_version.to_s)
|
71
|
+
end
|
72
|
+
|
73
|
+
def add_bundled_with
|
74
|
+
add_section("BUNDLED WITH", definition.locked_bundler_version.to_s)
|
75
|
+
end
|
76
|
+
|
77
|
+
def add_section(name, value)
|
78
|
+
out << "\n#{name}\n"
|
79
|
+
case value
|
80
|
+
when Array
|
81
|
+
value.map(&:to_s).sort.each do |val|
|
82
|
+
out << " #{val}\n"
|
83
|
+
end
|
84
|
+
when Hash
|
85
|
+
value.to_a.sort_by {|k, _| k.to_s }.each do |key, val|
|
86
|
+
out << " #{key}: #{val}\n"
|
87
|
+
end
|
88
|
+
when String
|
89
|
+
out << " #{value}\n"
|
90
|
+
else
|
91
|
+
raise ArgumentError, "#{value.inspect} can't be serialized in a lockfile"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|