bundler 1.11.1 → 2.2.6
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 +2125 -840
- data/LICENSE.md +18 -19
- data/README.md +33 -11
- data/bundler.gemspec +34 -21
- data/exe/bundle +36 -6
- data/exe/bundler +2 -18
- data/lib/bundler.rb +435 -160
- data/lib/bundler/build_metadata.rb +45 -0
- data/lib/bundler/capistrano.rb +9 -3
- data/lib/bundler/cli.rb +550 -130
- data/lib/bundler/cli/add.rb +47 -0
- data/lib/bundler/cli/binstubs.rb +26 -10
- data/lib/bundler/cli/cache.rb +25 -17
- data/lib/bundler/cli/check.rb +8 -7
- data/lib/bundler/cli/clean.rb +8 -8
- data/lib/bundler/cli/common.rb +69 -9
- data/lib/bundler/cli/config.rb +170 -76
- data/lib/bundler/cli/console.rb +6 -1
- data/lib/bundler/cli/doctor.rb +140 -0
- data/lib/bundler/cli/exec.rb +63 -21
- data/lib/bundler/cli/fund.rb +36 -0
- data/lib/bundler/cli/gem.rb +158 -42
- data/lib/bundler/cli/info.rb +73 -0
- data/lib/bundler/cli/init.rb +22 -7
- data/lib/bundler/cli/inject.rb +38 -10
- data/lib/bundler/cli/install.rb +139 -104
- data/lib/bundler/cli/issue.rb +40 -0
- data/lib/bundler/cli/list.rb +60 -0
- data/lib/bundler/cli/lock.rb +27 -5
- data/lib/bundler/cli/open.rb +13 -5
- data/lib/bundler/cli/outdated.rb +251 -46
- data/lib/bundler/cli/platform.rb +6 -2
- data/lib/bundler/cli/plugin.rb +41 -0
- data/lib/bundler/cli/pristine.rb +52 -0
- data/lib/bundler/cli/remove.rb +18 -0
- data/lib/bundler/cli/show.rb +5 -4
- data/lib/bundler/cli/update.rb +67 -26
- data/lib/bundler/cli/viz.rb +11 -6
- data/lib/bundler/compact_index_client.rb +125 -0
- data/lib/bundler/compact_index_client/cache.rb +110 -0
- data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/lib/bundler/compact_index_client/updater.rb +104 -0
- data/lib/bundler/constants.rb +2 -0
- data/lib/bundler/current_ruby.rb +51 -174
- data/lib/bundler/definition.rb +533 -216
- data/lib/bundler/dep_proxy.rb +18 -8
- data/lib/bundler/dependency.rb +39 -12
- data/lib/bundler/deployment.rb +7 -0
- data/lib/bundler/deprecate.rb +31 -2
- data/lib/bundler/dsl.rb +188 -91
- data/lib/bundler/endpoint_specification.rb +51 -10
- data/lib/bundler/env.rb +116 -48
- data/lib/bundler/environment_preserver.rb +82 -0
- data/lib/bundler/errors.rb +108 -31
- data/lib/bundler/feature_flag.rb +60 -0
- data/lib/bundler/fetcher.rb +81 -52
- data/lib/bundler/fetcher/base.rb +15 -3
- data/lib/bundler/fetcher/compact_index.rb +140 -0
- data/lib/bundler/fetcher/dependency.rb +36 -42
- data/lib/bundler/fetcher/downloader.rb +39 -12
- data/lib/bundler/fetcher/index.rb +34 -9
- data/lib/bundler/friendly_errors.rb +132 -88
- data/lib/bundler/gem_helper.rb +92 -50
- data/lib/bundler/gem_helpers.rb +90 -5
- data/lib/bundler/gem_tasks.rb +3 -1
- data/lib/bundler/gem_version_promoter.rb +190 -0
- data/lib/bundler/gemdeps.rb +29 -0
- data/lib/bundler/graph.rb +20 -41
- data/lib/bundler/index.rb +74 -57
- data/lib/bundler/injector.rb +242 -31
- data/lib/bundler/inline.rb +49 -23
- data/lib/bundler/installer.rb +190 -74
- data/lib/bundler/installer/gem_installer.rb +33 -20
- data/lib/bundler/installer/parallel_installer.rb +201 -97
- data/lib/bundler/installer/standalone.rb +10 -6
- data/lib/bundler/lazy_specification.rb +74 -10
- data/lib/bundler/lockfile_generator.rb +95 -0
- data/lib/bundler/lockfile_parser.rb +126 -74
- data/lib/bundler/{ssl_certs → man}/.document +0 -0
- data/lib/bundler/man/bundle-add.1 +66 -0
- data/lib/bundler/man/bundle-add.1.ronn +46 -0
- data/lib/bundler/man/bundle-binstubs.1 +42 -0
- data/lib/bundler/man/bundle-binstubs.1.ronn +41 -0
- data/lib/bundler/man/bundle-cache.1 +55 -0
- data/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +22 -16
- data/lib/bundler/man/bundle-check.1 +31 -0
- data/lib/bundler/man/bundle-check.1.ronn +26 -0
- data/lib/bundler/man/bundle-clean.1 +24 -0
- data/lib/bundler/man/bundle-clean.1.ronn +18 -0
- data/lib/bundler/man/bundle-config.1 +488 -0
- data/lib/bundler/man/bundle-config.1.ronn +388 -0
- data/lib/bundler/man/bundle-doctor.1 +44 -0
- data/lib/bundler/man/bundle-doctor.1.ronn +33 -0
- data/lib/bundler/man/bundle-exec.1 +165 -0
- data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +20 -4
- data/lib/bundler/man/bundle-gem.1 +102 -0
- data/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +37 -13
- data/lib/bundler/man/bundle-info.1 +20 -0
- data/lib/bundler/man/bundle-info.1.ronn +17 -0
- data/lib/bundler/man/bundle-init.1 +25 -0
- data/lib/bundler/man/bundle-init.1.ronn +29 -0
- data/lib/bundler/man/bundle-inject.1 +33 -0
- data/lib/bundler/man/bundle-inject.1.ronn +22 -0
- data/lib/bundler/man/bundle-install.1 +338 -0
- data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +82 -76
- data/lib/bundler/man/bundle-list.1 +50 -0
- data/lib/bundler/man/bundle-list.1.ronn +33 -0
- data/lib/bundler/man/bundle-lock.1 +84 -0
- data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +47 -0
- data/lib/bundler/man/bundle-open.1 +32 -0
- data/lib/bundler/man/bundle-open.1.ronn +19 -0
- data/lib/bundler/man/bundle-outdated.1 +155 -0
- data/lib/bundler/man/bundle-outdated.1.ronn +111 -0
- data/lib/bundler/man/bundle-platform.1 +61 -0
- data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +1 -1
- data/lib/bundler/man/bundle-pristine.1 +34 -0
- data/lib/bundler/man/bundle-pristine.1.ronn +34 -0
- data/lib/bundler/man/bundle-remove.1 +31 -0
- data/lib/bundler/man/bundle-remove.1.ronn +23 -0
- data/lib/bundler/man/bundle-show.1 +23 -0
- data/lib/bundler/man/bundle-show.1.ronn +21 -0
- data/lib/bundler/man/bundle-update.1 +394 -0
- data/lib/bundler/man/bundle-update.1.ronn +350 -0
- data/lib/bundler/man/bundle-viz.1 +39 -0
- data/lib/bundler/man/bundle-viz.1.ronn +30 -0
- data/lib/bundler/man/bundle.1 +136 -0
- data/lib/bundler/man/bundle.1.ronn +111 -0
- data/lib/bundler/man/gemfile.5 +686 -0
- data/{man → lib/bundler/man}/gemfile.5.ronn +117 -95
- data/lib/bundler/man/index.txt +25 -0
- data/lib/bundler/match_platform.rb +15 -4
- data/lib/bundler/mirror.rb +223 -0
- data/lib/bundler/plugin.rb +330 -0
- data/lib/bundler/plugin/api.rb +81 -0
- data/lib/bundler/plugin/api/source.rb +304 -0
- data/lib/bundler/plugin/dsl.rb +53 -0
- data/lib/bundler/plugin/events.rb +61 -0
- data/lib/bundler/plugin/index.rb +182 -0
- data/lib/bundler/plugin/installer.rb +109 -0
- data/lib/bundler/plugin/installer/git.rb +38 -0
- data/lib/bundler/plugin/installer/rubygems.rb +27 -0
- data/lib/bundler/plugin/source_list.rb +27 -0
- data/lib/bundler/process_lock.rb +24 -0
- data/lib/bundler/psyched_yaml.rb +2 -6
- data/lib/bundler/remote_specification.rb +42 -9
- data/lib/bundler/resolver.rb +312 -225
- data/lib/bundler/resolver/spec_group.rb +122 -0
- data/lib/bundler/retry.rb +11 -5
- data/lib/bundler/ruby_dsl.rb +9 -2
- data/lib/bundler/ruby_version.rb +84 -61
- data/lib/bundler/rubygems_ext.rb +92 -53
- data/lib/bundler/rubygems_gem_installer.rb +84 -0
- data/lib/bundler/rubygems_integration.rb +320 -395
- data/lib/bundler/runtime.rb +87 -75
- data/lib/bundler/settings.rb +297 -119
- data/lib/bundler/settings/validator.rb +102 -0
- data/lib/bundler/setup.rb +13 -12
- data/lib/bundler/shared_helpers.rb +234 -53
- data/lib/bundler/similarity_detector.rb +5 -3
- data/lib/bundler/source.rb +63 -4
- data/lib/bundler/source/gemspec.rb +18 -0
- data/lib/bundler/source/git.rb +97 -50
- data/lib/bundler/source/git/git_proxy.rb +138 -65
- data/lib/bundler/source/metadata.rb +67 -0
- data/lib/bundler/source/path.rb +83 -47
- data/lib/bundler/source/path/installer.rb +42 -11
- data/lib/bundler/source/rubygems.rb +231 -116
- data/lib/bundler/source/rubygems/remote.rb +30 -1
- data/lib/bundler/source_list.rb +103 -21
- data/lib/bundler/spec_set.rb +96 -51
- data/lib/bundler/stub_specification.rb +87 -4
- data/lib/bundler/templates/.document +1 -0
- data/lib/bundler/templates/Executable +14 -1
- data/lib/bundler/templates/Executable.bundler +114 -0
- data/lib/bundler/templates/Executable.standalone +6 -4
- data/lib/bundler/templates/Gemfile +4 -1
- data/lib/bundler/templates/gems.rb +8 -0
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +79 -44
- data/lib/bundler/templates/newgem/Gemfile.tt +18 -2
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +1 -1
- data/lib/bundler/templates/newgem/README.md.tt +16 -10
- data/lib/bundler/templates/newgem/Rakefile.tt +22 -8
- data/lib/bundler/templates/newgem/bin/console.tt +2 -1
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
- 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/github/workflows/main.yml.tt +18 -0
- data/lib/bundler/templates/newgem/gitignore.tt +5 -1
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +9 -6
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +6 -4
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +27 -28
- data/lib/bundler/templates/newgem/rspec.tt +1 -0
- data/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +4 -4
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +15 -2
- data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +3 -1
- data/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -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/templates/newgem/{.travis.yml.tt → travis.yml.tt} +2 -0
- data/lib/bundler/ui.rb +5 -3
- data/lib/bundler/ui/rg_proxy.rb +3 -1
- data/lib/bundler/ui/shell.rb +54 -21
- data/lib/bundler/ui/silent.rb +26 -1
- data/lib/bundler/uri_credentials_filter.rb +43 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +161 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +66 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +176 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1764 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +11 -5
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +57 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +81 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +113 -134
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +36 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +66 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +62 -0
- 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 +61 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +126 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +46 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +36 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +158 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +82 -8
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +4 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +2 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +6 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +555 -150
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +6 -3
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +19 -12
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent.rb +310 -467
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
- data/lib/bundler/vendor/thor/lib/thor.rb +58 -25
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +50 -33
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +3 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +5 -3
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +9 -19
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +16 -8
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +79 -22
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +33 -20
- data/lib/bundler/vendor/thor/lib/thor/base.rb +110 -67
- data/lib/bundler/vendor/thor/lib/thor/command.rb +33 -24
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +21 -1
- data/lib/bundler/vendor/thor/lib/thor/error.rb +81 -3
- data/lib/bundler/vendor/thor/lib/thor/group.rb +16 -16
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +5 -5
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +2 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +4 -7
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +18 -18
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +60 -26
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +31 -13
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +42 -39
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +5 -5
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +109 -39
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +7 -3
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +5 -5
- data/lib/bundler/vendor/thor/lib/thor/util.rb +26 -9
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
- data/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
- data/lib/bundler/vendor/uri/lib/uri/http.rb +88 -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 +21 -0
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
- data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/lib/bundler/vendored_fileutils.rb +4 -0
- data/lib/bundler/vendored_molinillo.rb +3 -1
- data/lib/bundler/vendored_persistent.rb +45 -9
- data/lib/bundler/vendored_thor.rb +8 -3
- data/lib/bundler/vendored_tmpdir.rb +4 -0
- data/lib/bundler/vendored_uri.rb +4 -0
- data/lib/bundler/version.rb +7 -4
- data/lib/bundler/version_ranges.rb +122 -0
- data/lib/bundler/vlad.rb +8 -2
- data/lib/bundler/worker.rb +38 -6
- data/lib/bundler/yaml_serializer.rb +89 -0
- metadata +164 -158
- data/.gitignore +0 -16
- data/.rspec +0 -3
- data/.rubocop.yml +0 -105
- data/.rubocop_todo.yml +0 -120
- data/.travis.yml +0 -97
- data/CODE_OF_CONDUCT.md +0 -42
- data/CONTRIBUTING.md +0 -32
- data/DEVELOPMENT.md +0 -118
- data/ISSUES.md +0 -96
- data/Rakefile +0 -309
- data/bin/rake +0 -14
- data/bin/rspec +0 -10
- data/bin/rubocop +0 -11
- data/exe/bundle_ruby +0 -60
- data/lib/bundler/cli/package.rb +0 -45
- data/lib/bundler/environment.rb +0 -41
- data/lib/bundler/gem_path_manipulation.rb +0 -8
- data/lib/bundler/gem_remote_fetcher.rb +0 -41
- data/lib/bundler/ssl_certs/AddTrustExternalCARoot-2048.pem +0 -25
- data/lib/bundler/ssl_certs/AddTrustExternalCARoot.pem +0 -32
- data/lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +0 -14
- data/lib/bundler/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +0 -28
- data/lib/bundler/ssl_certs/GeoTrustGlobalCA.pem +0 -20
- data/lib/bundler/ssl_certs/certificate_manager.rb +0 -64
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
- data/lib/bundler/vendor/net/http/faster.rb +0 -26
- data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +0 -128
- data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -10
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -98
- data/man/bundle-config.ronn +0 -187
- data/man/bundle-update.ronn +0 -188
- data/man/bundle.ronn +0 -98
- data/man/index.txt +0 -8
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
# This is the interfacing class represents the API that we intend to provide
|
5
|
+
# the plugins to use.
|
6
|
+
#
|
7
|
+
# For plugins to be independent of the Bundler internals they shall limit their
|
8
|
+
# interactions to methods of this class only. This will save them from breaking
|
9
|
+
# when some internal change.
|
10
|
+
#
|
11
|
+
# Currently we are delegating the methods defined in Bundler class to
|
12
|
+
# itself. So, this class acts as a buffer.
|
13
|
+
#
|
14
|
+
# If there is some change in the Bundler class that is incompatible to its
|
15
|
+
# previous behavior or if otherwise desired, we can reimplement(or implement)
|
16
|
+
# the method to preserve compatibility.
|
17
|
+
#
|
18
|
+
# To use this, either the class can inherit this class or use it directly.
|
19
|
+
# For example of both types of use, refer the file `spec/plugins/command.rb`
|
20
|
+
#
|
21
|
+
# To use it without inheriting, you will have to create an object of this
|
22
|
+
# to use the functions (except for declaration functions like command, source,
|
23
|
+
# and hooks).
|
24
|
+
module Plugin
|
25
|
+
class API
|
26
|
+
autoload :Source, File.expand_path("api/source", __dir__)
|
27
|
+
|
28
|
+
# The plugins should declare that they handle a command through this helper.
|
29
|
+
#
|
30
|
+
# @param [String] command being handled by them
|
31
|
+
# @param [Class] (optional) class that handles the command. If not
|
32
|
+
# provided, the `self` class will be used.
|
33
|
+
def self.command(command, cls = self)
|
34
|
+
Plugin.add_command command, cls
|
35
|
+
end
|
36
|
+
|
37
|
+
# The plugins should declare that they provide a installation source
|
38
|
+
# through this helper.
|
39
|
+
#
|
40
|
+
# @param [String] the source type they provide
|
41
|
+
# @param [Class] (optional) class that handles the source. If not
|
42
|
+
# provided, the `self` class will be used.
|
43
|
+
def self.source(source, cls = self)
|
44
|
+
cls.send :include, Bundler::Plugin::API::Source
|
45
|
+
Plugin.add_source source, cls
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.hook(event, &block)
|
49
|
+
Plugin.add_hook(event, &block)
|
50
|
+
end
|
51
|
+
|
52
|
+
# The cache dir to be used by the plugins for storage
|
53
|
+
#
|
54
|
+
# @return [Pathname] path of the cache dir
|
55
|
+
def cache_dir
|
56
|
+
Plugin.cache.join("plugins")
|
57
|
+
end
|
58
|
+
|
59
|
+
# A tmp dir to be used by plugins
|
60
|
+
# Accepts names that get concatenated as suffix
|
61
|
+
#
|
62
|
+
# @return [Pathname] object for the new directory created
|
63
|
+
def tmp(*names)
|
64
|
+
Bundler.tmp(["plugin", *names].join("-"))
|
65
|
+
end
|
66
|
+
|
67
|
+
def method_missing(name, *args, &blk)
|
68
|
+
return Bundler.send(name, *args, &blk) if Bundler.respond_to?(name)
|
69
|
+
|
70
|
+
return SharedHelpers.send(name, *args, &blk) if SharedHelpers.respond_to?(name)
|
71
|
+
|
72
|
+
super
|
73
|
+
end
|
74
|
+
|
75
|
+
def respond_to_missing?(name, include_private = false)
|
76
|
+
SharedHelpers.respond_to?(name, include_private) ||
|
77
|
+
Bundler.respond_to?(name, include_private) || super
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,304 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
module Plugin
|
5
|
+
class API
|
6
|
+
# This class provides the base to build source plugins
|
7
|
+
# All the method here are required to build a source plugin (except
|
8
|
+
# `uri_hash`, `gem_install_dir`; they are helpers).
|
9
|
+
#
|
10
|
+
# Defaults for methods, where ever possible are provided which is
|
11
|
+
# expected to work. But, all source plugins have to override
|
12
|
+
# `fetch_gemspec_files` and `install`. Defaults are also not provided for
|
13
|
+
# `remote!`, `cache!` and `unlock!`.
|
14
|
+
#
|
15
|
+
# The defaults shall work for most situations but nevertheless they can
|
16
|
+
# be (preferably should be) overridden as per the plugins' needs safely
|
17
|
+
# (as long as they behave as expected).
|
18
|
+
# On overriding `initialize` you should call super first.
|
19
|
+
#
|
20
|
+
# If required plugin should override `hash`, `==` and `eql?` methods to be
|
21
|
+
# able to match objects representing same sources, but may be created in
|
22
|
+
# different situation (like form gemfile and lockfile). The default ones
|
23
|
+
# checks only for class and uri, but elaborate source plugins may need
|
24
|
+
# more comparisons (e.g. git checking on branch or tag).
|
25
|
+
#
|
26
|
+
# @!attribute [r] uri
|
27
|
+
# @return [String] the remote specified with `source` block in Gemfile
|
28
|
+
#
|
29
|
+
# @!attribute [r] options
|
30
|
+
# @return [String] options passed during initialization (either from
|
31
|
+
# lockfile or Gemfile)
|
32
|
+
#
|
33
|
+
# @!attribute [r] name
|
34
|
+
# @return [String] name that can be used to uniquely identify a source
|
35
|
+
#
|
36
|
+
# @!attribute [rw] dependency_names
|
37
|
+
# @return [Array<String>] Names of dependencies that the source should
|
38
|
+
# try to resolve. It is not necessary to use this list internally. This
|
39
|
+
# is present to be compatible with `Definition` and is used by
|
40
|
+
# rubygems source.
|
41
|
+
module Source
|
42
|
+
attr_reader :uri, :options, :name
|
43
|
+
attr_accessor :dependency_names
|
44
|
+
|
45
|
+
def initialize(opts)
|
46
|
+
@options = opts
|
47
|
+
@dependency_names = []
|
48
|
+
@uri = opts["uri"]
|
49
|
+
@type = opts["type"]
|
50
|
+
@name = opts["name"] || "#{@type} at #{@uri}"
|
51
|
+
end
|
52
|
+
|
53
|
+
# This is used by the default `spec` method to constructs the
|
54
|
+
# Specification objects for the gems and versions that can be installed
|
55
|
+
# by this source plugin.
|
56
|
+
#
|
57
|
+
# Note: If the spec method is overridden, this function is not necessary
|
58
|
+
#
|
59
|
+
# @return [Array<String>] paths of the gemspec files for gems that can
|
60
|
+
# be installed
|
61
|
+
def fetch_gemspec_files
|
62
|
+
[]
|
63
|
+
end
|
64
|
+
|
65
|
+
# Options to be saved in the lockfile so that the source plugin is able
|
66
|
+
# to check out same version of gem later.
|
67
|
+
#
|
68
|
+
# There options are passed when the source plugin is created from the
|
69
|
+
# lock file.
|
70
|
+
#
|
71
|
+
# @return [Hash]
|
72
|
+
def options_to_lock
|
73
|
+
{}
|
74
|
+
end
|
75
|
+
|
76
|
+
# Install the gem specified by the spec at appropriate path.
|
77
|
+
# `install_path` provides a sufficient default, if the source can only
|
78
|
+
# satisfy one gem, but is not binding.
|
79
|
+
#
|
80
|
+
# @return [String] post installation message (if any)
|
81
|
+
def install(spec, opts)
|
82
|
+
raise MalformattedPlugin, "Source plugins need to override the install method."
|
83
|
+
end
|
84
|
+
|
85
|
+
# It builds extensions, generates bins and installs them for the spec
|
86
|
+
# provided.
|
87
|
+
#
|
88
|
+
# It depends on `spec.loaded_from` to get full_gem_path. The source
|
89
|
+
# plugins should set that.
|
90
|
+
#
|
91
|
+
# It should be called in `install` after the plugin is done placing the
|
92
|
+
# gem at correct install location.
|
93
|
+
#
|
94
|
+
# It also runs Gem hooks `pre_install`, `post_build` and `post_install`
|
95
|
+
#
|
96
|
+
# Note: Do not override if you don't know what you are doing.
|
97
|
+
def post_install(spec, disable_exts = false)
|
98
|
+
opts = { :env_shebang => false, :disable_extensions => disable_exts }
|
99
|
+
installer = Bundler::Source::Path::Installer.new(spec, opts)
|
100
|
+
installer.post_install
|
101
|
+
end
|
102
|
+
|
103
|
+
# A default installation path to install a single gem. If the source
|
104
|
+
# servers multiple gems, it's not of much use and the source should one
|
105
|
+
# of its own.
|
106
|
+
def install_path
|
107
|
+
@install_path ||=
|
108
|
+
begin
|
109
|
+
base_name = File.basename(Bundler::URI.parse(uri).normalize.path)
|
110
|
+
|
111
|
+
gem_install_dir.join("#{base_name}-#{uri_hash[0..11]}")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Parses the gemspec files to find the specs for the gems that can be
|
116
|
+
# satisfied by the source.
|
117
|
+
#
|
118
|
+
# Few important points to keep in mind:
|
119
|
+
# - If the gems are not installed then it shall return specs for all
|
120
|
+
# the gems it can satisfy
|
121
|
+
# - If gem is installed (that is to be detected by the plugin itself)
|
122
|
+
# then it shall return at least the specs that are installed.
|
123
|
+
# - The `loaded_from` for each of the specs shall be correct (it is
|
124
|
+
# used to find the load path)
|
125
|
+
#
|
126
|
+
# @return [Bundler::Index] index containing the specs
|
127
|
+
def specs
|
128
|
+
files = fetch_gemspec_files
|
129
|
+
|
130
|
+
Bundler::Index.build do |index|
|
131
|
+
files.each do |file|
|
132
|
+
next unless spec = Bundler.load_gemspec(file)
|
133
|
+
Bundler.rubygems.set_installed_by_version(spec)
|
134
|
+
|
135
|
+
spec.source = self
|
136
|
+
Bundler.rubygems.validate(spec)
|
137
|
+
|
138
|
+
index << spec
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
# Set internal representation to fetch the gems/specs from remote.
|
144
|
+
#
|
145
|
+
# When this is called, the source should try to fetch the specs and
|
146
|
+
# install from remote path.
|
147
|
+
def remote!
|
148
|
+
end
|
149
|
+
|
150
|
+
# Set internal representation to fetch the gems/specs from app cache.
|
151
|
+
#
|
152
|
+
# When this is called, the source should try to fetch the specs and
|
153
|
+
# install from the path provided by `app_cache_path`.
|
154
|
+
def cached!
|
155
|
+
end
|
156
|
+
|
157
|
+
# This is called to update the spec and installation.
|
158
|
+
#
|
159
|
+
# If the source plugin is loaded from lockfile or otherwise, it shall
|
160
|
+
# refresh the cache/specs (e.g. git sources can make a fresh clone).
|
161
|
+
def unlock!
|
162
|
+
end
|
163
|
+
|
164
|
+
# Name of directory where plugin the is expected to cache the gems when
|
165
|
+
# #cache is called.
|
166
|
+
#
|
167
|
+
# Also this name is matched against the directories in cache for pruning
|
168
|
+
#
|
169
|
+
# This is used by `app_cache_path`
|
170
|
+
def app_cache_dirname
|
171
|
+
base_name = File.basename(Bundler::URI.parse(uri).normalize.path)
|
172
|
+
"#{base_name}-#{uri_hash}"
|
173
|
+
end
|
174
|
+
|
175
|
+
# This method is called while caching to save copy of the gems that the
|
176
|
+
# source can resolve to path provided by `app_cache_app`so that they can
|
177
|
+
# be reinstalled from the cache without querying the remote (i.e. an
|
178
|
+
# alternative to remote)
|
179
|
+
#
|
180
|
+
# This is stored with the app and source plugins should try to provide
|
181
|
+
# specs and install only from this cache when `cached!` is called.
|
182
|
+
#
|
183
|
+
# This cache is different from the internal caching that can be done
|
184
|
+
# at sub paths of `cache_path` (from API). This can be though as caching
|
185
|
+
# by bundler.
|
186
|
+
def cache(spec, custom_path = nil)
|
187
|
+
new_cache_path = app_cache_path(custom_path)
|
188
|
+
|
189
|
+
FileUtils.rm_rf(new_cache_path)
|
190
|
+
FileUtils.cp_r(install_path, new_cache_path)
|
191
|
+
FileUtils.touch(app_cache_path.join(".bundlecache"))
|
192
|
+
end
|
193
|
+
|
194
|
+
# This shall check if two source object represent the same source.
|
195
|
+
#
|
196
|
+
# The comparison shall take place only on the attribute that can be
|
197
|
+
# inferred from the options passed from Gemfile and not on attributes
|
198
|
+
# that are used to pin down the gem to specific version (e.g. Git
|
199
|
+
# sources should compare on branch and tag but not on commit hash)
|
200
|
+
#
|
201
|
+
# The sources objects are constructed from Gemfile as well as from
|
202
|
+
# lockfile. To converge the sources, it is necessary that they match.
|
203
|
+
#
|
204
|
+
# The same applies for `eql?` and `hash`
|
205
|
+
def ==(other)
|
206
|
+
other.is_a?(self.class) && uri == other.uri
|
207
|
+
end
|
208
|
+
|
209
|
+
# When overriding `eql?` please preserve the behaviour as mentioned in
|
210
|
+
# docstring for `==` method.
|
211
|
+
alias_method :eql?, :==
|
212
|
+
|
213
|
+
# When overriding `hash` please preserve the behaviour as mentioned in
|
214
|
+
# docstring for `==` method, i.e. two methods equal by above comparison
|
215
|
+
# should have same hash.
|
216
|
+
def hash
|
217
|
+
[self.class, uri].hash
|
218
|
+
end
|
219
|
+
|
220
|
+
# A helper method, not necessary if not used internally.
|
221
|
+
def installed?
|
222
|
+
File.directory?(install_path)
|
223
|
+
end
|
224
|
+
|
225
|
+
# The full path where the plugin should cache the gem so that it can be
|
226
|
+
# installed latter.
|
227
|
+
#
|
228
|
+
# Note: Do not override if you don't know what you are doing.
|
229
|
+
def app_cache_path(custom_path = nil)
|
230
|
+
@app_cache_path ||= Bundler.app_cache(custom_path).join(app_cache_dirname)
|
231
|
+
end
|
232
|
+
|
233
|
+
# Used by definition.
|
234
|
+
#
|
235
|
+
# Note: Do not override if you don't know what you are doing.
|
236
|
+
def unmet_deps
|
237
|
+
specs.unmet_dependency_names
|
238
|
+
end
|
239
|
+
|
240
|
+
# Note: Do not override if you don't know what you are doing.
|
241
|
+
def can_lock?(spec)
|
242
|
+
spec.source == self
|
243
|
+
end
|
244
|
+
|
245
|
+
# Generates the content to be entered into the lockfile.
|
246
|
+
# Saves type and remote and also calls to `options_to_lock`.
|
247
|
+
#
|
248
|
+
# Plugin should use `options_to_lock` to save information in lockfile
|
249
|
+
# and not override this.
|
250
|
+
#
|
251
|
+
# Note: Do not override if you don't know what you are doing.
|
252
|
+
def to_lock
|
253
|
+
out = String.new("#{LockfileParser::PLUGIN}\n")
|
254
|
+
out << " remote: #{@uri}\n"
|
255
|
+
out << " type: #{@type}\n"
|
256
|
+
options_to_lock.each do |opt, value|
|
257
|
+
out << " #{opt}: #{value}\n"
|
258
|
+
end
|
259
|
+
out << " specs:\n"
|
260
|
+
end
|
261
|
+
|
262
|
+
def to_s
|
263
|
+
"plugin source for #{@type} with uri #{@uri}"
|
264
|
+
end
|
265
|
+
|
266
|
+
# Note: Do not override if you don't know what you are doing.
|
267
|
+
def include?(other)
|
268
|
+
other == self
|
269
|
+
end
|
270
|
+
|
271
|
+
def uri_hash
|
272
|
+
SharedHelpers.digest(:SHA1).hexdigest(uri)
|
273
|
+
end
|
274
|
+
|
275
|
+
# Note: Do not override if you don't know what you are doing.
|
276
|
+
def gem_install_dir
|
277
|
+
Bundler.install_path
|
278
|
+
end
|
279
|
+
|
280
|
+
# It is used to obtain the full_gem_path.
|
281
|
+
#
|
282
|
+
# spec's loaded_from path is expanded against this to get full_gem_path
|
283
|
+
#
|
284
|
+
# Note: Do not override if you don't know what you are doing.
|
285
|
+
def root
|
286
|
+
Bundler.root
|
287
|
+
end
|
288
|
+
|
289
|
+
# @private
|
290
|
+
# Returns true
|
291
|
+
def bundler_plugin_api_source?
|
292
|
+
true
|
293
|
+
end
|
294
|
+
|
295
|
+
# @private
|
296
|
+
# This API on source might not be stable, and for now we expect plugins
|
297
|
+
# to download all specs in `#specs`, so we implement the method for
|
298
|
+
# compatibility purposes and leave it undocumented (and don't support)
|
299
|
+
# overriding it)
|
300
|
+
def double_check_for(*); end
|
301
|
+
end
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
module Plugin
|
5
|
+
# Dsl to parse the Gemfile looking for plugins to install
|
6
|
+
class DSL < Bundler::Dsl
|
7
|
+
class PluginGemfileError < PluginError; end
|
8
|
+
alias_method :_gem, :gem # To use for plugin installation as gem
|
9
|
+
|
10
|
+
# So that we don't have to override all there methods to dummy ones
|
11
|
+
# explicitly.
|
12
|
+
# They will be handled by method_missing
|
13
|
+
[:gemspec, :gem, :install_if, :platforms, :env].each {|m| undef_method m }
|
14
|
+
|
15
|
+
# This lists the plugins that was added automatically and not specified by
|
16
|
+
# the user.
|
17
|
+
#
|
18
|
+
# When we encounter :type attribute with a source block, we add a plugin
|
19
|
+
# by name bundler-source-<type> to list of plugins to be installed.
|
20
|
+
#
|
21
|
+
# These plugins are optional and are not installed when there is conflict
|
22
|
+
# with any other plugin.
|
23
|
+
attr_reader :inferred_plugins
|
24
|
+
|
25
|
+
def initialize
|
26
|
+
super
|
27
|
+
@sources = Plugin::SourceList.new
|
28
|
+
@inferred_plugins = [] # The source plugins inferred from :type
|
29
|
+
end
|
30
|
+
|
31
|
+
def plugin(name, *args)
|
32
|
+
_gem(name, *args)
|
33
|
+
end
|
34
|
+
|
35
|
+
def method_missing(name, *args)
|
36
|
+
raise PluginGemfileError, "Undefined local variable or method `#{name}' for Gemfile" unless Bundler::Dsl.method_defined? name
|
37
|
+
end
|
38
|
+
|
39
|
+
def source(source, *args, &blk)
|
40
|
+
options = args.last.is_a?(Hash) ? args.pop.dup : {}
|
41
|
+
options = normalize_hash(options)
|
42
|
+
return super unless options.key?("type")
|
43
|
+
|
44
|
+
plugin_name = "bundler-source-#{options["type"]}"
|
45
|
+
|
46
|
+
return if @dependencies.any? {|d| d.name == plugin_name }
|
47
|
+
|
48
|
+
plugin(plugin_name)
|
49
|
+
@inferred_plugins << plugin_name
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
module Plugin
|
5
|
+
module Events
|
6
|
+
def self.define(const, event)
|
7
|
+
const = const.to_sym.freeze
|
8
|
+
if const_defined?(const) && const_get(const) != event
|
9
|
+
raise ArgumentError, "Attempting to reassign #{const} to a different value"
|
10
|
+
end
|
11
|
+
const_set(const, event) unless const_defined?(const)
|
12
|
+
@events ||= {}
|
13
|
+
@events[event] = const
|
14
|
+
end
|
15
|
+
private_class_method :define
|
16
|
+
|
17
|
+
def self.reset
|
18
|
+
@events.each_value do |const|
|
19
|
+
remove_const(const)
|
20
|
+
end
|
21
|
+
@events = nil
|
22
|
+
end
|
23
|
+
private_class_method :reset
|
24
|
+
|
25
|
+
# Check if an event has been defined
|
26
|
+
# @param event [String] An event to check
|
27
|
+
# @return [Boolean] A boolean indicating if the event has been defined
|
28
|
+
def self.defined_event?(event)
|
29
|
+
@events ||= {}
|
30
|
+
@events.key?(event)
|
31
|
+
end
|
32
|
+
|
33
|
+
# @!parse
|
34
|
+
# A hook called before each individual gem is installed
|
35
|
+
# Includes a Bundler::ParallelInstaller::SpecInstallation.
|
36
|
+
# No state, error, post_install_message will be present as nothing has installed yet
|
37
|
+
# GEM_BEFORE_INSTALL = "before-install"
|
38
|
+
define :GEM_BEFORE_INSTALL, "before-install"
|
39
|
+
|
40
|
+
# @!parse
|
41
|
+
# A hook called after each individual gem is installed
|
42
|
+
# Includes a Bundler::ParallelInstaller::SpecInstallation.
|
43
|
+
# - If state is failed, an error will be present.
|
44
|
+
# - If state is success, a post_install_message may be present.
|
45
|
+
# GEM_AFTER_INSTALL = "after-install"
|
46
|
+
define :GEM_AFTER_INSTALL, "after-install"
|
47
|
+
|
48
|
+
# @!parse
|
49
|
+
# A hook called before any gems install
|
50
|
+
# Includes an Array of Bundler::Dependency objects
|
51
|
+
# GEM_BEFORE_INSTALL_ALL = "before-install-all"
|
52
|
+
define :GEM_BEFORE_INSTALL_ALL, "before-install-all"
|
53
|
+
|
54
|
+
# @!parse
|
55
|
+
# A hook called after any gems install
|
56
|
+
# Includes an Array of Bundler::Dependency objects
|
57
|
+
# GEM_AFTER_INSTALL_ALL = "after-install-all"
|
58
|
+
define :GEM_AFTER_INSTALL_ALL, "after-install-all"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|