bundler 1.15.1 → 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 +320 -0
- data/README.md +17 -8
- data/bundler.gemspec +25 -9
- data/exe/bundle +1 -6
- data/exe/bundle_ruby +4 -3
- data/lib/bundler/build_metadata.rb +53 -0
- data/lib/bundler/capistrano.rb +5 -0
- data/lib/bundler/cli/add.rb +15 -6
- data/lib/bundler/cli/binstubs.rb +17 -9
- data/lib/bundler/cli/cache.rb +5 -4
- data/lib/bundler/cli/check.rb +3 -5
- data/lib/bundler/cli/clean.rb +5 -6
- data/lib/bundler/cli/common.rb +11 -2
- data/lib/bundler/cli/config.rb +2 -1
- data/lib/bundler/cli/console.rb +2 -1
- data/lib/bundler/cli/doctor.rb +48 -1
- data/lib/bundler/cli/exec.rb +6 -5
- data/lib/bundler/cli/gem.rb +13 -8
- data/lib/bundler/cli/info.rb +0 -1
- data/lib/bundler/cli/init.rb +18 -6
- data/lib/bundler/cli/inject.rb +1 -0
- data/lib/bundler/cli/install.rb +64 -77
- data/lib/bundler/cli/issue.rb +1 -1
- data/lib/bundler/cli/list.rb +58 -0
- data/lib/bundler/cli/lock.rb +0 -1
- data/lib/bundler/cli/open.rb +2 -2
- data/lib/bundler/cli/outdated.rb +20 -9
- data/lib/bundler/cli/package.rb +9 -6
- data/lib/bundler/cli/platform.rb +1 -0
- data/lib/bundler/cli/plugin.rb +1 -0
- data/lib/bundler/cli/pristine.rb +20 -6
- data/lib/bundler/cli/remove.rb +18 -0
- data/lib/bundler/cli/show.rb +0 -1
- data/lib/bundler/cli/update.rb +35 -7
- data/lib/bundler/cli/viz.rb +4 -0
- data/lib/bundler/cli.rb +234 -90
- data/lib/bundler/compact_index_client/cache.rb +1 -2
- data/lib/bundler/compact_index_client/updater.rb +35 -7
- data/lib/bundler/compact_index_client.rb +1 -0
- data/lib/bundler/compatibility_guard.rb +14 -0
- data/lib/bundler/constants.rb +1 -0
- data/lib/bundler/current_ruby.rb +13 -5
- data/lib/bundler/definition.rb +192 -139
- data/lib/bundler/dep_proxy.rb +3 -1
- data/lib/bundler/dependency.rb +9 -9
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/deprecate.rb +15 -3
- data/lib/bundler/dsl.rb +115 -64
- data/lib/bundler/endpoint_specification.rb +10 -1
- data/lib/bundler/env.rb +90 -29
- data/lib/bundler/environment_preserver.rb +27 -6
- data/lib/bundler/errors.rb +1 -0
- data/lib/bundler/feature_flag.rb +46 -4
- data/lib/bundler/fetcher/base.rb +1 -0
- data/lib/bundler/fetcher/compact_index.rb +2 -11
- data/lib/bundler/fetcher/dependency.rb +2 -1
- data/lib/bundler/fetcher/downloader.rb +11 -5
- data/lib/bundler/fetcher/index.rb +3 -2
- data/lib/bundler/fetcher.rb +18 -11
- data/lib/bundler/friendly_errors.rb +6 -1
- data/lib/bundler/gem_helper.rb +19 -10
- data/lib/bundler/gem_helpers.rb +1 -0
- 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 +1 -0
- data/lib/bundler/graph.rb +1 -0
- data/lib/bundler/index.rb +8 -8
- data/lib/bundler/injector.rb +192 -30
- data/lib/bundler/inline.rb +10 -10
- data/lib/bundler/installer/gem_installer.rb +12 -2
- data/lib/bundler/installer/parallel_installer.rb +78 -42
- data/lib/bundler/installer/standalone.rb +1 -0
- data/lib/bundler/installer.rb +138 -53
- data/lib/bundler/lazy_specification.rb +3 -2
- data/lib/bundler/lockfile_generator.rb +95 -0
- data/lib/bundler/lockfile_parser.rb +10 -4
- data/lib/bundler/match_platform.rb +1 -0
- data/lib/bundler/mirror.rb +8 -5
- data/lib/bundler/plugin/api/source.rb +9 -2
- data/lib/bundler/plugin/events.rb +61 -0
- data/lib/bundler/plugin/index.rb +7 -2
- data/lib/bundler/plugin/installer.rb +7 -6
- data/lib/bundler/plugin/source_list.rb +7 -8
- data/lib/bundler/plugin.rb +13 -5
- data/lib/bundler/process_lock.rb +24 -0
- data/lib/bundler/psyched_yaml.rb +10 -0
- data/lib/bundler/remote_specification.rb +10 -1
- data/lib/bundler/resolver/spec_group.rb +106 -0
- data/lib/bundler/resolver.rb +158 -195
- data/lib/bundler/retry.rb +1 -0
- data/lib/bundler/ruby_dsl.rb +1 -0
- data/lib/bundler/ruby_version.rb +2 -1
- data/lib/bundler/rubygems_ext.rb +5 -4
- data/lib/bundler/rubygems_gem_installer.rb +31 -1
- data/lib/bundler/rubygems_integration.rb +71 -32
- data/lib/bundler/runtime.rb +11 -9
- data/lib/bundler/settings/validator.rb +102 -0
- data/lib/bundler/settings.rb +213 -86
- data/lib/bundler/setup.rb +4 -7
- data/lib/bundler/shared_helpers.rb +131 -26
- data/lib/bundler/similarity_detector.rb +1 -0
- data/lib/bundler/source/gemspec.rb +1 -0
- data/lib/bundler/source/git/git_proxy.rb +21 -11
- data/lib/bundler/source/git.rb +24 -19
- data/lib/bundler/source/metadata.rb +62 -0
- data/lib/bundler/source/path/installer.rb +2 -0
- data/lib/bundler/source/path.rb +11 -7
- data/lib/bundler/source/rubygems/remote.rb +8 -2
- data/lib/bundler/source/rubygems.rb +161 -84
- data/lib/bundler/source.rb +36 -0
- data/lib/bundler/source_list.rb +75 -15
- data/lib/bundler/spec_set.rb +12 -6
- data/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
- data/lib/bundler/stub_specification.rb +1 -0
- data/lib/bundler/templates/.document +1 -0
- data/lib/bundler/templates/Executable +12 -0
- data/lib/bundler/templates/Executable.bundler +105 -0
- data/lib/bundler/templates/Gemfile +3 -0
- data/lib/bundler/templates/gems.rb +8 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +2 -0
- data/lib/bundler/templates/newgem/README.md.tt +1 -1
- data/lib/bundler/templates/newgem/gitignore.tt +0 -1
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +1 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +12 -3
- data/lib/bundler/templates/newgem/rspec.tt +1 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +0 -2
- data/lib/bundler/templates/newgem/{.travis.yml.tt → travis.yml.tt} +2 -0
- data/lib/bundler/ui/rg_proxy.rb +1 -0
- data/lib/bundler/ui/shell.rb +17 -4
- data/lib/bundler/ui/silent.rb +1 -0
- data/lib/bundler/ui.rb +1 -0
- 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/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/action.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +15 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +3 -2
- 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 +491 -148
- 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/molinillo/lib/molinillo.rb +2 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +3 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +9 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +45 -8
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +9 -3
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -3
- data/lib/bundler/vendor/thor/lib/thor/base.rb +27 -4
- data/lib/bundler/vendor/thor/lib/thor/command.rb +9 -7
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +12 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +2 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +5 -5
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +6 -5
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +6 -4
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +10 -9
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +25 -8
- data/lib/bundler/vendored_fileutils.rb +9 -0
- data/lib/bundler/vendored_molinillo.rb +1 -0
- data/lib/bundler/vendored_persistent.rb +35 -0
- data/lib/bundler/vendored_thor.rb +1 -0
- data/lib/bundler/version.rb +6 -2
- data/lib/bundler/version_ranges.rb +1 -0
- data/lib/bundler/vlad.rb +5 -0
- data/lib/bundler/worker.rb +1 -0
- data/lib/bundler/yaml_serializer.rb +3 -3
- data/lib/bundler.rb +86 -52
- data/man/bundle-add.1 +18 -3
- data/man/bundle-add.1.txt +26 -14
- data/man/bundle-add.ronn +13 -2
- data/man/bundle-binstubs.1 +11 -1
- data/man/bundle-binstubs.1.txt +33 -18
- data/man/bundle-binstubs.ronn +15 -1
- data/man/bundle-check.1 +4 -4
- data/man/bundle-check.1.txt +15 -14
- data/man/bundle-check.ronn +3 -3
- data/man/bundle-clean.1 +1 -1
- data/man/bundle-clean.1.txt +10 -10
- data/man/bundle-config.1 +129 -29
- data/man/bundle-config.1.txt +285 -174
- data/man/bundle-config.ronn +167 -88
- data/man/bundle-doctor.1 +44 -0
- data/man/bundle-doctor.1.txt +44 -0
- data/man/bundle-doctor.ronn +33 -0
- data/man/bundle-exec.1 +6 -3
- data/man/bundle-exec.1.txt +78 -71
- data/man/bundle-exec.ronn +10 -3
- data/man/bundle-gem.1 +4 -4
- data/man/bundle-gem.1.txt +41 -40
- data/man/bundle-gem.ronn +3 -2
- data/man/bundle-info.1 +1 -1
- data/man/bundle-info.1.txt +8 -8
- data/man/bundle-init.1 +9 -4
- data/man/bundle-init.1.txt +23 -13
- data/man/bundle-init.ronn +15 -4
- data/man/bundle-inject.1 +4 -4
- data/man/bundle-inject.1.txt +10 -10
- data/man/bundle-inject.ronn +3 -3
- data/man/bundle-install.1 +31 -28
- data/man/bundle-install.1.txt +205 -194
- data/man/bundle-install.ronn +44 -35
- data/man/bundle-list.1 +50 -0
- data/man/bundle-list.1.txt +43 -0
- data/man/bundle-list.ronn +33 -0
- data/man/bundle-lock.1 +1 -1
- data/man/bundle-lock.1.txt +47 -47
- data/man/bundle-lock.ronn +1 -1
- data/man/bundle-open.1 +1 -1
- data/man/bundle-open.1.txt +7 -7
- data/man/bundle-outdated.1 +7 -3
- data/man/bundle-outdated.1.txt +40 -36
- data/man/bundle-outdated.ronn +6 -2
- data/man/bundle-package.1 +6 -3
- data/man/bundle-package.1.txt +44 -39
- data/man/bundle-package.ronn +7 -2
- data/man/bundle-platform.1 +1 -1
- data/man/bundle-platform.1.txt +13 -13
- data/man/bundle-pristine.1 +21 -3
- data/man/bundle-pristine.1.txt +33 -10
- data/man/bundle-pristine.ronn +24 -3
- 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 +3 -3
- data/man/bundle-show.1.txt +14 -12
- data/man/bundle-show.ronn +3 -2
- data/man/bundle-update.1 +13 -9
- data/man/bundle-update.1.txt +133 -130
- data/man/bundle-update.ronn +21 -17
- data/man/bundle-viz.1 +7 -7
- data/man/bundle-viz.1.txt +17 -15
- data/man/bundle-viz.ronn +6 -6
- data/man/bundle.1 +31 -32
- data/man/bundle.1.txt +63 -75
- data/man/bundle.ronn +35 -47
- data/man/gemfile.5 +44 -8
- data/man/gemfile.5.ronn +54 -8
- data/man/gemfile.5.txt +218 -165
- data/man/index.txt +25 -15
- metadata +36 -44
- data/.codeclimate.yml +0 -25
- data/.gitignore +0 -18
- data/.rspec +0 -3
- data/.rubocop.yml +0 -131
- data/.rubocop_todo.yml +0 -418
- data/.travis.yml +0 -122
- data/CODE_OF_CONDUCT.md +0 -42
- data/CONTRIBUTING.md +0 -17
- data/Rakefile +0 -346
- data/bin/rake +0 -19
- data/bin/rspec +0 -15
- data/bin/rubocop +0 -17
- data/bin/with_rubygems +0 -39
- data/doc/README.md +0 -30
- data/doc/TROUBLESHOOTING.md +0 -64
- data/doc/contributing/BUG_TRIAGE.md +0 -36
- data/doc/contributing/COMMUNITY.md +0 -13
- data/doc/contributing/GETTING_HELP.md +0 -11
- data/doc/contributing/HOW_YOU_CAN_HELP.md +0 -27
- data/doc/contributing/ISSUES.md +0 -51
- data/doc/contributing/README.md +0 -38
- data/doc/development/NEW_FEATURES.md +0 -10
- data/doc/development/PULL_REQUESTS.md +0 -40
- data/doc/development/README.md +0 -19
- data/doc/development/RELEASING.md +0 -9
- data/doc/development/SETUP.md +0 -29
- data/doc/documentation/README.md +0 -29
- data/doc/documentation/VISION.md +0 -26
- data/doc/documentation/WRITING.md +0 -54
- data/lib/bundler/postit_trampoline.rb +0 -73
- 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/vendor/postit/lib/postit.rb +0 -15
- data/task/release.rake +0 -116
@@ -1,12 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Bundler
|
3
4
|
class EnvironmentPreserver
|
5
|
+
INTENTIONALLY_NIL = "BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL".freeze
|
6
|
+
BUNDLER_KEYS = %w[
|
7
|
+
BUNDLE_BIN_PATH
|
8
|
+
BUNDLE_GEMFILE
|
9
|
+
BUNDLER_ORIG_MANPATH
|
10
|
+
BUNDLER_VERSION
|
11
|
+
GEM_HOME
|
12
|
+
GEM_PATH
|
13
|
+
MANPATH
|
14
|
+
PATH
|
15
|
+
RB_USER_INSTALL
|
16
|
+
RUBYLIB
|
17
|
+
RUBYOPT
|
18
|
+
].map(&:freeze).freeze
|
19
|
+
BUNDLER_PREFIX = "BUNDLER_ORIG_".freeze
|
20
|
+
|
4
21
|
# @param env [ENV]
|
5
22
|
# @param keys [Array<String>]
|
6
23
|
def initialize(env, keys)
|
7
24
|
@original = env.to_hash
|
8
25
|
@keys = keys
|
9
|
-
@prefix =
|
26
|
+
@prefix = BUNDLER_PREFIX
|
10
27
|
end
|
11
28
|
|
12
29
|
# @return [Hash]
|
@@ -14,9 +31,10 @@ module Bundler
|
|
14
31
|
env = @original.clone
|
15
32
|
@keys.each do |key|
|
16
33
|
value = env[key]
|
17
|
-
|
18
|
-
|
19
|
-
|
34
|
+
if !value.nil? && !value.empty?
|
35
|
+
env[@prefix + key] ||= value
|
36
|
+
elsif value.nil?
|
37
|
+
env[@prefix + key] ||= INTENTIONALLY_NIL
|
20
38
|
end
|
21
39
|
end
|
22
40
|
env
|
@@ -27,10 +45,13 @@ module Bundler
|
|
27
45
|
env = @original.clone
|
28
46
|
@keys.each do |key|
|
29
47
|
value_original = env[@prefix + key]
|
30
|
-
|
48
|
+
next if value_original.nil? || value_original.empty?
|
49
|
+
if value_original == INTENTIONALLY_NIL
|
50
|
+
env.delete(key)
|
51
|
+
else
|
31
52
|
env[key] = value_original
|
32
|
-
env.delete(@prefix + key)
|
33
53
|
end
|
54
|
+
env.delete(@prefix + key)
|
34
55
|
end
|
35
56
|
env
|
36
57
|
end
|
data/lib/bundler/errors.rb
CHANGED
data/lib/bundler/feature_flag.rb
CHANGED
@@ -1,22 +1,66 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Bundler
|
3
4
|
class FeatureFlag
|
4
5
|
def self.settings_flag(flag, &default)
|
5
6
|
unless Bundler::Settings::BOOL_KEYS.include?(flag.to_s)
|
6
7
|
raise "Cannot use `#{flag}` as a settings feature flag since it isn't a bool key"
|
7
8
|
end
|
8
|
-
|
9
|
-
|
9
|
+
|
10
|
+
settings_method("#{flag}?", flag, &default)
|
11
|
+
end
|
12
|
+
private_class_method :settings_flag
|
13
|
+
|
14
|
+
def self.settings_option(key, &default)
|
15
|
+
settings_method(key, key, &default)
|
16
|
+
end
|
17
|
+
private_class_method :settings_option
|
18
|
+
|
19
|
+
def self.settings_method(name, key, &default)
|
20
|
+
define_method(name) do
|
21
|
+
value = Bundler.settings[key]
|
10
22
|
value = instance_eval(&default) if value.nil? && !default.nil?
|
11
23
|
value
|
12
24
|
end
|
13
25
|
end
|
26
|
+
private_class_method :settings_method
|
14
27
|
|
15
28
|
(1..10).each {|v| define_method("bundler_#{v}_mode?") { major_version >= v } }
|
16
29
|
|
30
|
+
settings_flag(:allow_bundler_dependency_conflicts) { bundler_2_mode? }
|
17
31
|
settings_flag(:allow_offline_install) { bundler_2_mode? }
|
32
|
+
settings_flag(:auto_clean_without_path) { bundler_2_mode? }
|
33
|
+
settings_flag(:auto_config_jobs) { bundler_2_mode? }
|
34
|
+
settings_flag(:cache_all) { bundler_2_mode? }
|
35
|
+
settings_flag(:cache_command_is_package) { bundler_2_mode? }
|
36
|
+
settings_flag(:console_command) { !bundler_2_mode? }
|
37
|
+
settings_flag(:default_install_uses_path) { bundler_2_mode? }
|
38
|
+
settings_flag(:deployment_means_frozen) { bundler_2_mode? }
|
39
|
+
settings_flag(:disable_multisource) { bundler_2_mode? }
|
40
|
+
settings_flag(:error_on_stderr) { bundler_2_mode? }
|
41
|
+
settings_flag(:forget_cli_options) { bundler_2_mode? }
|
42
|
+
settings_flag(:global_path_appends_ruby_scope) { bundler_2_mode? }
|
43
|
+
settings_flag(:global_gem_cache) { bundler_2_mode? }
|
44
|
+
settings_flag(:init_gems_rb) { bundler_2_mode? }
|
45
|
+
settings_flag(:list_command) { bundler_2_mode? }
|
46
|
+
settings_flag(:lockfile_uses_separate_rubygems_sources) { bundler_2_mode? }
|
18
47
|
settings_flag(:only_update_to_newer_versions) { bundler_2_mode? }
|
48
|
+
settings_flag(:path_relative_to_cwd) { bundler_2_mode? }
|
19
49
|
settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
|
50
|
+
settings_flag(:prefer_gems_rb) { bundler_2_mode? }
|
51
|
+
settings_flag(:print_only_version_number) { bundler_2_mode? }
|
52
|
+
settings_flag(:setup_makes_kernel_gem_public) { !bundler_2_mode? }
|
53
|
+
settings_flag(:skip_default_git_sources) { bundler_2_mode? }
|
54
|
+
settings_flag(:specific_platform) { bundler_2_mode? }
|
55
|
+
settings_flag(:suppress_install_using_messages) { bundler_2_mode? }
|
56
|
+
settings_flag(:unlock_source_unlocks_spec) { !bundler_2_mode? }
|
57
|
+
settings_flag(:update_requires_all_flag) { bundler_2_mode? }
|
58
|
+
settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_2_mode? }
|
59
|
+
settings_flag(:viz_command) { !bundler_2_mode? }
|
60
|
+
|
61
|
+
settings_option(:default_cli_command) { bundler_2_mode? ? :cli_help : :install }
|
62
|
+
|
63
|
+
settings_method(:github_https?, "github.https") { bundler_2_mode? }
|
20
64
|
|
21
65
|
def initialize(bundler_version)
|
22
66
|
@bundler_version = Gem::Version.create(bundler_version)
|
@@ -26,7 +70,5 @@ module Bundler
|
|
26
70
|
@bundler_version.segments.first
|
27
71
|
end
|
28
72
|
private :major_version
|
29
|
-
|
30
|
-
class << self; private :settings_flag; end
|
31
73
|
end
|
32
74
|
end
|
data/lib/bundler/fetcher/base.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "bundler/fetcher/base"
|
3
4
|
require "bundler/worker"
|
4
5
|
|
@@ -61,7 +62,7 @@ module Bundler
|
|
61
62
|
compact_index_request :fetch_spec
|
62
63
|
|
63
64
|
def available?
|
64
|
-
return nil unless md5_available?
|
65
|
+
return nil unless SharedHelpers.md5_available?
|
65
66
|
user_home = Bundler.user_home
|
66
67
|
return nil unless user_home.directory? && user_home.writable?
|
67
68
|
# Read info file checksums out of /versions, so we can know if gems are up to date
|
@@ -120,16 +121,6 @@ module Bundler
|
|
120
121
|
Net::HTTPNotModified.new(nil, nil, nil)
|
121
122
|
end
|
122
123
|
end
|
123
|
-
|
124
|
-
def md5_available?
|
125
|
-
require "openssl"
|
126
|
-
OpenSSL::Digest::MD5.digest("")
|
127
|
-
true
|
128
|
-
rescue LoadError
|
129
|
-
true
|
130
|
-
rescue OpenSSL::Digest::DigestError
|
131
|
-
false
|
132
|
-
end
|
133
124
|
end
|
134
125
|
end
|
135
126
|
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
|
@@ -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,11 +43,11 @@ module Bundler
|
|
37
43
|
end
|
38
44
|
end
|
39
45
|
|
40
|
-
def request(uri,
|
46
|
+
def request(uri, headers)
|
41
47
|
validate_uri_scheme!(uri)
|
42
48
|
|
43
49
|
Bundler.ui.debug "HTTP GET #{uri}"
|
44
|
-
req = Net::HTTP::Get.new uri.request_uri,
|
50
|
+
req = Net::HTTP::Get.new uri.request_uri, headers
|
45
51
|
if uri.user
|
46
52
|
user = CGI.unescape(uri.user)
|
47
53
|
password = uri.password ? CGI.unescape(uri.password) : nil
|
@@ -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" \
|
data/lib/bundler/fetcher.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "bundler/vendored_persistent"
|
3
4
|
require "cgi"
|
4
5
|
require "securerandom"
|
@@ -95,11 +96,11 @@ module Bundler
|
|
95
96
|
|
96
97
|
uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
|
97
98
|
if uri.scheme == "file"
|
98
|
-
Bundler.load_marshal
|
99
|
+
Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(uri.path))
|
99
100
|
elsif cached_spec_path = gemspec_cached_path(spec_file_name)
|
100
101
|
Bundler.load_gemspec(cached_spec_path)
|
101
102
|
else
|
102
|
-
Bundler.load_marshal
|
103
|
+
Bundler.load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
|
103
104
|
end
|
104
105
|
rescue MarshalError
|
105
106
|
raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \
|
@@ -177,7 +178,7 @@ module Bundler
|
|
177
178
|
# engine_version raises on unknown engines
|
178
179
|
engine_version = begin
|
179
180
|
ruby.engine_versions
|
180
|
-
rescue
|
181
|
+
rescue RuntimeError
|
181
182
|
"???"
|
182
183
|
end
|
183
184
|
agent << " #{ruby.engine}/#{ruby.versions_string(engine_version)}"
|
@@ -237,7 +238,7 @@ module Bundler
|
|
237
238
|
Bundler.settings[:ssl_client_cert]
|
238
239
|
raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
|
239
240
|
|
240
|
-
con =
|
241
|
+
con = PersistentHTTP.new "bundler", :ENV
|
241
242
|
if gem_proxy = Bundler.rubygems.configuration[:http_proxy]
|
242
243
|
con.proxy = URI.parse(gem_proxy) if gem_proxy != :no_proxy
|
243
244
|
end
|
@@ -248,8 +249,11 @@ module Bundler
|
|
248
249
|
con.cert_store = bundler_cert_store
|
249
250
|
end
|
250
251
|
|
251
|
-
|
252
|
-
|
252
|
+
ssl_client_cert = Bundler.settings[:ssl_client_cert] ||
|
253
|
+
(Bundler.rubygems.configuration.ssl_client_cert if
|
254
|
+
Bundler.rubygems.configuration.respond_to?(:ssl_client_cert))
|
255
|
+
if ssl_client_cert
|
256
|
+
pem = File.read(ssl_client_cert)
|
253
257
|
con.cert = OpenSSL::X509::Certificate.new(pem)
|
254
258
|
con.key = OpenSSL::PKey::RSA.new(pem)
|
255
259
|
end
|
@@ -273,16 +277,19 @@ module Bundler
|
|
273
277
|
Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH,
|
274
278
|
Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EAGAIN,
|
275
279
|
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError,
|
276
|
-
|
280
|
+
PersistentHTTP::Error, Zlib::BufError, Errno::EHOSTUNREACH
|
277
281
|
].freeze
|
278
282
|
|
279
283
|
def bundler_cert_store
|
280
284
|
store = OpenSSL::X509::Store.new
|
281
|
-
|
282
|
-
|
283
|
-
|
285
|
+
ssl_ca_cert = Bundler.settings[:ssl_ca_cert] ||
|
286
|
+
(Bundler.rubygems.configuration.ssl_ca_cert if
|
287
|
+
Bundler.rubygems.configuration.respond_to?(:ssl_ca_cert))
|
288
|
+
if ssl_ca_cert
|
289
|
+
if File.directory? ssl_ca_cert
|
290
|
+
store.add_path ssl_ca_cert
|
284
291
|
else
|
285
|
-
store.add_file
|
292
|
+
store.add_file ssl_ca_cert
|
286
293
|
end
|
287
294
|
else
|
288
295
|
store.set_default_paths
|
@@ -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
|
|
@@ -44,6 +45,8 @@ module Bundler
|
|
44
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)."
|
45
46
|
else request_issue_report_for(error)
|
46
47
|
end
|
48
|
+
rescue
|
49
|
+
raise error
|
47
50
|
end
|
48
51
|
|
49
52
|
def exit_status(error)
|
@@ -92,7 +95,7 @@ module Bundler
|
|
92
95
|
#{e.backtrace && e.backtrace.join("\n ").chomp}
|
93
96
|
```
|
94
97
|
|
95
|
-
#{Bundler::Env.
|
98
|
+
#{Bundler::Env.report}
|
96
99
|
--- TEMPLATE END ----------------------------------------------------------------
|
97
100
|
|
98
101
|
EOS
|
@@ -119,6 +122,8 @@ module Bundler
|
|
119
122
|
|
120
123
|
def self.with_friendly_errors
|
121
124
|
yield
|
125
|
+
rescue SignalException
|
126
|
+
raise
|
122
127
|
rescue Exception => e
|
123
128
|
FriendlyErrors.log_error(e)
|
124
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,18 +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
97
|
gem_command += " --key #{gem_key}" if gem_key
|
98
|
-
if
|
99
|
-
allowed_push_host = @gemspec.metadata["allowed_push_host"]
|
100
|
-
gem_command += " --host #{allowed_push_host}" if allowed_push_host
|
101
|
-
end
|
98
|
+
gem_command += " --host #{allowed_push_host}" if allowed_push_host
|
102
99
|
unless allowed_push_host || Bundler.user_home.join(".gem/credentials").file?
|
103
100
|
raise "Your rubygems.org credentials aren't set. Run `gem push` to set them."
|
104
101
|
end
|
105
102
|
sh(gem_command)
|
106
|
-
Bundler.ui.confirm "Pushed #{name} #{version} to #{
|
103
|
+
Bundler.ui.confirm "Pushed #{name} #{version} to #{gem_push_host}"
|
107
104
|
end
|
108
105
|
|
109
106
|
def built_gem_path
|
@@ -116,6 +113,18 @@ module Bundler
|
|
116
113
|
Bundler.ui.confirm "Pushed git commits and tags."
|
117
114
|
end
|
118
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
|
+
|
119
128
|
def perform_git_push(options = "")
|
120
129
|
cmd = "git push #{options}"
|
121
130
|
out, code = sh_with_code(cmd)
|
@@ -144,7 +153,7 @@ module Bundler
|
|
144
153
|
sh "git tag -m \"Version #{version}\" #{version_tag}"
|
145
154
|
Bundler.ui.confirm "Tagged #{version_tag}."
|
146
155
|
yield if block_given?
|
147
|
-
rescue
|
156
|
+
rescue RuntimeError
|
148
157
|
Bundler.ui.error "Untagging #{version_tag} due to error."
|
149
158
|
sh_with_code "git tag -d #{version_tag}"
|
150
159
|
raise
|
@@ -187,7 +196,7 @@ module Bundler
|
|
187
196
|
end
|
188
197
|
|
189
198
|
def gem_push?
|
190
|
-
!%w
|
199
|
+
!%w[n no nil false off 0].include?(ENV["gem_push"].to_s.downcase)
|
191
200
|
end
|
192
201
|
end
|
193
202
|
end
|
data/lib/bundler/gem_helpers.rb
CHANGED
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
|
data/lib/bundler/gemdeps.rb
CHANGED
data/lib/bundler/graph.rb
CHANGED
data/lib/bundler/index.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "set"
|
3
4
|
|
4
5
|
module Bundler
|
@@ -111,6 +112,13 @@ module Bundler
|
|
111
112
|
spec_sets.values.each(&blk)
|
112
113
|
end
|
113
114
|
sources.each {|s| s.each(&blk) }
|
115
|
+
self
|
116
|
+
end
|
117
|
+
|
118
|
+
def spec_names
|
119
|
+
names = specs.keys + sources.map(&:spec_names)
|
120
|
+
names.uniq!
|
121
|
+
names
|
114
122
|
end
|
115
123
|
|
116
124
|
# returns a list of the dependencies
|
@@ -191,14 +199,6 @@ module Bundler
|
|
191
199
|
end
|
192
200
|
end
|
193
201
|
|
194
|
-
wants_prerelease = dependency.requirement.prerelease?
|
195
|
-
wants_prerelease ||= base && base.any? {|base_spec| base_spec.version.prerelease? }
|
196
|
-
only_prerelease = specs.all? {|spec| spec.version.prerelease? }
|
197
|
-
|
198
|
-
unless wants_prerelease || only_prerelease
|
199
|
-
found.reject! {|spec| spec.version.prerelease? }
|
200
|
-
end
|
201
|
-
|
202
202
|
found
|
203
203
|
end
|
204
204
|
end
|