bundler 1.17.0.pre.2 → 2.1.0.pre.2
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 +4 -4
- data/CHANGELOG.md +769 -570
- data/LICENSE.md +18 -19
- data/README.md +9 -8
- data/bundler.gemspec +12 -23
- data/exe/bundle +19 -3
- data/lib/bundler.rb +121 -68
- data/lib/bundler/build_metadata.rb +14 -7
- data/lib/bundler/capistrano.rb +4 -4
- data/lib/bundler/cli.rb +129 -121
- data/lib/bundler/cli/add.rb +27 -16
- data/lib/bundler/cli/common.rb +11 -12
- data/lib/bundler/cli/config.rb +161 -86
- data/lib/bundler/cli/console.rb +1 -1
- data/lib/bundler/cli/doctor.rb +4 -4
- data/lib/bundler/cli/exec.rb +4 -9
- data/lib/bundler/cli/gem.rb +5 -5
- data/lib/bundler/cli/info.rb +17 -5
- data/lib/bundler/cli/init.rb +1 -1
- data/lib/bundler/cli/install.rb +11 -10
- data/lib/bundler/cli/issue.rb +3 -3
- data/lib/bundler/cli/open.rb +10 -6
- data/lib/bundler/cli/outdated.rb +85 -81
- data/lib/bundler/cli/package.rb +8 -9
- data/lib/bundler/cli/plugin.rb +9 -2
- data/lib/bundler/cli/pristine.rb +1 -1
- data/lib/bundler/cli/show.rb +1 -1
- data/lib/bundler/cli/update.rb +31 -11
- data/lib/bundler/compact_index_client.rb +25 -9
- data/lib/bundler/compact_index_client/updater.rb +2 -6
- data/lib/bundler/current_ruby.rb +9 -7
- data/lib/bundler/definition.rb +35 -26
- data/lib/bundler/dependency.rb +16 -4
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/dsl.rb +15 -39
- data/lib/bundler/env.rb +8 -13
- data/lib/bundler/environment_preserver.rb +0 -1
- data/lib/bundler/feature_flag.rb +23 -32
- data/lib/bundler/fetcher.rb +14 -11
- data/lib/bundler/fetcher/compact_index.rb +26 -12
- data/lib/bundler/fetcher/dependency.rb +1 -1
- data/lib/bundler/fetcher/downloader.rb +4 -1
- data/lib/bundler/fetcher/index.rb +4 -2
- data/lib/bundler/friendly_errors.rb +4 -5
- data/lib/bundler/gem_helper.rb +39 -24
- data/lib/bundler/gem_helpers.rb +2 -4
- data/lib/bundler/gem_tasks.rb +1 -1
- data/lib/bundler/gem_version_promoter.rb +3 -3
- data/lib/bundler/graph.rb +2 -2
- data/lib/bundler/injector.rb +10 -8
- data/lib/bundler/inline.rb +19 -18
- data/lib/bundler/installer.rb +7 -14
- data/lib/bundler/installer/gem_installer.rb +5 -1
- data/lib/bundler/installer/parallel_installer.rb +4 -8
- data/lib/bundler/installer/standalone.rb +1 -2
- data/lib/bundler/lazy_specification.rb +2 -2
- data/lib/bundler/lockfile_parser.rb +13 -21
- data/lib/bundler/match_platform.rb +1 -1
- data/lib/bundler/plugin.rb +42 -29
- data/lib/bundler/plugin/api.rb +1 -1
- data/lib/bundler/plugin/api/source.rb +2 -2
- data/lib/bundler/plugin/index.rb +14 -3
- data/lib/bundler/plugin/installer.rb +28 -15
- data/lib/bundler/psyched_yaml.rb +1 -1
- data/lib/bundler/resolver.rb +72 -24
- data/lib/bundler/resolver/spec_group.rb +3 -2
- data/lib/bundler/retry.rb +2 -2
- data/lib/bundler/ruby_version.rb +4 -19
- data/lib/bundler/rubygems_ext.rb +10 -66
- data/lib/bundler/rubygems_gem_installer.rb +1 -1
- data/lib/bundler/rubygems_integration.rb +144 -395
- data/lib/bundler/runtime.rb +2 -9
- data/lib/bundler/settings.rb +15 -47
- data/lib/bundler/setup.rb +6 -5
- data/lib/bundler/shared_helpers.rb +64 -67
- data/lib/bundler/similarity_detector.rb +2 -2
- data/lib/bundler/source.rb +5 -5
- data/lib/bundler/source/git.rb +19 -12
- data/lib/bundler/source/git/git_proxy.rb +35 -39
- data/lib/bundler/source/metadata.rb +9 -5
- data/lib/bundler/source/path.rb +13 -8
- data/lib/bundler/source/rubygems.rb +11 -5
- data/lib/bundler/source/rubygems/remote.rb +1 -2
- data/lib/bundler/source_list.rb +9 -12
- data/lib/bundler/spec_set.rb +23 -12
- data/lib/bundler/stub_specification.rb +18 -30
- data/lib/bundler/templates/Executable.bundler +23 -14
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +3 -3
- data/lib/bundler/templates/newgem/Gemfile.tt +8 -2
- data/lib/bundler/templates/newgem/README.md.tt +4 -3
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -27
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +1 -1
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -1
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/ui/rg_proxy.rb +1 -1
- data/lib/bundler/ui/shell.rb +4 -8
- 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 +151 -48
- data/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +5 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +6 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +30 -8
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +4 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +248 -279
- 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 +7 -2
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +21 -11
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +11 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/base.rb +16 -17
- data/lib/bundler/vendor/thor/lib/thor/error.rb +82 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +7 -2
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +52 -7
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendored_fileutils.rb +1 -6
- data/lib/bundler/vendored_molinillo.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +7 -5
- data/lib/bundler/vendored_thor.rb +2 -2
- data/lib/bundler/version.rb +1 -20
- data/lib/bundler/version_ranges.rb +51 -5
- data/lib/bundler/vlad.rb +2 -2
- data/lib/bundler/worker.rb +1 -3
- data/lib/bundler/yaml_serializer.rb +2 -3
- data/man/bundle-add.1 +10 -2
- data/man/bundle-add.1.txt +11 -5
- data/man/bundle-add.ronn +7 -1
- data/man/bundle-binstubs.1 +2 -2
- data/man/bundle-binstubs.1.txt +2 -2
- data/man/bundle-binstubs.ronn +1 -1
- data/man/bundle-check.1 +1 -1
- data/man/bundle-check.1.txt +6 -6
- data/man/bundle-clean.1 +1 -1
- data/man/bundle-clean.1.txt +1 -1
- data/man/bundle-config.1 +52 -36
- data/man/bundle-config.1.txt +82 -67
- data/man/bundle-config.ronn +56 -40
- data/man/bundle-doctor.1 +1 -1
- data/man/bundle-doctor.1.txt +1 -1
- data/man/bundle-exec.1 +2 -2
- data/man/bundle-exec.1.txt +2 -2
- data/man/bundle-exec.ronn +1 -1
- data/man/bundle-gem.1 +1 -1
- data/man/bundle-gem.1.txt +3 -3
- data/man/bundle-info.1 +1 -1
- data/man/bundle-info.1.txt +1 -1
- data/man/bundle-init.1 +2 -2
- data/man/bundle-init.1.txt +2 -2
- data/man/bundle-init.ronn +1 -1
- data/man/bundle-inject.1 +1 -1
- data/man/bundle-inject.1.txt +1 -1
- data/man/bundle-install.1 +8 -5
- data/man/bundle-install.1.txt +56 -51
- data/man/bundle-install.ronn +9 -4
- data/man/bundle-list.1 +1 -1
- data/man/bundle-list.1.txt +1 -1
- data/man/bundle-lock.1 +1 -1
- data/man/bundle-lock.1.txt +16 -16
- data/man/bundle-open.1 +1 -1
- data/man/bundle-open.1.txt +1 -1
- data/man/bundle-outdated.1 +1 -1
- data/man/bundle-outdated.1.txt +1 -1
- data/man/bundle-package.1 +1 -1
- data/man/bundle-package.1.txt +1 -1
- data/man/bundle-platform.1 +1 -1
- data/man/bundle-platform.1.txt +1 -1
- data/man/bundle-pristine.1 +1 -1
- data/man/bundle-pristine.1.txt +1 -1
- data/man/bundle-remove.1 +1 -1
- data/man/bundle-remove.1.txt +1 -1
- data/man/bundle-show.1 +1 -1
- data/man/bundle-show.1.txt +1 -1
- data/man/bundle-update.1 +4 -4
- data/man/bundle-update.1.txt +64 -65
- data/man/bundle-update.ronn +3 -3
- data/man/bundle-viz.1 +1 -1
- data/man/bundle-viz.1.txt +1 -1
- data/man/bundle.1 +7 -3
- data/man/bundle.1.txt +11 -8
- data/man/bundle.ronn +5 -2
- data/man/gemfile.5 +17 -20
- data/man/gemfile.5.ronn +14 -18
- data/man/gemfile.5.txt +108 -112
- metadata +17 -104
- data/exe/bundle_ruby +0 -60
- data/lib/bundler/cli/cache.rb +0 -36
- data/lib/bundler/compatibility_guard.rb +0 -14
- data/lib/bundler/ssl_certs/.document +0 -1
- data/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
- data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
data/lib/bundler/cli/add.rb
CHANGED
@@ -2,34 +2,45 @@
|
|
2
2
|
|
3
3
|
module Bundler
|
4
4
|
class CLI::Add
|
5
|
+
attr_reader :gems, :options, :version
|
6
|
+
|
5
7
|
def initialize(options, gems)
|
6
8
|
@gems = gems
|
7
9
|
@options = options
|
8
|
-
@options[:group] =
|
10
|
+
@options[:group] = options[:group].split(",").map(&:strip) unless options[:group].nil?
|
11
|
+
@version = options[:version].split(",").map(&:strip) unless options[:version].nil?
|
9
12
|
end
|
10
13
|
|
11
14
|
def run
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
15
|
+
validate_options!
|
16
|
+
inject_dependencies
|
17
|
+
perform_bundle_install unless options["skip-install"]
|
18
|
+
end
|
16
19
|
|
17
|
-
|
20
|
+
private
|
18
21
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
22
|
+
def perform_bundle_install
|
23
|
+
Installer.install(Bundler.root, Bundler.definition)
|
24
|
+
end
|
24
25
|
|
25
|
-
|
26
|
+
def inject_dependencies
|
27
|
+
dependencies = gems.map {|g| Bundler::Dependency.new(g, version, options) }
|
26
28
|
|
27
29
|
Injector.inject(dependencies,
|
28
|
-
:conservative_versioning =>
|
29
|
-
:optimistic =>
|
30
|
-
:strict =>
|
30
|
+
:conservative_versioning => options[:version].nil?, # Perform conservative versioning only when version is not specified
|
31
|
+
:optimistic => options[:optimistic],
|
32
|
+
:strict => options[:strict])
|
33
|
+
end
|
34
|
+
|
35
|
+
def validate_options!
|
36
|
+
raise InvalidOption, "You can not specify `--strict` and `--optimistic` at the same time." if options[:strict] && options[:optimistic]
|
31
37
|
|
32
|
-
|
38
|
+
# raise error when no gems are specified
|
39
|
+
raise InvalidOption, "Please specify gems to add." if gems.empty?
|
40
|
+
|
41
|
+
version.to_a.each do |v|
|
42
|
+
raise InvalidOption, "Invalid gem requirement pattern '#{v}'" unless Gem::Requirement::PATTERN =~ v.to_s
|
43
|
+
end
|
33
44
|
end
|
34
45
|
end
|
35
46
|
end
|
data/lib/bundler/cli/common.rb
CHANGED
@@ -14,17 +14,18 @@ module Bundler
|
|
14
14
|
Bundler.ui.info msg
|
15
15
|
end
|
16
16
|
|
17
|
-
def self.output_without_groups_message
|
17
|
+
def self.output_without_groups_message(command)
|
18
18
|
return if Bundler.settings[:without].empty?
|
19
|
-
Bundler.ui.confirm without_groups_message
|
19
|
+
Bundler.ui.confirm without_groups_message(command)
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.without_groups_message
|
22
|
+
def self.without_groups_message(command)
|
23
|
+
command_in_past_tense = command == :install ? "installed" : "updated"
|
23
24
|
groups = Bundler.settings[:without]
|
24
25
|
group_list = [groups[0...-1].join(", "), groups[-1..-1]].
|
25
26
|
reject {|s| s.to_s.empty? }.join(" and ")
|
26
|
-
group_str =
|
27
|
-
"Gems in the #{group_str} #{group_list} were not
|
27
|
+
group_str = groups.size == 1 ? "group" : "groups"
|
28
|
+
"Gems in the #{group_str} #{group_list} were not #{command_in_past_tense}."
|
28
29
|
end
|
29
30
|
|
30
31
|
def self.select_spec(name, regex_match = nil)
|
@@ -49,10 +50,6 @@ module Bundler
|
|
49
50
|
end
|
50
51
|
|
51
52
|
def self.ask_for_spec_from(specs)
|
52
|
-
if !$stdout.tty? && ENV["BUNDLE_SPEC_RUN"].nil?
|
53
|
-
raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
|
54
|
-
end
|
55
|
-
|
56
53
|
specs.each_with_index do |spec, index|
|
57
54
|
Bundler.ui.info "#{index.succ} : #{spec.name}", true
|
58
55
|
end
|
@@ -63,7 +60,7 @@ module Bundler
|
|
63
60
|
end
|
64
61
|
|
65
62
|
def self.gem_not_found_message(missing_gem_name, alternatives)
|
66
|
-
|
63
|
+
require_relative "../similarity_detector"
|
67
64
|
message = "Could not find gem '#{missing_gem_name}'."
|
68
65
|
alternate_names = alternatives.map {|a| a.respond_to?(:name) ? a.name : a }
|
69
66
|
suggestions = SimilarityDetector.new(alternate_names).similar_word_list(missing_gem_name)
|
@@ -72,7 +69,7 @@ module Bundler
|
|
72
69
|
end
|
73
70
|
|
74
71
|
def self.ensure_all_gems_in_lockfile!(names, locked_gems = Bundler.locked_gems)
|
75
|
-
locked_names = locked_gems.specs.map(&:name)
|
72
|
+
locked_names = locked_gems.specs.map(&:name).uniq
|
76
73
|
names.-(locked_names).each do |g|
|
77
74
|
raise GemNotFound, gem_not_found_message(g, locked_names)
|
78
75
|
end
|
@@ -80,10 +77,12 @@ module Bundler
|
|
80
77
|
|
81
78
|
def self.configure_gem_version_promoter(definition, options)
|
82
79
|
patch_level = patch_level_options(options)
|
80
|
+
patch_level << :patch if patch_level.empty? && Bundler.settings[:prefer_patch]
|
83
81
|
raise InvalidOption, "Provide only one of the following options: #{patch_level.join(", ")}" unless patch_level.length <= 1
|
82
|
+
|
84
83
|
definition.gem_version_promoter.tap do |gvp|
|
85
84
|
gvp.level = patch_level.first || :major
|
86
|
-
gvp.strict = options[:strict] || options["update-strict"]
|
85
|
+
gvp.strict = options[:strict] || options["update-strict"] || options["filter-strict"]
|
87
86
|
end
|
88
87
|
end
|
89
88
|
|
data/lib/bundler/cli/config.rb
CHANGED
@@ -1,119 +1,194 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Bundler
|
4
|
-
class CLI::Config
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
@args = args
|
11
|
-
@thor = thor
|
12
|
-
@name = peek = args.shift
|
13
|
-
@scope = "global"
|
14
|
-
return unless peek && peek.start_with?("--")
|
15
|
-
@name = args.shift
|
16
|
-
@scope = peek[2..-1]
|
4
|
+
class CLI::Config < Thor
|
5
|
+
class_option :parseable, :type => :boolean, :banner => "Use minimal formatting for more parseable output"
|
6
|
+
|
7
|
+
def self.scope_options
|
8
|
+
method_option :global, :type => :boolean, :banner => "Only change the global config"
|
9
|
+
method_option :local, :type => :boolean, :banner => "Only change the local config"
|
17
10
|
end
|
11
|
+
private_class_method :scope_options
|
18
12
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
13
|
+
desc "base NAME [VALUE]", "The Bundler 1 config interface", :hide => true
|
14
|
+
scope_options
|
15
|
+
method_option :delete, :type => :boolean, :banner => "delete"
|
16
|
+
def base(name = nil, *value)
|
17
|
+
new_args =
|
18
|
+
if ARGV.size == 1
|
19
|
+
["config", "list"]
|
20
|
+
elsif ARGV.include?("--delete")
|
21
|
+
ARGV.map {|arg| arg == "--delete" ? "unset" : arg }
|
22
|
+
elsif ARGV.include?("--global") || ARGV.include?("--local") || ARGV.size == 3
|
23
|
+
["config", "set", *ARGV[1..-1]]
|
24
|
+
else
|
25
|
+
["config", "get", ARGV[1]]
|
26
|
+
end
|
24
27
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
28
|
+
SharedHelpers.major_deprecation 2,
|
29
|
+
"Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle #{new_args.join(" ")}` instead."
|
30
|
+
|
31
|
+
Base.new(options, name, value, self).run
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "list", "List out all configured settings"
|
35
|
+
def list
|
36
|
+
Base.new(options, nil, nil, self).run
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "get NAME", "Returns the value for the given key"
|
40
|
+
def get(name)
|
41
|
+
Base.new(options, name, nil, self).run
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "set NAME VALUE", "Sets the given value for the given key"
|
45
|
+
scope_options
|
46
|
+
def set(name, value, *value_)
|
47
|
+
Base.new(options, name, value_.unshift(value), self).run
|
48
|
+
end
|
29
49
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
50
|
+
desc "unset NAME", "Unsets the value for the given key"
|
51
|
+
scope_options
|
52
|
+
def unset(name)
|
53
|
+
options[:delete] = true
|
54
|
+
Base.new(options, name, nil, self).run
|
55
|
+
end
|
56
|
+
|
57
|
+
default_task :base
|
58
|
+
|
59
|
+
class Base
|
60
|
+
attr_reader :name, :value, :options, :scope, :thor
|
61
|
+
|
62
|
+
def initialize(options, name, value, thor)
|
63
|
+
@options = options
|
64
|
+
@name = name
|
65
|
+
value = Array(value)
|
66
|
+
@value = value.empty? ? nil : value.join(" ")
|
67
|
+
@thor = thor
|
68
|
+
validate_scope!
|
34
69
|
end
|
35
70
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
71
|
+
def run
|
72
|
+
unless name
|
73
|
+
warn_unused_scope "Ignoring --#{scope}"
|
74
|
+
confirm_all
|
75
|
+
return
|
76
|
+
end
|
77
|
+
|
78
|
+
if options[:delete]
|
79
|
+
if !explicit_scope? || scope != "global"
|
80
|
+
Bundler.settings.set_local(name, nil)
|
81
|
+
end
|
82
|
+
if !explicit_scope? || scope != "local"
|
83
|
+
Bundler.settings.set_global(name, nil)
|
40
84
|
end
|
41
85
|
return
|
42
86
|
end
|
43
87
|
|
44
|
-
|
45
|
-
|
46
|
-
end
|
88
|
+
if value.nil?
|
89
|
+
warn_unused_scope "Ignoring --#{scope} since no value to set was given"
|
47
90
|
|
48
|
-
|
49
|
-
|
50
|
-
|
91
|
+
if options[:parseable]
|
92
|
+
if value = Bundler.settings[name]
|
93
|
+
Bundler.ui.info("#{name}=#{value}")
|
94
|
+
end
|
95
|
+
return
|
96
|
+
end
|
51
97
|
|
52
|
-
|
98
|
+
confirm(name)
|
99
|
+
return
|
100
|
+
end
|
53
101
|
|
54
|
-
|
55
|
-
|
56
|
-
|
102
|
+
Bundler.ui.info(message) if message
|
103
|
+
Bundler.settings.send("set_#{scope}", name, new_value)
|
104
|
+
end
|
105
|
+
|
106
|
+
def confirm_all
|
107
|
+
if @options[:parseable]
|
108
|
+
thor.with_padding do
|
109
|
+
Bundler.settings.all.each do |setting|
|
110
|
+
val = Bundler.settings[setting]
|
111
|
+
Bundler.ui.info "#{setting}=#{val}"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
else
|
115
|
+
Bundler.ui.confirm "Settings are listed in order of priority. The top value will be used.\n"
|
57
116
|
Bundler.settings.all.each do |setting|
|
58
|
-
|
59
|
-
|
117
|
+
Bundler.ui.confirm setting
|
118
|
+
show_pretty_values_for(setting)
|
119
|
+
Bundler.ui.confirm ""
|
60
120
|
end
|
61
121
|
end
|
62
|
-
else
|
63
|
-
Bundler.ui.confirm "Settings are listed in order of priority. The top value will be used.\n"
|
64
|
-
Bundler.settings.all.each do |setting|
|
65
|
-
Bundler.ui.confirm "#{setting}"
|
66
|
-
show_pretty_values_for(setting)
|
67
|
-
Bundler.ui.confirm ""
|
68
|
-
end
|
69
122
|
end
|
70
|
-
end
|
71
123
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
124
|
+
def confirm(name)
|
125
|
+
Bundler.ui.confirm "Settings for `#{name}` in order of priority. The top value will be used"
|
126
|
+
show_pretty_values_for(name)
|
127
|
+
end
|
76
128
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
129
|
+
def new_value
|
130
|
+
pathname = Pathname.new(value)
|
131
|
+
if name.start_with?("local.") && pathname.directory?
|
132
|
+
pathname.expand_path.to_s
|
133
|
+
else
|
134
|
+
value
|
135
|
+
end
|
83
136
|
end
|
84
|
-
end
|
85
137
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
138
|
+
def message
|
139
|
+
locations = Bundler.settings.locations(name)
|
140
|
+
if @options[:parseable]
|
141
|
+
"#{name}=#{new_value}" if new_value
|
142
|
+
elsif scope == "global"
|
143
|
+
if !locations[:local].nil?
|
144
|
+
"Your application has set #{name} to #{locations[:local].inspect}. " \
|
145
|
+
"This will override the global value you are currently setting"
|
146
|
+
elsif locations[:env]
|
147
|
+
"You have a bundler environment variable for #{name} set to " \
|
148
|
+
"#{locations[:env].inspect}. This will take precedence over the global value you are setting"
|
149
|
+
elsif !locations[:global].nil? && locations[:global] != value
|
150
|
+
"You are replacing the current global value of #{name}, which is currently " \
|
151
|
+
"#{locations[:global].inspect}"
|
152
|
+
end
|
153
|
+
elsif scope == "local" && !locations[:local].nil? && locations[:local] != value
|
154
|
+
"You are replacing the current local value of #{name}, which is currently " \
|
155
|
+
"#{locations[:local].inspect}"
|
100
156
|
end
|
101
|
-
elsif scope == "local" && locations[:local] != args.join(" ")
|
102
|
-
"You are replacing the current local value of #{name}, which is currently " \
|
103
|
-
"#{locations[:local].inspect}"
|
104
157
|
end
|
105
|
-
end
|
106
158
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
159
|
+
def show_pretty_values_for(setting)
|
160
|
+
thor.with_padding do
|
161
|
+
Bundler.settings.pretty_values_for(setting).each do |line|
|
162
|
+
Bundler.ui.info line
|
163
|
+
end
|
111
164
|
end
|
112
165
|
end
|
113
|
-
end
|
114
166
|
|
115
|
-
|
116
|
-
|
167
|
+
def explicit_scope?
|
168
|
+
@explicit_scope
|
169
|
+
end
|
170
|
+
|
171
|
+
def warn_unused_scope(msg)
|
172
|
+
return unless explicit_scope?
|
173
|
+
return if options[:parseable]
|
174
|
+
|
175
|
+
Bundler.ui.warn(msg)
|
176
|
+
end
|
177
|
+
|
178
|
+
def validate_scope!
|
179
|
+
@explicit_scope = true
|
180
|
+
scopes = %w[global local].select {|s| options[s] }
|
181
|
+
case scopes.size
|
182
|
+
when 0
|
183
|
+
@scope = "global"
|
184
|
+
@explicit_scope = false
|
185
|
+
when 1
|
186
|
+
@scope = scopes.first
|
187
|
+
else
|
188
|
+
raise InvalidOption,
|
189
|
+
"The options #{scopes.join " and "} were specified. Please only use one of the switches at a time."
|
190
|
+
end
|
191
|
+
end
|
117
192
|
end
|
118
193
|
end
|
119
194
|
end
|
data/lib/bundler/cli/console.rb
CHANGED
@@ -12,7 +12,7 @@ module Bundler
|
|
12
12
|
Bundler::SharedHelpers.major_deprecation 2, "bundle console will be replaced " \
|
13
13
|
"by `bin/console` generated by `bundle gem <name>`"
|
14
14
|
|
15
|
-
group ? Bundler.require(:default, *
|
15
|
+
group ? Bundler.require(:default, *group.split.map!(&:to_sym)) : Bundler.require
|
16
16
|
ARGV.clear
|
17
17
|
|
18
18
|
console = get_console(Bundler.settings[:console] || "irb")
|
data/lib/bundler/cli/doctor.rb
CHANGED
@@ -4,8 +4,8 @@ require "rbconfig"
|
|
4
4
|
|
5
5
|
module Bundler
|
6
6
|
class CLI::Doctor
|
7
|
-
DARWIN_REGEX = /\s+(.+) \(compatibility
|
8
|
-
LDD_REGEX = /\t\S+ => (\S+) \(\S+\)
|
7
|
+
DARWIN_REGEX = /\s+(.+) \(compatibility /.freeze
|
8
|
+
LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/.freeze
|
9
9
|
|
10
10
|
attr_reader :options
|
11
11
|
|
@@ -56,7 +56,7 @@ module Bundler
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def check!
|
59
|
-
|
59
|
+
require_relative "check"
|
60
60
|
Bundler::CLI::Check.new({}).run
|
61
61
|
end
|
62
62
|
|
@@ -100,7 +100,7 @@ module Bundler
|
|
100
100
|
files_not_readable_or_writable = []
|
101
101
|
files_not_rw_and_owned_by_different_user = []
|
102
102
|
files_not_owned_by_current_user_but_still_rw = []
|
103
|
-
Find.find(Bundler.
|
103
|
+
Find.find(Bundler.bundle_path.to_s).each do |f|
|
104
104
|
if !File.writable?(f) || !File.readable?(f)
|
105
105
|
if File.stat(f).uid != Process.uid
|
106
106
|
files_not_rw_and_owned_by_different_user << f
|
data/lib/bundler/cli/exec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "../current_ruby"
|
4
4
|
|
5
5
|
module Bundler
|
6
6
|
class CLI::Exec
|
@@ -13,7 +13,7 @@ module Bundler
|
|
13
13
|
@cmd = args.shift
|
14
14
|
@args = args
|
15
15
|
|
16
|
-
if
|
16
|
+
if !Bundler.current_ruby.jruby?
|
17
17
|
@args << { :close_others => !options.keep_file_descriptors? }
|
18
18
|
elsif options.keep_file_descriptors?
|
19
19
|
Bundler.ui.warn "Ruby version #{RUBY_VERSION} defaults to keeping non-standard file descriptors on Kernel#exec."
|
@@ -27,12 +27,7 @@ module Bundler
|
|
27
27
|
if !Bundler.settings[:disable_exec_load] && ruby_shebang?(bin_path)
|
28
28
|
return kernel_load(bin_path, *args)
|
29
29
|
end
|
30
|
-
|
31
|
-
if Bundler.current_ruby.jruby_18?
|
32
|
-
kernel_exec(bin_path, *args)
|
33
|
-
else
|
34
|
-
kernel_exec([bin_path, cmd], *args)
|
35
|
-
end
|
30
|
+
kernel_exec(bin_path, *args)
|
36
31
|
else
|
37
32
|
# exec using the given command
|
38
33
|
kernel_exec(cmd, *args)
|
@@ -69,7 +64,7 @@ module Bundler
|
|
69
64
|
Process.setproctitle(process_title(file, args)) if Process.respond_to?(:setproctitle)
|
70
65
|
ui = Bundler.ui
|
71
66
|
Bundler.ui = nil
|
72
|
-
|
67
|
+
require_relative "../setup"
|
73
68
|
TRAPPED_SIGNALS.each {|s| trap(s, "DEFAULT") }
|
74
69
|
Kernel.load(file)
|
75
70
|
rescue SystemExit, SignalException
|