bundler 1.13.6 → 1.17.3
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 +554 -9
- data/README.md +28 -5
- data/bundler.gemspec +40 -11
- data/exe/bundle +4 -8
- data/exe/bundle_ruby +4 -3
- data/lib/bundler.rb +162 -68
- data/lib/bundler/build_metadata.rb +53 -0
- data/lib/bundler/capistrano.rb +5 -0
- data/lib/bundler/cli.rb +360 -118
- data/lib/bundler/cli/add.rb +35 -0
- data/lib/bundler/cli/binstubs.rb +18 -10
- data/lib/bundler/cli/cache.rb +6 -5
- data/lib/bundler/cli/check.rb +4 -6
- data/lib/bundler/cli/clean.rb +6 -7
- data/lib/bundler/cli/common.rb +47 -1
- data/lib/bundler/cli/config.rb +26 -7
- data/lib/bundler/cli/console.rb +2 -1
- data/lib/bundler/cli/doctor.rb +63 -18
- data/lib/bundler/cli/exec.rb +12 -5
- data/lib/bundler/cli/gem.rb +59 -21
- data/lib/bundler/cli/info.rb +50 -0
- data/lib/bundler/cli/init.rb +21 -7
- data/lib/bundler/cli/inject.rb +13 -4
- data/lib/bundler/cli/install.rb +72 -101
- data/lib/bundler/cli/issue.rb +40 -0
- data/lib/bundler/cli/list.rb +58 -0
- data/lib/bundler/cli/lock.rb +9 -6
- data/lib/bundler/cli/open.rb +4 -3
- data/lib/bundler/cli/outdated.rb +175 -60
- data/lib/bundler/cli/package.rb +9 -6
- data/lib/bundler/cli/platform.rb +2 -1
- data/lib/bundler/cli/plugin.rb +1 -0
- data/lib/bundler/cli/pristine.rb +47 -0
- data/lib/bundler/cli/remove.rb +18 -0
- data/lib/bundler/cli/show.rb +2 -2
- data/lib/bundler/cli/update.rb +44 -34
- data/lib/bundler/cli/viz.rb +5 -1
- data/lib/bundler/compact_index_client.rb +109 -0
- data/lib/bundler/compact_index_client/cache.rb +118 -0
- data/lib/bundler/compact_index_client/updater.rb +116 -0
- data/lib/bundler/compatibility_guard.rb +14 -0
- data/lib/bundler/constants.rb +1 -0
- data/lib/bundler/current_ruby.rb +17 -8
- data/lib/bundler/definition.rb +353 -182
- data/lib/bundler/dep_proxy.rb +3 -1
- data/lib/bundler/dependency.rb +22 -10
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/deprecate.rb +15 -3
- data/lib/bundler/dsl.rb +122 -64
- data/lib/bundler/endpoint_specification.rb +13 -3
- data/lib/bundler/env.rb +110 -38
- data/lib/bundler/environment_preserver.rb +27 -6
- data/lib/bundler/errors.rb +24 -0
- data/lib/bundler/feature_flag.rb +74 -0
- data/lib/bundler/fetcher.rb +18 -11
- data/lib/bundler/fetcher/base.rb +1 -0
- data/lib/bundler/fetcher/compact_index.rb +7 -5
- data/lib/bundler/fetcher/dependency.rb +3 -2
- data/lib/bundler/fetcher/downloader.rb +25 -7
- data/lib/bundler/fetcher/index.rb +3 -2
- data/lib/bundler/friendly_errors.rb +33 -7
- data/lib/bundler/gem_helper.rb +25 -11
- data/lib/bundler/gem_helpers.rb +70 -1
- data/lib/bundler/gem_remote_fetcher.rb +1 -0
- data/lib/bundler/gem_tasks.rb +1 -0
- data/lib/bundler/gem_version_promoter.rb +17 -2
- data/lib/bundler/gemdeps.rb +29 -0
- data/lib/bundler/graph.rb +1 -0
- data/lib/bundler/index.rb +28 -15
- data/lib/bundler/injector.rb +216 -33
- data/lib/bundler/inline.rb +12 -12
- data/lib/bundler/installer.rb +139 -53
- data/lib/bundler/installer/gem_installer.rb +15 -5
- data/lib/bundler/installer/parallel_installer.rb +113 -28
- data/lib/bundler/installer/standalone.rb +1 -0
- data/lib/bundler/lazy_specification.rb +31 -3
- data/lib/bundler/lockfile_generator.rb +95 -0
- data/lib/bundler/lockfile_parser.rb +50 -37
- data/lib/bundler/match_platform.rb +13 -3
- data/lib/bundler/mirror.rb +10 -5
- data/lib/bundler/plugin.rb +22 -8
- data/lib/bundler/plugin/api.rb +2 -1
- data/lib/bundler/plugin/api/source.rb +17 -4
- data/lib/bundler/plugin/events.rb +61 -0
- data/lib/bundler/plugin/index.rb +9 -2
- data/lib/bundler/plugin/installer.rb +7 -6
- data/lib/bundler/plugin/source_list.rb +7 -8
- data/lib/bundler/process_lock.rb +24 -0
- data/lib/bundler/psyched_yaml.rb +10 -0
- data/lib/bundler/remote_specification.rb +30 -1
- data/lib/bundler/resolver.rb +187 -194
- data/lib/bundler/resolver/spec_group.rb +106 -0
- data/lib/bundler/retry.rb +5 -1
- data/lib/bundler/ruby_dsl.rb +1 -0
- data/lib/bundler/ruby_version.rb +12 -2
- data/lib/bundler/rubygems_ext.rb +23 -8
- data/lib/bundler/rubygems_gem_installer.rb +90 -0
- data/lib/bundler/rubygems_integration.rb +193 -70
- data/lib/bundler/runtime.rb +39 -22
- data/lib/bundler/settings.rb +245 -85
- data/lib/bundler/settings/validator.rb +102 -0
- data/lib/bundler/setup.rb +4 -7
- data/lib/bundler/shared_helpers.rb +183 -40
- data/lib/bundler/similarity_detector.rb +1 -0
- data/lib/bundler/source.rb +58 -1
- data/lib/bundler/source/gemspec.rb +1 -0
- data/lib/bundler/source/git.rb +52 -23
- data/lib/bundler/source/git/git_proxy.rb +30 -14
- data/lib/bundler/source/metadata.rb +62 -0
- data/lib/bundler/source/path.rb +42 -16
- data/lib/bundler/source/path/installer.rb +4 -2
- data/lib/bundler/source/rubygems.rb +171 -82
- data/lib/bundler/source/rubygems/remote.rb +12 -2
- data/lib/bundler/source_list.rb +75 -15
- data/lib/bundler/spec_set.rb +67 -32
- data/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
- data/lib/bundler/stub_specification.rb +86 -2
- data/lib/bundler/templates/.document +1 -0
- data/lib/bundler/templates/Executable +13 -1
- data/lib/bundler/templates/Executable.bundler +105 -0
- data/lib/bundler/templates/Executable.standalone +5 -5
- data/lib/bundler/templates/Gemfile +3 -0
- data/lib/bundler/templates/gems.rb +8 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -2
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +1 -1
- data/lib/bundler/templates/newgem/README.md.tt +14 -8
- data/lib/bundler/templates/newgem/Rakefile.tt +5 -5
- data/lib/bundler/templates/newgem/bin/console.tt +1 -1
- 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/gitignore.tt +5 -1
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +7 -6
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +4 -4
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +21 -12
- data/lib/bundler/templates/newgem/rspec.tt +1 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +1 -3
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +13 -1
- data/lib/bundler/templates/newgem/test/newgem_test.rb.tt +1 -1
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +3 -3
- data/lib/bundler/templates/newgem/{.travis.yml.tt → travis.yml.tt} +2 -0
- data/lib/bundler/ui.rb +1 -0
- data/lib/bundler/ui/rg_proxy.rb +1 -0
- data/lib/bundler/ui/shell.rb +30 -10
- data/lib/bundler/ui/silent.rb +21 -1
- data/lib/bundler/uri_credentials_filter.rb +1 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +2 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +26 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +2 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +12 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +3 -2
- 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 +11 -3
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +13 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +3 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +3 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +18 -5
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +75 -7
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +3 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +499 -128
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -4
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/faster.rb +1 -0
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent.rb +27 -24
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent/ssl_reuse.rb +2 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +46 -21
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +24 -22
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +2 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +16 -8
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +66 -18
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +17 -15
- data/lib/bundler/vendor/thor/lib/thor/base.rb +55 -32
- data/lib/bundler/vendor/thor/lib/thor/command.rb +13 -11
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +21 -1
- data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +7 -5
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +94 -63
- data/lib/bundler/vendor/thor/lib/thor/error.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/group.rb +13 -13
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +4 -5
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +2 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +4 -7
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +16 -16
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +42 -21
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +13 -10
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +31 -29
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +49 -33
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/util.rb +8 -7
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendored_fileutils.rb +9 -0
- data/lib/bundler/vendored_molinillo.rb +1 -0
- data/lib/bundler/vendored_persistent.rb +43 -3
- data/lib/bundler/vendored_thor.rb +6 -2
- data/lib/bundler/version.rb +19 -2
- data/lib/bundler/version_ranges.rb +76 -0
- data/lib/bundler/vlad.rb +5 -0
- data/lib/bundler/worker.rb +30 -6
- data/lib/bundler/yaml_serializer.rb +4 -4
- data/man/bundle-add.1 +58 -0
- data/man/bundle-add.1.txt +52 -0
- data/man/bundle-add.ronn +40 -0
- data/{lib/bundler/man/bundle-binstubs → man/bundle-binstubs.1} +11 -1
- data/man/bundle-binstubs.1.txt +48 -0
- data/man/bundle-binstubs.ronn +15 -1
- data/man/bundle-check.1 +31 -0
- data/man/bundle-check.1.txt +33 -0
- data/man/bundle-check.ronn +26 -0
- data/man/bundle-clean.1 +24 -0
- data/man/bundle-clean.1.txt +26 -0
- data/man/bundle-clean.ronn +18 -0
- data/man/bundle-config.1 +497 -0
- data/man/bundle-config.1.txt +529 -0
- data/man/bundle-config.ronn +233 -61
- data/man/bundle-doctor.1 +44 -0
- data/man/bundle-doctor.1.txt +44 -0
- data/man/bundle-doctor.ronn +33 -0
- data/{lib/bundler/man/bundle-exec → man/bundle-exec.1} +6 -3
- data/man/bundle-exec.1.txt +178 -0
- data/man/bundle-exec.ronn +10 -3
- data/{lib/bundler/man/bundle-gem → man/bundle-gem.1} +4 -4
- data/man/bundle-gem.1.txt +91 -0
- data/man/bundle-gem.ronn +3 -2
- data/man/bundle-info.1 +20 -0
- data/man/bundle-info.1.txt +21 -0
- data/man/bundle-info.ronn +17 -0
- data/man/bundle-init.1 +25 -0
- data/man/bundle-init.1.txt +34 -0
- data/man/bundle-init.ronn +29 -0
- data/man/bundle-inject.1 +33 -0
- data/man/bundle-inject.1.txt +32 -0
- data/man/bundle-inject.ronn +22 -0
- data/{lib/bundler/man/bundle-install → man/bundle-install.1} +32 -29
- data/man/bundle-install.1.txt +396 -0
- data/man/bundle-install.ronn +45 -36
- data/man/bundle-list.1 +50 -0
- data/man/bundle-list.1.txt +43 -0
- data/man/bundle-list.ronn +33 -0
- data/{lib/bundler/man/bundle-lock → man/bundle-lock.1} +43 -2
- data/man/bundle-lock.1.txt +93 -0
- data/man/bundle-lock.ronn +47 -0
- data/man/bundle-open.1 +32 -0
- data/man/bundle-open.1.txt +29 -0
- data/man/bundle-open.ronn +19 -0
- data/man/bundle-outdated.1 +155 -0
- data/man/bundle-outdated.1.txt +131 -0
- data/man/bundle-outdated.ronn +111 -0
- data/{lib/bundler/man/bundle-package → man/bundle-package.1} +6 -3
- data/man/bundle-package.1.txt +79 -0
- data/man/bundle-package.ronn +7 -2
- data/{lib/bundler/man/bundle-platform → man/bundle-platform.1} +1 -1
- data/man/bundle-platform.1.txt +57 -0
- data/man/bundle-pristine.1 +34 -0
- data/man/bundle-pristine.1.txt +44 -0
- data/man/bundle-pristine.ronn +34 -0
- data/man/bundle-remove.1 +31 -0
- data/man/bundle-remove.1.txt +34 -0
- data/man/bundle-remove.ronn +23 -0
- data/man/bundle-show.1 +23 -0
- data/man/bundle-show.1.txt +27 -0
- data/man/bundle-show.ronn +21 -0
- data/man/bundle-update.1 +394 -0
- data/man/bundle-update.1.txt +391 -0
- data/man/bundle-update.ronn +172 -16
- data/man/bundle-viz.1 +39 -0
- data/man/bundle-viz.1.txt +39 -0
- data/man/bundle-viz.ronn +30 -0
- data/{lib/bundler/man/bundle → man/bundle.1} +44 -28
- data/man/bundle.1.txt +116 -0
- data/man/bundle.ronn +39 -27
- data/{lib/bundler/man → man}/gemfile.5 +67 -84
- data/man/gemfile.5.ronn +77 -55
- data/man/gemfile.5.txt +653 -0
- data/man/index.txt +25 -8
- metadata +118 -58
- data/.codeclimate.yml +0 -25
- data/.gitignore +0 -16
- data/.rspec +0 -3
- data/.rubocop.yml +0 -128
- data/.rubocop_todo.yml +0 -248
- data/.travis.yml +0 -108
- data/CODE_OF_CONDUCT.md +0 -42
- data/CONTRIBUTING.md +0 -36
- data/DEVELOPMENT.md +0 -148
- data/ISSUES.md +0 -100
- data/Rakefile +0 -333
- data/bin/rake +0 -19
- data/bin/rspec +0 -15
- data/bin/rubocop +0 -17
- data/bin/with_rubygems +0 -39
- data/lib/bundler/man/bundle-binstubs.txt +0 -33
- data/lib/bundler/man/bundle-config +0 -254
- data/lib/bundler/man/bundle-config.txt +0 -282
- data/lib/bundler/man/bundle-exec.txt +0 -171
- data/lib/bundler/man/bundle-gem.txt +0 -90
- data/lib/bundler/man/bundle-install.txt +0 -385
- data/lib/bundler/man/bundle-lock.txt +0 -52
- data/lib/bundler/man/bundle-package.txt +0 -74
- data/lib/bundler/man/bundle-platform.txt +0 -57
- data/lib/bundler/man/bundle-update +0 -221
- data/lib/bundler/man/bundle-update.txt +0 -227
- data/lib/bundler/man/bundle.txt +0 -104
- data/lib/bundler/man/gemfile.5.txt +0 -636
- data/lib/bundler/postit_trampoline.rb +0 -68
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +0 -79
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +0 -112
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +0 -80
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +0 -4
- data/lib/bundler/vendor/postit/lib/postit.rb +0 -15
- data/lib/bundler/vendor/postit/lib/postit/environment.rb +0 -44
- data/lib/bundler/vendor/postit/lib/postit/installer.rb +0 -28
- data/lib/bundler/vendor/postit/lib/postit/parser.rb +0 -21
- data/lib/bundler/vendor/postit/lib/postit/setup.rb +0 -12
- data/lib/bundler/vendor/postit/lib/postit/version.rb +0 -3
data/lib/bundler/fetcher/base.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "bundler/fetcher/base"
|
3
4
|
require "bundler/worker"
|
4
5
|
|
5
6
|
module Bundler
|
7
|
+
autoload :CompactIndexClient, "bundler/compact_index_client"
|
8
|
+
|
6
9
|
class Fetcher
|
7
10
|
class CompactIndex < Base
|
8
|
-
require "bundler/vendor/compact_index_client/lib/compact_index_client"
|
9
|
-
|
10
11
|
def self.compact_index_request(method_name)
|
11
12
|
method = instance_method(method_name)
|
12
13
|
undef_method(method_name)
|
@@ -61,7 +62,8 @@ module Bundler
|
|
61
62
|
compact_index_request :fetch_spec
|
62
63
|
|
63
64
|
def available?
|
64
|
-
|
65
|
+
return nil unless SharedHelpers.md5_available?
|
66
|
+
user_home = Bundler.user_home
|
65
67
|
return nil unless user_home.directory? && user_home.writable?
|
66
68
|
# Read info file checksums out of /versions, so we can know if gems are up to date
|
67
69
|
fetch_uri.scheme != "file" && compact_index_client.update_and_parse_checksums!
|
@@ -95,7 +97,7 @@ module Bundler
|
|
95
97
|
def bundle_worker(func = nil)
|
96
98
|
@bundle_worker ||= begin
|
97
99
|
worker_name = "Compact Index (#{display_uri.host})"
|
98
|
-
Bundler::Worker.new(25, worker_name, func)
|
100
|
+
Bundler::Worker.new(Bundler.current_ruby.rbx? ? 1 : 25, worker_name, func)
|
99
101
|
end
|
100
102
|
@bundle_worker.tap do |worker|
|
101
103
|
worker.instance_variable_set(:@func, func) if func
|
@@ -114,7 +116,7 @@ module Bundler
|
|
114
116
|
def call(path, headers)
|
115
117
|
fetcher.downloader.fetch(fetcher.fetch_uri + path, headers)
|
116
118
|
rescue NetworkDownError => e
|
117
|
-
raise unless Bundler.
|
119
|
+
raise unless Bundler.feature_flag.allow_offline_install? && headers["If-None-Match"]
|
118
120
|
ui.warn "Using the cached data for the new index because of a network error: #{e}"
|
119
121
|
Net::HTTPNotModified.new(nil, nil, nil)
|
120
122
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "bundler/fetcher/base"
|
3
4
|
require "cgi"
|
4
5
|
|
@@ -6,7 +7,7 @@ module Bundler
|
|
6
7
|
class Fetcher
|
7
8
|
class Dependency < Base
|
8
9
|
def available?
|
9
|
-
fetch_uri.scheme != "file" && downloader.fetch(dependency_api_uri)
|
10
|
+
@available ||= fetch_uri.scheme != "file" && downloader.fetch(dependency_api_uri)
|
10
11
|
rescue NetworkDownError => e
|
11
12
|
raise HTTPError, e.message
|
12
13
|
rescue AuthenticationRequiredError
|
@@ -73,7 +74,7 @@ module Bundler
|
|
73
74
|
|
74
75
|
def dependency_api_uri(gem_names = [])
|
75
76
|
uri = fetch_uri + "api/v1/dependencies"
|
76
|
-
uri.query = "gems=#{CGI.escape(gem_names.join(","))}" if gem_names.any?
|
77
|
+
uri.query = "gems=#{CGI.escape(gem_names.sort.join(","))}" if gem_names.any?
|
77
78
|
uri
|
78
79
|
end
|
79
80
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Bundler
|
3
4
|
class Fetcher
|
4
5
|
class Downloader
|
@@ -10,10 +11,10 @@ module Bundler
|
|
10
11
|
@redirect_limit = redirect_limit
|
11
12
|
end
|
12
13
|
|
13
|
-
def fetch(uri,
|
14
|
+
def fetch(uri, headers = {}, counter = 0)
|
14
15
|
raise HTTPError, "Too many redirects" if counter >= redirect_limit
|
15
16
|
|
16
|
-
response = request(uri,
|
17
|
+
response = request(uri, headers)
|
17
18
|
Bundler.ui.debug("HTTP #{response.code} #{response.message} #{uri}")
|
18
19
|
|
19
20
|
case response
|
@@ -25,7 +26,12 @@ module Bundler
|
|
25
26
|
new_uri.user = uri.user
|
26
27
|
new_uri.password = uri.password
|
27
28
|
end
|
28
|
-
fetch(new_uri,
|
29
|
+
fetch(new_uri, headers, counter + 1)
|
30
|
+
when Net::HTTPRequestedRangeNotSatisfiable
|
31
|
+
new_headers = headers.dup
|
32
|
+
new_headers.delete("Range")
|
33
|
+
new_headers["Accept-Encoding"] = "gzip"
|
34
|
+
fetch(uri, new_headers)
|
29
35
|
when Net::HTTPRequestEntityTooLarge
|
30
36
|
raise FallbackError, response.body
|
31
37
|
when Net::HTTPUnauthorized
|
@@ -37,9 +43,11 @@ module Bundler
|
|
37
43
|
end
|
38
44
|
end
|
39
45
|
|
40
|
-
def request(uri,
|
46
|
+
def request(uri, headers)
|
47
|
+
validate_uri_scheme!(uri)
|
48
|
+
|
41
49
|
Bundler.ui.debug "HTTP GET #{uri}"
|
42
|
-
req = Net::HTTP::Get.new uri.request_uri,
|
50
|
+
req = Net::HTTP::Get.new uri.request_uri, headers
|
43
51
|
if uri.user
|
44
52
|
user = CGI.unescape(uri.user)
|
45
53
|
password = uri.password ? CGI.unescape(uri.password) : nil
|
@@ -56,11 +64,21 @@ module Bundler
|
|
56
64
|
case e.message
|
57
65
|
when /host down:/, /getaddrinfo: nodename nor servname provided/
|
58
66
|
raise NetworkDownError, "Could not reach host #{uri.host}. Check your network " \
|
59
|
-
|
67
|
+
"connection and try again."
|
60
68
|
else
|
61
|
-
raise HTTPError, "Network error while fetching #{URICredentialsFilter.credential_filtered_uri(uri)}"
|
69
|
+
raise HTTPError, "Network error while fetching #{URICredentialsFilter.credential_filtered_uri(uri)}" \
|
70
|
+
" (#{e})"
|
62
71
|
end
|
63
72
|
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def validate_uri_scheme!(uri)
|
77
|
+
return if uri.scheme =~ /\Ahttps?\z/
|
78
|
+
raise InvalidOption,
|
79
|
+
"The request uri `#{uri}` has an invalid scheme (`#{uri.scheme}`). " \
|
80
|
+
"Did you mean `http` or `https`?"
|
81
|
+
end
|
64
82
|
end
|
65
83
|
end
|
66
84
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "bundler/fetcher/base"
|
3
4
|
require "rubygems/remote_fetcher"
|
4
5
|
|
@@ -28,11 +29,11 @@ module Bundler
|
|
28
29
|
|
29
30
|
uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
|
30
31
|
if uri.scheme == "file"
|
31
|
-
Bundler.load_marshal
|
32
|
+
Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(uri.path))
|
32
33
|
elsif cached_spec_path = gemspec_cached_path(spec_file_name)
|
33
34
|
Bundler.load_gemspec(cached_spec_path)
|
34
35
|
else
|
35
|
-
Bundler.load_marshal
|
36
|
+
Bundler.load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
|
36
37
|
end
|
37
38
|
rescue MarshalError
|
38
39
|
raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# frozen_string_literal: true
|
3
|
+
|
3
4
|
require "cgi"
|
4
5
|
require "bundler/vendored_thor"
|
5
6
|
|
@@ -37,8 +38,15 @@ module Bundler
|
|
37
38
|
when Gem::InvalidSpecificationException
|
38
39
|
Bundler.ui.error error.message, :wrap => true
|
39
40
|
when SystemExit
|
41
|
+
when *[defined?(Java::JavaLang::OutOfMemoryError) && Java::JavaLang::OutOfMemoryError].compact
|
42
|
+
Bundler.ui.error "\nYour JVM has run out of memory, and Bundler cannot continue. " \
|
43
|
+
"You can decrease the amount of memory Bundler needs by removing gems from your Gemfile, " \
|
44
|
+
"especially large gems. (Gems can be as large as hundreds of megabytes, and Bundler has to read those files!). " \
|
45
|
+
"Alternatively, you can increase the amount of memory the JVM is able to use by running Bundler with jruby -J-Xmx1024m -S bundle (JRuby defaults to 500MB)."
|
40
46
|
else request_issue_report_for(error)
|
41
47
|
end
|
48
|
+
rescue
|
49
|
+
raise error
|
42
50
|
end
|
43
51
|
|
44
52
|
def exit_status(error)
|
@@ -53,25 +61,41 @@ module Bundler
|
|
53
61
|
def request_issue_report_for(e)
|
54
62
|
Bundler.ui.info <<-EOS.gsub(/^ {8}/, "")
|
55
63
|
--- ERROR REPORT TEMPLATE -------------------------------------------------------
|
56
|
-
|
64
|
+
# Error Report
|
65
|
+
|
66
|
+
## Questions
|
67
|
+
|
68
|
+
Please fill out answers to these questions, it'll help us figure out
|
69
|
+
why things are going wrong.
|
70
|
+
|
71
|
+
- **What did you do?**
|
57
72
|
|
58
73
|
I ran the command `#{$PROGRAM_NAME} #{ARGV.join(" ")}`
|
59
74
|
|
60
|
-
- What did you expect to happen
|
75
|
+
- **What did you expect to happen?**
|
61
76
|
|
62
77
|
I expected Bundler to...
|
63
78
|
|
64
|
-
- What happened instead
|
79
|
+
- **What happened instead?**
|
65
80
|
|
66
81
|
Instead, what happened was...
|
67
82
|
|
83
|
+
- **Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?**
|
84
|
+
|
85
|
+
I tried...
|
86
|
+
|
87
|
+
- **Have you read our issues document, https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md?**
|
88
|
+
|
89
|
+
...
|
68
90
|
|
69
|
-
|
91
|
+
## Backtrace
|
70
92
|
|
71
|
-
|
72
|
-
|
93
|
+
```
|
94
|
+
#{e.class}: #{e.message}
|
95
|
+
#{e.backtrace && e.backtrace.join("\n ").chomp}
|
96
|
+
```
|
73
97
|
|
74
|
-
#{Bundler::Env.
|
98
|
+
#{Bundler::Env.report}
|
75
99
|
--- TEMPLATE END ----------------------------------------------------------------
|
76
100
|
|
77
101
|
EOS
|
@@ -98,6 +122,8 @@ module Bundler
|
|
98
122
|
|
99
123
|
def self.with_friendly_errors
|
100
124
|
yield
|
125
|
+
rescue SignalException
|
126
|
+
raise
|
101
127
|
rescue Exception => e
|
102
128
|
FriendlyErrors.log_error(e)
|
103
129
|
exit FriendlyErrors.exit_status(e)
|
data/lib/bundler/gem_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "bundler/vendored_thor" unless defined?(Thor)
|
3
4
|
require "bundler"
|
4
5
|
|
@@ -50,8 +51,8 @@ module Bundler
|
|
50
51
|
install_gem(built_gem_path, :local)
|
51
52
|
end
|
52
53
|
|
53
|
-
desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to
|
54
|
-
"To prevent publishing in
|
54
|
+
desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to #{gem_push_host}\n" \
|
55
|
+
"To prevent publishing in RubyGems use `gem_push=no rake release`"
|
55
56
|
task "release", [:remote] => ["build", "release:guard_clean",
|
56
57
|
"release:source_control_push", "release:rubygem_push"] do
|
57
58
|
end
|
@@ -92,17 +93,14 @@ module Bundler
|
|
92
93
|
protected
|
93
94
|
|
94
95
|
def rubygem_push(path)
|
95
|
-
allowed_push_host = nil
|
96
96
|
gem_command = "gem push '#{path}'"
|
97
|
-
if
|
98
|
-
|
99
|
-
|
100
|
-
end
|
101
|
-
unless allowed_push_host || Pathname.new("~/.gem/credentials").expand_path.file?
|
97
|
+
gem_command += " --key #{gem_key}" if gem_key
|
98
|
+
gem_command += " --host #{allowed_push_host}" if allowed_push_host
|
99
|
+
unless allowed_push_host || Bundler.user_home.join(".gem/credentials").file?
|
102
100
|
raise "Your rubygems.org credentials aren't set. Run `gem push` to set them."
|
103
101
|
end
|
104
102
|
sh(gem_command)
|
105
|
-
Bundler.ui.confirm "Pushed #{name} #{version} to #{
|
103
|
+
Bundler.ui.confirm "Pushed #{name} #{version} to #{gem_push_host}"
|
106
104
|
end
|
107
105
|
|
108
106
|
def built_gem_path
|
@@ -115,6 +113,18 @@ module Bundler
|
|
115
113
|
Bundler.ui.confirm "Pushed git commits and tags."
|
116
114
|
end
|
117
115
|
|
116
|
+
def allowed_push_host
|
117
|
+
@gemspec.metadata["allowed_push_host"] if @gemspec.respond_to?(:metadata)
|
118
|
+
end
|
119
|
+
|
120
|
+
def gem_push_host
|
121
|
+
env_rubygems_host = ENV["RUBYGEMS_HOST"]
|
122
|
+
env_rubygems_host = nil if
|
123
|
+
env_rubygems_host && env_rubygems_host.empty?
|
124
|
+
|
125
|
+
allowed_push_host || env_rubygems_host || "rubygems.org"
|
126
|
+
end
|
127
|
+
|
118
128
|
def perform_git_push(options = "")
|
119
129
|
cmd = "git push #{options}"
|
120
130
|
out, code = sh_with_code(cmd)
|
@@ -143,7 +153,7 @@ module Bundler
|
|
143
153
|
sh "git tag -m \"Version #{version}\" #{version_tag}"
|
144
154
|
Bundler.ui.confirm "Tagged #{version_tag}."
|
145
155
|
yield if block_given?
|
146
|
-
rescue
|
156
|
+
rescue RuntimeError
|
147
157
|
Bundler.ui.error "Untagging #{version_tag} due to error."
|
148
158
|
sh_with_code "git tag -d #{version_tag}"
|
149
159
|
raise
|
@@ -181,8 +191,12 @@ module Bundler
|
|
181
191
|
end
|
182
192
|
end
|
183
193
|
|
194
|
+
def gem_key
|
195
|
+
Bundler.settings["gem.push_key"].to_s.downcase if Bundler.settings["gem.push_key"]
|
196
|
+
end
|
197
|
+
|
184
198
|
def gem_push?
|
185
|
-
!%w
|
199
|
+
!%w[n no nil false off 0].include?(ENV["gem_push"].to_s.downcase)
|
186
200
|
end
|
187
201
|
end
|
188
202
|
end
|
data/lib/bundler/gem_helpers.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Bundler
|
3
4
|
module GemHelpers
|
4
5
|
GENERIC_CACHE = {} # rubocop:disable MutableConstant
|
@@ -25,8 +26,76 @@ module Bundler
|
|
25
26
|
module_function :generic
|
26
27
|
|
27
28
|
def generic_local_platform
|
28
|
-
generic(
|
29
|
+
generic(Bundler.local_platform)
|
29
30
|
end
|
30
31
|
module_function :generic_local_platform
|
32
|
+
|
33
|
+
def platform_specificity_match(spec_platform, user_platform)
|
34
|
+
spec_platform = Gem::Platform.new(spec_platform)
|
35
|
+
return PlatformMatch::EXACT_MATCH if spec_platform == user_platform
|
36
|
+
return PlatformMatch::WORST_MATCH if spec_platform.nil? || spec_platform == Gem::Platform::RUBY || user_platform == Gem::Platform::RUBY
|
37
|
+
|
38
|
+
PlatformMatch.new(
|
39
|
+
PlatformMatch.os_match(spec_platform, user_platform),
|
40
|
+
PlatformMatch.cpu_match(spec_platform, user_platform),
|
41
|
+
PlatformMatch.platform_version_match(spec_platform, user_platform)
|
42
|
+
)
|
43
|
+
end
|
44
|
+
module_function :platform_specificity_match
|
45
|
+
|
46
|
+
def select_best_platform_match(specs, platform)
|
47
|
+
specs.select {|spec| spec.match_platform(platform) }.
|
48
|
+
min_by {|spec| platform_specificity_match(spec.platform, platform) }
|
49
|
+
end
|
50
|
+
module_function :select_best_platform_match
|
51
|
+
|
52
|
+
PlatformMatch = Struct.new(:os_match, :cpu_match, :platform_version_match)
|
53
|
+
class PlatformMatch
|
54
|
+
def <=>(other)
|
55
|
+
return nil unless other.is_a?(PlatformMatch)
|
56
|
+
|
57
|
+
m = os_match <=> other.os_match
|
58
|
+
return m unless m.zero?
|
59
|
+
|
60
|
+
m = cpu_match <=> other.cpu_match
|
61
|
+
return m unless m.zero?
|
62
|
+
|
63
|
+
m = platform_version_match <=> other.platform_version_match
|
64
|
+
m
|
65
|
+
end
|
66
|
+
|
67
|
+
EXACT_MATCH = new(-1, -1, -1).freeze
|
68
|
+
WORST_MATCH = new(1_000_000, 1_000_000, 1_000_000).freeze
|
69
|
+
|
70
|
+
def self.os_match(spec_platform, user_platform)
|
71
|
+
if spec_platform.os == user_platform.os
|
72
|
+
0
|
73
|
+
else
|
74
|
+
1
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.cpu_match(spec_platform, user_platform)
|
79
|
+
if spec_platform.cpu == user_platform.cpu
|
80
|
+
0
|
81
|
+
elsif spec_platform.cpu == "arm" && user_platform.cpu.to_s.start_with?("arm")
|
82
|
+
0
|
83
|
+
elsif spec_platform.cpu.nil? || spec_platform.cpu == "universal"
|
84
|
+
1
|
85
|
+
else
|
86
|
+
2
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.platform_version_match(spec_platform, user_platform)
|
91
|
+
if spec_platform.version == user_platform.version
|
92
|
+
0
|
93
|
+
elsif spec_platform.version.nil?
|
94
|
+
1
|
95
|
+
else
|
96
|
+
2
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
31
100
|
end
|
32
101
|
end
|
data/lib/bundler/gem_tasks.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Bundler
|
3
4
|
# This class contains all of the logic for determining the next version of a
|
4
5
|
# Gem to update to based on the requested level (patch, minor, major).
|
@@ -6,6 +7,8 @@ module Bundler
|
|
6
7
|
# available dependency versions as found in its index, before returning it to
|
7
8
|
# to the resolution engine to select the best version.
|
8
9
|
class GemVersionPromoter
|
10
|
+
DEBUG = ENV["DEBUG_RESOLVER"]
|
11
|
+
|
9
12
|
attr_reader :level, :locked_specs, :unlock_gems
|
10
13
|
|
11
14
|
# By default, strict is false, meaning every available version of a gem
|
@@ -21,6 +24,8 @@ module Bundler
|
|
21
24
|
# existing in the referenced source.
|
22
25
|
attr_accessor :strict
|
23
26
|
|
27
|
+
attr_accessor :prerelease_specified
|
28
|
+
|
24
29
|
# Given a list of locked_specs and a list of gems to unlock creates a
|
25
30
|
# GemVersionPromoter instance.
|
26
31
|
#
|
@@ -36,6 +41,7 @@ module Bundler
|
|
36
41
|
@locked_specs = locked_specs
|
37
42
|
@unlock_gems = unlock_gems
|
38
43
|
@sort_versions = {}
|
44
|
+
@prerelease_specified = {}
|
39
45
|
end
|
40
46
|
|
41
47
|
# @param value [Symbol] One of three Symbols: :major, :minor or :patch.
|
@@ -60,7 +66,7 @@ module Bundler
|
|
60
66
|
# @return [SpecGroup] A new instance of the SpecGroup Array sorted and
|
61
67
|
# possibly filtered.
|
62
68
|
def sort_versions(dep, spec_groups)
|
63
|
-
before_result = "before sort_versions: #{debug_format_result(dep, spec_groups).inspect}" if
|
69
|
+
before_result = "before sort_versions: #{debug_format_result(dep, spec_groups).inspect}" if DEBUG
|
64
70
|
|
65
71
|
@sort_versions[dep] ||= begin
|
66
72
|
gem_name = dep.name
|
@@ -74,7 +80,7 @@ module Bundler
|
|
74
80
|
else
|
75
81
|
sort_dep_specs(spec_groups, locked_spec)
|
76
82
|
end.tap do |specs|
|
77
|
-
if
|
83
|
+
if DEBUG
|
78
84
|
STDERR.puts before_result
|
79
85
|
STDERR.puts " after sort_versions: #{debug_format_result(dep, specs).inspect}"
|
80
86
|
end
|
@@ -120,6 +126,15 @@ module Bundler
|
|
120
126
|
result = spec_groups.sort do |a, b|
|
121
127
|
@a_ver = a.version
|
122
128
|
@b_ver = b.version
|
129
|
+
|
130
|
+
unless @prerelease_specified[@gem_name]
|
131
|
+
a_pre = @a_ver.prerelease?
|
132
|
+
b_pre = @b_ver.prerelease?
|
133
|
+
|
134
|
+
next -1 if a_pre && !b_pre
|
135
|
+
next 1 if b_pre && !a_pre
|
136
|
+
end
|
137
|
+
|
123
138
|
if major?
|
124
139
|
@a_ver <=> @b_ver
|
125
140
|
elsif either_version_older_than_locked
|