bundler-clone 4.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5670 -0
- data/LICENSE.md +22 -0
- data/README.md +58 -0
- data/bundler.gemspec +46 -0
- data/exe/bundle +29 -0
- data/exe/bundler +4 -0
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +44 -0
- data/lib/bundler/capistrano.rb +4 -0
- data/lib/bundler/checksum.rb +270 -0
- data/lib/bundler/ci_detector.rb +75 -0
- data/lib/bundler/cli/add.rb +62 -0
- data/lib/bundler/cli/binstubs.rb +57 -0
- data/lib/bundler/cli/cache.rb +32 -0
- data/lib/bundler/cli/check.rb +40 -0
- data/lib/bundler/cli/clean.rb +25 -0
- data/lib/bundler/cli/common.rb +161 -0
- data/lib/bundler/cli/config.rb +208 -0
- data/lib/bundler/cli/console.rb +47 -0
- data/lib/bundler/cli/doctor/diagnose.rb +167 -0
- data/lib/bundler/cli/doctor/ssl.rb +249 -0
- data/lib/bundler/cli/doctor.rb +33 -0
- data/lib/bundler/cli/exec.rb +114 -0
- data/lib/bundler/cli/fund.rb +36 -0
- data/lib/bundler/cli/gem.rb +493 -0
- data/lib/bundler/cli/info.rb +83 -0
- data/lib/bundler/cli/init.rb +51 -0
- data/lib/bundler/cli/install.rb +127 -0
- data/lib/bundler/cli/issue.rb +41 -0
- data/lib/bundler/cli/list.rb +97 -0
- data/lib/bundler/cli/lock.rb +94 -0
- data/lib/bundler/cli/open.rb +29 -0
- data/lib/bundler/cli/outdated.rb +337 -0
- data/lib/bundler/cli/platform.rb +48 -0
- data/lib/bundler/cli/plugin.rb +39 -0
- data/lib/bundler/cli/pristine.rb +64 -0
- data/lib/bundler/cli/remove.rb +17 -0
- data/lib/bundler/cli/show.rb +71 -0
- data/lib/bundler/cli/update.rb +125 -0
- data/lib/bundler/cli.rb +829 -0
- data/lib/bundler/compact_index_client/cache.rb +96 -0
- data/lib/bundler/compact_index_client/cache_file.rb +148 -0
- data/lib/bundler/compact_index_client/parser.rb +87 -0
- data/lib/bundler/compact_index_client/updater.rb +105 -0
- data/lib/bundler/compact_index_client.rb +92 -0
- data/lib/bundler/constants.rb +14 -0
- data/lib/bundler/current_ruby.rb +94 -0
- data/lib/bundler/definition.rb +1304 -0
- data/lib/bundler/dependency.rb +151 -0
- data/lib/bundler/deployment.rb +6 -0
- data/lib/bundler/deprecate.rb +44 -0
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +642 -0
- data/lib/bundler/endpoint_specification.rb +184 -0
- data/lib/bundler/env.rb +148 -0
- data/lib/bundler/environment_preserver.rb +69 -0
- data/lib/bundler/errors.rb +277 -0
- data/lib/bundler/feature_flag.rb +20 -0
- data/lib/bundler/fetcher/base.rb +55 -0
- data/lib/bundler/fetcher/compact_index.rb +133 -0
- data/lib/bundler/fetcher/dependency.rb +85 -0
- data/lib/bundler/fetcher/downloader.rb +116 -0
- data/lib/bundler/fetcher/gem_remote_fetcher.rb +24 -0
- data/lib/bundler/fetcher/index.rb +25 -0
- data/lib/bundler/fetcher.rb +365 -0
- data/lib/bundler/force_platform.rb +16 -0
- data/lib/bundler/friendly_errors.rb +127 -0
- data/lib/bundler/gem_helper.rb +237 -0
- data/lib/bundler/gem_tasks.rb +7 -0
- data/lib/bundler/gem_version_promoter.rb +147 -0
- data/lib/bundler/index.rb +203 -0
- data/lib/bundler/injector.rb +284 -0
- data/lib/bundler/inline.rb +106 -0
- data/lib/bundler/installer/gem_installer.rb +88 -0
- data/lib/bundler/installer/parallel_installer.rb +280 -0
- data/lib/bundler/installer/standalone.rb +113 -0
- data/lib/bundler/installer.rb +241 -0
- data/lib/bundler/lazy_specification.rb +270 -0
- data/lib/bundler/lockfile_generator.rb +119 -0
- data/lib/bundler/lockfile_parser.rb +328 -0
- data/lib/bundler/man/.document +1 -0
- data/lib/bundler/man/bundle-add.1 +79 -0
- data/lib/bundler/man/bundle-add.1.ronn +92 -0
- data/lib/bundler/man/bundle-binstubs.1 +30 -0
- data/lib/bundler/man/bundle-binstubs.1.ronn +42 -0
- data/lib/bundler/man/bundle-cache.1 +56 -0
- data/lib/bundler/man/bundle-cache.1.ronn +95 -0
- data/lib/bundler/man/bundle-check.1 +21 -0
- data/lib/bundler/man/bundle-check.1.ronn +26 -0
- data/lib/bundler/man/bundle-clean.1 +17 -0
- data/lib/bundler/man/bundle-clean.1.ronn +18 -0
- data/lib/bundler/man/bundle-config.1 +339 -0
- data/lib/bundler/man/bundle-config.1.ronn +455 -0
- data/lib/bundler/man/bundle-console.1 +33 -0
- data/lib/bundler/man/bundle-console.1.ronn +39 -0
- data/lib/bundler/man/bundle-doctor.1 +69 -0
- data/lib/bundler/man/bundle-doctor.1.ronn +77 -0
- data/lib/bundler/man/bundle-env.1 +9 -0
- data/lib/bundler/man/bundle-env.1.ronn +10 -0
- data/lib/bundler/man/bundle-exec.1 +104 -0
- data/lib/bundler/man/bundle-exec.1.ronn +150 -0
- data/lib/bundler/man/bundle-fund.1 +22 -0
- data/lib/bundler/man/bundle-fund.1.ronn +25 -0
- data/lib/bundler/man/bundle-gem.1 +107 -0
- data/lib/bundler/man/bundle-gem.1.ronn +150 -0
- data/lib/bundler/man/bundle-help.1 +9 -0
- data/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/lib/bundler/man/bundle-info.1 +17 -0
- data/lib/bundler/man/bundle-info.1.ronn +21 -0
- data/lib/bundler/man/bundle-init.1 +20 -0
- data/lib/bundler/man/bundle-init.1.ronn +32 -0
- data/lib/bundler/man/bundle-install.1 +178 -0
- data/lib/bundler/man/bundle-install.1.ronn +314 -0
- data/lib/bundler/man/bundle-issue.1 +45 -0
- data/lib/bundler/man/bundle-issue.1.ronn +37 -0
- data/lib/bundler/man/bundle-licenses.1 +9 -0
- data/lib/bundler/man/bundle-licenses.1.ronn +10 -0
- data/lib/bundler/man/bundle-list.1 +40 -0
- data/lib/bundler/man/bundle-list.1.ronn +41 -0
- data/lib/bundler/man/bundle-lock.1 +75 -0
- data/lib/bundler/man/bundle-lock.1.ronn +115 -0
- data/lib/bundler/man/bundle-open.1 +32 -0
- data/lib/bundler/man/bundle-open.1.ronn +28 -0
- data/lib/bundler/man/bundle-outdated.1 +106 -0
- data/lib/bundler/man/bundle-outdated.1.ronn +117 -0
- data/lib/bundler/man/bundle-platform.1 +49 -0
- data/lib/bundler/man/bundle-platform.1.ronn +49 -0
- data/lib/bundler/man/bundle-plugin.1 +76 -0
- data/lib/bundler/man/bundle-plugin.1.ronn +84 -0
- data/lib/bundler/man/bundle-pristine.1 +23 -0
- data/lib/bundler/man/bundle-pristine.1.ronn +34 -0
- data/lib/bundler/man/bundle-remove.1 +15 -0
- data/lib/bundler/man/bundle-remove.1.ronn +16 -0
- data/lib/bundler/man/bundle-show.1 +16 -0
- data/lib/bundler/man/bundle-show.1.ronn +21 -0
- data/lib/bundler/man/bundle-update.1 +284 -0
- data/lib/bundler/man/bundle-update.1.ronn +367 -0
- data/lib/bundler/man/bundle-version.1 +22 -0
- data/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/lib/bundler/man/bundle.1 +93 -0
- data/lib/bundler/man/bundle.1.ronn +107 -0
- data/lib/bundler/man/gemfile.5 +503 -0
- data/lib/bundler/man/gemfile.5.ronn +586 -0
- data/lib/bundler/man/index.txt +31 -0
- data/lib/bundler/match_metadata.rb +30 -0
- data/lib/bundler/match_platform.rb +42 -0
- data/lib/bundler/match_remote_metadata.rb +29 -0
- data/lib/bundler/materialization.rb +59 -0
- data/lib/bundler/mirror.rb +221 -0
- data/lib/bundler/plugin/api/source.rb +330 -0
- data/lib/bundler/plugin/api.rb +81 -0
- data/lib/bundler/plugin/dsl.rb +53 -0
- data/lib/bundler/plugin/events.rb +85 -0
- data/lib/bundler/plugin/index.rb +203 -0
- data/lib/bundler/plugin/installer/git.rb +34 -0
- data/lib/bundler/plugin/installer/path.rb +26 -0
- data/lib/bundler/plugin/installer/rubygems.rb +19 -0
- data/lib/bundler/plugin/installer.rb +123 -0
- data/lib/bundler/plugin/source_list.rb +31 -0
- data/lib/bundler/plugin/unloaded_source.rb +25 -0
- data/lib/bundler/plugin.rb +387 -0
- data/lib/bundler/process_lock.rb +20 -0
- data/lib/bundler/remote_specification.rb +126 -0
- data/lib/bundler/resolver/base.rb +127 -0
- data/lib/bundler/resolver/candidate.rb +85 -0
- data/lib/bundler/resolver/incompatibility.rb +15 -0
- data/lib/bundler/resolver/package.rb +95 -0
- data/lib/bundler/resolver/root.rb +25 -0
- data/lib/bundler/resolver/spec_group.rb +74 -0
- data/lib/bundler/resolver/strategy.rb +43 -0
- data/lib/bundler/resolver.rb +603 -0
- data/lib/bundler/retry.rb +92 -0
- data/lib/bundler/ruby_dsl.rb +67 -0
- data/lib/bundler/ruby_version.rb +135 -0
- data/lib/bundler/rubygems_ext.rb +503 -0
- data/lib/bundler/rubygems_gem_installer.rb +206 -0
- data/lib/bundler/rubygems_integration.rb +456 -0
- data/lib/bundler/runtime.rb +331 -0
- data/lib/bundler/safe_marshal.rb +31 -0
- data/lib/bundler/self_manager.rb +197 -0
- data/lib/bundler/settings/validator.rb +86 -0
- data/lib/bundler/settings.rb +585 -0
- data/lib/bundler/setup.rb +39 -0
- data/lib/bundler/shared_helpers.rb +392 -0
- data/lib/bundler/source/gemspec.rb +19 -0
- data/lib/bundler/source/git/git_proxy.rb +509 -0
- data/lib/bundler/source/git.rb +451 -0
- data/lib/bundler/source/metadata.rb +67 -0
- data/lib/bundler/source/path/installer.rb +53 -0
- data/lib/bundler/source/path.rb +256 -0
- data/lib/bundler/source/rubygems/remote.rb +86 -0
- data/lib/bundler/source/rubygems.rb +606 -0
- data/lib/bundler/source/rubygems_aggregate.rb +71 -0
- data/lib/bundler/source.rb +120 -0
- data/lib/bundler/source_list.rb +240 -0
- data/lib/bundler/source_map.rb +72 -0
- data/lib/bundler/spec_set.rb +390 -0
- data/lib/bundler/stub_specification.rb +147 -0
- data/lib/bundler/templates/.document +1 -0
- data/lib/bundler/templates/Executable +16 -0
- data/lib/bundler/templates/Executable.standalone +14 -0
- data/lib/bundler/templates/Gemfile +5 -0
- data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +10 -0
- data/lib/bundler/templates/newgem/Cargo.toml.tt +13 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +24 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
- data/lib/bundler/templates/newgem/README.md.tt +49 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +72 -0
- data/lib/bundler/templates/newgem/bin/console.tt +11 -0
- data/lib/bundler/templates/newgem/bin/setup.tt +8 -0
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +37 -0
- data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +22 -0
- data/lib/bundler/templates/newgem/ext/newgem/build.rs.tt +5 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +23 -0
- data/lib/bundler/templates/newgem/github/workflows/build-gems.yml.tt +69 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +48 -0
- data/lib/bundler/templates/newgem/gitignore.tt +23 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +27 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +9 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +15 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +58 -0
- data/lib/bundler/templates/newgem/rspec.tt +3 -0
- data/lib/bundler/templates/newgem/rubocop.yml.tt +8 -0
- data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +19 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +15 -0
- data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
- data/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
- data/lib/bundler/templates/newgem/test/minitest/test_newgem.rb.tt +19 -0
- data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
- data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
- data/lib/bundler/ui/rg_proxy.rb +19 -0
- data/lib/bundler/ui/shell.rb +191 -0
- data/lib/bundler/ui/silent.rb +96 -0
- data/lib/bundler/ui.rb +9 -0
- data/lib/bundler/uri_credentials_filter.rb +43 -0
- data/lib/bundler/uri_normalizer.rb +23 -0
- data/lib/bundler/vendor/.document +1 -0
- data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +227 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +230 -0
- data/lib/bundler/vendor/fileutils/COPYING +56 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +2701 -0
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +41 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +65 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +80 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1153 -0
- data/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +169 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +61 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb +42 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +423 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +236 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
- data/lib/bundler/vendor/securerandom/COPYING +56 -0
- data/lib/bundler/vendor/securerandom/lib/securerandom.rb +102 -0
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +105 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +61 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +108 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +143 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +407 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +130 -0
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +340 -0
- data/lib/bundler/vendor/thor/lib/thor/base.rb +825 -0
- data/lib/bundler/vendor/thor/lib/thor/command.rb +151 -0
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +107 -0
- data/lib/bundler/vendor/thor/lib/thor/error.rb +106 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +292 -0
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +178 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +37 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
- data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +86 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +195 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +178 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +294 -0
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +72 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +335 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +384 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +112 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +81 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +118 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb +42 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb +38 -0
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
- data/lib/bundler/vendor/thor/lib/thor/util.rb +285 -0
- data/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
- data/lib/bundler/vendor/thor/lib/thor.rb +674 -0
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +455 -0
- data/lib/bundler/vendor/uri/COPYING +56 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +922 -0
- data/lib/bundler/vendor/uri/lib/uri/file.rb +100 -0
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +1592 -0
- data/lib/bundler/vendor/uri/lib/uri/http.rb +137 -0
- data/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +22 -0
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +293 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +547 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +206 -0
- data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
- data/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/lib/bundler/vendored_fileutils.rb +4 -0
- data/lib/bundler/vendored_net_http.rb +23 -0
- data/lib/bundler/vendored_persistent.rb +11 -0
- data/lib/bundler/vendored_pub_grub.rb +4 -0
- data/lib/bundler/vendored_securerandom.rb +12 -0
- data/lib/bundler/vendored_thor.rb +8 -0
- data/lib/bundler/vendored_timeout.rb +12 -0
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/vendored_uri.rb +21 -0
- data/lib/bundler/version.rb +21 -0
- data/lib/bundler/vlad.rb +4 -0
- data/lib/bundler/worker.rb +125 -0
- data/lib/bundler/yaml_serializer.rb +98 -0
- data/lib/bundler.rb +691 -0
- metadata +409 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../worker"
|
|
4
|
+
require_relative "gem_installer"
|
|
5
|
+
|
|
6
|
+
module Bundler
|
|
7
|
+
class ParallelInstaller
|
|
8
|
+
class SpecInstallation
|
|
9
|
+
attr_accessor :spec, :name, :full_name, :post_install_message, :state, :error, :dependencies
|
|
10
|
+
def initialize(spec)
|
|
11
|
+
@spec = spec
|
|
12
|
+
@name = spec.name
|
|
13
|
+
@full_name = spec.full_name
|
|
14
|
+
@state = :none
|
|
15
|
+
@post_install_message = ""
|
|
16
|
+
@error = nil
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def installed?
|
|
20
|
+
state == :installed
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def enqueued?
|
|
24
|
+
state == :enqueued
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def enqueue_with_priority?
|
|
28
|
+
state == :installable && spec.extensions.any?
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def failed?
|
|
32
|
+
state == :failed
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def ready_to_enqueue?
|
|
36
|
+
state == :none
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def ready_to_install?(installed_specs)
|
|
40
|
+
return false unless state == :downloaded
|
|
41
|
+
|
|
42
|
+
spec.extensions.none? || dependencies_installed?(installed_specs)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def has_post_install_message?
|
|
46
|
+
!post_install_message.empty?
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Recursively checks that all dependencies (direct and transitive) have been installed.
|
|
50
|
+
def dependencies_installed?(installed_specs)
|
|
51
|
+
dependencies.all? do |dep|
|
|
52
|
+
installed_specs.include?(dep.name) && dep.dependencies_installed?(installed_specs)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def to_s
|
|
57
|
+
"#<#{self.class} #{full_name} (#{state})>"
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def self.call(*args, **kwargs)
|
|
62
|
+
new(*args, **kwargs).call
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
attr_reader :size
|
|
66
|
+
|
|
67
|
+
def initialize(installer, all_specs, size, standalone, force, local: false, skip: nil)
|
|
68
|
+
@installer = installer
|
|
69
|
+
@size = size
|
|
70
|
+
@standalone = standalone
|
|
71
|
+
@force = force
|
|
72
|
+
@local = local
|
|
73
|
+
@specs = all_specs.map {|s| SpecInstallation.new(s) }
|
|
74
|
+
specs_by_name = @specs.to_h {|s| [s.name, s] }
|
|
75
|
+
@specs.each do |spec_install|
|
|
76
|
+
spec_install.dependencies = spec_install.spec.dependencies.filter_map do |dep|
|
|
77
|
+
specs_by_name[dep.name] unless dep.type == :development || dep.name == spec_install.name
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
@specs.each do |spec_install|
|
|
81
|
+
spec_install.state = :installed if skip.include?(spec_install.name)
|
|
82
|
+
end if skip
|
|
83
|
+
@spec_set = all_specs
|
|
84
|
+
@rake = @specs.find {|s| s.name == "rake" unless s.installed? }
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def call
|
|
88
|
+
if @rake
|
|
89
|
+
do_download(@rake, 0)
|
|
90
|
+
do_install(@rake, 0)
|
|
91
|
+
Gem::Specification.reset
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if @size > 1
|
|
95
|
+
install_with_worker
|
|
96
|
+
else
|
|
97
|
+
install_serially
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
handle_error if failed_specs.any?
|
|
101
|
+
@specs
|
|
102
|
+
ensure
|
|
103
|
+
worker_pool&.stop
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
private
|
|
107
|
+
|
|
108
|
+
def failed_specs
|
|
109
|
+
@specs.select(&:failed?)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def install_with_worker
|
|
113
|
+
with_jobserver do
|
|
114
|
+
installed_specs = {}
|
|
115
|
+
enqueue_specs(installed_specs)
|
|
116
|
+
|
|
117
|
+
process_specs(installed_specs) until finished_installing?
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def with_jobserver
|
|
122
|
+
# The jobserver hands tokens to child `make` processes through MAKEFLAGS
|
|
123
|
+
# using the GNU make `--jobserver-auth` protocol. nmake, the default make
|
|
124
|
+
# on mswin, instead reads MAKEFLAGS as bare option letters and aborts
|
|
125
|
+
# every native extension build with `fatal error U1065: invalid option
|
|
126
|
+
# '-'`. Skip the jobserver when nmake is in use. Other Windows toolchains
|
|
127
|
+
# such as mingw use GNU make and keep working through the inherited pipe.
|
|
128
|
+
return yield if nmake?
|
|
129
|
+
|
|
130
|
+
begin
|
|
131
|
+
r, w = IO.pipe
|
|
132
|
+
r.close_on_exec = false
|
|
133
|
+
w.close_on_exec = false
|
|
134
|
+
w.write("*" * @size)
|
|
135
|
+
|
|
136
|
+
old_makeflags = ENV["MAKEFLAGS"]
|
|
137
|
+
ENV["MAKEFLAGS"] = [old_makeflags, "--jobserver-auth=#{r.fileno},#{w.fileno}"].compact.join(" ")
|
|
138
|
+
|
|
139
|
+
yield
|
|
140
|
+
ensure
|
|
141
|
+
# Restore MAKEFLAGS before closing the pipe so a close failure can't
|
|
142
|
+
# leave the process with descriptors that point at a closed pipe.
|
|
143
|
+
old_makeflags ? ENV["MAKEFLAGS"] = old_makeflags : ENV.delete("MAKEFLAGS")
|
|
144
|
+
|
|
145
|
+
r&.close
|
|
146
|
+
w&.close
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Mirror how RubyGems' extension builder picks the make program so the
|
|
151
|
+
# jobserver is only set up when a GNU-compatible make will consume it.
|
|
152
|
+
def nmake?
|
|
153
|
+
make = ENV["MAKE"] || ENV["make"]
|
|
154
|
+
make ||= "nmake" if RUBY_PLATFORM.include?("mswin")
|
|
155
|
+
/\bnmake/i.match?(make.to_s)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def install_serially
|
|
159
|
+
until finished_installing?
|
|
160
|
+
raise "failed to find a spec to enqueue while installing serially" unless spec_install = @specs.find(&:ready_to_enqueue?)
|
|
161
|
+
spec_install.state = :enqueued
|
|
162
|
+
do_download(spec_install, 0)
|
|
163
|
+
do_install(spec_install, 0)
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def worker_pool
|
|
168
|
+
@worker_pool ||= Bundler::Worker.new @size, "Parallel Installer", lambda {|spec_install, worker_num|
|
|
169
|
+
case spec_install.state
|
|
170
|
+
when :enqueued
|
|
171
|
+
do_download(spec_install, worker_num)
|
|
172
|
+
when :installable
|
|
173
|
+
do_install(spec_install, worker_num)
|
|
174
|
+
else
|
|
175
|
+
spec_install
|
|
176
|
+
end
|
|
177
|
+
}
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def do_download(spec_install, worker_num)
|
|
181
|
+
Plugin.hook(Plugin::Events::GEM_BEFORE_INSTALL, spec_install)
|
|
182
|
+
|
|
183
|
+
gem_installer = Bundler::GemInstaller.new(
|
|
184
|
+
spec_install.spec, @installer, @standalone, worker_num, @force, @local
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
success, message = gem_installer.download
|
|
188
|
+
|
|
189
|
+
if success
|
|
190
|
+
spec_install.state = :downloaded
|
|
191
|
+
else
|
|
192
|
+
spec_install.error = "#{message}\n\n#{require_tree_for_spec(spec_install.spec)}"
|
|
193
|
+
spec_install.state = :failed
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
spec_install
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def do_install(spec_install, worker_num)
|
|
200
|
+
gem_installer = Bundler::GemInstaller.new(
|
|
201
|
+
spec_install.spec, @installer, @standalone, worker_num, @force, @local
|
|
202
|
+
)
|
|
203
|
+
success, message = gem_installer.install_from_spec
|
|
204
|
+
if success
|
|
205
|
+
spec_install.state = :installed
|
|
206
|
+
spec_install.post_install_message = message unless message.nil?
|
|
207
|
+
else
|
|
208
|
+
spec_install.error = "#{message}\n\n#{require_tree_for_spec(spec_install.spec)}"
|
|
209
|
+
spec_install.state = :failed
|
|
210
|
+
end
|
|
211
|
+
Plugin.hook(Plugin::Events::GEM_AFTER_INSTALL, spec_install)
|
|
212
|
+
spec_install
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Dequeue a spec and save its post-install message and then enqueue the
|
|
216
|
+
# remaining specs.
|
|
217
|
+
# Some specs might've had to wait til this spec was installed to be
|
|
218
|
+
# processed so the call to `enqueue_specs` is important after every
|
|
219
|
+
# dequeue.
|
|
220
|
+
def process_specs(installed_specs)
|
|
221
|
+
spec = worker_pool.deq
|
|
222
|
+
|
|
223
|
+
if spec.installed?
|
|
224
|
+
installed_specs[spec.name] = true
|
|
225
|
+
return
|
|
226
|
+
elsif spec.failed?
|
|
227
|
+
return
|
|
228
|
+
elsif spec.ready_to_install?(installed_specs)
|
|
229
|
+
spec.state = :installable
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
worker_pool.enq(spec, priority: spec.enqueue_with_priority?)
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
def finished_installing?
|
|
236
|
+
@specs.all? do |spec|
|
|
237
|
+
return true if spec.failed?
|
|
238
|
+
spec.installed?
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
def handle_error
|
|
243
|
+
errors = failed_specs.map(&:error)
|
|
244
|
+
if exception = errors.find {|e| e.is_a?(Bundler::BundlerError) }
|
|
245
|
+
raise exception
|
|
246
|
+
end
|
|
247
|
+
raise Bundler::InstallError, errors.join("\n\n")
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
def require_tree_for_spec(spec)
|
|
251
|
+
tree = @spec_set.what_required(spec)
|
|
252
|
+
t = String.new("In #{File.basename(SharedHelpers.default_gemfile)}:\n")
|
|
253
|
+
tree.each_with_index do |s, depth|
|
|
254
|
+
t << " " * depth.succ << s.name
|
|
255
|
+
unless tree.last == s
|
|
256
|
+
t << %( was resolved to #{s.version}, which depends on)
|
|
257
|
+
end
|
|
258
|
+
t << %(\n)
|
|
259
|
+
end
|
|
260
|
+
t
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
# Keys in the remains hash represent uninstalled gems specs.
|
|
264
|
+
# We enqueue all gem specs that do not have any dependencies.
|
|
265
|
+
# Later we call this lambda again to install specs that depended on
|
|
266
|
+
# previously installed specifications. We continue until all specs
|
|
267
|
+
# are installed.
|
|
268
|
+
def enqueue_specs(installed_specs)
|
|
269
|
+
@specs.each do |spec|
|
|
270
|
+
if spec.installed?
|
|
271
|
+
installed_specs[spec.name] = true
|
|
272
|
+
next
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
spec.state = :enqueued
|
|
276
|
+
worker_pool.enq spec
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
end
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bundler
|
|
4
|
+
class Standalone
|
|
5
|
+
def initialize(groups, definition)
|
|
6
|
+
@specs = definition.specs_for(groups)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def generate
|
|
10
|
+
SharedHelpers.filesystem_access(bundler_path) do |p|
|
|
11
|
+
FileUtils.mkdir_p(p)
|
|
12
|
+
end
|
|
13
|
+
File.open File.join(bundler_path, "setup.rb"), "w" do |file|
|
|
14
|
+
file.puts "require 'rbconfig'"
|
|
15
|
+
file.puts prevent_gem_activation
|
|
16
|
+
file.puts define_path_helpers
|
|
17
|
+
file.puts reverse_rubygems_kernel_mixin
|
|
18
|
+
paths.each do |path|
|
|
19
|
+
if Pathname.new(path).absolute?
|
|
20
|
+
file.puts %($:.unshift "#{path}")
|
|
21
|
+
else
|
|
22
|
+
file.puts %($:.unshift File.expand_path("\#{__dir__}/#{path}"))
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def paths
|
|
31
|
+
@specs.flat_map do |spec|
|
|
32
|
+
next if spec.name == "bundler"
|
|
33
|
+
Array(spec.require_paths).map do |path|
|
|
34
|
+
gem_path(path, spec).
|
|
35
|
+
sub(version_dir, '#{RUBY_ENGINE}/#{Gem.ruby_api_version}').
|
|
36
|
+
sub(extensions_dir, 'extensions/\k<platform>/#{Gem.extension_api_version}')
|
|
37
|
+
# This is a static string intentionally. It's interpolated at a later time.
|
|
38
|
+
end
|
|
39
|
+
end.compact
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def version_dir
|
|
43
|
+
"#{RUBY_ENGINE}/#{Gem.ruby_api_version}"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def extensions_dir
|
|
47
|
+
%r{extensions/(?<platform>[^/]+)/#{Regexp.escape(Gem.extension_api_version)}}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def bundler_path
|
|
51
|
+
Bundler.root.join(Bundler.settings[:path].to_s, "bundler")
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def gem_path(path, spec)
|
|
55
|
+
full_path = Pathname.new(path).absolute? ? path : File.join(spec.full_gem_path, path)
|
|
56
|
+
if spec.source.instance_of?(Source::Path) && spec.source.path.absolute?
|
|
57
|
+
full_path
|
|
58
|
+
else
|
|
59
|
+
SharedHelpers.relative_path_to(full_path, from: Bundler.root.join(bundler_path))
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def prevent_gem_activation
|
|
64
|
+
<<~'END'
|
|
65
|
+
module Kernel
|
|
66
|
+
remove_method(:gem) if private_method_defined?(:gem)
|
|
67
|
+
|
|
68
|
+
def gem(*)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
private :gem
|
|
72
|
+
end
|
|
73
|
+
END
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def define_path_helpers
|
|
77
|
+
<<~'END'
|
|
78
|
+
unless defined?(Gem)
|
|
79
|
+
module Gem
|
|
80
|
+
def self.ruby_api_version
|
|
81
|
+
RbConfig::CONFIG["ruby_version"]
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def self.extension_api_version
|
|
85
|
+
if 'no' == RbConfig::CONFIG['ENABLE_SHARED']
|
|
86
|
+
"#{ruby_api_version}-static"
|
|
87
|
+
else
|
|
88
|
+
ruby_api_version
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
END
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def reverse_rubygems_kernel_mixin
|
|
97
|
+
<<~END
|
|
98
|
+
if Gem.respond_to?(:discover_gems_on_require=)
|
|
99
|
+
Gem.discover_gems_on_require = false
|
|
100
|
+
else
|
|
101
|
+
[::Kernel.singleton_class, ::Kernel].each do |k|
|
|
102
|
+
if k.private_method_defined?(:gem_original_require)
|
|
103
|
+
private_require = k.private_method_defined?(:require)
|
|
104
|
+
k.send(:remove_method, :require)
|
|
105
|
+
k.send(:define_method, :require, k.instance_method(:gem_original_require))
|
|
106
|
+
k.send(:private, :require) if private_require
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
END
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "worker"
|
|
4
|
+
require_relative "installer/parallel_installer"
|
|
5
|
+
require_relative "installer/standalone"
|
|
6
|
+
require_relative "installer/gem_installer"
|
|
7
|
+
|
|
8
|
+
module Bundler
|
|
9
|
+
class Installer
|
|
10
|
+
attr_reader :post_install_messages, :definition
|
|
11
|
+
|
|
12
|
+
# Begins the installation process for Bundler.
|
|
13
|
+
# For more information see the #run method on this class.
|
|
14
|
+
def self.install(root, definition, options = {})
|
|
15
|
+
installer = new(root, definition)
|
|
16
|
+
Plugin.hook(Plugin::Events::GEM_BEFORE_INSTALL_ALL, definition.dependencies)
|
|
17
|
+
installer.run(options)
|
|
18
|
+
Plugin.hook(Plugin::Events::GEM_AFTER_INSTALL_ALL, definition.dependencies)
|
|
19
|
+
installer
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def initialize(root, definition)
|
|
23
|
+
@root = root
|
|
24
|
+
@definition = definition
|
|
25
|
+
@post_install_messages = {}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Runs the install procedures for a specific Gemfile.
|
|
29
|
+
#
|
|
30
|
+
# Firstly, this method will check to see if `Bundler.bundle_path` exists
|
|
31
|
+
# and if not then Bundler will create the directory. This is usually the same
|
|
32
|
+
# location as RubyGems which typically is the `~/.gem` directory
|
|
33
|
+
# unless other specified.
|
|
34
|
+
#
|
|
35
|
+
# Secondly, it checks if Bundler has been configured to be "frozen".
|
|
36
|
+
# Frozen ensures that the Gemfile and the Gemfile.lock file are matching.
|
|
37
|
+
# This stops a situation where a developer may update the Gemfile but may not run
|
|
38
|
+
# `bundle install`, which leads to the Gemfile.lock file not being correctly updated.
|
|
39
|
+
# If this file is not correctly updated then any other developer running
|
|
40
|
+
# `bundle install` will potentially not install the correct gems.
|
|
41
|
+
#
|
|
42
|
+
# Thirdly, Bundler checks if there are any dependencies specified in the Gemfile.
|
|
43
|
+
# If there are no dependencies specified then Bundler returns a warning message stating
|
|
44
|
+
# so and this method returns.
|
|
45
|
+
#
|
|
46
|
+
# Fourthly, Bundler checks if the Gemfile.lock exists, and if so
|
|
47
|
+
# then proceeds to set up a definition based on the Gemfile and the Gemfile.lock.
|
|
48
|
+
# During this step Bundler will also download information about any new gems
|
|
49
|
+
# that are not in the Gemfile.lock and resolve any dependencies if needed.
|
|
50
|
+
#
|
|
51
|
+
# Fifthly, Bundler resolves the dependencies either through a cache of gems or by remote.
|
|
52
|
+
# This then leads into the gems being installed, along with stubs for their executables,
|
|
53
|
+
# but only if the --binstubs option has been passed or Bundler.options[:bin] has been set
|
|
54
|
+
# earlier.
|
|
55
|
+
#
|
|
56
|
+
# Sixthly, a new Gemfile.lock is created from the installed gems to ensure that the next time
|
|
57
|
+
# that a user runs `bundle install` they will receive any updates from this process.
|
|
58
|
+
#
|
|
59
|
+
# Finally, if the user has specified the standalone flag, Bundler will generate the needed
|
|
60
|
+
# require paths and save them in a `setup.rb` file. See `bundle standalone --help` for more
|
|
61
|
+
# information.
|
|
62
|
+
def run(options)
|
|
63
|
+
Bundler.create_bundle_path
|
|
64
|
+
|
|
65
|
+
ProcessLock.lock do
|
|
66
|
+
# Invalidate any stale gem specification cache from before we acquired the lock.
|
|
67
|
+
# Another process may have installed gems while we were waiting.
|
|
68
|
+
Gem::Specification.reset
|
|
69
|
+
@definition.sources.clear_cache
|
|
70
|
+
|
|
71
|
+
@definition.ensure_equivalent_gemfile_and_lockfile(options[:deployment])
|
|
72
|
+
|
|
73
|
+
if @definition.dependencies.empty?
|
|
74
|
+
Bundler.ui.warn "The Gemfile specifies no dependencies"
|
|
75
|
+
lock
|
|
76
|
+
return
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
if @definition.setup_domain!(options)
|
|
80
|
+
ensure_specs_are_compatible!
|
|
81
|
+
load_plugins
|
|
82
|
+
end
|
|
83
|
+
install(options)
|
|
84
|
+
|
|
85
|
+
Gem::Specification.reset # invalidate gem specification cache so that installed gems are immediately available
|
|
86
|
+
|
|
87
|
+
lock
|
|
88
|
+
Standalone.new(options[:standalone], @definition).generate if options[:standalone]
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def generate_bundler_executable_stubs(spec, options = {})
|
|
93
|
+
if spec.name == "bundler"
|
|
94
|
+
Bundler.ui.warn "Bundler itself does not use binstubs because its version is selected by RubyGems"
|
|
95
|
+
return
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
if options[:binstubs_cmd] && spec.executables.empty?
|
|
99
|
+
options = {}
|
|
100
|
+
spec.runtime_dependencies.each do |dep|
|
|
101
|
+
bins = @definition.specs[dep].first.executables
|
|
102
|
+
options[dep.name] = bins unless bins.empty?
|
|
103
|
+
end
|
|
104
|
+
if options.any?
|
|
105
|
+
Bundler.ui.warn "#{spec.name} has no executables, but you may want " \
|
|
106
|
+
"one from a gem it depends on."
|
|
107
|
+
options.each {|name, bins| Bundler.ui.warn " #{name} has: #{bins.join(", ")}" }
|
|
108
|
+
else
|
|
109
|
+
Bundler.ui.warn "There are no executables for the gem #{spec.name}."
|
|
110
|
+
end
|
|
111
|
+
return
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# double-assignment to avoid warnings about variables that will be used by ERB
|
|
115
|
+
bin_path = Bundler.bin_path
|
|
116
|
+
bin_path = bin_path
|
|
117
|
+
relative_gemfile_path = Bundler.default_gemfile.relative_path_from(bin_path)
|
|
118
|
+
relative_gemfile_path = relative_gemfile_path
|
|
119
|
+
ruby_command = Thor::Util.ruby_command
|
|
120
|
+
ruby_command = ruby_command
|
|
121
|
+
template_path = File.expand_path("templates/Executable", __dir__)
|
|
122
|
+
template = File.read(template_path)
|
|
123
|
+
|
|
124
|
+
exists = []
|
|
125
|
+
spec.executables.each do |executable|
|
|
126
|
+
binstub_path = "#{bin_path}/#{executable}"
|
|
127
|
+
if File.exist?(binstub_path) && !options[:force]
|
|
128
|
+
exists << executable
|
|
129
|
+
next
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
mode = Gem.win_platform? ? "wb:UTF-8" : "w"
|
|
133
|
+
require "erb"
|
|
134
|
+
content = ERB.new(template, trim_mode: "-").result(binding)
|
|
135
|
+
|
|
136
|
+
File.write(binstub_path, content, mode: mode, perm: 0o777 & ~File.umask)
|
|
137
|
+
if Gem.win_platform? || options[:all_platforms]
|
|
138
|
+
prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n"
|
|
139
|
+
File.write("#{binstub_path}.cmd", prefix + content, mode: mode)
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
if options[:binstubs_cmd] && exists.any?
|
|
144
|
+
case exists.size
|
|
145
|
+
when 1
|
|
146
|
+
Bundler.ui.warn "Skipped #{exists[0]} since it already exists."
|
|
147
|
+
when 2
|
|
148
|
+
Bundler.ui.warn "Skipped #{exists.join(" and ")} since they already exist."
|
|
149
|
+
else
|
|
150
|
+
items = exists[0...-1].empty? ? nil : exists[0...-1].join(", ")
|
|
151
|
+
skipped = [items, exists[-1]].compact.join(" and ")
|
|
152
|
+
Bundler.ui.warn "Skipped #{skipped} since they already exist."
|
|
153
|
+
end
|
|
154
|
+
Bundler.ui.warn "If you want to overwrite skipped stubs, use --force."
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def generate_standalone_bundler_executable_stubs(spec, options = {})
|
|
159
|
+
# double-assignment to avoid warnings about variables that will be used by ERB
|
|
160
|
+
bin_path = Bundler.bin_path
|
|
161
|
+
unless path = Bundler.settings[:path]
|
|
162
|
+
raise "Can't standalone without an explicit path set"
|
|
163
|
+
end
|
|
164
|
+
standalone_path = Bundler.root.join(path).relative_path_from(bin_path)
|
|
165
|
+
standalone_path = standalone_path
|
|
166
|
+
template = File.read(File.expand_path("templates/Executable.standalone", __dir__))
|
|
167
|
+
ruby_command = Thor::Util.ruby_command
|
|
168
|
+
ruby_command = ruby_command
|
|
169
|
+
|
|
170
|
+
spec.executables.each do |executable|
|
|
171
|
+
next if executable == "bundle"
|
|
172
|
+
executable_path = Pathname(spec.full_gem_path).join(spec.bindir, executable).relative_path_from(bin_path)
|
|
173
|
+
executable_path = executable_path
|
|
174
|
+
|
|
175
|
+
mode = Gem.win_platform? ? "wb:UTF-8" : "w"
|
|
176
|
+
require "erb"
|
|
177
|
+
content = ERB.new(template, trim_mode: "-").result(binding)
|
|
178
|
+
|
|
179
|
+
File.write("#{bin_path}/#{executable}", content, mode: mode, perm: 0o755)
|
|
180
|
+
if Gem.win_platform? || options[:all_platforms]
|
|
181
|
+
prefix = "@ruby -x \"%~f0\" %*\n@exit /b %ERRORLEVEL%\n\n"
|
|
182
|
+
File.write("#{bin_path}/#{executable}.cmd", prefix + content, mode: mode)
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
private
|
|
188
|
+
|
|
189
|
+
# the order that the resolver provides is significant, since
|
|
190
|
+
# dependencies might affect the installation of a gem.
|
|
191
|
+
# that said, it's a rare situation (other than rake), and parallel
|
|
192
|
+
# installation is SO MUCH FASTER. so we let people opt in.
|
|
193
|
+
def install(options)
|
|
194
|
+
standalone = options[:standalone]
|
|
195
|
+
force = options[:force]
|
|
196
|
+
local = options[:local] || options[:"prefer-local"]
|
|
197
|
+
jobs = Bundler.settings.installation_parallelization
|
|
198
|
+
specs = @definition.specs
|
|
199
|
+
# Installing default gems may need the remote index again to cache
|
|
200
|
+
# their .gem files, so keep resolution memory around in that case.
|
|
201
|
+
# The bundler spec itself is excluded because it comes from the
|
|
202
|
+
# metadata source and never goes through that path.
|
|
203
|
+
@definition.release_resolution_memory! if specs.none? {|s| s.default_gem? && s.source.is_a?(Source::Rubygems) }
|
|
204
|
+
spec_installations = ParallelInstaller.call(self, specs, jobs, standalone, force, local: local)
|
|
205
|
+
spec_installations.each do |installation|
|
|
206
|
+
post_install_messages[installation.name] = installation.post_install_message if installation.has_post_install_message?
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def load_plugins
|
|
211
|
+
Gem.load_plugins
|
|
212
|
+
|
|
213
|
+
requested_path_gems = @definition.specs.select {|s| s.source.is_a?(Source::Path) }
|
|
214
|
+
path_plugin_files = requested_path_gems.flat_map do |spec|
|
|
215
|
+
spec.matches_for_glob("rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
|
|
216
|
+
rescue TypeError
|
|
217
|
+
error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
|
|
218
|
+
raise Gem::InvalidSpecificationException, error_message
|
|
219
|
+
end
|
|
220
|
+
Gem.load_plugin_files(path_plugin_files)
|
|
221
|
+
Gem.load_env_plugins
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
def ensure_specs_are_compatible!
|
|
225
|
+
@definition.specs.each do |spec|
|
|
226
|
+
unless spec.matches_current_ruby?
|
|
227
|
+
raise InstallError, "#{spec.full_name} requires ruby version #{spec.required_ruby_version}, " \
|
|
228
|
+
"which is incompatible with the current version, #{Gem.ruby_version}"
|
|
229
|
+
end
|
|
230
|
+
unless spec.matches_current_rubygems?
|
|
231
|
+
raise InstallError, "#{spec.full_name} requires rubygems version #{spec.required_rubygems_version}, " \
|
|
232
|
+
"which is incompatible with the current version, #{Gem.rubygems_version}"
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
def lock
|
|
238
|
+
@definition.lock
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
end
|