rubygems-update 2.6.4 → 2.6.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +18 -24
- data/CODE_OF_CONDUCT.md +2 -2
- data/CONTRIBUTING.rdoc +1 -1
- data/History.txt +30 -1
- data/Manifest.txt +233 -3
- data/Rakefile +30 -1
- data/appveyor.yml +0 -2
- data/bundler/CHANGELOG.md +2407 -0
- data/bundler/CODE_OF_CONDUCT.md +42 -0
- data/bundler/CONTRIBUTING.md +36 -0
- data/bundler/DEVELOPMENT.md +148 -0
- data/bundler/ISSUES.md +100 -0
- data/bundler/LICENSE.md +23 -0
- data/bundler/README.md +40 -0
- data/bundler/exe/bundle +35 -0
- data/bundler/exe/bundle_ruby +61 -0
- data/bundler/exe/bundler +22 -0
- data/bundler/lib/bundler.rb +455 -0
- data/bundler/lib/bundler/capistrano.rb +17 -0
- data/bundler/lib/bundler/cli.rb +497 -0
- data/bundler/lib/bundler/cli/binstubs.rb +40 -0
- data/bundler/lib/bundler/cli/cache.rb +35 -0
- data/bundler/lib/bundler/cli/check.rb +40 -0
- data/bundler/lib/bundler/cli/clean.rb +26 -0
- data/bundler/lib/bundler/cli/common.rb +56 -0
- data/bundler/lib/bundler/cli/config.rb +100 -0
- data/bundler/lib/bundler/cli/console.rb +39 -0
- data/bundler/lib/bundler/cli/exec.rb +82 -0
- data/bundler/lib/bundler/cli/gem.rb +214 -0
- data/bundler/lib/bundler/cli/init.rb +33 -0
- data/bundler/lib/bundler/cli/inject.rb +33 -0
- data/bundler/lib/bundler/cli/install.rb +225 -0
- data/bundler/lib/bundler/cli/lock.rb +48 -0
- data/bundler/lib/bundler/cli/open.rb +25 -0
- data/bundler/lib/bundler/cli/outdated.rb +151 -0
- data/bundler/lib/bundler/cli/package.rb +46 -0
- data/bundler/lib/bundler/cli/platform.rb +45 -0
- data/bundler/lib/bundler/cli/plugin.rb +23 -0
- data/bundler/lib/bundler/cli/show.rb +75 -0
- data/bundler/lib/bundler/cli/update.rb +72 -0
- data/bundler/lib/bundler/cli/viz.rb +27 -0
- data/bundler/lib/bundler/constants.rb +6 -0
- data/bundler/lib/bundler/current_ruby.rb +84 -0
- data/bundler/lib/bundler/definition.rb +744 -0
- data/bundler/lib/bundler/dep_proxy.rb +46 -0
- data/bundler/lib/bundler/dependency.rb +127 -0
- data/bundler/lib/bundler/deployment.rb +63 -0
- data/bundler/lib/bundler/deprecate.rb +16 -0
- data/bundler/lib/bundler/dsl.rb +512 -0
- data/bundler/lib/bundler/endpoint_specification.rb +129 -0
- data/bundler/lib/bundler/env.rb +83 -0
- data/bundler/lib/bundler/environment.rb +42 -0
- data/bundler/lib/bundler/environment_preserver.rb +38 -0
- data/bundler/lib/bundler/errors.rb +124 -0
- data/bundler/lib/bundler/fetcher.rb +304 -0
- data/bundler/lib/bundler/fetcher/base.rb +41 -0
- data/bundler/lib/bundler/fetcher/compact_index.rb +103 -0
- data/bundler/lib/bundler/fetcher/dependency.rb +92 -0
- data/bundler/lib/bundler/fetcher/downloader.rb +66 -0
- data/bundler/lib/bundler/fetcher/index.rb +51 -0
- data/bundler/lib/bundler/friendly_errors.rb +103 -0
- data/bundler/lib/bundler/gem_helper.rb +188 -0
- data/bundler/lib/bundler/gem_helpers.rb +32 -0
- data/bundler/lib/bundler/gem_remote_fetcher.rb +42 -0
- data/bundler/lib/bundler/gem_tasks.rb +6 -0
- data/bundler/lib/bundler/graph.rb +172 -0
- data/bundler/lib/bundler/index.rb +191 -0
- data/bundler/lib/bundler/injector.rb +63 -0
- data/bundler/lib/bundler/inline.rb +74 -0
- data/bundler/lib/bundler/installer.rb +217 -0
- data/bundler/lib/bundler/installer/gem_installer.rb +77 -0
- data/bundler/lib/bundler/installer/parallel_installer.rb +126 -0
- data/bundler/lib/bundler/installer/standalone.rb +52 -0
- data/bundler/lib/bundler/lazy_specification.rb +85 -0
- data/bundler/lib/bundler/lockfile_parser.rb +233 -0
- data/bundler/lib/bundler/match_platform.rb +14 -0
- data/bundler/lib/bundler/mirror.rb +218 -0
- data/bundler/lib/bundler/plugin.rb +156 -0
- data/bundler/lib/bundler/plugin/api.rb +56 -0
- data/bundler/lib/bundler/plugin/dsl.rb +29 -0
- data/bundler/lib/bundler/plugin/index.rb +88 -0
- data/bundler/lib/bundler/plugin/installer.rb +99 -0
- data/bundler/lib/bundler/plugin/installer/git.rb +38 -0
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +27 -0
- data/bundler/lib/bundler/plugin/source_list.rb +24 -0
- data/bundler/lib/bundler/postit_trampoline.rb +57 -0
- data/bundler/lib/bundler/psyched_yaml.rb +27 -0
- data/bundler/lib/bundler/remote_specification.rb +85 -0
- data/bundler/lib/bundler/resolver.rb +368 -0
- data/bundler/lib/bundler/retry.rb +61 -0
- data/bundler/lib/bundler/ruby_dsl.rb +17 -0
- data/bundler/lib/bundler/ruby_version.rb +140 -0
- data/bundler/lib/bundler/rubygems_ext.rb +178 -0
- data/bundler/lib/bundler/rubygems_gem_installer.rb +10 -0
- data/bundler/lib/bundler/rubygems_integration.rb +710 -0
- data/bundler/lib/bundler/runtime.rb +282 -0
- data/bundler/lib/bundler/settings.rb +259 -0
- data/bundler/lib/bundler/setup.rb +28 -0
- data/bundler/lib/bundler/shared_helpers.rb +212 -0
- data/bundler/lib/bundler/similarity_detector.rb +62 -0
- data/bundler/lib/bundler/source.rb +37 -0
- data/bundler/lib/bundler/source/gemspec.rb +13 -0
- data/bundler/lib/bundler/source/git.rb +297 -0
- data/bundler/lib/bundler/source/git/git_proxy.rb +218 -0
- data/bundler/lib/bundler/source/path.rb +245 -0
- data/bundler/lib/bundler/source/path/installer.rb +44 -0
- data/bundler/lib/bundler/source/rubygems.rb +450 -0
- data/bundler/lib/bundler/source/rubygems/remote.rb +59 -0
- data/bundler/lib/bundler/source_list.rb +106 -0
- data/bundler/lib/bundler/spec_set.rb +157 -0
- data/bundler/lib/bundler/ssl_certs/.document +1 -0
- data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +65 -0
- data/bundler/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
- data/bundler/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +23 -0
- data/{lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot-2048.pem → bundler/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem} +0 -0
- data/bundler/lib/bundler/stub_specification.rb +24 -0
- data/bundler/lib/bundler/templates/Executable +17 -0
- data/bundler/lib/bundler/templates/Executable.standalone +12 -0
- data/bundler/lib/bundler/templates/Gemfile +5 -0
- data/bundler/lib/bundler/templates/newgem/.travis.yml.tt +5 -0
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +74 -0
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/bundler/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
- data/bundler/lib/bundler/templates/newgem/README.md.tt +41 -0
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +29 -0
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +14 -0
- data/bundler/lib/bundler/templates/newgem/bin/setup.tt +8 -0
- data/bundler/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/gitignore.tt +16 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +46 -0
- data/bundler/lib/bundler/templates/newgem/rspec.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
- data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/test/newgem_test.rb.tt +11 -0
- data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +4 -0
- data/bundler/lib/bundler/ui.rb +8 -0
- data/bundler/lib/bundler/ui/rg_proxy.rb +18 -0
- data/bundler/lib/bundler/ui/shell.rb +114 -0
- data/bundler/lib/bundler/ui/silent.rb +48 -0
- data/bundler/lib/bundler/uri_credentials_filter.rb +36 -0
- data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +79 -0
- data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +98 -0
- data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +80 -0
- data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +4 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +10 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +50 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +80 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +203 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +35 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +58 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +61 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +53 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +114 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +45 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +35 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +123 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +75 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +5 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +100 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +65 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +460 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +45 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +54 -0
- data/bundler/lib/bundler/vendor/net/http/faster.rb +26 -0
- data/bundler/lib/bundler/vendor/net/http/persistent.rb +1230 -0
- data/bundler/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +128 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit.rb +15 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit/environment.rb +44 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit/installer.rb +28 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit/parser.rb +21 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit/setup.rb +12 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit/version.rb +3 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +484 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +319 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +103 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +59 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +118 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +135 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +316 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +107 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +656 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +133 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +77 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +10 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +98 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +32 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +281 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +178 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +35 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +73 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +175 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +125 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +218 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +71 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +322 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +421 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +149 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +126 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +267 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
- data/bundler/lib/bundler/vendored_molinillo.rb +3 -0
- data/bundler/lib/bundler/vendored_persistent.rb +12 -0
- data/bundler/lib/bundler/vendored_thor.rb +4 -0
- data/bundler/lib/bundler/version.rb +11 -0
- data/bundler/lib/bundler/vlad.rb +12 -0
- data/bundler/lib/bundler/worker.rb +82 -0
- data/bundler/lib/bundler/yaml_serializer.rb +67 -0
- data/bundler/man/bundle-config.ronn +193 -0
- data/bundler/man/bundle-exec.ronn +136 -0
- data/bundler/man/bundle-gem.ronn +77 -0
- data/bundler/man/bundle-install.ronn +404 -0
- data/bundler/man/bundle-lock.ronn +47 -0
- data/bundler/man/bundle-package.ronn +67 -0
- data/bundler/man/bundle-platform.ronn +42 -0
- data/bundler/man/bundle-update.ronn +194 -0
- data/bundler/man/bundle.ronn +98 -0
- data/bundler/man/gemfile.5.ronn +499 -0
- data/bundler/man/index.txt +8 -0
- data/lib/rubygems.rb +42 -2
- data/lib/rubygems/config_file.rb +1 -1
- data/lib/rubygems/defaults.rb +18 -0
- data/lib/rubygems/installer.rb +1 -0
- data/lib/rubygems/package.rb +3 -1
- data/lib/rubygems/package/tar_writer.rb +10 -16
- data/lib/rubygems/remote_fetcher.rb +1 -15
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +50 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +80 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +57 -145
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +35 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +58 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +61 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +53 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +114 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +45 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +35 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +123 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +1 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +55 -54
- data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +4 -2
- data/lib/rubygems/security/signer.rb +2 -0
- data/lib/rubygems/specification.rb +4 -4
- data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +25 -0
- data/test/rubygems/alternate_cert.pem +10 -9
- data/test/rubygems/alternate_cert_32.pem +10 -9
- data/test/rubygems/child_cert.pem +11 -9
- data/test/rubygems/child_cert_32.pem +11 -9
- data/test/rubygems/encrypted_private_key.pem +26 -26
- data/test/rubygems/expired_cert.pem +9 -8
- data/test/rubygems/future_cert.pem +9 -8
- data/test/rubygems/future_cert_32.pem +9 -8
- data/test/rubygems/grandchild_cert.pem +11 -9
- data/test/rubygems/grandchild_cert_32.pem +11 -9
- data/test/rubygems/invalid_issuer_cert.pem +11 -9
- data/test/rubygems/invalid_issuer_cert_32.pem +11 -9
- data/test/rubygems/invalid_signer_cert.pem +10 -9
- data/test/rubygems/invalid_signer_cert_32.pem +10 -9
- data/test/rubygems/invalidchild_cert.pem +11 -9
- data/test/rubygems/invalidchild_cert_32.pem +11 -9
- data/test/rubygems/public_cert.pem +11 -9
- data/test/rubygems/public_cert_32.pem +10 -9
- data/test/rubygems/test_bundled_ca.rb +1 -1
- data/test/rubygems/test_gem.rb +7 -0
- data/test/rubygems/test_gem_installer.rb +119 -0
- data/test/rubygems/test_gem_package.rb +9 -3
- data/test/rubygems/test_gem_package_tar_writer.rb +24 -0
- data/test/rubygems/test_gem_remote_fetcher.rb +0 -12
- data/test/rubygems/test_gem_security_signer.rb +8 -0
- data/test/rubygems/test_gem_specification.rb +1 -1
- data/test/rubygems/wrong_key_cert.pem +10 -9
- data/test/rubygems/wrong_key_cert_32.pem +10 -9
- data/util/ci +73 -0
- data/util/create_certs.rb +64 -49
- data/util/update_bundled_ca_certificates.rb +23 -2
- metadata +257 -19
- data/lib/gauntlet_rubygems.rb +0 -51
- data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRoot.pem +0 -18
@@ -0,0 +1,156 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
module Plugin
|
5
|
+
autoload :API, "bundler/plugin/api"
|
6
|
+
autoload :DSL, "bundler/plugin/dsl"
|
7
|
+
autoload :Index, "bundler/plugin/index"
|
8
|
+
autoload :Installer, "bundler/plugin/installer"
|
9
|
+
autoload :SourceList, "bundler/plugin/source_list"
|
10
|
+
|
11
|
+
class MalformattedPlugin < PluginError; end
|
12
|
+
class UndefinedCommandError < PluginError; end
|
13
|
+
|
14
|
+
PLUGIN_FILE_NAME = "plugins.rb".freeze
|
15
|
+
|
16
|
+
module_function
|
17
|
+
|
18
|
+
@commands = {}
|
19
|
+
|
20
|
+
# Installs a new plugin by the given name
|
21
|
+
#
|
22
|
+
# @param [Array<String>] names the name of plugin to be installed
|
23
|
+
# @param [Hash] options various parameters as described in description
|
24
|
+
# @option options [String] :source rubygems source to fetch the plugin gem from
|
25
|
+
# @option options [String] :version (optional) the version of the plugin to install
|
26
|
+
def install(names, options)
|
27
|
+
paths = Installer.new.install(names, options)
|
28
|
+
|
29
|
+
save_plugins paths
|
30
|
+
rescue PluginError => e
|
31
|
+
paths.values.map {|path| Bundler.rm_rf(path) } if paths
|
32
|
+
Bundler.ui.error "Failed to install plugin #{name}: #{e.message}\n #{e.backtrace.join("\n ")}"
|
33
|
+
end
|
34
|
+
|
35
|
+
# Evaluates the Gemfile with a limited DSL and installs the plugins
|
36
|
+
# specified by plugin method
|
37
|
+
#
|
38
|
+
# @param [Pathname] gemfile path
|
39
|
+
def gemfile_install(gemfile = nil, &inline)
|
40
|
+
if block_given?
|
41
|
+
builder = DSL.new
|
42
|
+
builder.instance_eval(&inline)
|
43
|
+
definition = builder.to_definition(nil, true)
|
44
|
+
else
|
45
|
+
definition = DSL.evaluate(gemfile, nil, {})
|
46
|
+
end
|
47
|
+
return unless definition.dependencies.any?
|
48
|
+
|
49
|
+
plugins = Installer.new.install_definition(definition)
|
50
|
+
|
51
|
+
save_plugins plugins
|
52
|
+
end
|
53
|
+
|
54
|
+
# The index object used to store the details about the plugin
|
55
|
+
def index
|
56
|
+
@index ||= Index.new
|
57
|
+
end
|
58
|
+
|
59
|
+
# The directory root to all plugin related data
|
60
|
+
def root
|
61
|
+
@root ||= Bundler.user_bundle_path.join("plugin")
|
62
|
+
end
|
63
|
+
|
64
|
+
# The cache directory for plugin stuffs
|
65
|
+
def cache
|
66
|
+
@cache ||= root.join("cache")
|
67
|
+
end
|
68
|
+
|
69
|
+
# To be called via the API to register to handle a command
|
70
|
+
def add_command(command, cls)
|
71
|
+
@commands[command] = cls
|
72
|
+
end
|
73
|
+
|
74
|
+
# Checks if any plugins handles the command
|
75
|
+
def command?(command)
|
76
|
+
!index.command_plugin(command).nil?
|
77
|
+
end
|
78
|
+
|
79
|
+
# To be called from Cli class to pass the command and argument to
|
80
|
+
# approriate plugin class
|
81
|
+
def exec_command(command, args)
|
82
|
+
raise UndefinedCommandError, "Command #{command} not found" unless command? command
|
83
|
+
|
84
|
+
load_plugin index.command_plugin(command) unless @commands.key? command
|
85
|
+
|
86
|
+
@commands[command].new.exec(command, args)
|
87
|
+
end
|
88
|
+
|
89
|
+
# currently only intended for specs
|
90
|
+
#
|
91
|
+
# @return [String, nil] installed path
|
92
|
+
def installed?(plugin)
|
93
|
+
Index.new.installed?(plugin)
|
94
|
+
end
|
95
|
+
|
96
|
+
# Post installation processing and registering with index
|
97
|
+
#
|
98
|
+
# @param [Hash] plugins mapped to their installtion path
|
99
|
+
def save_plugins(plugins)
|
100
|
+
plugins.each do |name, path|
|
101
|
+
path = Pathname.new path
|
102
|
+
validate_plugin! path
|
103
|
+
register_plugin name, path
|
104
|
+
Bundler.ui.info "Installed plugin #{name}"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# Checks if the gem is good to be a plugin
|
109
|
+
#
|
110
|
+
# At present it only checks whether it contains plugins.rb file
|
111
|
+
#
|
112
|
+
# @param [Pathname] plugin_path the path plugin is installed at
|
113
|
+
# @raise [Error] if plugins.rb file is not found
|
114
|
+
def validate_plugin!(plugin_path)
|
115
|
+
plugin_file = plugin_path.join(PLUGIN_FILE_NAME)
|
116
|
+
raise MalformattedPlugin, "#{PLUGIN_FILE_NAME} was not found in the plugin!" unless plugin_file.file?
|
117
|
+
end
|
118
|
+
|
119
|
+
# Runs the plugins.rb file in an isolated namespace, records the plugin
|
120
|
+
# actions it registers for and then passes the data to index to be stored.
|
121
|
+
#
|
122
|
+
# @param [String] name the name of the plugin
|
123
|
+
# @param [Pathname] path the path where the plugin is installed at
|
124
|
+
def register_plugin(name, path)
|
125
|
+
commands = @commands
|
126
|
+
|
127
|
+
@commands = {}
|
128
|
+
|
129
|
+
begin
|
130
|
+
load path.join(PLUGIN_FILE_NAME), true
|
131
|
+
rescue StandardError => e
|
132
|
+
raise MalformattedPlugin, "#{e.class}: #{e.message}"
|
133
|
+
end
|
134
|
+
|
135
|
+
index.register_plugin name, path.to_s, @commands.keys
|
136
|
+
ensure
|
137
|
+
@commands = commands
|
138
|
+
end
|
139
|
+
|
140
|
+
# Executes the plugins.rb file
|
141
|
+
#
|
142
|
+
# @param [String] name of the plugin
|
143
|
+
def load_plugin(name)
|
144
|
+
# Need to ensure before this that plugin root where the rest of gems
|
145
|
+
# are installed to be on load path to support plugin deps. Currently not
|
146
|
+
# done to avoid conflicts
|
147
|
+
path = index.plugin_path(name)
|
148
|
+
|
149
|
+
load path.join(PLUGIN_FILE_NAME)
|
150
|
+
end
|
151
|
+
|
152
|
+
class << self
|
153
|
+
private :load_plugin, :register_plugin, :save_plugins, :validate_plugin!
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
@@ -0,0 +1,56 @@
|
|
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
|
+
# The plugins should declare that they handle a command through this helper.
|
27
|
+
#
|
28
|
+
# @param [String] command being handled by them
|
29
|
+
# @param [Class] (optional) class that shall handle the command. If not
|
30
|
+
# provided, the `self` class will be used.
|
31
|
+
def self.command(command, cls = self)
|
32
|
+
Plugin.add_command command, cls
|
33
|
+
end
|
34
|
+
|
35
|
+
# The cache dir to be used by the plugins for persistance storage
|
36
|
+
#
|
37
|
+
# @return [Pathname] path of the cache dir
|
38
|
+
def cache
|
39
|
+
Plugin.cache.join("plugins")
|
40
|
+
end
|
41
|
+
|
42
|
+
# A tmp dir to be used by plugins
|
43
|
+
# Accepts names that get concatenated as suffix
|
44
|
+
#
|
45
|
+
# @return [Pathname] object for the new directory created
|
46
|
+
def tmp(*names)
|
47
|
+
Bundler.tmp(["plugin", *names].join("-"))
|
48
|
+
end
|
49
|
+
|
50
|
+
def method_missing(name, *args, &blk)
|
51
|
+
super unless Bundler.respond_to?(name)
|
52
|
+
Bundler.send(name, *args, &blk)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
# Dsl to parse the Gemfile looking for plugins to install
|
5
|
+
module Plugin
|
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, :path, :install_if, :platforms, :env].each {|m| undef_method m }
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
super
|
17
|
+
@sources = Plugin::SourceList.new
|
18
|
+
end
|
19
|
+
|
20
|
+
def plugin(name, *args)
|
21
|
+
_gem(name, *args)
|
22
|
+
end
|
23
|
+
|
24
|
+
def method_missing(name, *args)
|
25
|
+
raise PluginGemfileError, "Undefined local variable or method `#{name}' for Gemfile" unless Bundler::Dsl.method_defined? name
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,88 @@
|
|
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
|
+
def initialize
|
17
|
+
@plugin_paths = {}
|
18
|
+
@commands = {}
|
19
|
+
|
20
|
+
load_index
|
21
|
+
end
|
22
|
+
|
23
|
+
# This function is to be called when a new plugin is installed. This function shall add
|
24
|
+
# the functions of the plugin to existing maps and also the name to source location.
|
25
|
+
#
|
26
|
+
# @param [String] name of the plugin to be registered
|
27
|
+
# @param [String] path where the plugin is installed
|
28
|
+
# @param [Array<String>] commands that are handled by the plugin
|
29
|
+
def register_plugin(name, path, commands)
|
30
|
+
@plugin_paths[name] = path
|
31
|
+
|
32
|
+
common = commands & @commands.keys
|
33
|
+
raise CommandConflict.new(name, common) unless common.empty?
|
34
|
+
commands.each {|c| @commands[c] = name }
|
35
|
+
|
36
|
+
save_index
|
37
|
+
end
|
38
|
+
|
39
|
+
# Path where the index file is stored
|
40
|
+
def index_file
|
41
|
+
Plugin.root.join("index")
|
42
|
+
end
|
43
|
+
|
44
|
+
def plugin_path(name)
|
45
|
+
Pathname.new @plugin_paths[name]
|
46
|
+
end
|
47
|
+
|
48
|
+
# Fetch the name of plugin handling the command
|
49
|
+
def command_plugin(command)
|
50
|
+
@commands[command]
|
51
|
+
end
|
52
|
+
|
53
|
+
def installed?(name)
|
54
|
+
@plugin_paths[name]
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
# Reads the index file from the directory and initializes the instance variables.
|
60
|
+
def load_index
|
61
|
+
SharedHelpers.filesystem_access(index_file, :read) do |index_f|
|
62
|
+
valid_file = index_f && index_f.exist? && !index_f.size.zero?
|
63
|
+
break unless valid_file
|
64
|
+
data = index_f.read
|
65
|
+
require "bundler/yaml_serializer"
|
66
|
+
index = YAMLSerializer.load(data)
|
67
|
+
@plugin_paths = index["plugin_paths"] || {}
|
68
|
+
@commands = index["commands"] || {}
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Should be called when any of the instance variables change. Stores the instance
|
73
|
+
# variables in YAML format. (The instance variables are supposed to be only String key value pairs)
|
74
|
+
def save_index
|
75
|
+
index = {
|
76
|
+
"plugin_paths" => @plugin_paths,
|
77
|
+
"commands" => @commands,
|
78
|
+
}
|
79
|
+
|
80
|
+
require "bundler/yaml_serializer"
|
81
|
+
SharedHelpers.filesystem_access(index_file) do |index_f|
|
82
|
+
FileUtils.mkdir_p(index_f.dirname)
|
83
|
+
File.open(index_f, "w") {|f| f.puts YAMLSerializer.dump(index) }
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,99 @@
|
|
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, "bundler/plugin/installer/rubygems"
|
12
|
+
autoload :Git, "bundler/plugin/installer/git"
|
13
|
+
|
14
|
+
def install(names, options)
|
15
|
+
version = options[:version] || [">= 0"]
|
16
|
+
|
17
|
+
if options[:git]
|
18
|
+
install_git(names, version, options)
|
19
|
+
else
|
20
|
+
sources = options[:source] || Bundler.rubygems.sources
|
21
|
+
install_rubygems(names, version, sources)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Installs the plugin from Definition object created by limited parsing of
|
26
|
+
# Gemfile searching for plugins to be installed
|
27
|
+
#
|
28
|
+
# @param [Definition] definiton object
|
29
|
+
# @return [Hash] map of plugin names to thier paths
|
30
|
+
def install_definition(definition)
|
31
|
+
plugins = definition.dependencies.map(&:name)
|
32
|
+
|
33
|
+
def definition.lock(*); end
|
34
|
+
definition.resolve_remotely!
|
35
|
+
specs = definition.specs
|
36
|
+
|
37
|
+
paths = install_from_specs specs
|
38
|
+
|
39
|
+
Hash[paths.select {|name, _| plugins.include? name }]
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def install_git(names, version, options)
|
45
|
+
uri = options.delete(:git)
|
46
|
+
options["uri"] = uri
|
47
|
+
|
48
|
+
source_list = SourceList.new
|
49
|
+
source_list.add_git_source(options)
|
50
|
+
|
51
|
+
# To support both sources
|
52
|
+
if options[:source]
|
53
|
+
source_list.add_rubygems_source("remotes" => options[:source])
|
54
|
+
end
|
55
|
+
|
56
|
+
deps = names.map {|name| Dependency.new name, version }
|
57
|
+
|
58
|
+
definition = Definition.new(nil, deps, source_list, true)
|
59
|
+
install_definition(definition)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Installs the plugin from rubygems source and returns the path where the
|
63
|
+
# plugin was installed
|
64
|
+
#
|
65
|
+
# @param [String] name of the plugin gem to search in the source
|
66
|
+
# @param [Array] version of the gem to install
|
67
|
+
# @param [String, Array<String>] source(s) to resolve the gem
|
68
|
+
#
|
69
|
+
# @return [String] the path where the plugin was installed
|
70
|
+
def install_rubygems(names, version, sources)
|
71
|
+
deps = names.map {|name| Dependency.new name, version }
|
72
|
+
|
73
|
+
source_list = SourceList.new
|
74
|
+
source_list.add_rubygems_source("remotes" => sources)
|
75
|
+
|
76
|
+
definition = Definition.new(nil, deps, source_list, true)
|
77
|
+
install_definition(definition)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Installs the plugins and deps from the provided specs and returns map of
|
81
|
+
# gems to their paths
|
82
|
+
#
|
83
|
+
# @param specs to install
|
84
|
+
#
|
85
|
+
# @return [Hash] map of names to path where the plugin was installed
|
86
|
+
def install_from_specs(specs)
|
87
|
+
paths = {}
|
88
|
+
|
89
|
+
specs.each do |spec|
|
90
|
+
spec.source.install spec
|
91
|
+
|
92
|
+
paths[spec.name] = spec.full_gem_path
|
93
|
+
end
|
94
|
+
|
95
|
+
paths
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
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
|