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,182 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
# Manages which plugins are installed and their sources. This also is supposed to map
|
5
|
+
# which plugin does what (currently the features are not implemented so this class is
|
6
|
+
# now a stub class).
|
7
|
+
module Plugin
|
8
|
+
class Index
|
9
|
+
class CommandConflict < PluginError
|
10
|
+
def initialize(plugin, commands)
|
11
|
+
msg = "Command(s) `#{commands.join("`, `")}` declared by #{plugin} are already registered."
|
12
|
+
super msg
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class SourceConflict < PluginError
|
17
|
+
def initialize(plugin, sources)
|
18
|
+
msg = "Source(s) `#{sources.join("`, `")}` declared by #{plugin} are already registered."
|
19
|
+
super msg
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
attr_reader :commands
|
24
|
+
|
25
|
+
def initialize
|
26
|
+
@plugin_paths = {}
|
27
|
+
@commands = {}
|
28
|
+
@sources = {}
|
29
|
+
@hooks = {}
|
30
|
+
@load_paths = {}
|
31
|
+
|
32
|
+
begin
|
33
|
+
load_index(global_index_file, true)
|
34
|
+
rescue GenericSystemCallError
|
35
|
+
# no need to fail when on a read-only FS, for example
|
36
|
+
nil
|
37
|
+
end
|
38
|
+
load_index(local_index_file) if SharedHelpers.in_bundle?
|
39
|
+
end
|
40
|
+
|
41
|
+
# This function is to be called when a new plugin is installed. This
|
42
|
+
# function shall add the functions of the plugin to existing maps and also
|
43
|
+
# the name to source location.
|
44
|
+
#
|
45
|
+
# @param [String] name of the plugin to be registered
|
46
|
+
# @param [String] path where the plugin is installed
|
47
|
+
# @param [Array<String>] load_paths for the plugin
|
48
|
+
# @param [Array<String>] commands that are handled by the plugin
|
49
|
+
# @param [Array<String>] sources that are handled by the plugin
|
50
|
+
def register_plugin(name, path, load_paths, commands, sources, hooks)
|
51
|
+
old_commands = @commands.dup
|
52
|
+
|
53
|
+
common = commands & @commands.keys
|
54
|
+
raise CommandConflict.new(name, common) unless common.empty?
|
55
|
+
commands.each {|c| @commands[c] = name }
|
56
|
+
|
57
|
+
common = sources & @sources.keys
|
58
|
+
raise SourceConflict.new(name, common) unless common.empty?
|
59
|
+
sources.each {|k| @sources[k] = name }
|
60
|
+
|
61
|
+
hooks.each do |event|
|
62
|
+
event_hooks = (@hooks[event] ||= []) << name
|
63
|
+
event_hooks.uniq!
|
64
|
+
end
|
65
|
+
|
66
|
+
@plugin_paths[name] = path
|
67
|
+
@load_paths[name] = load_paths
|
68
|
+
save_index
|
69
|
+
rescue StandardError
|
70
|
+
@commands = old_commands
|
71
|
+
raise
|
72
|
+
end
|
73
|
+
|
74
|
+
def unregister_plugin(name)
|
75
|
+
@commands.delete_if {|_, v| v == name }
|
76
|
+
@sources.delete_if {|_, v| v == name }
|
77
|
+
@hooks.each {|_, plugin_names| plugin_names.delete(name) }
|
78
|
+
@plugin_paths.delete(name)
|
79
|
+
@load_paths.delete(name)
|
80
|
+
save_index
|
81
|
+
end
|
82
|
+
|
83
|
+
# Path of default index file
|
84
|
+
def index_file
|
85
|
+
Plugin.root.join("index")
|
86
|
+
end
|
87
|
+
|
88
|
+
# Path where the global index file is stored
|
89
|
+
def global_index_file
|
90
|
+
Plugin.global_root.join("index")
|
91
|
+
end
|
92
|
+
|
93
|
+
# Path where the local index file is stored
|
94
|
+
def local_index_file
|
95
|
+
Plugin.local_root.join("index")
|
96
|
+
end
|
97
|
+
|
98
|
+
def plugin_path(name)
|
99
|
+
Pathname.new @plugin_paths[name]
|
100
|
+
end
|
101
|
+
|
102
|
+
def load_paths(name)
|
103
|
+
@load_paths[name]
|
104
|
+
end
|
105
|
+
|
106
|
+
# Fetch the name of plugin handling the command
|
107
|
+
def command_plugin(command)
|
108
|
+
@commands[command]
|
109
|
+
end
|
110
|
+
|
111
|
+
def installed?(name)
|
112
|
+
@plugin_paths[name]
|
113
|
+
end
|
114
|
+
|
115
|
+
def installed_plugins
|
116
|
+
@plugin_paths.keys
|
117
|
+
end
|
118
|
+
|
119
|
+
def plugin_commands(plugin)
|
120
|
+
@commands.find_all {|_, n| n == plugin }.map(&:first)
|
121
|
+
end
|
122
|
+
|
123
|
+
def source?(source)
|
124
|
+
@sources.key? source
|
125
|
+
end
|
126
|
+
|
127
|
+
def source_plugin(name)
|
128
|
+
@sources[name]
|
129
|
+
end
|
130
|
+
|
131
|
+
# Returns the list of plugin names handling the passed event
|
132
|
+
def hook_plugins(event)
|
133
|
+
@hooks[event] || []
|
134
|
+
end
|
135
|
+
|
136
|
+
private
|
137
|
+
|
138
|
+
# Reads the index file from the directory and initializes the instance
|
139
|
+
# variables.
|
140
|
+
#
|
141
|
+
# It skips the sources if the second param is true
|
142
|
+
# @param [Pathname] index file path
|
143
|
+
# @param [Boolean] is the index file global index
|
144
|
+
def load_index(index_file, global = false)
|
145
|
+
SharedHelpers.filesystem_access(index_file, :read) do |index_f|
|
146
|
+
valid_file = index_f && index_f.exist? && !index_f.size.zero?
|
147
|
+
break unless valid_file
|
148
|
+
|
149
|
+
data = index_f.read
|
150
|
+
|
151
|
+
require_relative "../yaml_serializer"
|
152
|
+
index = YAMLSerializer.load(data)
|
153
|
+
|
154
|
+
@commands.merge!(index["commands"])
|
155
|
+
@hooks.merge!(index["hooks"])
|
156
|
+
@load_paths.merge!(index["load_paths"])
|
157
|
+
@plugin_paths.merge!(index["plugin_paths"])
|
158
|
+
@sources.merge!(index["sources"]) unless global
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
# Should be called when any of the instance variables change. Stores the
|
163
|
+
# instance variables in YAML format. (The instance variables are supposed
|
164
|
+
# to be only String key value pairs)
|
165
|
+
def save_index
|
166
|
+
index = {
|
167
|
+
"commands" => @commands,
|
168
|
+
"hooks" => @hooks,
|
169
|
+
"load_paths" => @load_paths,
|
170
|
+
"plugin_paths" => @plugin_paths,
|
171
|
+
"sources" => @sources,
|
172
|
+
}
|
173
|
+
|
174
|
+
require_relative "../yaml_serializer"
|
175
|
+
SharedHelpers.filesystem_access(index_file) do |index_f|
|
176
|
+
FileUtils.mkdir_p(index_f.dirname)
|
177
|
+
File.open(index_f, "w") {|f| f.puts YAMLSerializer.dump(index) }
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
# Handles the installation of plugin in appropriate directories.
|
5
|
+
#
|
6
|
+
# This class is supposed to be wrapper over the existing gem installation infra
|
7
|
+
# but currently it itself handles everything as the Source's subclasses (e.g. Source::RubyGems)
|
8
|
+
# are heavily dependent on the Gemfile.
|
9
|
+
module Plugin
|
10
|
+
class Installer
|
11
|
+
autoload :Rubygems, File.expand_path("installer/rubygems", __dir__)
|
12
|
+
autoload :Git, File.expand_path("installer/git", __dir__)
|
13
|
+
|
14
|
+
def install(names, options)
|
15
|
+
check_sources_consistency!(options)
|
16
|
+
|
17
|
+
version = options[:version] || [">= 0"]
|
18
|
+
|
19
|
+
Bundler.settings.temporary(:disable_multisource => false) do
|
20
|
+
if options[:git]
|
21
|
+
install_git(names, version, options)
|
22
|
+
elsif options[:local_git]
|
23
|
+
install_local_git(names, version, options)
|
24
|
+
else
|
25
|
+
sources = options[:source] || Bundler.rubygems.sources
|
26
|
+
install_rubygems(names, version, sources)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Installs the plugin from Definition object created by limited parsing of
|
32
|
+
# Gemfile searching for plugins to be installed
|
33
|
+
#
|
34
|
+
# @param [Definition] definition object
|
35
|
+
# @return [Hash] map of names to their specs they are installed with
|
36
|
+
def install_definition(definition)
|
37
|
+
def definition.lock(*); end
|
38
|
+
definition.resolve_remotely!
|
39
|
+
specs = definition.specs
|
40
|
+
|
41
|
+
install_from_specs specs
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def check_sources_consistency!(options)
|
47
|
+
if options.key?(:git) && options.key?(:local_git)
|
48
|
+
raise InvalidOption, "Remote and local plugin git sources can't be both specified"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def install_git(names, version, options)
|
53
|
+
uri = options.delete(:git)
|
54
|
+
options["uri"] = uri
|
55
|
+
|
56
|
+
install_all_sources(names, version, options, options[:source])
|
57
|
+
end
|
58
|
+
|
59
|
+
def install_local_git(names, version, options)
|
60
|
+
uri = options.delete(:local_git)
|
61
|
+
options["uri"] = uri
|
62
|
+
|
63
|
+
install_all_sources(names, version, options, options[:source])
|
64
|
+
end
|
65
|
+
|
66
|
+
# Installs the plugin from rubygems source and returns the path where the
|
67
|
+
# plugin was installed
|
68
|
+
#
|
69
|
+
# @param [String] name of the plugin gem to search in the source
|
70
|
+
# @param [Array] version of the gem to install
|
71
|
+
# @param [String, Array<String>] source(s) to resolve the gem
|
72
|
+
#
|
73
|
+
# @return [Hash] map of names to the specs of plugins installed
|
74
|
+
def install_rubygems(names, version, sources)
|
75
|
+
install_all_sources(names, version, nil, sources)
|
76
|
+
end
|
77
|
+
|
78
|
+
def install_all_sources(names, version, git_source_options, rubygems_source)
|
79
|
+
source_list = SourceList.new
|
80
|
+
|
81
|
+
source_list.add_git_source(git_source_options) if git_source_options
|
82
|
+
source_list.add_rubygems_source("remotes" => rubygems_source) if rubygems_source
|
83
|
+
|
84
|
+
deps = names.map {|name| Dependency.new name, version }
|
85
|
+
|
86
|
+
definition = Definition.new(nil, deps, source_list, true)
|
87
|
+
install_definition(definition)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Installs the plugins and deps from the provided specs and returns map of
|
91
|
+
# gems to their paths
|
92
|
+
#
|
93
|
+
# @param specs to install
|
94
|
+
#
|
95
|
+
# @return [Hash] map of names to the specs
|
96
|
+
def install_from_specs(specs)
|
97
|
+
paths = {}
|
98
|
+
|
99
|
+
specs.each do |spec|
|
100
|
+
spec.source.install spec
|
101
|
+
|
102
|
+
paths[spec.name] = spec
|
103
|
+
end
|
104
|
+
|
105
|
+
paths
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
module Plugin
|
5
|
+
class Installer
|
6
|
+
class Git < Bundler::Source::Git
|
7
|
+
def cache_path
|
8
|
+
@cache_path ||= begin
|
9
|
+
git_scope = "#{base_name}-#{uri_hash}"
|
10
|
+
|
11
|
+
Plugin.cache.join("bundler", "git", git_scope)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def install_path
|
16
|
+
@install_path ||= begin
|
17
|
+
git_scope = "#{base_name}-#{shortref_for_path(revision)}"
|
18
|
+
|
19
|
+
Plugin.root.join("bundler", "gems", git_scope)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def version_message(spec)
|
24
|
+
"#{spec.name} #{spec.version}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def root
|
28
|
+
Plugin.root
|
29
|
+
end
|
30
|
+
|
31
|
+
def generate_bin(spec, disable_extensions = false)
|
32
|
+
# Need to find a way without code duplication
|
33
|
+
# For now, we can ignore this
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
module Plugin
|
5
|
+
class Installer
|
6
|
+
class Rubygems < Bundler::Source::Rubygems
|
7
|
+
def version_message(spec)
|
8
|
+
"#{spec.name} #{spec.version}"
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def requires_sudo?
|
14
|
+
false # Will change on implementation of project level plugins
|
15
|
+
end
|
16
|
+
|
17
|
+
def rubygems_dir
|
18
|
+
Plugin.root
|
19
|
+
end
|
20
|
+
|
21
|
+
def cache_path
|
22
|
+
Plugin.cache
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
# SourceList object to be used while parsing the Gemfile, setting the
|
5
|
+
# approptiate options to be used with Source classes for plugin installation
|
6
|
+
module Plugin
|
7
|
+
class SourceList < Bundler::SourceList
|
8
|
+
def add_git_source(options = {})
|
9
|
+
add_source_to_list Plugin::Installer::Git.new(options), git_sources
|
10
|
+
end
|
11
|
+
|
12
|
+
def add_rubygems_source(options = {})
|
13
|
+
add_source_to_list Plugin::Installer::Rubygems.new(options), @rubygems_sources
|
14
|
+
end
|
15
|
+
|
16
|
+
def all_sources
|
17
|
+
path_sources + git_sources + rubygems_sources + [metadata_source]
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def rubygems_aggregate_class
|
23
|
+
Plugin::Installer::Rubygems
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
class ProcessLock
|
5
|
+
def self.lock(bundle_path = Bundler.bundle_path)
|
6
|
+
lock_file_path = File.join(bundle_path, "bundler.lock")
|
7
|
+
has_lock = false
|
8
|
+
|
9
|
+
File.open(lock_file_path, "w") do |f|
|
10
|
+
f.flock(File::LOCK_EX)
|
11
|
+
has_lock = true
|
12
|
+
yield
|
13
|
+
f.flock(File::LOCK_UN)
|
14
|
+
end
|
15
|
+
rescue Errno::EACCES, Errno::ENOLCK, *[SharedHelpers.const_get_safely(:ENOTSUP, Errno)].compact
|
16
|
+
# In the case the user does not have access to
|
17
|
+
# create the lock file or is using NFS where
|
18
|
+
# locks are not available we skip locking.
|
19
|
+
yield
|
20
|
+
ensure
|
21
|
+
FileUtils.rm_f(lock_file_path) if has_lock
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/bundler/psyched_yaml.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
|
-
#
|
2
|
-
begin
|
3
|
-
gem "psych"
|
4
|
-
rescue LoadError
|
5
|
-
end if defined?(gem)
|
1
|
+
# frozen_string_literal: true
|
6
2
|
|
7
|
-
# Psych could
|
3
|
+
# Psych could be in the stdlib
|
8
4
|
# but it's too late if Syck is already loaded
|
9
5
|
begin
|
10
6
|
require "psych" unless defined?(Syck)
|
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
require "rubygems/spec_fetcher"
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
3
|
module Bundler
|
5
4
|
# Represents a lazily loaded gem specification, where the full specification
|
@@ -11,13 +10,15 @@ module Bundler
|
|
11
10
|
include Comparable
|
12
11
|
|
13
12
|
attr_reader :name, :version, :platform
|
13
|
+
attr_writer :dependencies
|
14
14
|
attr_accessor :source, :remote
|
15
15
|
|
16
16
|
def initialize(name, version, platform, spec_fetcher)
|
17
17
|
@name = name
|
18
|
-
@version = version
|
18
|
+
@version = Gem::Version.create version
|
19
19
|
@platform = platform
|
20
20
|
@spec_fetcher = spec_fetcher
|
21
|
+
@dependencies = nil
|
21
22
|
end
|
22
23
|
|
23
24
|
# Needed before installs, since the arch matters then and quick
|
@@ -49,6 +50,9 @@ module Bundler
|
|
49
50
|
# once the remote gem is downloaded, the backend specification will
|
50
51
|
# be swapped out.
|
51
52
|
def __swap__(spec)
|
53
|
+
raise APIResponseInvalidDependenciesError unless spec.dependencies.all? {|d| d.is_a?(Gem::Dependency) }
|
54
|
+
|
55
|
+
SharedHelpers.ensure_same_dependencies(self, dependencies, spec.dependencies)
|
52
56
|
@_remote_specification = spec
|
53
57
|
end
|
54
58
|
|
@@ -65,18 +69,47 @@ module Bundler
|
|
65
69
|
[@name, @version, @platform == Gem::Platform::RUBY ? -1 : 1]
|
66
70
|
end
|
67
71
|
|
68
|
-
|
72
|
+
def to_s
|
73
|
+
"#<#{self.class} name=#{name} version=#{version} platform=#{platform}>"
|
74
|
+
end
|
75
|
+
|
76
|
+
def dependencies
|
77
|
+
@dependencies ||= begin
|
78
|
+
deps = method_missing(:dependencies)
|
79
|
+
|
80
|
+
# allow us to handle when the specs dependencies are an array of array of string
|
81
|
+
# in order to delay the crash to `#__swap__` where it results in a friendlier error
|
82
|
+
# see https://github.com/rubygems/bundler/issues/5797
|
83
|
+
deps = deps.map {|d| d.is_a?(Gem::Dependency) ? d : Gem::Dependency.new(*d) }
|
84
|
+
|
85
|
+
deps
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def git_version
|
90
|
+
return unless loaded_from && source.is_a?(Bundler::Source::Git)
|
91
|
+
" #{source.revision[0..6]}"
|
92
|
+
end
|
93
|
+
|
94
|
+
private
|
95
|
+
|
96
|
+
def to_ary
|
97
|
+
nil
|
98
|
+
end
|
69
99
|
|
70
100
|
def _remote_specification
|
71
101
|
@_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @platform])
|
102
|
+
@_remote_specification || raise(GemspecError, "Gemspec data for #{full_name} was" \
|
103
|
+
" missing from the server! Try installing with `--full-index` as a workaround.")
|
72
104
|
end
|
73
105
|
|
74
106
|
def method_missing(method, *args, &blk)
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
107
|
+
_remote_specification.send(method, *args, &blk)
|
108
|
+
end
|
109
|
+
|
110
|
+
def respond_to?(method, include_all = false)
|
111
|
+
super || _remote_specification.respond_to?(method, include_all)
|
80
112
|
end
|
113
|
+
public :respond_to?
|
81
114
|
end
|
82
115
|
end
|