bundler 1.13.6 → 1.17.3
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 +554 -9
- data/README.md +28 -5
- data/bundler.gemspec +40 -11
- data/exe/bundle +4 -8
- data/exe/bundle_ruby +4 -3
- data/lib/bundler.rb +162 -68
- data/lib/bundler/build_metadata.rb +53 -0
- data/lib/bundler/capistrano.rb +5 -0
- data/lib/bundler/cli.rb +360 -118
- data/lib/bundler/cli/add.rb +35 -0
- data/lib/bundler/cli/binstubs.rb +18 -10
- data/lib/bundler/cli/cache.rb +6 -5
- data/lib/bundler/cli/check.rb +4 -6
- data/lib/bundler/cli/clean.rb +6 -7
- data/lib/bundler/cli/common.rb +47 -1
- data/lib/bundler/cli/config.rb +26 -7
- data/lib/bundler/cli/console.rb +2 -1
- data/lib/bundler/cli/doctor.rb +63 -18
- data/lib/bundler/cli/exec.rb +12 -5
- data/lib/bundler/cli/gem.rb +59 -21
- data/lib/bundler/cli/info.rb +50 -0
- data/lib/bundler/cli/init.rb +21 -7
- data/lib/bundler/cli/inject.rb +13 -4
- data/lib/bundler/cli/install.rb +72 -101
- data/lib/bundler/cli/issue.rb +40 -0
- data/lib/bundler/cli/list.rb +58 -0
- data/lib/bundler/cli/lock.rb +9 -6
- data/lib/bundler/cli/open.rb +4 -3
- data/lib/bundler/cli/outdated.rb +175 -60
- data/lib/bundler/cli/package.rb +9 -6
- data/lib/bundler/cli/platform.rb +2 -1
- data/lib/bundler/cli/plugin.rb +1 -0
- data/lib/bundler/cli/pristine.rb +47 -0
- data/lib/bundler/cli/remove.rb +18 -0
- data/lib/bundler/cli/show.rb +2 -2
- data/lib/bundler/cli/update.rb +44 -34
- data/lib/bundler/cli/viz.rb +5 -1
- data/lib/bundler/compact_index_client.rb +109 -0
- data/lib/bundler/compact_index_client/cache.rb +118 -0
- data/lib/bundler/compact_index_client/updater.rb +116 -0
- data/lib/bundler/compatibility_guard.rb +14 -0
- data/lib/bundler/constants.rb +1 -0
- data/lib/bundler/current_ruby.rb +17 -8
- data/lib/bundler/definition.rb +353 -182
- data/lib/bundler/dep_proxy.rb +3 -1
- data/lib/bundler/dependency.rb +22 -10
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/deprecate.rb +15 -3
- data/lib/bundler/dsl.rb +122 -64
- data/lib/bundler/endpoint_specification.rb +13 -3
- data/lib/bundler/env.rb +110 -38
- data/lib/bundler/environment_preserver.rb +27 -6
- data/lib/bundler/errors.rb +24 -0
- data/lib/bundler/feature_flag.rb +74 -0
- data/lib/bundler/fetcher.rb +18 -11
- data/lib/bundler/fetcher/base.rb +1 -0
- data/lib/bundler/fetcher/compact_index.rb +7 -5
- data/lib/bundler/fetcher/dependency.rb +3 -2
- data/lib/bundler/fetcher/downloader.rb +25 -7
- data/lib/bundler/fetcher/index.rb +3 -2
- data/lib/bundler/friendly_errors.rb +33 -7
- data/lib/bundler/gem_helper.rb +25 -11
- data/lib/bundler/gem_helpers.rb +70 -1
- data/lib/bundler/gem_remote_fetcher.rb +1 -0
- data/lib/bundler/gem_tasks.rb +1 -0
- data/lib/bundler/gem_version_promoter.rb +17 -2
- data/lib/bundler/gemdeps.rb +29 -0
- data/lib/bundler/graph.rb +1 -0
- data/lib/bundler/index.rb +28 -15
- data/lib/bundler/injector.rb +216 -33
- data/lib/bundler/inline.rb +12 -12
- data/lib/bundler/installer.rb +139 -53
- data/lib/bundler/installer/gem_installer.rb +15 -5
- data/lib/bundler/installer/parallel_installer.rb +113 -28
- data/lib/bundler/installer/standalone.rb +1 -0
- data/lib/bundler/lazy_specification.rb +31 -3
- data/lib/bundler/lockfile_generator.rb +95 -0
- data/lib/bundler/lockfile_parser.rb +50 -37
- data/lib/bundler/match_platform.rb +13 -3
- data/lib/bundler/mirror.rb +10 -5
- data/lib/bundler/plugin.rb +22 -8
- data/lib/bundler/plugin/api.rb +2 -1
- data/lib/bundler/plugin/api/source.rb +17 -4
- data/lib/bundler/plugin/events.rb +61 -0
- data/lib/bundler/plugin/index.rb +9 -2
- 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 +10 -0
- data/lib/bundler/remote_specification.rb +30 -1
- data/lib/bundler/resolver.rb +187 -194
- data/lib/bundler/resolver/spec_group.rb +106 -0
- data/lib/bundler/retry.rb +5 -1
- data/lib/bundler/ruby_dsl.rb +1 -0
- data/lib/bundler/ruby_version.rb +12 -2
- data/lib/bundler/rubygems_ext.rb +23 -8
- data/lib/bundler/rubygems_gem_installer.rb +90 -0
- data/lib/bundler/rubygems_integration.rb +193 -70
- data/lib/bundler/runtime.rb +39 -22
- data/lib/bundler/settings.rb +245 -85
- data/lib/bundler/settings/validator.rb +102 -0
- data/lib/bundler/setup.rb +4 -7
- data/lib/bundler/shared_helpers.rb +183 -40
- data/lib/bundler/similarity_detector.rb +1 -0
- data/lib/bundler/source.rb +58 -1
- data/lib/bundler/source/gemspec.rb +1 -0
- data/lib/bundler/source/git.rb +52 -23
- data/lib/bundler/source/git/git_proxy.rb +30 -14
- data/lib/bundler/source/metadata.rb +62 -0
- data/lib/bundler/source/path.rb +42 -16
- data/lib/bundler/source/path/installer.rb +4 -2
- data/lib/bundler/source/rubygems.rb +171 -82
- data/lib/bundler/source/rubygems/remote.rb +12 -2
- data/lib/bundler/source_list.rb +75 -15
- data/lib/bundler/spec_set.rb +67 -32
- data/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
- data/lib/bundler/stub_specification.rb +86 -2
- data/lib/bundler/templates/.document +1 -0
- data/lib/bundler/templates/Executable +13 -1
- data/lib/bundler/templates/Executable.bundler +105 -0
- data/lib/bundler/templates/Executable.standalone +5 -5
- data/lib/bundler/templates/Gemfile +3 -0
- data/lib/bundler/templates/gems.rb +8 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -2
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +1 -1
- data/lib/bundler/templates/newgem/README.md.tt +14 -8
- data/lib/bundler/templates/newgem/Rakefile.tt +5 -5
- data/lib/bundler/templates/newgem/bin/console.tt +1 -1
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +4 -4
- data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +3 -3
- data/lib/bundler/templates/newgem/gitignore.tt +5 -1
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +7 -6
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +4 -4
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +21 -12
- data/lib/bundler/templates/newgem/rspec.tt +1 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +1 -3
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +13 -1
- data/lib/bundler/templates/newgem/test/newgem_test.rb.tt +1 -1
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +3 -3
- data/lib/bundler/templates/newgem/{.travis.yml.tt → travis.yml.tt} +2 -0
- data/lib/bundler/ui.rb +1 -0
- data/lib/bundler/ui/rg_proxy.rb +1 -0
- data/lib/bundler/ui/shell.rb +30 -10
- data/lib/bundler/ui/silent.rb +21 -1
- 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 +26 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +2 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +12 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +3 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +63 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +11 -3
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +13 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +3 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +3 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +18 -5
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +75 -7
- 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 +499 -128
- 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 → net-http-persistent/lib/net}/http/faster.rb +1 -0
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent.rb +27 -24
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent/ssl_reuse.rb +2 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +46 -21
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +24 -22
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +2 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +16 -8
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +66 -18
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +17 -15
- data/lib/bundler/vendor/thor/lib/thor/base.rb +55 -32
- data/lib/bundler/vendor/thor/lib/thor/command.rb +13 -11
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +21 -1
- data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +7 -5
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +94 -63
- data/lib/bundler/vendor/thor/lib/thor/error.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/group.rb +13 -13
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +4 -5
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +2 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +4 -7
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +16 -16
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +42 -21
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +13 -10
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +31 -29
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +49 -33
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/util.rb +8 -7
- data/lib/bundler/vendor/thor/lib/thor/version.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 +43 -3
- data/lib/bundler/vendored_thor.rb +6 -2
- data/lib/bundler/version.rb +19 -2
- data/lib/bundler/version_ranges.rb +76 -0
- data/lib/bundler/vlad.rb +5 -0
- data/lib/bundler/worker.rb +30 -6
- data/lib/bundler/yaml_serializer.rb +4 -4
- data/man/bundle-add.1 +58 -0
- data/man/bundle-add.1.txt +52 -0
- data/man/bundle-add.ronn +40 -0
- data/{lib/bundler/man/bundle-binstubs → man/bundle-binstubs.1} +11 -1
- data/man/bundle-binstubs.1.txt +48 -0
- data/man/bundle-binstubs.ronn +15 -1
- data/man/bundle-check.1 +31 -0
- data/man/bundle-check.1.txt +33 -0
- data/man/bundle-check.ronn +26 -0
- data/man/bundle-clean.1 +24 -0
- data/man/bundle-clean.1.txt +26 -0
- data/man/bundle-clean.ronn +18 -0
- data/man/bundle-config.1 +497 -0
- data/man/bundle-config.1.txt +529 -0
- data/man/bundle-config.ronn +233 -61
- data/man/bundle-doctor.1 +44 -0
- data/man/bundle-doctor.1.txt +44 -0
- data/man/bundle-doctor.ronn +33 -0
- data/{lib/bundler/man/bundle-exec → man/bundle-exec.1} +6 -3
- data/man/bundle-exec.1.txt +178 -0
- data/man/bundle-exec.ronn +10 -3
- data/{lib/bundler/man/bundle-gem → man/bundle-gem.1} +4 -4
- data/man/bundle-gem.1.txt +91 -0
- data/man/bundle-gem.ronn +3 -2
- data/man/bundle-info.1 +20 -0
- data/man/bundle-info.1.txt +21 -0
- data/man/bundle-info.ronn +17 -0
- data/man/bundle-init.1 +25 -0
- data/man/bundle-init.1.txt +34 -0
- data/man/bundle-init.ronn +29 -0
- data/man/bundle-inject.1 +33 -0
- data/man/bundle-inject.1.txt +32 -0
- data/man/bundle-inject.ronn +22 -0
- data/{lib/bundler/man/bundle-install → man/bundle-install.1} +32 -29
- data/man/bundle-install.1.txt +396 -0
- data/man/bundle-install.ronn +45 -36
- data/man/bundle-list.1 +50 -0
- data/man/bundle-list.1.txt +43 -0
- data/man/bundle-list.ronn +33 -0
- data/{lib/bundler/man/bundle-lock → man/bundle-lock.1} +43 -2
- data/man/bundle-lock.1.txt +93 -0
- data/man/bundle-lock.ronn +47 -0
- data/man/bundle-open.1 +32 -0
- data/man/bundle-open.1.txt +29 -0
- data/man/bundle-open.ronn +19 -0
- data/man/bundle-outdated.1 +155 -0
- data/man/bundle-outdated.1.txt +131 -0
- data/man/bundle-outdated.ronn +111 -0
- data/{lib/bundler/man/bundle-package → man/bundle-package.1} +6 -3
- data/man/bundle-package.1.txt +79 -0
- data/man/bundle-package.ronn +7 -2
- data/{lib/bundler/man/bundle-platform → man/bundle-platform.1} +1 -1
- 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 +34 -0
- data/man/bundle-remove.1 +31 -0
- data/man/bundle-remove.1.txt +34 -0
- data/man/bundle-remove.ronn +23 -0
- data/man/bundle-show.1 +23 -0
- data/man/bundle-show.1.txt +27 -0
- data/man/bundle-show.ronn +21 -0
- data/man/bundle-update.1 +394 -0
- data/man/bundle-update.1.txt +391 -0
- data/man/bundle-update.ronn +172 -16
- data/man/bundle-viz.1 +39 -0
- data/man/bundle-viz.1.txt +39 -0
- data/man/bundle-viz.ronn +30 -0
- data/{lib/bundler/man/bundle → man/bundle.1} +44 -28
- data/man/bundle.1.txt +116 -0
- data/man/bundle.ronn +39 -27
- data/{lib/bundler/man → man}/gemfile.5 +67 -84
- data/man/gemfile.5.ronn +77 -55
- data/man/gemfile.5.txt +653 -0
- data/man/index.txt +25 -8
- metadata +118 -58
- data/.codeclimate.yml +0 -25
- data/.gitignore +0 -16
- data/.rspec +0 -3
- data/.rubocop.yml +0 -128
- data/.rubocop_todo.yml +0 -248
- data/.travis.yml +0 -108
- data/CODE_OF_CONDUCT.md +0 -42
- data/CONTRIBUTING.md +0 -36
- data/DEVELOPMENT.md +0 -148
- data/ISSUES.md +0 -100
- data/Rakefile +0 -333
- data/bin/rake +0 -19
- data/bin/rspec +0 -15
- data/bin/rubocop +0 -17
- data/bin/with_rubygems +0 -39
- data/lib/bundler/man/bundle-binstubs.txt +0 -33
- data/lib/bundler/man/bundle-config +0 -254
- data/lib/bundler/man/bundle-config.txt +0 -282
- data/lib/bundler/man/bundle-exec.txt +0 -171
- data/lib/bundler/man/bundle-gem.txt +0 -90
- data/lib/bundler/man/bundle-install.txt +0 -385
- data/lib/bundler/man/bundle-lock.txt +0 -52
- data/lib/bundler/man/bundle-package.txt +0 -74
- data/lib/bundler/man/bundle-platform.txt +0 -57
- data/lib/bundler/man/bundle-update +0 -221
- data/lib/bundler/man/bundle-update.txt +0 -227
- data/lib/bundler/man/bundle.txt +0 -104
- data/lib/bundler/man/gemfile.5.txt +0 -636
- data/lib/bundler/postit_trampoline.rb +0 -68
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +0 -79
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +0 -112
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +0 -80
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +0 -4
- data/lib/bundler/vendor/postit/lib/postit.rb +0 -15
- data/lib/bundler/vendor/postit/lib/postit/environment.rb +0 -44
- data/lib/bundler/vendor/postit/lib/postit/installer.rb +0 -28
- data/lib/bundler/vendor/postit/lib/postit/parser.rb +0 -21
- data/lib/bundler/vendor/postit/lib/postit/setup.rb +0 -12
- data/lib/bundler/vendor/postit/lib/postit/version.rb +0 -3
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"
|
@@ -20,8 +21,9 @@ module Bundler
|
|
20
21
|
# For more information see the #run method on this class.
|
21
22
|
def self.install(root, definition, options = {})
|
22
23
|
installer = new(root, definition)
|
23
|
-
Plugin.hook(
|
24
|
+
Plugin.hook(Plugin::Events::GEM_BEFORE_INSTALL_ALL, definition.dependencies)
|
24
25
|
installer.run(options)
|
26
|
+
Plugin.hook(Plugin::Events::GEM_AFTER_INSTALL_ALL, definition.dependencies)
|
25
27
|
installer
|
26
28
|
end
|
27
29
|
|
@@ -33,25 +35,26 @@ module Bundler
|
|
33
35
|
|
34
36
|
# Runs the install procedures for a specific Gemfile.
|
35
37
|
#
|
36
|
-
# Firstly, this method will check to see if Bundler.bundle_path exists
|
37
|
-
# and if not then will create
|
38
|
-
#
|
38
|
+
# Firstly, this method will check to see if `Bundler.bundle_path` exists
|
39
|
+
# and if not then Bundler will create the directory. This is usually the same
|
40
|
+
# location as RubyGems which typically is the `~/.gem` directory
|
41
|
+
# unless other specified.
|
39
42
|
#
|
40
|
-
# Secondly, it checks if Bundler has been configured to be "frozen"
|
43
|
+
# Secondly, it checks if Bundler has been configured to be "frozen".
|
41
44
|
# Frozen ensures that the Gemfile and the Gemfile.lock file are matching.
|
42
45
|
# This stops a situation where a developer may update the Gemfile but may not run
|
43
46
|
# `bundle install`, which leads to the Gemfile.lock file not being correctly updated.
|
44
47
|
# If this file is not correctly updated then any other developer running
|
45
48
|
# `bundle install` will potentially not install the correct gems.
|
46
49
|
#
|
47
|
-
# Thirdly, Bundler checks if there are any dependencies specified in the Gemfile
|
48
|
-
#
|
49
|
-
#
|
50
|
+
# Thirdly, Bundler checks if there are any dependencies specified in the Gemfile.
|
51
|
+
# If there are no dependencies specified then Bundler returns a warning message stating
|
52
|
+
# so and this method returns.
|
50
53
|
#
|
51
|
-
# Fourthly, Bundler checks if the
|
52
|
-
# then proceeds to set up a
|
53
|
-
#
|
54
|
-
#
|
54
|
+
# Fourthly, Bundler checks if the Gemfile.lock exists, and if so
|
55
|
+
# then proceeds to set up a definition based on the Gemfile and the Gemfile.lock.
|
56
|
+
# During this step Bundler will also download information about any new gems
|
57
|
+
# that are not in the Gemfile.lock and resolve any dependencies if needed.
|
55
58
|
#
|
56
59
|
# Fifthly, Bundler resolves the dependencies either through a cache of gems or by remote.
|
57
60
|
# This then leads into the gems being installed, along with stubs for their executables,
|
@@ -61,26 +64,36 @@ module Bundler
|
|
61
64
|
# Sixthly, a new Gemfile.lock is created from the installed gems to ensure that the next time
|
62
65
|
# that a user runs `bundle install` they will receive any updates from this process.
|
63
66
|
#
|
64
|
-
# Finally
|
67
|
+
# Finally, if the user has specified the standalone flag, Bundler will generate the needed
|
68
|
+
# require paths and save them in a `setup.rb` file. See `bundle standalone --help` for more
|
69
|
+
# information.
|
65
70
|
def run(options)
|
66
71
|
create_bundle_path
|
67
72
|
|
68
|
-
|
69
|
-
|
70
|
-
|
73
|
+
ProcessLock.lock do
|
74
|
+
if Bundler.frozen_bundle?
|
75
|
+
@definition.ensure_equivalent_gemfile_and_lockfile(options[:deployment])
|
76
|
+
end
|
71
77
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
78
|
+
if @definition.dependencies.empty?
|
79
|
+
Bundler.ui.warn "The Gemfile specifies no dependencies"
|
80
|
+
lock
|
81
|
+
return
|
82
|
+
end
|
77
83
|
|
78
|
-
|
79
|
-
|
80
|
-
|
84
|
+
if resolve_if_needed(options)
|
85
|
+
ensure_specs_are_compatible!
|
86
|
+
warn_on_incompatible_bundler_deps
|
87
|
+
load_plugins
|
88
|
+
options.delete(:jobs)
|
89
|
+
else
|
90
|
+
options[:jobs] = 1 # to avoid the overhead of Bundler::Worker
|
91
|
+
end
|
92
|
+
install(options)
|
81
93
|
|
82
|
-
|
83
|
-
|
94
|
+
lock unless Bundler.frozen_bundle?
|
95
|
+
Standalone.new(options[:standalone], @definition).generate if options[:standalone]
|
96
|
+
end
|
84
97
|
end
|
85
98
|
|
86
99
|
def generate_bundler_executable_stubs(spec, options = {})
|
@@ -101,15 +114,21 @@ module Bundler
|
|
101
114
|
end
|
102
115
|
|
103
116
|
# double-assignment to avoid warnings about variables that will be used by ERB
|
104
|
-
bin_path =
|
105
|
-
|
106
|
-
relative_gemfile_path =
|
107
|
-
|
117
|
+
bin_path = Bundler.bin_path
|
118
|
+
bin_path = bin_path
|
119
|
+
relative_gemfile_path = Bundler.default_gemfile.relative_path_from(bin_path)
|
120
|
+
relative_gemfile_path = relative_gemfile_path
|
121
|
+
ruby_command = Thor::Util.ruby_command
|
122
|
+
ruby_command = ruby_command
|
123
|
+
template_path = File.expand_path("../templates/Executable", __FILE__)
|
124
|
+
if spec.name == "bundler"
|
125
|
+
template_path += ".bundler"
|
126
|
+
spec.executables = %(bundle)
|
127
|
+
end
|
128
|
+
template = File.read(template_path)
|
108
129
|
|
109
130
|
exists = []
|
110
131
|
spec.executables.each do |executable|
|
111
|
-
next if executable == "bundle"
|
112
|
-
|
113
132
|
binstub_path = "#{bin_path}/#{executable}"
|
114
133
|
if File.exist?(binstub_path) && !options[:force]
|
115
134
|
exists << executable
|
@@ -117,7 +136,11 @@ module Bundler
|
|
117
136
|
end
|
118
137
|
|
119
138
|
File.open(binstub_path, "w", 0o777 & ~File.umask) do |f|
|
120
|
-
|
139
|
+
if RUBY_VERSION >= "2.6"
|
140
|
+
f.puts ERB.new(template, :trim_mode => "-").result(binding)
|
141
|
+
else
|
142
|
+
f.puts ERB.new(template, nil, "-").result(binding)
|
143
|
+
end
|
121
144
|
end
|
122
145
|
end
|
123
146
|
|
@@ -139,15 +162,25 @@ module Bundler
|
|
139
162
|
def generate_standalone_bundler_executable_stubs(spec)
|
140
163
|
# double-assignment to avoid warnings about variables that will be used by ERB
|
141
164
|
bin_path = Bundler.bin_path
|
142
|
-
|
165
|
+
unless path = Bundler.settings[:path]
|
166
|
+
raise "Can't standalone without an explicit path set"
|
167
|
+
end
|
168
|
+
standalone_path = Bundler.root.join(path).relative_path_from(bin_path)
|
169
|
+
standalone_path = standalone_path
|
143
170
|
template = File.read(File.expand_path("../templates/Executable.standalone", __FILE__))
|
144
|
-
ruby_command =
|
171
|
+
ruby_command = Thor::Util.ruby_command
|
172
|
+
ruby_command = ruby_command
|
145
173
|
|
146
174
|
spec.executables.each do |executable|
|
147
175
|
next if executable == "bundle"
|
148
|
-
executable_path =
|
176
|
+
executable_path = Pathname(spec.full_gem_path).join(spec.bindir, executable).relative_path_from(bin_path)
|
177
|
+
executable_path = executable_path
|
149
178
|
File.open "#{bin_path}/#{executable}", "w", 0o755 do |f|
|
150
|
-
|
179
|
+
if RUBY_VERSION >= "2.6"
|
180
|
+
f.puts ERB.new(template, :trim_mode => "-").result(binding)
|
181
|
+
else
|
182
|
+
f.puts ERB.new(template, nil, "-").result(binding)
|
183
|
+
end
|
151
184
|
end
|
152
185
|
end
|
153
186
|
end
|
@@ -160,11 +193,53 @@ module Bundler
|
|
160
193
|
# installation is SO MUCH FASTER. so we let people opt in.
|
161
194
|
def install(options)
|
162
195
|
force = options["force"]
|
163
|
-
jobs =
|
164
|
-
jobs = [Bundler.settings[:jobs].to_i - 1, 1].max if can_install_in_parallel?
|
196
|
+
jobs = installation_parallelization(options)
|
165
197
|
install_in_parallel jobs, options[:standalone], force
|
166
198
|
end
|
167
199
|
|
200
|
+
def installation_parallelization(options)
|
201
|
+
if jobs = options.delete(:jobs)
|
202
|
+
return jobs
|
203
|
+
end
|
204
|
+
|
205
|
+
return 1 unless can_install_in_parallel?
|
206
|
+
|
207
|
+
auto_config_jobs = Bundler.feature_flag.auto_config_jobs?
|
208
|
+
if jobs = Bundler.settings[:jobs]
|
209
|
+
if auto_config_jobs
|
210
|
+
jobs
|
211
|
+
else
|
212
|
+
[jobs.pred, 1].max
|
213
|
+
end
|
214
|
+
elsif auto_config_jobs
|
215
|
+
processor_count
|
216
|
+
else
|
217
|
+
1
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
def processor_count
|
222
|
+
require "etc"
|
223
|
+
Etc.nprocessors
|
224
|
+
rescue
|
225
|
+
1
|
226
|
+
end
|
227
|
+
|
228
|
+
def load_plugins
|
229
|
+
Bundler.rubygems.load_plugins
|
230
|
+
|
231
|
+
requested_path_gems = @definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
|
232
|
+
path_plugin_files = requested_path_gems.map do |spec|
|
233
|
+
begin
|
234
|
+
Bundler.rubygems.spec_matches_for_glob(spec, "rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
|
235
|
+
rescue TypeError
|
236
|
+
error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
|
237
|
+
raise Gem::InvalidSpecificationException, error_message
|
238
|
+
end
|
239
|
+
end.flatten
|
240
|
+
Bundler.rubygems.load_plugin_files(path_plugin_files)
|
241
|
+
end
|
242
|
+
|
168
243
|
def ensure_specs_are_compatible!
|
169
244
|
system_ruby = Bundler::RubyVersion.system
|
170
245
|
rubygems_version = Gem::Version.create(Gem::VERSION)
|
@@ -183,12 +258,28 @@ module Bundler
|
|
183
258
|
end
|
184
259
|
end
|
185
260
|
|
261
|
+
def warn_on_incompatible_bundler_deps
|
262
|
+
bundler_version = Gem::Version.create(Bundler::VERSION)
|
263
|
+
@definition.specs.each do |spec|
|
264
|
+
spec.dependencies.each do |dep|
|
265
|
+
next if dep.type == :development
|
266
|
+
next unless dep.name == "bundler".freeze
|
267
|
+
next if dep.requirement.satisfied_by?(bundler_version)
|
268
|
+
|
269
|
+
Bundler.ui.warn "#{spec.name} (#{spec.version}) has dependency" \
|
270
|
+
" #{SharedHelpers.pretty_dependency(dep)}" \
|
271
|
+
", which is unsatisfied by the current bundler version #{VERSION}" \
|
272
|
+
", so the dependency is being ignored"
|
273
|
+
end
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
186
277
|
def can_install_in_parallel?
|
187
278
|
if Bundler.rubygems.provides?(">= 2.1.0")
|
188
279
|
true
|
189
280
|
else
|
190
|
-
Bundler.ui.warn "
|
191
|
-
"gems will be installed one at a time. Upgrade to
|
281
|
+
Bundler.ui.warn "RubyGems #{Gem::VERSION} is not threadsafe, so your "\
|
282
|
+
"gems will be installed one at a time. Upgrade to RubyGems 2.1.0 " \
|
192
283
|
"or higher to enable parallel gem installation."
|
193
284
|
false
|
194
285
|
end
|
@@ -206,23 +297,18 @@ module Bundler
|
|
206
297
|
Bundler.mkdir_p(p)
|
207
298
|
end unless Bundler.bundle_path.exist?
|
208
299
|
rescue Errno::EEXIST
|
209
|
-
raise PathError, "Could not install to path `#{Bundler.
|
210
|
-
"because
|
300
|
+
raise PathError, "Could not install to path `#{Bundler.bundle_path}` " \
|
301
|
+
"because a file already exists at that path. Either remove or rename the file so the directory can be created."
|
211
302
|
end
|
212
303
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
tmpdef = Definition.build(Bundler.default_gemfile, Bundler.default_lockfile, nil)
|
218
|
-
true unless tmpdef.new_platform? || tmpdef.missing_dependencies.any?
|
219
|
-
rescue BundlerError
|
220
|
-
end
|
221
|
-
end
|
304
|
+
# returns whether or not a re-resolve was needed
|
305
|
+
def resolve_if_needed(options)
|
306
|
+
if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
|
307
|
+
return false if @definition.nothing_changed? && !@definition.missing_specs?
|
222
308
|
end
|
223
309
|
|
224
|
-
return if local
|
225
310
|
options["local"] ? @definition.resolve_with_cache! : @definition.resolve_remotely!
|
311
|
+
true
|
226
312
|
end
|
227
313
|
|
228
314
|
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
|
@@ -16,11 +17,11 @@ module Bundler
|
|
16
17
|
Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
|
17
18
|
generate_executable_stubs
|
18
19
|
return true, post_install_message
|
19
|
-
rescue Bundler::InstallHookError, Bundler::SecurityError
|
20
|
+
rescue Bundler::InstallHookError, Bundler::SecurityError, APIResponseMismatchError
|
20
21
|
raise
|
21
22
|
rescue Errno::ENOSPC
|
22
23
|
return false, out_of_space_message
|
23
|
-
rescue => e
|
24
|
+
rescue StandardError => e
|
24
25
|
return false, specific_failure_message(e)
|
25
26
|
end
|
26
27
|
|
@@ -43,7 +44,14 @@ module Bundler
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def gem_install_message
|
46
|
-
|
47
|
+
source = spec.source
|
48
|
+
return unless source.respond_to?(:remotes)
|
49
|
+
|
50
|
+
if source.remotes.size == 1
|
51
|
+
"Make sure that `gem install #{spec.name} -v '#{spec.version}' --source '#{source.remotes.first}'` succeeds before bundling."
|
52
|
+
else
|
53
|
+
"Make sure that `gem install #{spec.name} -v '#{spec.version}'` succeeds before bundling."
|
54
|
+
end
|
47
55
|
end
|
48
56
|
|
49
57
|
def spec_settings
|
@@ -52,12 +60,12 @@ module Bundler
|
|
52
60
|
end
|
53
61
|
|
54
62
|
def install
|
55
|
-
spec.source.install(spec, :force => force, :ensure_builtin_gems_cached => standalone)
|
63
|
+
spec.source.install(spec, :force => force, :ensure_builtin_gems_cached => standalone, :build_args => Array(spec_settings))
|
56
64
|
end
|
57
65
|
|
58
66
|
def install_with_settings
|
59
67
|
# Build arguments are global, so this is mutexed
|
60
|
-
Bundler.rubygems.
|
68
|
+
Bundler.rubygems.install_with_build_args([spec_settings]) { install }
|
61
69
|
end
|
62
70
|
|
63
71
|
def out_of_space_message
|
@@ -65,6 +73,8 @@ module Bundler
|
|
65
73
|
end
|
66
74
|
|
67
75
|
def generate_executable_stubs
|
76
|
+
return if Bundler.feature_flag.forget_cli_options?
|
77
|
+
return if Bundler.settings[:inline]
|
68
78
|
if Bundler.settings[:bin] && standalone
|
69
79
|
installer.generate_standalone_bundler_executable_stubs(spec)
|
70
80
|
elsif Bundler.settings[:bin]
|
@@ -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
|
|
@@ -47,37 +48,37 @@ module Bundler
|
|
47
48
|
# sure needed dependencies have been installed.
|
48
49
|
def dependencies_installed?(all_specs)
|
49
50
|
installed_specs = all_specs.select(&:installed?).map(&:name)
|
50
|
-
dependencies
|
51
|
+
dependencies.all? {|d| installed_specs.include? d.name }
|
51
52
|
end
|
52
53
|
|
53
54
|
# Represents only the non-development dependencies, the ones that are
|
54
55
|
# itself and are in the total list.
|
55
|
-
def dependencies
|
56
|
+
def dependencies
|
56
57
|
@dependencies ||= begin
|
57
|
-
|
58
|
-
missing = deps.reject {|dep| all_spec_names.include? dep.name }
|
59
|
-
unless missing.empty?
|
60
|
-
raise Bundler::LockfileError, "Your Gemfile.lock is corrupt. The following #{missing.size > 1 ? "gems are" : "gem is"} missing " \
|
61
|
-
"from the DEPENDENCIES section: '#{missing.map(&:name).join('\' \'')}'"
|
62
|
-
end
|
63
|
-
deps
|
58
|
+
all_dependencies.reject {|dep| ignorable_dependency? dep }
|
64
59
|
end
|
65
60
|
end
|
66
61
|
|
62
|
+
def missing_lockfile_dependencies(all_spec_names)
|
63
|
+
deps = all_dependencies.reject {|dep| ignorable_dependency? dep }
|
64
|
+
deps.reject {|dep| all_spec_names.include? dep.name }
|
65
|
+
end
|
66
|
+
|
67
67
|
# Represents all dependencies
|
68
68
|
def all_dependencies
|
69
69
|
@spec.dependencies
|
70
70
|
end
|
71
|
+
|
72
|
+
def to_s
|
73
|
+
"#<#{self.class} #{@spec.full_name} (#{state})>"
|
74
|
+
end
|
71
75
|
end
|
72
76
|
|
73
77
|
def self.call(*args)
|
74
78
|
new(*args).call
|
75
79
|
end
|
76
80
|
|
77
|
-
|
78
|
-
def self.max_threads
|
79
|
-
[Bundler.settings[:jobs].to_i - 1, 1].max
|
80
|
-
end
|
81
|
+
attr_reader :size
|
81
82
|
|
82
83
|
def initialize(installer, all_specs, size, standalone, force)
|
83
84
|
@installer = installer
|
@@ -85,44 +86,113 @@ module Bundler
|
|
85
86
|
@standalone = standalone
|
86
87
|
@force = force
|
87
88
|
@specs = all_specs.map {|s| SpecInstallation.new(s) }
|
89
|
+
@spec_set = all_specs
|
90
|
+
@rake = @specs.find {|s| s.name == "rake" }
|
88
91
|
end
|
89
92
|
|
90
93
|
def call
|
91
|
-
|
92
|
-
|
94
|
+
# Since `autoload` has the potential for threading issues on 1.8.7
|
95
|
+
# TODO: remove in bundler 2.0
|
96
|
+
require "bundler/gem_remote_fetcher" if RUBY_VERSION < "1.9"
|
97
|
+
|
98
|
+
check_for_corrupt_lockfile
|
99
|
+
|
100
|
+
if @size > 1
|
101
|
+
install_with_worker
|
102
|
+
else
|
103
|
+
install_serially
|
104
|
+
end
|
105
|
+
|
93
106
|
handle_error if @specs.any?(&:failed?)
|
94
107
|
@specs
|
95
108
|
ensure
|
96
109
|
worker_pool && worker_pool.stop
|
97
110
|
end
|
98
111
|
|
112
|
+
def check_for_corrupt_lockfile
|
113
|
+
missing_dependencies = @specs.map do |s|
|
114
|
+
[
|
115
|
+
s,
|
116
|
+
s.missing_lockfile_dependencies(@specs.map(&:name)),
|
117
|
+
]
|
118
|
+
end.reject { |a| a.last.empty? }
|
119
|
+
return if missing_dependencies.empty?
|
120
|
+
|
121
|
+
warning = []
|
122
|
+
warning << "Your lockfile was created by an old Bundler that left some things out."
|
123
|
+
if @size != 1
|
124
|
+
warning << "Because of the missing DEPENDENCIES, we can only install gems one at a time, instead of installing #{@size} at a time."
|
125
|
+
@size = 1
|
126
|
+
end
|
127
|
+
warning << "You can fix this by adding the missing gems to your Gemfile, running bundle install, and then removing the gems from your Gemfile."
|
128
|
+
warning << "The missing gems are:"
|
129
|
+
|
130
|
+
missing_dependencies.each do |spec, missing|
|
131
|
+
warning << "* #{missing.map(&:name).join(", ")} depended upon by #{spec.name}"
|
132
|
+
end
|
133
|
+
|
134
|
+
Bundler.ui.warn(warning.join("\n"))
|
135
|
+
end
|
136
|
+
|
137
|
+
private
|
138
|
+
|
139
|
+
def install_with_worker
|
140
|
+
enqueue_specs
|
141
|
+
process_specs until finished_installing?
|
142
|
+
end
|
143
|
+
|
144
|
+
def install_serially
|
145
|
+
until finished_installing?
|
146
|
+
raise "failed to find a spec to enqueue while installing serially" unless spec_install = @specs.find(&:ready_to_enqueue?)
|
147
|
+
spec_install.state = :enqueued
|
148
|
+
do_install(spec_install, 0)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
99
152
|
def worker_pool
|
100
153
|
@worker_pool ||= Bundler::Worker.new @size, "Parallel Installer", lambda { |spec_install, worker_num|
|
101
|
-
|
102
|
-
spec_install.spec, @installer, @standalone, worker_num, @force
|
103
|
-
)
|
104
|
-
success, message = gem_installer.install_from_spec
|
105
|
-
if success && !message.nil?
|
106
|
-
spec_install.post_install_message = message
|
107
|
-
elsif !success
|
108
|
-
spec_install.state = :failed
|
109
|
-
spec_install.error = message
|
110
|
-
end
|
111
|
-
spec_install
|
154
|
+
do_install(spec_install, worker_num)
|
112
155
|
}
|
113
156
|
end
|
114
157
|
|
158
|
+
def do_install(spec_install, worker_num)
|
159
|
+
Plugin.hook(Plugin::Events::GEM_BEFORE_INSTALL, spec_install)
|
160
|
+
gem_installer = Bundler::GemInstaller.new(
|
161
|
+
spec_install.spec, @installer, @standalone, worker_num, @force
|
162
|
+
)
|
163
|
+
success, message = begin
|
164
|
+
gem_installer.install_from_spec
|
165
|
+
rescue RuntimeError => e
|
166
|
+
raise e, "#{e}\n\n#{require_tree_for_spec(spec_install.spec)}"
|
167
|
+
end
|
168
|
+
if success
|
169
|
+
spec_install.state = :installed
|
170
|
+
spec_install.post_install_message = message unless message.nil?
|
171
|
+
else
|
172
|
+
spec_install.state = :failed
|
173
|
+
spec_install.error = "#{message}\n\n#{require_tree_for_spec(spec_install.spec)}"
|
174
|
+
end
|
175
|
+
Plugin.hook(Plugin::Events::GEM_AFTER_INSTALL, spec_install)
|
176
|
+
spec_install
|
177
|
+
end
|
178
|
+
|
115
179
|
# Dequeue a spec and save its post-install message and then enqueue the
|
116
180
|
# remaining specs.
|
117
181
|
# Some specs might've had to wait til this spec was installed to be
|
118
182
|
# processed so the call to `enqueue_specs` is important after every
|
119
183
|
# dequeue.
|
120
184
|
def process_specs
|
121
|
-
|
122
|
-
spec.state = :installed unless spec.failed?
|
185
|
+
worker_pool.deq
|
123
186
|
enqueue_specs
|
124
187
|
end
|
125
188
|
|
189
|
+
def finished_installing?
|
190
|
+
@specs.all? do |spec|
|
191
|
+
return true if spec.failed?
|
192
|
+
spec.installed?
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
126
196
|
def handle_error
|
127
197
|
errors = @specs.select(&:failed?).map(&:error)
|
128
198
|
if exception = errors.find {|e| e.is_a?(Bundler::BundlerError) }
|
@@ -131,6 +201,19 @@ module Bundler
|
|
131
201
|
raise Bundler::InstallError, errors.map(&:to_s).join("\n\n")
|
132
202
|
end
|
133
203
|
|
204
|
+
def require_tree_for_spec(spec)
|
205
|
+
tree = @spec_set.what_required(spec)
|
206
|
+
t = String.new("In #{File.basename(SharedHelpers.default_gemfile)}:\n")
|
207
|
+
tree.each_with_index do |s, depth|
|
208
|
+
t << " " * depth.succ << s.name
|
209
|
+
unless tree.last == s
|
210
|
+
t << %( was resolved to #{s.version}, which depends on)
|
211
|
+
end
|
212
|
+
t << %(\n)
|
213
|
+
end
|
214
|
+
t
|
215
|
+
end
|
216
|
+
|
134
217
|
# Keys in the remains hash represent uninstalled gems specs.
|
135
218
|
# We enqueue all gem specs that do not have any dependencies.
|
136
219
|
# Later we call this lambda again to install specs that depended on
|
@@ -138,6 +221,8 @@ module Bundler
|
|
138
221
|
# are installed.
|
139
222
|
def enqueue_specs
|
140
223
|
@specs.select(&:ready_to_enqueue?).each do |spec|
|
224
|
+
next if @rake && !@rake.installed? && spec.name != @rake.name
|
225
|
+
|
141
226
|
if spec.dependencies_installed? @specs
|
142
227
|
spec.state = :enqueued
|
143
228
|
worker_pool.enq spec
|