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,40 @@
|
|
1
|
+
##
|
2
|
+
# A Net::HTTP connection wrapper that holds extra information for managing the
|
3
|
+
# connection's lifetime.
|
4
|
+
|
5
|
+
class Bundler::Persistent::Net::HTTP::Persistent::Connection # :nodoc:
|
6
|
+
|
7
|
+
attr_accessor :http
|
8
|
+
|
9
|
+
attr_accessor :last_use
|
10
|
+
|
11
|
+
attr_accessor :requests
|
12
|
+
|
13
|
+
attr_accessor :ssl_generation
|
14
|
+
|
15
|
+
def initialize http_class, http_args, ssl_generation
|
16
|
+
@http = http_class.new(*http_args)
|
17
|
+
@ssl_generation = ssl_generation
|
18
|
+
|
19
|
+
reset
|
20
|
+
end
|
21
|
+
|
22
|
+
def finish
|
23
|
+
@http.finish
|
24
|
+
rescue IOError
|
25
|
+
ensure
|
26
|
+
reset
|
27
|
+
end
|
28
|
+
|
29
|
+
def reset
|
30
|
+
@last_use = Bundler::Persistent::Net::HTTP::Persistent::EPOCH
|
31
|
+
@requests = 0
|
32
|
+
end
|
33
|
+
|
34
|
+
def ressl ssl_generation
|
35
|
+
@ssl_generation = ssl_generation
|
36
|
+
|
37
|
+
finish
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
class Bundler::Persistent::Net::HTTP::Persistent::Pool < Bundler::ConnectionPool # :nodoc:
|
2
|
+
|
3
|
+
attr_reader :available # :nodoc:
|
4
|
+
attr_reader :key # :nodoc:
|
5
|
+
|
6
|
+
def initialize(options = {}, &block)
|
7
|
+
super
|
8
|
+
|
9
|
+
@available = Bundler::Persistent::Net::HTTP::Persistent::TimedStackMulti.new(@size, &block)
|
10
|
+
@key = "current-#{@available.object_id}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def checkin net_http_args
|
14
|
+
stack = Thread.current[@key][net_http_args] ||= []
|
15
|
+
|
16
|
+
raise Bundler::ConnectionPool::Error, 'no connections are checked out' if
|
17
|
+
stack.empty?
|
18
|
+
|
19
|
+
conn = stack.pop
|
20
|
+
|
21
|
+
if stack.empty?
|
22
|
+
@available.push conn, connection_args: net_http_args
|
23
|
+
|
24
|
+
Thread.current[@key].delete(net_http_args)
|
25
|
+
Thread.current[@key] = nil if Thread.current[@key].empty?
|
26
|
+
end
|
27
|
+
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
|
31
|
+
def checkout net_http_args
|
32
|
+
stacks = Thread.current[@key] ||= {}
|
33
|
+
stack = stacks[net_http_args] ||= []
|
34
|
+
|
35
|
+
if stack.empty? then
|
36
|
+
conn = @available.pop connection_args: net_http_args
|
37
|
+
else
|
38
|
+
conn = stack.last
|
39
|
+
end
|
40
|
+
|
41
|
+
stack.push conn
|
42
|
+
|
43
|
+
conn
|
44
|
+
end
|
45
|
+
|
46
|
+
def shutdown
|
47
|
+
Thread.current[@key] = nil
|
48
|
+
super
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
require_relative 'timed_stack_multi'
|
53
|
+
|
@@ -0,0 +1,79 @@
|
|
1
|
+
class Bundler::Persistent::Net::HTTP::Persistent::TimedStackMulti < Bundler::ConnectionPool::TimedStack # :nodoc:
|
2
|
+
|
3
|
+
##
|
4
|
+
# Returns a new hash that has arrays for keys
|
5
|
+
#
|
6
|
+
# Using a class method to limit the bindings referenced by the hash's
|
7
|
+
# default_proc
|
8
|
+
|
9
|
+
def self.hash_of_arrays # :nodoc:
|
10
|
+
Hash.new { |h,k| h[k] = [] }
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(size = 0, &block)
|
14
|
+
super
|
15
|
+
|
16
|
+
@enqueued = 0
|
17
|
+
@ques = self.class.hash_of_arrays
|
18
|
+
@lru = {}
|
19
|
+
@key = :"connection_args-#{object_id}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def empty?
|
23
|
+
(@created - @enqueued) >= @max
|
24
|
+
end
|
25
|
+
|
26
|
+
def length
|
27
|
+
@max - @created + @enqueued
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def connection_stored? options = {} # :nodoc:
|
33
|
+
!@ques[options[:connection_args]].empty?
|
34
|
+
end
|
35
|
+
|
36
|
+
def fetch_connection options = {} # :nodoc:
|
37
|
+
connection_args = options[:connection_args]
|
38
|
+
|
39
|
+
@enqueued -= 1
|
40
|
+
lru_update connection_args
|
41
|
+
@ques[connection_args].pop
|
42
|
+
end
|
43
|
+
|
44
|
+
def lru_update connection_args # :nodoc:
|
45
|
+
@lru.delete connection_args
|
46
|
+
@lru[connection_args] = true
|
47
|
+
end
|
48
|
+
|
49
|
+
def shutdown_connections # :nodoc:
|
50
|
+
@ques.each_key do |key|
|
51
|
+
super connection_args: key
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def store_connection obj, options = {} # :nodoc:
|
56
|
+
@ques[options[:connection_args]].push obj
|
57
|
+
@enqueued += 1
|
58
|
+
end
|
59
|
+
|
60
|
+
def try_create options = {} # :nodoc:
|
61
|
+
connection_args = options[:connection_args]
|
62
|
+
|
63
|
+
if @created >= @max && @enqueued >= 1
|
64
|
+
oldest, = @lru.first
|
65
|
+
@lru.delete oldest
|
66
|
+
@ques[oldest].pop
|
67
|
+
|
68
|
+
@created -= 1
|
69
|
+
end
|
70
|
+
|
71
|
+
if @created < @max
|
72
|
+
@created += 1
|
73
|
+
lru_update connection_args
|
74
|
+
return @create_block.call(connection_args)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "set"
|
2
|
-
|
2
|
+
require_relative "thor/base"
|
3
3
|
|
4
|
-
class Bundler::Thor
|
4
|
+
class Bundler::Thor
|
5
5
|
class << self
|
6
6
|
# Allows for custom "Command" package naming.
|
7
7
|
#
|
@@ -9,7 +9,7 @@ class Bundler::Thor # rubocop:disable ClassLength
|
|
9
9
|
# name<String>
|
10
10
|
# options<Hash>
|
11
11
|
#
|
12
|
-
def package_name(name,
|
12
|
+
def package_name(name, _ = {})
|
13
13
|
@package_name = name.nil? || name == "" ? nil : name
|
14
14
|
end
|
15
15
|
|
@@ -57,7 +57,9 @@ class Bundler::Thor # rubocop:disable ClassLength
|
|
57
57
|
command.usage = usage if usage
|
58
58
|
command.description = description if description
|
59
59
|
else
|
60
|
-
@usage
|
60
|
+
@usage = usage
|
61
|
+
@desc = description
|
62
|
+
@hide = options[:hide] || false
|
61
63
|
end
|
62
64
|
end
|
63
65
|
|
@@ -88,9 +90,14 @@ class Bundler::Thor # rubocop:disable ClassLength
|
|
88
90
|
# ==== Parameters
|
89
91
|
# Hash[String|Array => Symbol]:: Maps the string or the strings in the array to the given command.
|
90
92
|
#
|
91
|
-
def map(mappings = nil)
|
93
|
+
def map(mappings = nil, **kw)
|
92
94
|
@map ||= from_superclass(:map, {})
|
93
95
|
|
96
|
+
if mappings && !kw.empty?
|
97
|
+
mappings = kw.merge!(mappings)
|
98
|
+
else
|
99
|
+
mappings ||= kw
|
100
|
+
end
|
94
101
|
if mappings
|
95
102
|
mappings.each do |key, value|
|
96
103
|
if key.respond_to?(:each)
|
@@ -168,9 +175,9 @@ class Bundler::Thor # rubocop:disable ClassLength
|
|
168
175
|
handle_no_command_error(meth) unless command
|
169
176
|
|
170
177
|
shell.say "Usage:"
|
171
|
-
shell.say " #{banner(command)}"
|
178
|
+
shell.say " #{banner(command).split("\n").join("\n ")}"
|
172
179
|
shell.say
|
173
|
-
class_options_help(shell, nil => command.options.
|
180
|
+
class_options_help(shell, nil => command.options.values)
|
174
181
|
if command.long_description
|
175
182
|
shell.say "Description:"
|
176
183
|
shell.print_wrapped(command.long_description, :indent => 2)
|
@@ -231,8 +238,12 @@ class Bundler::Thor # rubocop:disable ClassLength
|
|
231
238
|
|
232
239
|
define_method(subcommand) do |*args|
|
233
240
|
args, opts = Bundler::Thor::Arguments.split(args)
|
234
|
-
args
|
235
|
-
|
241
|
+
invoke_args = [args, opts, {:invoked_via_subcommand => true, :class_options => options}]
|
242
|
+
invoke_args.unshift "help" if opts.delete("--help") || opts.delete("-h")
|
243
|
+
invoke subcommand_class, *invoke_args
|
244
|
+
end
|
245
|
+
subcommand_class.commands.each do |_meth, command|
|
246
|
+
command.ancestor_name = subcommand
|
236
247
|
end
|
237
248
|
end
|
238
249
|
alias_method :subtask, :subcommand
|
@@ -319,11 +330,31 @@ class Bundler::Thor # rubocop:disable ClassLength
|
|
319
330
|
command && stop_on_unknown_option.include?(command.name.to_sym)
|
320
331
|
end
|
321
332
|
|
333
|
+
# Disable the check for required options for the given commands.
|
334
|
+
# This is useful if you have a command that does not need the required options
|
335
|
+
# to work, like help.
|
336
|
+
#
|
337
|
+
# ==== Parameters
|
338
|
+
# Symbol ...:: A list of commands that should be affected.
|
339
|
+
def disable_required_check!(*command_names)
|
340
|
+
disable_required_check.merge(command_names)
|
341
|
+
end
|
342
|
+
|
343
|
+
def disable_required_check?(command) #:nodoc:
|
344
|
+
command && disable_required_check.include?(command.name.to_sym)
|
345
|
+
end
|
346
|
+
|
322
347
|
protected
|
348
|
+
|
323
349
|
def stop_on_unknown_option #:nodoc:
|
324
350
|
@stop_on_unknown_option ||= Set.new
|
325
351
|
end
|
326
352
|
|
353
|
+
# help command has the required check disabled by default.
|
354
|
+
def disable_required_check #:nodoc:
|
355
|
+
@disable_required_check ||= Set.new([:help])
|
356
|
+
end
|
357
|
+
|
327
358
|
# The method responsible for dispatching given the args.
|
328
359
|
def dispatch(meth, given_args, given_opts, config) #:nodoc: # rubocop:disable MethodLength
|
329
360
|
meth ||= retrieve_command_name(given_args)
|
@@ -345,12 +376,14 @@ class Bundler::Thor # rubocop:disable ClassLength
|
|
345
376
|
opts.clear
|
346
377
|
end
|
347
378
|
else
|
348
|
-
args
|
379
|
+
args = given_args
|
380
|
+
opts = nil
|
349
381
|
command = dynamic_command_class.new(meth)
|
350
382
|
end
|
351
383
|
|
352
384
|
opts = given_opts || opts || []
|
353
|
-
config
|
385
|
+
config[:current_command] = command
|
386
|
+
config[:command_options] = command.options
|
354
387
|
|
355
388
|
instance = new(args, opts, config)
|
356
389
|
yield instance if block_given?
|
@@ -365,7 +398,10 @@ class Bundler::Thor # rubocop:disable ClassLength
|
|
365
398
|
# the namespace should be displayed as arguments.
|
366
399
|
#
|
367
400
|
def banner(command, namespace = nil, subcommand = false)
|
368
|
-
|
401
|
+
$thor_runner ||= false
|
402
|
+
command.formatted_usage(self, $thor_runner, subcommand).split("\n").map do |formatted_usage|
|
403
|
+
"#{basename} #{formatted_usage}"
|
404
|
+
end.join("\n")
|
369
405
|
end
|
370
406
|
|
371
407
|
def baseclass #:nodoc:
|
@@ -380,6 +416,7 @@ class Bundler::Thor # rubocop:disable ClassLength
|
|
380
416
|
@usage ||= nil
|
381
417
|
@desc ||= nil
|
382
418
|
@long_desc ||= nil
|
419
|
+
@hide ||= nil
|
383
420
|
|
384
421
|
if @usage && @desc
|
385
422
|
base_class = @hide ? Bundler::Thor::HiddenCommand : Bundler::Thor::Command
|
@@ -389,8 +426,8 @@ class Bundler::Thor # rubocop:disable ClassLength
|
|
389
426
|
elsif all_commands[meth] || meth == "method_missing"
|
390
427
|
true
|
391
428
|
else
|
392
|
-
puts "[WARNING] Attempted to create command #{meth.inspect} without usage or description. "
|
393
|
-
"Call desc if you want this method to be available as command or declare it inside a "
|
429
|
+
puts "[WARNING] Attempted to create command #{meth.inspect} without usage or description. " \
|
430
|
+
"Call desc if you want this method to be available as command or declare it inside a " \
|
394
431
|
"no_commands{} block. Invoked from #{caller[1].inspect}."
|
395
432
|
false
|
396
433
|
end
|
@@ -405,11 +442,7 @@ class Bundler::Thor # rubocop:disable ClassLength
|
|
405
442
|
# Retrieve the command name from given args.
|
406
443
|
def retrieve_command_name(args) #:nodoc:
|
407
444
|
meth = args.first.to_s unless args.empty?
|
408
|
-
if meth && (map[meth] || meth !~ /^\-/)
|
409
|
-
args.shift
|
410
|
-
else
|
411
|
-
nil
|
412
|
-
end
|
445
|
+
args.shift if meth && (map[meth] || meth !~ /^\-/)
|
413
446
|
end
|
414
447
|
alias_method :retrieve_task_name, :retrieve_command_name
|
415
448
|
|
@@ -421,20 +454,20 @@ class Bundler::Thor # rubocop:disable ClassLength
|
|
421
454
|
# +normalize_command_name+ also converts names like +animal-prison+
|
422
455
|
# into +animal_prison+.
|
423
456
|
def normalize_command_name(meth) #:nodoc:
|
424
|
-
return default_command.to_s.
|
457
|
+
return default_command.to_s.tr("-", "_") unless meth
|
425
458
|
|
426
459
|
possibilities = find_command_possibilities(meth)
|
427
|
-
if possibilities.size > 1
|
428
|
-
|
429
|
-
|
430
|
-
meth
|
460
|
+
raise AmbiguousTaskError, "Ambiguous command #{meth} matches [#{possibilities.join(', ')}]" if possibilities.size > 1
|
461
|
+
|
462
|
+
if possibilities.empty?
|
463
|
+
meth ||= default_command
|
431
464
|
elsif map[meth]
|
432
465
|
meth = map[meth]
|
433
466
|
else
|
434
467
|
meth = possibilities.first
|
435
468
|
end
|
436
469
|
|
437
|
-
meth.to_s.
|
470
|
+
meth.to_s.tr("-", "_") # treat foo-bar as foo_bar
|
438
471
|
end
|
439
472
|
alias_method :normalize_task_name, :normalize_command_name
|
440
473
|
|
@@ -1,18 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
require "bundler/vendor/thor/lib/thor/actions/empty_directory"
|
8
|
-
require "bundler/vendor/thor/lib/thor/actions/file_manipulation"
|
9
|
-
require "bundler/vendor/thor/lib/thor/actions/inject_into_file"
|
1
|
+
require_relative "actions/create_file"
|
2
|
+
require_relative "actions/create_link"
|
3
|
+
require_relative "actions/directory"
|
4
|
+
require_relative "actions/empty_directory"
|
5
|
+
require_relative "actions/file_manipulation"
|
6
|
+
require_relative "actions/inject_into_file"
|
10
7
|
|
11
8
|
class Bundler::Thor
|
12
9
|
module Actions
|
13
10
|
attr_accessor :behavior
|
14
11
|
|
15
12
|
def self.included(base) #:nodoc:
|
13
|
+
super(base)
|
16
14
|
base.extend ClassMethods
|
17
15
|
end
|
18
16
|
|
@@ -73,14 +71,15 @@ class Bundler::Thor
|
|
73
71
|
#
|
74
72
|
def initialize(args = [], options = {}, config = {})
|
75
73
|
self.behavior = case config[:behavior].to_s
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
74
|
+
when "force", "skip"
|
75
|
+
_cleanup_options_and_set(options, config[:behavior])
|
76
|
+
:invoke
|
77
|
+
when "revoke"
|
78
|
+
:revoke
|
79
|
+
else
|
80
|
+
:invoke
|
81
|
+
end
|
82
|
+
|
84
83
|
super
|
85
84
|
self.destination_root = config[:destination_root]
|
86
85
|
end
|
@@ -113,8 +112,10 @@ class Bundler::Thor
|
|
113
112
|
# the script started).
|
114
113
|
#
|
115
114
|
def relative_to_original_destination_root(path, remove_dot = true)
|
116
|
-
|
117
|
-
if path.
|
115
|
+
root = @destination_stack[0]
|
116
|
+
if path.start_with?(root) && [File::SEPARATOR, File::ALT_SEPARATOR, nil, ''].include?(path[root.size..root.size])
|
117
|
+
path = path.dup
|
118
|
+
path[0...root.size] = '.'
|
118
119
|
remove_dot ? (path[2..-1] || "") : path
|
119
120
|
else
|
120
121
|
path
|
@@ -129,7 +130,7 @@ class Bundler::Thor
|
|
129
130
|
|
130
131
|
# Receives a file or directory and search for it in the source paths.
|
131
132
|
#
|
132
|
-
def find_in_source_paths(file)
|
133
|
+
def find_in_source_paths(file)
|
133
134
|
possible_files = [file, file + TEMPLATE_EXTNAME]
|
134
135
|
relative_root = relative_to_original_destination_root(destination_root, false)
|
135
136
|
|
@@ -140,19 +141,19 @@ class Bundler::Thor
|
|
140
141
|
end
|
141
142
|
end
|
142
143
|
|
143
|
-
message = "Could not find #{file.inspect} in any of your source paths. "
|
144
|
+
message = "Could not find #{file.inspect} in any of your source paths. ".dup
|
144
145
|
|
145
146
|
unless self.class.source_root
|
146
147
|
message << "Please invoke #{self.class.name}.source_root(PATH) with the PATH containing your templates. "
|
147
148
|
end
|
148
149
|
|
149
|
-
if source_paths.empty?
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
150
|
+
message << if source_paths.empty?
|
151
|
+
"Currently you have no source paths."
|
152
|
+
else
|
153
|
+
"Your current source paths are: \n#{source_paths.join("\n")}"
|
154
|
+
end
|
154
155
|
|
155
|
-
|
156
|
+
raise Error, message
|
156
157
|
end
|
157
158
|
|
158
159
|
# Do something in the root or on a provided subfolder. If a relative path
|
@@ -174,6 +175,7 @@ class Bundler::Thor
|
|
174
175
|
|
175
176
|
# If the directory doesnt exist and we're not pretending
|
176
177
|
if !File.exist?(destination_root) && !pretend
|
178
|
+
require "fileutils"
|
177
179
|
FileUtils.mkdir_p(destination_root)
|
178
180
|
end
|
179
181
|
|
@@ -181,6 +183,7 @@ class Bundler::Thor
|
|
181
183
|
# In pretend mode, just yield down to the block
|
182
184
|
block.arity == 1 ? yield(destination_root) : yield
|
183
185
|
else
|
186
|
+
require "fileutils"
|
184
187
|
FileUtils.cd(destination_root) { block.arity == 1 ? yield(destination_root) : yield }
|
185
188
|
end
|
186
189
|
|
@@ -214,10 +217,11 @@ class Bundler::Thor
|
|
214
217
|
say_status :apply, path, verbose
|
215
218
|
shell.padding += 1 if verbose
|
216
219
|
|
217
|
-
if is_uri
|
218
|
-
|
220
|
+
contents = if is_uri
|
221
|
+
require "open-uri"
|
222
|
+
open(path, "Accept" => "application/x-thor-template", &:read)
|
219
223
|
else
|
220
|
-
|
224
|
+
open(path, &:read)
|
221
225
|
end
|
222
226
|
|
223
227
|
instance_eval(contents, path)
|
@@ -250,9 +254,22 @@ class Bundler::Thor
|
|
250
254
|
|
251
255
|
say_status :run, desc, config.fetch(:verbose, true)
|
252
256
|
|
253
|
-
|
254
|
-
|
257
|
+
return if options[:pretend]
|
258
|
+
|
259
|
+
env_splat = [config[:env]] if config[:env]
|
260
|
+
|
261
|
+
if config[:capture]
|
262
|
+
require "open3"
|
263
|
+
result, status = Open3.capture2e(*env_splat, command.to_s)
|
264
|
+
success = status.success?
|
265
|
+
else
|
266
|
+
result = system(*env_splat, command.to_s)
|
267
|
+
success = result
|
255
268
|
end
|
269
|
+
|
270
|
+
abort if !success && config.fetch(:abort_on_failure, self.class.exit_on_failure?)
|
271
|
+
|
272
|
+
result
|
256
273
|
end
|
257
274
|
|
258
275
|
# Executes a ruby script (taking into account WIN32 platform quirks).
|
@@ -308,7 +325,7 @@ class Bundler::Thor
|
|
308
325
|
def _cleanup_options_and_set(options, key) #:nodoc:
|
309
326
|
case options
|
310
327
|
when Array
|
311
|
-
%w
|
328
|
+
%w(--force -f --skip -s).each { |i| options.delete(i) }
|
312
329
|
options << "--#{key}"
|
313
330
|
when Hash
|
314
331
|
[:force, :skip, "force", "skip"].each { |i| options.delete(i) }
|